1
0
mirror of https://github.com/MrDetonia/Maki.git synced 2024-11-22 11:54:16 -05:00

v1.0.2 - stop reactions being problematic by giving them a safe space

This commit is contained in:
MrDetonia 2017-05-10 11:42:32 +00:00
parent 288a08ee1d
commit b37b4561be
3 changed files with 21 additions and 14 deletions

14
bot.py
View File

@ -80,18 +80,8 @@ def on_message(msg):
fp.write('\n' + msg.content) fp.write('\n' + msg.content)
except PermissionError: pass except PermissionError: pass
# TODO: dedicated reaction function # react to stuff
# someone noticed me! <3 yield from makireacts(client, msg)
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}')
# check for commands # check for commands
if msg.content.startswith(prefix): if msg.content.startswith(prefix):

View File

@ -13,7 +13,7 @@ import json
# bot version # bot version
version = "v1.0.1" version = "v1.0.2"
# TODO: generate this on the fly and make it look acceptable # TODO: generate this on the fly and make it look acceptable

View File

@ -11,6 +11,7 @@ import asyncio
import discord import discord
import logging import logging
import datetime import datetime
import re
# LOCAL IMPORTS # LOCAL IMPORTS
from common import * from common import *
@ -66,3 +67,19 @@ def discord_typing(client, message):
break break
else: else:
print('ERROR: Failed to send typing signal to discord after 5 attempts') 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])