[Streams] Suppress HTTPExceptions on load (#2228)

Resolves #2227.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
This commit is contained in:
Toby Harradine 2018-10-15 22:31:14 +11:00 committed by GitHub
parent ad51fa830b
commit 5ba95090d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -626,7 +626,12 @@ 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"])
if chn is not None:
try:
msg = await chn.get_message(raw_msg["message"]) msg = await chn.get_message(raw_msg["message"])
except discord.HTTPException:
pass
else:
raw_stream["_messages_cache"].append(msg) 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:
@ -646,7 +651,12 @@ 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"])
if chn is not None:
try:
msg = await chn.get_message(raw_msg["message"]) msg = await chn.get_message(raw_msg["message"])
except discord.HTTPException:
pass
else:
raw_community["_messages_cache"].append(msg) 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))