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

Remove users from tells when messages are sent, v0.9.2

This commit is contained in:
Zac Herd 2016-04-01 17:07:13 +01:00
parent a166f5c540
commit d778360224

8
bot.py
View File

@ -23,7 +23,7 @@ from secret import email,pwd
name = "Maki" name = "Maki"
# bot version # bot version
version = "v0.9.1" version = "v0.9.2"
# text shown by .help command # text shown by .help command
helptext = """I am a bot written in Python by MrDetonia helptext = """I am a bot written in Python by MrDetonia
@ -157,11 +157,13 @@ def on_message(message):
if message.author != client.user: if message.author != client.user:
# send any messages we have for author: # send any messages we have for author:
if message.author.name in tells and len(tells[message.author.name]) > 0: if message.author.name in tells:
yield from client.send_message(message.channel, 'Hey ' + message.author.name + ', I have messages for you!') yield from client.send_message(message.channel, 'Hey ' + message.author.name + ', I have messages for you!')
for msg in tells[message.author.name]: for msg in tells[message.author.name]:
yield from client.send_message(message.author, msg[0] + ' says "' + msg[1] + '"') yield from client.send_message(message.author, msg[0] + ' says "' + msg[1] + '"')
tells[message.author.name].remove(msg)
# delete this user's entry
del tells[message.author.name]
# update messages # update messages
with open('tells.json', 'w') as fp: with open('tells.json', 'w') as fp: