diff --git a/bot.py b/bot.py index 2c10940..ad058e9 100644 --- a/bot.py +++ b/bot.py @@ -80,18 +80,8 @@ def on_message(msg): fp.write('\n' + msg.content) except PermissionError: pass - # TODO: dedicated reaction function - # someone noticed me! <3 - if bool(re.search(r'\bmaki\b', msg.content, re.IGNORECASE)): - yield from client.add_reaction(msg, '\N{BLACK HEART SUIT}') - - # butter - if bool(re.search(r'\bbutter\b', msg.content, re.IGNORECASE)): - yield from client.add_reaction(msg, '\N{PERSON WITH FOLDED HANDS}') - - # egg - if bool(re.search(r'\begg\b', msg.content, re.IGNORECASE)): - yield from client.add_reaction(msg, '\N{AUBERGINE}') + # react to stuff + yield from makireacts(client, msg) # check for commands if msg.content.startswith(prefix): diff --git a/common.py b/common.py index bbf46eb..08c401c 100755 --- a/common.py +++ b/common.py @@ -13,7 +13,7 @@ import json # bot version -version = "v1.0.1" +version = "v1.0.2" # TODO: generate this on the fly and make it look acceptable diff --git a/helpers.py b/helpers.py index 425b8ca..b6b0d63 100755 --- a/helpers.py +++ b/helpers.py @@ -11,6 +11,7 @@ import asyncio import discord import logging import datetime +import re # LOCAL IMPORTS from common import * @@ -65,4 +66,20 @@ def discord_typing(client, message): else: break else: - print('ERROR: Failed to send typing signal to discord after 5 attempts') \ No newline at end of file + print('ERROR: Failed to send typing signal to discord after 5 attempts') + + +# Maki Reacts to... +@asyncio.coroutine +def makireacts(client, msg): + # TODO: track down the person(s) responsible for naming emoji + reactions = { + r"\bmaki\b": "\N{BLACK HEART SUIT}", + r"\bbutter\b": "\N{PERSON WITH FOLDED HANDS}", + r"\begg\b": "\N{AUBERGINE}", + r"\bproblematic\b": "\N{EYEGLASSES}", + } + + for i in reactions: + if bool(re.search(i, msg.content, re.IGNORECASE)): + yield from client.add_reaction(msg, reactions[i]) \ No newline at end of file