fix multilines && fix doublons in logs
This commit is contained in:
parent
c463f7bd4e
commit
86c6f80b26
1 changed files with 6 additions and 5 deletions
|
@ -62,15 +62,16 @@ def main():
|
||||||
print(message.content)
|
print(message.content)
|
||||||
if message.author == bot.user:
|
if message.author == bot.user:
|
||||||
return
|
return
|
||||||
if message.content == 'pwet':
|
|
||||||
await message.channel.send('pong')
|
|
||||||
else:
|
else:
|
||||||
if bot.user in message.mentions and len(message.mentions) < 3:
|
if bot.user in message.mentions \
|
||||||
|
and len(message.mentions) < 3 \
|
||||||
|
and len(message.content.splitlines()) == 1:
|
||||||
path = '/tmp/%s.log' % message.channel
|
path = '/tmp/%s.log' % message.channel
|
||||||
with open(path, 'r') as f :
|
with open(path, 'r') as f :
|
||||||
lines = f.read().splitlines()
|
lines = f.read().splitlines()
|
||||||
with open(path, 'a') as f :
|
if not message.content in lines:
|
||||||
f.write(message.content + '\n')
|
with open(path, 'a') as f :
|
||||||
|
f.write(message.content + '\n')
|
||||||
response = random.choice(lines).replace(str(bot.user.id), str(message.author.id))
|
response = random.choice(lines).replace(str(bot.user.id), str(message.author.id))
|
||||||
await message.channel.send(response)
|
await message.channel.send(response)
|
||||||
await bot.process_commands(message)
|
await bot.process_commands(message)
|
||||||
|
|
Loading…
Reference in a new issue