mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[Streams] Don't raise KeyError on missing token (#1994)
Some streaming services don't require a token/clientID. Resolves #1932
This commit is contained in:
parent
06f986b92e
commit
51a54863c5
@ -608,16 +608,12 @@ class Streams:
|
|||||||
chn = self.bot.get_channel(raw_msg["channel"])
|
chn = self.bot.get_channel(raw_msg["channel"])
|
||||||
msg = await chn.get_message(raw_msg["message"])
|
msg = await chn.get_message(raw_msg["message"])
|
||||||
raw_stream["_messages_cache"].append(msg)
|
raw_stream["_messages_cache"].append(msg)
|
||||||
token = await self.db.tokens.get_raw(_class.__name__)
|
token = await self.db.tokens.get_raw(_class.__name__, default=None)
|
||||||
streams.append(_class(token=token, **raw_stream))
|
if token is not None:
|
||||||
|
raw_stream["token"] = token
|
||||||
|
streams.append(_class(**raw_stream))
|
||||||
|
|
||||||
# issue 1191 extended resolution: Remove this after suitable period
|
return streams
|
||||||
# Fast dedupe below
|
|
||||||
seen = set()
|
|
||||||
seen_add = seen.add
|
|
||||||
return [x for x in streams if not (x.name.lower() in seen or seen_add(x.name.lower()))]
|
|
||||||
|
|
||||||
# return streams
|
|
||||||
|
|
||||||
async def load_communities(self):
|
async def load_communities(self):
|
||||||
communities = []
|
communities = []
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user