mirror of
https://github.com/MrDetonia/Maki.git
synced 2024-11-22 03:44:18 -05:00
v0.17.3 history is now per-server
This commit is contained in:
parent
340a3822dd
commit
55e7b9e51b
13
bot.py
13
bot.py
@ -32,7 +32,7 @@ from secret import token, lfmkey
|
|||||||
# CONFIGURATION
|
# CONFIGURATION
|
||||||
|
|
||||||
# bot version
|
# bot version
|
||||||
version = "v0.17.2"
|
version = "v0.17.3"
|
||||||
|
|
||||||
# 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
|
||||||
@ -200,14 +200,14 @@ 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
|
||||||
try:
|
try:
|
||||||
target = message.server.get_member_named(message.content[6:]).id
|
target = message.server.id + message.server.get_member_named(message.content[6:]).id
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
response = "user not seen yet"
|
response = "I can't find that user!"
|
||||||
target = ""
|
target = ""
|
||||||
|
|
||||||
if target in history:
|
if target in history and history[target][0] == message.server.id:
|
||||||
# user logged, print last message and time
|
# user logged, print last message and time
|
||||||
response = 'user ' + message.content[6:] + ' was last seen saying "' + history[target][0] + '" at ' + strfromdt(dtfromts(history[target][1]))
|
response = 'user ' + message.content[6:] + ' was last seen saying "' + history[target][2] + '" at ' + strfromdt(dtfromts(history[target][1]))
|
||||||
elif message.content[6:] == 'Maki':
|
elif message.content[6:] == 'Maki':
|
||||||
# Maki doesn't need to be .seen
|
# Maki doesn't need to be .seen
|
||||||
response = 'I\'m right here!'
|
response = 'I\'m right here!'
|
||||||
@ -285,6 +285,7 @@ def on_message(message):
|
|||||||
response = 'you did it wrong!'
|
response = 'you did it wrong!'
|
||||||
|
|
||||||
elif message.content.startswith('.np'):
|
elif message.content.startswith('.np'):
|
||||||
|
# show now playing info from last.fm
|
||||||
tmp = message.content[4:]
|
tmp = message.content[4:]
|
||||||
|
|
||||||
if tmp == '':
|
if tmp == '':
|
||||||
@ -335,7 +336,7 @@ def on_message(message):
|
|||||||
else:
|
else:
|
||||||
# log each message against users
|
# log each message against users
|
||||||
if message.content != "":
|
if message.content != "":
|
||||||
history[message.author.id] = (message.content, time.time())
|
history[message.server.id + message.author.id] = (message.server.id, time.time(), message.content)
|
||||||
with open('hist.json', 'w') as fp:
|
with open('hist.json', 'w') as fp:
|
||||||
json.dump(history, fp)
|
json.dump(history, fp)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user