Missing maybe_*(), however.
from enum import Enum
from plugins import Plugins
import bot
+import cat
class Identify(Enum):
member = 1
return
result = yield from set_avatar(url)
if not result:
- yield from bot.say(message.channel, 'yelp!')
+ yield from cat.yelp(message.channel)
return
elif command == 'bling':
yield from client.send_typing(message.channel)
data = fn(url)
if data is None:
- yield from bot.say(message.channel, 'yelp!')
+ yield from cat.yelp(message.channel)
return
yield from client.send_file(message.channel, data, filename = filename + '.png', content = ' '.join(mentions) if mentions is not None else 'purr')
return
elif command == 'delete':
# delete
if message.channel.is_private:
- yield from bot.say(message.channel, 'hiss', wake = False)
+ yield from cat.hiss(message.channel, wake = False)
return
args = {}
def do_fork(message, command, raw):
yield from client.send_typing(message.channel)
if re.search(r'[^A-Za-z0-9-_."\'\s]', raw):
- yield from bot.say(message.channel, 'hiss')
+ yield from cat.hiss(message.channel)
return
p = pexpect.spawnu('./{}'.format(raw))
p.expect(pexpect.EOF)
lines.append(name)
yield from bot.say_many(message.channel, lines)
else:
- yield from bot.say(message.channel, '*shrugs*')
+ yield from cat.shrug(message.channel)
return True
return False
if bot.status() == discord.Status.idle:
yield from bot.maybe_say(message.channel, 'zzz', wake = False)
else:
- yield from bot.maybe_say(message.channel, 'meow!')
+ yield from cat.meow(message.channel)
def channels_to_greet():
greetings = get_bot_variable('greetings', [])
--- /dev/null
+import asyncio
+import bot
+
+@asyncio.coroutine
+def meow(destination, voice = None, **args):
+ result = yield from bot.say(destination, 'meow!') if destination is not None else True
+ if result and voice is not None:
+ yield from bot.play_sound(voice, 'meow.wav', **args)
+
+@asyncio.coroutine
+def purr(destination, voice = None, **args):
+ result = yield from bot.say(destination, 'purr') if destination is not None else True
+ if result and voice is not None:
+ yield from bot.play_sound(voice, 'purr.wav', **args)
+
+@asyncio.coroutine
+def hiss(destination, **args):
+ yield from bot.say(destination, 'hiss!', **args)
+
+@asyncio.coroutine
+def yelp(destination, **args):
+ yield from bot.say(destination, 'yelp!', **args)
+
+@asyncio.coroutine
+def shrug(destination, **args):
+ yield from bot.say(destination, '*shrugs*', **args)
+
+@asyncio.coroutine
+def zzz(destination, **args):
+ yield from bot.say(destination, 'zzz', **args)
from db import DBConnection
from plugins import PluginCommand
import bot
+import cat
class Announcements(DBConnection):
def __init__(self, filename = None):
log.debug('Member {} with role {} on server {} can create announcements.'.format(member.name, member_role.name, server.name))
return announcement
- yield from bot.say(channel, 'hiss!')
+ yield from cat.hiss(channel)
return False
@asyncio.coroutine
if len(results):
yield from bot.say_many(message.channel, results)
else:
- yield from bot.say(message.channel, '*shrugs*')
+ yield from cat.shrug(message.channel)
@asyncio.coroutine
def show_announcement(self, message, id):
create['id'] = id
log.info('Created announcement: {}'.format(create))
yield from bot.say(message.channel, id)
- yield from bot.play_sound(bot.voice_channel_for_user(message.author), 'purr.wav', join = False)
+ yield from cat.purr(None, bot.voice_channel_for_user(message.author), join = False)
else:
log.info('Failed to create announcement: {}'.format(create))
- yield from bot.say(message.channel, 'yelp!')
+ yield from cat.yelp(message.channel)
@asyncio.coroutine
def edit_existing_announcement(self, message, raw):
if self.update_announcement(client, id, **update):
log.info('Edited announcement {}: {}'.format(id, update))
yield from bot.say(message.channel, ', '.join([announcement_key(k) for k in update]))
- yield from bot.play_sound(bot.voice_channel_for_user(message.author), 'purr.wav', join = False)
+ yield from cat.purr(None, bot.voice_channel_for_user(message.author), join = False)
else:
log.info('Failed to edit announcement {}: {}'.format(id, update))
- yield from bot.say(message.channel, 'yelp!')
+ yield from cat.yelp(message.channel)
@asyncio.coroutine
def delete_existing_announcement(self, message, id):
else:
log.info('Deleting announcement {}'.format(id))
if self.delete_announcement(client, id):
- yield from bot.say(message.channel, 'purr')
+ yield from cat.purr(message.channel)
else:
- yield from bot.say(message.channel, 'yelp!')
+ yield from cat.yelp(message.channel)
@asyncio.coroutine
def schedule_announcement(self, message, id, **args):
else:
log.info('Updating announcement {}: {}'.format(id, update))
if self.update_announcement(client, id, **update):
- yield from bot.say(message.channel, 'purr')
+ yield from cat.purr(message.channel)
else:
- yield from bot.say(message.channel, 'yelp!')
+ yield from cat.yelp(message.channel)
@asyncio.coroutine
def manage_announcements(self, message, command, raw):
yield from self.help_announcements(message)
return
else:
- yield from bot.say(message.channel, 'yelp!')
+ yield from cat.yelp(message.channel)
return
if command == 'show':
from db import DBConnection
from plugins import PluginCommand
import bot
+import cat
rsstime = multiprocessing.Value('i', 600)
yield from self.help_feeds(message)
return
else:
- yield from bot.say(message.channel, 'yelp!')
+ yield from cat.yelp(message.channel)
return
if command == 'show':
log.debug('Member {} with role {} on server {} can manage feeds.'.format(member.name, member_role.name, server.name))
return feed
- yield from bot.say(channel, 'hiss!')
+ yield from cat.hiss(channel)
return False
@asyncio.coroutine
if len(results):
yield from bot.say_many(message.channel, results)
else:
- yield from bot.say(message.channel, '*shrugs*')
+ yield from cat.shrug(message.channel)
@asyncio.coroutine
def show_feed(self, message, id):
create['id'] = id
log.info('Created feed: {}'.format(create))
yield from bot.say(message.channel, id)
- yield from play_sound(voice_channel_for_user(message.author), 'purr.wav', join = False)
+ yield from cat.purr(None, voice_channel_for_user(message.author), join = False)
else:
log.info('Failed to create feed: {}'.format(create))
- yield from bot.say(message.channel, 'yelp!')
+ yield from cat.yelp(message.channel)
@asyncio.coroutine
def edit_existing_feed(self, message, *args):
if self.update_feed(client, id, **update):
log.info('Edited feed {}: {}'.format(id, update))
yield from bot.say(message.channel, ', '.join([self.feed_key(k) for k in update]))
- yield from play_sound(voice_channel_for_user(message.author), 'purr.wav', join = False)
+ yield from cat.purr(None, voice_channel_for_user(message.author), join = False)
else:
log.info('Failed to edit feed {}: {}'.format(id, update))
- yield from bot.say(message.channel, 'yelp!')
+ yield from cat.yelp(message.channel)
@asyncio.coroutine
def delete_existing_feed(self, message, id):
else:
log.info('Deleting feed {}'.format(id))
if self.delete_feed(client, id):
- yield from bot.say(message.channel, 'purr')
+ yield from cat.purr(message.channel)
else:
- yield from bot.say(message.channel, 'yelp!')
+ yield from cat.yelp(message.channel)
@asyncio.coroutine
def schedule_feed(self, message, id, **args):
else:
log.info('Updating feed {}: {}'.format(id, update))
if self.update_feed(client, id, **update):
- yield from bot.say(message.channel, 'purr')
+ yield from cat.purr(message.channel)
else:
- yield from bot.say(message.channel, 'yelp!')
+ yield from cat.yelp(message.channel)
@asyncio.coroutine
def help_feeds(self, message, command = None):