Fixed dm messages

Checking to see if dm-logs work on heroku
pull/2/head
sgoudham 5 years ago
parent 3e95149352
commit 9ae69b9e14

@ -269,9 +269,9 @@ async def on_message(message):
# Send message to #general
channel = client.get_channel(721449922838134876)
await channel.send(message.content)
write_to_file(msg_time, msg_author, msg_content)
write_to_dm_file(msg_time, msg_author, msg_content)
else:
write_to_file(msg_time, msg_author, msg_content)
write_to_dm_file(msg_time, msg_author, msg_content)
await client.process_commands(message)
@ -322,9 +322,9 @@ async def on_command_missing_user(ctx):
await message.delete()
def write_to_file(time, author, content):
with open('images/logs/dm-logs.txt', mode='w') as dm_logs_file:
dm_logs_file.write(f"{time}: {author}: {content}\n")
def write_to_dm_file(time, author, content):
with open('images/logs/dm-logs.txt', mode='a') as dm_logs_file:
dm_logs_file.write(f"{time}: {author}: {content}")
# Run the bot, allowing it to come online

@ -1 +1,2 @@
2020-06-24T00:47:47.401000: Mr. Hamothy#5619: Testing
2020-06-24T00:54:12.116000: Mr. Hamothy#5619: sdfds
2020-06-24T00:55:02.451000: Mr. Hamothy#5619: Hiiii
Loading…
Cancel
Save