From 278c8c210288d7ffd05e8996a6bb8c328495cadd Mon Sep 17 00:00:00 2001 From: CMDR furrycat Date: Fri, 20 Jan 2017 16:21:27 +0000 Subject: [PATCH] We were vocalising more than intended. --- app.py | 6 +++--- cat.py | 23 +++++++++++++++++++---- plugin/bling/bling.py | 2 +- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/app.py b/app.py index 7b005c2..5451938 100644 --- 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 --- 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) diff --git a/plugin/bling/bling.py b/plugin/bling/bling.py index 8f6c79d..d2aa8b5 100644 --- a/plugin/bling/bling.py +++ b/plugin/bling/bling.py @@ -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) -- 2.7.4