diff options
| author | 2018-02-16 12:34:11 +0000 | |
|---|---|---|
| committer | 2018-02-16 12:34:11 +0000 | |
| commit | 7b55da53e763b056edb73672c457e35c8f81534b (patch) | |
| tree | 26c5dce23a9c6ade359242fa2c251c487acdde09 | |
| parent | Connected embed (#8) (diff) | |
Fun cog, limited to the bot channel.
This stuff isn't important. Just easter eggs and fun. But don't make super annoying stuff, please.
| -rw-r--r-- | bot/__main__.py | 1 | ||||
| -rw-r--r-- | bot/cogs/fun.py | 49 | ||||
| -rw-r--r-- | bot/constants.py | 1 |
3 files changed, 51 insertions, 0 deletions
diff --git a/bot/__main__.py b/bot/__main__.py index 5b529d75c..87cb62d14 100644 --- a/bot/__main__.py +++ b/bot/__main__.py @@ -30,6 +30,7 @@ bot.load_extension("bot.cogs.events") # Commands, etc bot.load_extension("bot.cogs.bot") bot.load_extension("bot.cogs.deployment") +bot.load_extension("bot.cogs.fun") bot.load_extension("bot.cogs.eval") bot.load_extension("bot.cogs.verification") diff --git a/bot/cogs/fun.py b/bot/cogs/fun.py new file mode 100644 index 000000000..457c4b5ef --- /dev/null +++ b/bot/cogs/fun.py @@ -0,0 +1,49 @@ +# coding=utf-8 +from discord import Message +from discord.ext.commands import AutoShardedBot + +from bot.constants import BOT_CHANNEL + +RESPONSES = { + "_pokes {us}_": "_Pokes {them}_", + "_eats {us}_": "_Tastes crunchy_", + "_pets {us}_": "_Purrs_" +} + + +class Fun: + """ + Fun, mostly-useless stuff + """ + + def __init__(self, bot: AutoShardedBot): + self.bot = bot + + async def on_ready(self): + keys = list(RESPONSES.keys()) + + for key in keys: + changed_key = key.replace("{us}", self.bot.user.mention) + + if key != changed_key: + RESPONSES[changed_key] = RESPONSES[key] + del RESPONSES[key] + + async def on_message(self, message: Message): + if message.channel.id != BOT_CHANNEL: + return + + content = message.content + + if content and content[0] == "*" and content[-1] == "*": + content = f"_{content[1:-1]}_" + + response = RESPONSES.get(content) + + if response: + await message.channel.send(response.replace("{them}", message.author.mention)) + + +def setup(bot): + bot.add_cog(Fun(bot)) + print("Cog loaded: Fun") diff --git a/bot/constants.py b/bot/constants.py index 9fd7ef79b..7fd4d9258 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -4,6 +4,7 @@ import os PYTHON_GUILD = 267624335836053506 +BOT_CHANNEL = 267659945086812160 DEVLOG_CHANNEL = 409308876241108992 VERIFICATION_CHANNEL = 352442727016693763 |