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

Fixed bug finding users in admin .welcome, v0.15.1

This commit is contained in:
Zac Herd 2016-05-05 21:34:45 +01:00
parent 24af20e770
commit d9fef4b886

13
bot.py
View File

@ -31,7 +31,7 @@ from secret import token
name = "Maki" name = "Maki"
# bot version # bot version
version = "v0.15.0" version = "v0.15.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
@ -126,7 +126,7 @@ def on_member_update(before, after):
# print custom welcome # print custom welcome
yield from client.send_message(client.get_channel(def_chan), welcomes[after.id]) yield from client.send_message(client.get_channel(def_chan), welcomes[after.id])
else: else:
yield from client.send_message(client.get_channel(def_chan), after.name + ' is now online') yield from client.send_message(client.get_channel(def_chan), after.name + ' is online. Set your welcome message with the `.welcome` command!')
# called when message received # called when message received
@client.event @client.event
@ -185,9 +185,12 @@ def on_message(message):
# manage welcome messages # manage welcome messages
if message.author.id in admins: if message.author.id in admins:
tmp = message.content[9:].split(' ',1) tmp = message.content[9:].split(' ',1)
target = message.server.get_member(tmp[0]).id target = message.server.get_member_named(tmp[0])
welcomes[target] = tmp[1] if target == None:
response = 'Okay, I will now greet ' + message.server.get_member(target).name + ' with "' + tmp[1] + '"' response = 'I can\'t find ' + tmp[0]
else:
welcomes[target.id] = tmp[1]
response = 'Okay, I will now greet ' + target.name + ' with "' + tmp[1] + '"'
else: else:
welcomes[message.author.id] = message.content[9:] welcomes[message.author.id] = message.content[9:]
response = 'Okay, I will now greet ' + message.author.name + ' with "' + message.content[9:] + '"' response = 'Okay, I will now greet ' + message.author.name + ' with "' + message.content[9:] + '"'