We were vocalising more than intended.
authorCMDR furrycat <elite@furrycat.net>
Fri, 20 Jan 2017 16:21:27 +0000 (16:21 +0000)
committerCMDR furrycat <elite@furrycat.net>
Fri, 20 Jan 2017 16:21:27 +0000 (16:21 +0000)
app.py
cat.py
plugin/bling/bling.py

diff --git a/app.py b/app.py
index 7b005c2..5451938 100644 (file)
--- a/app.py
+++ b/app.py
@@ -114,7 +114,7 @@ def do_commands(message, command, raw, non_admin):
       url = message.attachments[0]['url']
     if url is None:
       log.debug('No URL for avatar')
-      yield from bot.say(message.channel, 'zzz', wake = False)
+      yield from cat.zzz(message.channel)
       return
     result = yield from set_avatar(url)
     if not result:
@@ -263,9 +263,9 @@ def process_module(message, command, raw):
       return
   log.debug('Unrecognised command from {}!'.format(message.author.name))
   if bot.status() == discord.Status.idle:
-    yield from bot.maybe_say(message.channel, 'zzz', wake = False)
+    yield from cat.maybe_zzz(message.channel)
   else:
-    yield from cat.meow(message.channel)
+    yield from cat.maybe_meow(message.channel)
 
   return True
 
diff --git a/cat.py b/cat.py
index afaafd3..fcbbb1f 100644 (file)
--- a/cat.py
+++ b/cat.py
@@ -2,14 +2,21 @@ import asyncio
 import bot
 
 @asyncio.coroutine
-def meow(destination, voice = None, **args):
+def maybe_meow(destination, voice = None, **args):
   result = False
   if destination is not None:
-    result = yield from bot.say(destination, 'meow!')
+    result = yield from bot.maybe_say(destination, 'meow!', **args)
   if result and voice is not None:
     yield from bot.play_sound(voice, 'meow.wav', **args)
 
 @asyncio.coroutine
+def meow(destination, voice = None, **extra):
+  args = {}
+  args.update(**extra)
+  args['probability'] = 1.0
+  yield from maybe_meow(destination, voice, **args)
+
+@asyncio.coroutine
 def purr(destination, voice = None, **args):
   result = False
   if destination is not None:
@@ -30,5 +37,13 @@ def shrug(destination, **args):
   yield from bot.say(destination, '*shrugs*', **args)
 
 @asyncio.coroutine
-def zzz(destination, **args):
-  yield from bot.say(destination, 'zzz', **args)
+def maybe_zzz(destination, **args):
+  yield from bot.maybe_say(destination, 'zzz', **args)
+
+@asyncio.coroutine
+def zzz(destination, **extra):
+  args = {}
+  args.update(**extra)
+  args['probability'] = 1.0
+  args['wake'] = False
+  yield from maybe_zzz(destination, **args)
index 8f6c79d..d2aa8b5 100644 (file)
@@ -144,7 +144,7 @@ class Bling(object):
     parsed = self.parse_message(message, name)
     if parsed['url'] is None:
       log.debug('No URL for avatar to bling.')
-      yield from bot.say(message.channel, 'zzz', wake = False)
+      yield from cat.zzz(message.channel)
       return
 
     yield from client.send_typing(message.channel)