From 8be039da80925444ba36f967b3f9857087987ec3 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Wed, 17 Jan 2018 10:49:29 -0600 Subject: [PATCH] use "first recipient"'s name for DM log file we were using the message author before, which made sense for incoming messages, but then all the replies were getting dumped to a directory for the bot, which doesn't make much sense. this will use the "first recipient", which sounds kind of like a backwards-compat attribute but does what we want for single-user DMs if we ever care heavily about multi-user DMs we should maybe look at channel.recipients, but that probably changes over time, so we'd need to use channel.id? --- logger/bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/logger/bot.py b/logger/bot.py index f182e70..bdd96ac 100644 --- a/logger/bot.py +++ b/logger/bot.py @@ -67,8 +67,8 @@ async def on_message_edit(before, after): def log_file_for_message(message): """For the given message, figure out where we'd log the message.""" if message.channel.is_private: - log_directory = 'DM/{0:s}/'.format(str(message.author)) - log_file = '{0:s}-{1:s}.log'.format(str(message.author), str(message.timestamp.strftime('%Y%m'))) + log_directory = 'DM/{0:s}/'.format(str(message.channel.user.name)) + log_file = '{0:s}-{1:s}.log'.format(str(message.channel.user.name), str(message.timestamp.strftime('%Y%m'))) else: log_directory = '{0:s}-{1:s}/{2:s}/'.format(str(message.server.id), str(message.server), str(message.channel))