Skip to content

Commit fe88794

Browse files
committed
Removed reference as it's not necessary
1 parent 75865eb commit fe88794

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

core/config.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ class ConfigManager:
77
"""Class that manages a cached configuration"""
88

99
allowed_to_change_in_command = {
10-
'activity_message', 'activity_type', 'log_channel_id', 'mention', 'disable_autoupdates', 'prefix',
11-
'main_category_id', 'sent_emoji', 'blocked_emoji', 'thread_creation_response', 'twitch_url'
10+
'activity_message', 'activity_type', 'log_channel_id',
11+
'mention', 'disable_autoupdates', 'prefix',
12+
'main_category_id', 'sent_emoji', 'blocked_emoji',
13+
'thread_creation_response', 'twitch_url'
1214
}
1315

1416
internal_keys = {
@@ -20,7 +22,7 @@ class ConfigManager:
2022
'mongo_uri', 'github_access_token', 'log_url'
2123
}
2224

23-
valid_keys = allowed_to_change_in_command.union(internal_keys).union(protected_keys)
25+
valid_keys = allowed_to_change_in_command | internal_keys | protected_keys
2426

2527
def __init__(self, bot):
2628
self.bot = bot
@@ -47,7 +49,8 @@ def populate_cache(self):
4749
pass
4850
finally:
4951
data.update(os.environ)
50-
data = {k.lower(): v for k, v in data.items() if k.lower() in self.valid_keys}
52+
data = {k.lower(): v for k, v in data.items()
53+
if k.lower() in self.valid_keys}
5154
self.cache = data
5255

5356
async def update(self, data=None):

core/thread.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ async def close(self, *, closer, after=0, silent=False,
5151
"""Close a thread now or after a set time in seconds"""
5252

5353
if self.close_task is not None:
54+
# restarts the after timer
5455
self.close_task.cancel()
5556

5657
if after > 0:
@@ -164,7 +165,7 @@ async def reply(self, message):
164165
self.send(message, self.recipient, from_mod=True)
165166
]
166167

167-
if self.close_task is not None and not self.close_task.cancelled():
168+
if self.close_task is not None:
168169
# cancel closing if a thread message is sent.
169170
self.close_task.cancel()
170171
tasks.append(self.channel.send(
@@ -175,7 +176,7 @@ async def reply(self, message):
175176
await asyncio.gather(*tasks)
176177

177178
async def send(self, message, destination=None, from_mod=False):
178-
if self.close_task is not None and not self.close_task.cancelled():
179+
if self.close_task is not None:
179180
# cancel closing if a thread message is sent.
180181
self.close_task.cancel()
181182
await self.channel.send(embed=discord.Embed(
@@ -282,7 +283,7 @@ def get_notifications(self):
282283
if key in config['notification_squad']:
283284
mentions.extend(config['notification_squad'][key])
284285
del config['notification_squad'][key]
285-
asyncio.create_task(config.update())
286+
self.bot.loop.create_task(config.update())
286287

287288
return ' '.join(mentions)
288289

0 commit comments

Comments
 (0)