break
@asyncio.coroutine
-def maybe_say(channel, text, probability = 0.2):
+def maybe_say(channel, text, *, probability = 0.2, wake = True):
if random.random() <= probability:
yield from client.send_typing(channel)
yield from client.send_message(channel, text)
- yield from wake_up()
+ if wake:
+ yield from wake_up()
return True
else:
log.debug("Didn't bother to say {}".format(text))
return False
@asyncio.coroutine
-def say(channel, text):
- yield from maybe_say(channel, text, 1.0)
+def say(channel, text, *, wake = None):
+ args = { 'probability': 1.0 }
+ if wake is not None:
+ args['wake'] = wake
+ yield from maybe_say(channel, text, **args)
return True
@asyncio.coroutine