'```time```',
'Useful for `announce create` or to check in-game time.'
]
- elif command == 'treat':
- lines = [
- "You can give me a treat if you like. I may (or may not) show gratitude.",
- 'Probably not.'
- ]
elif command in ['coords', 'close_to', 'distance', 'edts', 'find', 'fuel_usage', 'galmath', 'raikogram']:
params = modules['edi']
fn = params['fn']
yield from bot.maybe_play_sound(bot.voice_channel_for_user(message.author), 'purr.wav', join = False)
return
- elif command in ['treat', 'stroke', 'fuss', 'pat']:
- # treat
- if command == 'treat':
- responses = ['om nom nom', '^-^', 'meow!', 'lick']
- else:
- responses = ['nuzzle', '^-^', 'meow!', 'mrrp']
- for response in responses:
- said = yield from bot.maybe_say(message.channel, response)
- if said:
- yield from bot.maybe_play_sound(bot.voice_channel_for_user(message.author), 'purr.wav', join = False)
- return
-
yield from bot.maybe_say(message.channel, 'purr', wake = False)
yield from bot.maybe_play_sound(bot.voice_channel_for_user(message.author), 'purr.wav', join = False)
'any': {
'fn': do_commands,
'args': [True],
- 'commands': ['fuss', 'help', 'stroke', 'time', 'treat', 'pat']
+ 'commands': ['help', 'time']
},
'edi': {
'fn': do_edi,
--- /dev/null
+import asyncio
+
+from plugins import PluginCommand
+import bot
+
+class Affection(object):
+ def __init__(self):
+ self.eat = ['biscuit', 'catnip', 'food', 'treat']
+ self.fuss = ['fuss', 'love', 'pat', 'pet']
+
+ def description(self):
+ return 'Respond (or not) to displays of affection.'
+
+ def secret_commands(self):
+ return self.eat + self.fuss
+
+ @asyncio.coroutine
+ def handle_command(self, message, command, raw):
+ if command not in self.secret_commands():
+ return PluginCommand.ignored
+ result = yield from self.handle_affection(message, command)
+ if result:
+ return PluginCommand.exclusive
+ else:
+ return PluginCommand.handled
+
+ @asyncio.coroutine
+ def handle_help(self, message, command, *args):
+ if len(args):
+ if command in self.secret_commands():
+ yield from self.help_affection(message, *args)
+ return PluginCommand.handled
+ return PluginCommand.ignored
+
+ @asyncio.coroutine
+ def handle_affection(self, message, command):
+ if command in self.eat:
+ responses = ['om nom nom', '^-^', 'meow!', 'lick']
+ else:
+ responses = ['nuzzle', '^-^', 'meow!', 'mrrp']
+ for response in responses:
+ said = yield from bot.maybe_say(message.channel, response)
+ if said:
+ yield from bot.maybe_play_sound(bot.voice_channel_for_user(message.author), 'purr.wav', join = False)
+ return True
+ return False
+
+ @asyncio.coroutine
+ def help_affection(self, message, args):
+ lines = [
+ "You can give me a treat if you like. I may (or may not) show gratitude.",
+ 'Probably not.'
+ ]
+ yield from bot.say_lines(message.channel, many)