mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[Streams] Suppress HTTPExceptions on load (#2228)
Resolves #2227. Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
This commit is contained in:
parent
ad51fa830b
commit
5ba95090d9
@ -626,8 +626,13 @@ class Streams(commands.Cog):
|
|||||||
raw_stream["_messages_cache"] = []
|
raw_stream["_messages_cache"] = []
|
||||||
for raw_msg in raw_msg_cache:
|
for raw_msg in raw_msg_cache:
|
||||||
chn = self.bot.get_channel(raw_msg["channel"])
|
chn = self.bot.get_channel(raw_msg["channel"])
|
||||||
msg = await chn.get_message(raw_msg["message"])
|
if chn is not None:
|
||||||
raw_stream["_messages_cache"].append(msg)
|
try:
|
||||||
|
msg = await chn.get_message(raw_msg["message"])
|
||||||
|
except discord.HTTPException:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
raw_stream["_messages_cache"].append(msg)
|
||||||
token = await self.db.tokens.get_raw(_class.__name__, default=None)
|
token = await self.db.tokens.get_raw(_class.__name__, default=None)
|
||||||
if token is not None:
|
if token is not None:
|
||||||
raw_stream["token"] = token
|
raw_stream["token"] = token
|
||||||
@ -646,8 +651,13 @@ class Streams(commands.Cog):
|
|||||||
raw_community["_messages_cache"] = []
|
raw_community["_messages_cache"] = []
|
||||||
for raw_msg in raw_msg_cache:
|
for raw_msg in raw_msg_cache:
|
||||||
chn = self.bot.get_channel(raw_msg["channel"])
|
chn = self.bot.get_channel(raw_msg["channel"])
|
||||||
msg = await chn.get_message(raw_msg["message"])
|
if chn is not None:
|
||||||
raw_community["_messages_cache"].append(msg)
|
try:
|
||||||
|
msg = await chn.get_message(raw_msg["message"])
|
||||||
|
except discord.HTTPException:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
raw_community["_messages_cache"].append(msg)
|
||||||
token = await self.db.tokens.get_raw(_class.__name__, default=None)
|
token = await self.db.tokens.get_raw(_class.__name__, default=None)
|
||||||
communities.append(_class(token=token, **raw_community))
|
communities.append(_class(token=token, **raw_community))
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user