fix bug for forbidden channel

This commit is contained in:
Klemek
2021-03-16 16:00:20 +01:00
parent d092074ed5
commit 3e781c746f
3 changed files with 34 additions and 27 deletions
+1
View File
@@ -70,6 +70,7 @@ class ChannelLogs:
yield len(self.messages), False yield len(self.messages), False
self.last_message_id = channel.last_message_id self.last_message_id = channel.last_message_id
except discord.errors.HTTPException: except discord.errors.HTTPException:
yield -1, True
return # When an exception occurs (like Forbidden) return # When an exception occurs (like Forbidden)
yield len(self.messages), True yield len(self.messages), True
+1 -1
View File
@@ -154,7 +154,7 @@ class GuildLogs:
workers += [Worker(self.channels[channel.id], channel)] workers += [Worker(self.channels[channel.id], channel)]
warning_msg = "(this might take a while)" warning_msg = "(this might take a while)"
if len(target_channels) > 5 and loading_new > 5: if len(target_channels) > 5 and loading_new > 5:
warning_msg = "(most channels are new, this might take a looong while)" warning_msg = "(most channels are new, this will take a long while)"
elif loading_new > 0: elif loading_new > 0:
warning_msg = "(some channels are new, this might take a long while)" warning_msg = "(some channels are new, this might take a long while)"
await code_message( await code_message(
+6
View File
@@ -123,6 +123,12 @@ class Scanner(ABC):
self.msg_count += count self.msg_count += count
self.chan_count += 1 if count > 0 else 0 self.chan_count += 1 if count > 0 else 0
logging.info(f"scan {guild.id} > scanned in {delta(t0):,}ms") logging.info(f"scan {guild.id} > scanned in {delta(t0):,}ms")
if self.total_msg == 0:
await message.channel.send(
"There are no messages found matching the filters",
reference=message,
)
else:
await progress.edit(content="```Computing results...```") await progress.edit(content="```Computing results...```")
# Display results # Display results
t0 = datetime.now() t0 = datetime.now()