mirror of
https://github.com/Ryujinx/ryuko-ng.git
synced 2025-01-03 19:15:31 +00:00
Fix logfilereader logic
This commit is contained in:
parent
8550271af6
commit
40fce5e354
|
@ -483,11 +483,14 @@ class LogFileReader(Cog):
|
||||||
author_mention = message.author.mention
|
author_mention = message.author.mention
|
||||||
filename = message.attachments[0].filename
|
filename = message.attachments[0].filename
|
||||||
# Any message over 2000 chars is uploaded as message.txt, so this is accounted for
|
# Any message over 2000 chars is uploaded as message.txt, so this is accounted for
|
||||||
log_file_regex = re.compile(r"^Ryujinx_.*\.log|message\.txt$")
|
ryujinx_log_file_regex = re.compile(r"^Ryujinx_.*\.log|message\.txt$")
|
||||||
is_log_file = re.match(log_file_regex, filename)
|
log_file = re.compile(r"^.*\.log|.*\.txt$")
|
||||||
|
is_ryujinx_log_file = re.match(ryujinx_log_file_regex, filename)
|
||||||
|
is_log_file = re.match(log_file, filename)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
message.channel.id in self.bot_log_allowed_channels.values()
|
message.channel.id in self.bot_log_allowed_channels.values()
|
||||||
and is_log_file
|
and is_ryujinx_log_file
|
||||||
):
|
):
|
||||||
if filename not in self.uploaded_log_filenames:
|
if filename not in self.uploaded_log_filenames:
|
||||||
reply_message = await message.channel.send(
|
reply_message = await message.channel.send(
|
||||||
|
@ -516,11 +519,11 @@ class LogFileReader(Cog):
|
||||||
await message.channel.send(
|
await message.channel.send(
|
||||||
f"The log file `{filename}` appears to be a duplicate {author_mention}. Please upload a more recent file."
|
f"The log file `{filename}` appears to be a duplicate {author_mention}. Please upload a more recent file."
|
||||||
)
|
)
|
||||||
elif not is_log_file:
|
elif is_log_file and not is_ryujinx_log_file and message.channel.id in self.bot_log_allowed_channels.values():
|
||||||
return await message.channel.send(
|
return await message.channel.send(
|
||||||
f"{author_mention} Your file does not match the Ryujinx log format. Please check your file."
|
f"{author_mention} Your file does not match the Ryujinx log format. Please check your file."
|
||||||
)
|
)
|
||||||
else:
|
elif is_log_file and not message.channel.id in self.bot_log_allowed_channels.values():
|
||||||
return await message.channel.send(
|
return await message.channel.send(
|
||||||
"\n".join(
|
"\n".join(
|
||||||
(
|
(
|
||||||
|
|
Loading…
Reference in a new issue