1
0
mirror of https://github.com/MrDetonia/Maki.git synced 2024-11-26 04:57:18 -05:00

Made user ID tracking more frequent, v0.8.1

This commit is contained in:
Zac Herd 2016-04-01 14:32:18 +01:00
parent 0366302649
commit b8819929c1

11
bot.py
View File

@ -23,7 +23,7 @@ from secret import email,pwd
name = "Maki" name = "Maki"
# bot version # bot version
version = "v0.8.0" version = "v0.8.1"
# 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
@ -86,6 +86,7 @@ def strfromdt(dt):
def dtfromts(ts): def dtfromts(ts):
return datetime.datetime.fromtimestamp(ts) return datetime.datetime.fromtimestamp(ts)
# EVENT HANDLERS # EVENT HANDLERS
# called when client ready # called when client ready
@ -136,6 +137,14 @@ def on_message(message):
# print messages to terminal for info # print messages to terminal for info
print(message.author.name + ': ' + message.content) print(message.author.name + ': ' + message.content)
# ensure we store this user's ID
if message.author.name not in users:
users[message.author.name] = message.author.id
# update JSON file
with open('users.json', 'w') as fp:
json.dump(users, fp)
# do not parse own messages # do not parse own messages
if message.author != client.user: if message.author != client.user: