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

v0.16.7 added emoji reactions to 'maki'

This commit is contained in:
Zac Herd 2016-11-07 21:56:54 +00:00
parent d78eb48726
commit e9d546439b

22
bot.py
View File

@ -30,7 +30,7 @@ from secret import token
# CONFIGURATION # CONFIGURATION
# bot version # bot version
version = "v0.16.6" version = "v0.16.7"
# text shown by .help command # text shown by .help command
helptext = """I am a Discord bot written in Python helptext = """I am a Discord bot written in Python
@ -103,6 +103,7 @@ def on_ready():
@client.event @client.event
@asyncio.coroutine @asyncio.coroutine
def on_message(message): def on_message(message):
# print messages to terminal for info # print messages to terminal for info
timestr = time.strftime('%Y-%m-%d-%H:%M:%S: ') timestr = time.strftime('%Y-%m-%d-%H:%M:%S: ')
try: try:
@ -156,7 +157,11 @@ def on_message(message):
elif message.content.startswith('.seen '): elif message.content.startswith('.seen '):
# print when user was last seen # print when user was last seen
target = message.server.get_member_named(message.content[6:]).id try:
target = message.server.get_member_named(message.content[6:]).id
except AttributeError:
response = "user not seen yet"
target = ""
if target in history: if target in history:
# user logged, print last message and time # user logged, print last message and time
@ -166,7 +171,7 @@ def on_message(message):
response = 'I\'m right here!' response = 'I\'m right here!'
else: else:
# user not logged # user not logged
response = 'user not seen yet' response = "user not seen yet"
elif message.content.startswith('.say '): elif message.content.startswith('.say '):
# delete calling message for effect # delete calling message for effect
@ -287,8 +292,15 @@ def on_message(message):
# log user messages for markov chains, ignoring messages with certain substrings # log user messages for markov chains, ignoring messages with certain substrings
filters = ['```', 'http://', 'https://'] filters = ['```', 'http://', 'https://']
if not any(x in message.content for x in filters): if not any(x in message.content for x in filters):
with open('./markovs/' + message.author.id, 'a') as fp: try:
fp.write('\n' + message.content) with open('./markovs/' + message.author.id, 'a') as fp:
fp.write('\n' + message.content)
except PermissionError:
pass
# someone noticed me! <3
if "Maki" in message.content or "maki" in message.content:
yield from client.add_reaction(message, '\N{BLACK HEART SUIT}')
# send response to channel if needed: # send response to channel if needed:
if response is not '': if response is not '':