mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-20 18:06:08 -05:00
[V3 Config] Adjust functionality of get_attr (#1342)
* Intermediate commit * Add defaulting stuff to config * Remove set_attr in favor of set_raw * Modify get_attr * Fix issue with clearing data
This commit is contained in:
@@ -53,7 +53,7 @@ class Streams:
|
||||
@commands.command()
|
||||
async def twitch(self, ctx, channel_name: str):
|
||||
"""Checks if a Twitch channel is streaming"""
|
||||
token = await self.db.tokens.get_attr(TwitchStream.__name__)
|
||||
token = await self.db.tokens.get_raw(TwitchStream.__name__, default=None)
|
||||
stream = TwitchStream(name=channel_name,
|
||||
token=token)
|
||||
await self.check_online(ctx, stream)
|
||||
@@ -187,7 +187,7 @@ class Streams:
|
||||
async def stream_alert(self, ctx, _class, channel_name):
|
||||
stream = self.get_stream(_class, channel_name.lower())
|
||||
if not stream:
|
||||
token = await self.db.tokens.get_attr(_class.__name__)
|
||||
token = await self.db.tokens.get_raw(_class.__name__, default=None)
|
||||
stream = _class(name=channel_name,
|
||||
token=token)
|
||||
try:
|
||||
@@ -210,7 +210,7 @@ class Streams:
|
||||
async def community_alert(self, ctx, _class, community_name):
|
||||
community = self.get_community(_class, community_name)
|
||||
if not community:
|
||||
token = await self.db.tokens.get_attr(_class.__name__)
|
||||
token = await self.db.tokens.get_raw(_class.__name__, default=None)
|
||||
community = _class(name=community_name, token=token)
|
||||
try:
|
||||
await community.get_community_streams()
|
||||
@@ -477,7 +477,7 @@ class Streams:
|
||||
if not _class:
|
||||
continue
|
||||
|
||||
token = await self.db.tokens.get_attr(_class.__name__)
|
||||
token = await self.db.tokens.get_raw(_class.__name__)
|
||||
streams.append(_class(token=token, **raw_stream))
|
||||
|
||||
# issue 1191 extended resolution: Remove this after suitable period
|
||||
@@ -497,7 +497,7 @@ class Streams:
|
||||
if not _class:
|
||||
continue
|
||||
|
||||
token = await self.db.tokens.get_attr(_class.__name__)
|
||||
token = await self.db.tokens.get_raw(_class.__name__, default=None)
|
||||
communities.append(_class(token=token, **raw_community))
|
||||
|
||||
# issue 1191 extended resolution: Remove this after suitable period
|
||||
|
||||
Reference in New Issue
Block a user