1
0
mirror of http://aero2k.de/t/repos/urlbot-native.git synced 2017-09-06 15:25:38 +02:00
Files
urlbot-native-trex/plugins/cake.py

69 lines
2.3 KiB
Python
Raw Permalink Normal View History

2016-04-05 14:18:22 +02:00
# -*- coding: utf-8 -*-
import random
2016-04-05 18:40:31 +02:00
from common import giphy
2016-04-05 14:18:22 +02:00
from plugin_system import pluginfunction, ptypes
from rate_limit import RATE_FUN, RATE_GLOBAL
2016-04-05 18:40:31 +02:00
2016-12-11 12:22:00 +01:00
def give_item(user, item_name, search_word=None):
if not search_word:
search_word = item_name
return {'msg': '{} for {}: {}'.format(item_name, user, giphy(search_word, 'dc6zaTOxFJmzC'))}
2016-04-05 14:18:22 +02:00
2016-12-11 12:22:00 +01:00
def cake_excuse(user):
2016-04-05 14:18:22 +02:00
return {
2016-12-11 12:22:00 +01:00
'msg': '{}: {}'.format(user, random.choice(cakes))
2016-04-05 14:18:22 +02:00
}
2016-12-11 12:22:00 +01:00
@pluginfunction('cake', 'displays a cake ASCII art', ptypes.COMMAND, ratelimit_class=RATE_FUN | RATE_GLOBAL)
def command_cake(argv, **args):
if {'please', 'bitte'}.intersection(set(argv)):
return give_item(args['reply_user'], 'cake')
else:
return cake_excuse(args['reply_user'])
2016-04-05 14:18:22 +02:00
@pluginfunction('keks', 'keks!', ptypes.COMMAND, ratelimit_class=RATE_FUN | RATE_GLOBAL)
def command_cookie(argv, **args):
if {'please', 'bitte'}.intersection(set(argv)):
2016-12-11 12:22:00 +01:00
return give_item(args['reply_user'], 'keks', 'cookie')
else:
return cake_excuse(args['reply_user'])
2016-04-05 14:18:22 +02:00
2016-12-11 12:22:00 +01:00
@pluginfunction('schnitzel', 'schnitzel!', ptypes.COMMAND, ratelimit_class=RATE_FUN | RATE_GLOBAL)
def command_schnitzel(argv, **args):
if {'please', 'bitte'}.intersection(set(argv)):
return give_item(args['reply_user'], 'schnitzel')
else:
return cake_excuse(args['reply_user'])
@pluginfunction('kaffee', 'kaffee!', ptypes.COMMAND, ratelimit_class=RATE_FUN | RATE_GLOBAL)
def command_coffee(argv, **args):
if {'please', 'bitte'}.intersection(set(argv)):
return give_item(args['reply_user'], 'kaffee', 'coffee')
else:
return cake_excuse(args['reply_user'])
2016-04-05 14:18:22 +02:00
cakes = [
"No cake for you!",
("The Enrichment Center is required to remind you "
"that you will be baked, and then there will be cake."),
"The cake is a lie!",
("This is your fault. I'm going to kill you. "
"And all the cake is gone. You don't even care, do you?"),
"Quit now and cake will be served immediately.",
("Enrichment Center regulations require both hands to be "
"empty before any cake..."),
("Uh oh. Somebody cut the cake. I told them to wait for "
"you, but they did it anyway. There is still some left, "
"though, if you hurry back."),
"I'm going to kill you, and all the cake is gone.",
"Who's gonna make the cake when I'm gone? You?"
]