Skip to content

Commit c19d244

Browse files
committed
Creates ABC Cache
1 parent e63164b commit c19d244

8 files changed

Lines changed: 448 additions & 39 deletions

File tree

cogs/helper_cog.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def _change_vote_threshold(
7171
bypass_ctx_check=False,
7272
bypass_argument_checks=False,
7373
):
74+
raise NotImplementedError("This method is no longer supported!!!")
7475
"""A helper method that will change the vote_threshold to the one specified"""
7576
if not bypass_ctx_check:
7677
assert isinstance(
@@ -102,6 +103,7 @@ def _change_trusted_users(
102103
):
103104
"""A helper method that will change the trusted_users.
104105
This will replace the trusted users with the one given!"""
106+
raise NotImplementedError("This method is no longer supported!!!")
105107
if not bypass_ctx_check:
106108
assert isinstance(
107109
ctx,

cogs/problems_cog.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,7 @@ async def vote(self, inter, problem_id: int, is_guild_problem: bool = False):
809809
The data about you voting is not private; it will be given to people who created/solved/voted for problems and use /user_data get_data
810810
"""
811811
# Get the problem
812+
812813
try:
813814
guild_id = inter.guild_id if is_guild_problem else None
814815
problem = await self.bot.cache.get_problem(
@@ -821,6 +822,8 @@ async def vote(self, inter, problem_id: int, is_guild_problem: bool = False):
821822
)
822823
return
823824
# Step 2: make sure they didn't vote, to make sure people can only vote once
825+
826+
# TODO: Check for undeletable problems
824827
if problem.is_voter(inter.author):
825828
await inter.send(
826829
embed=ErrorEmbed(

cogs/suggestion_ext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ async def suggest(
157157
if len(suggestion) > 5450:
158158
return await inter.send("Your suggestion is too long.")
159159
if not self.is_ready:
160-
return await inter.send("I am not ready to recieve suggestions!")
160+
return await inter.send("I am not ready to receive suggestions!")
161161

162162
await inter.send(
163163
embed=custom_embeds.SimpleEmbed(

helpful_modules/custom_bot.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -231,26 +231,24 @@ async def close(self):
231231
await asyncio.sleep(5)
232232
self.storer.close()
233233
await asyncio.gather(*self.closing_things)
234-
except Exception as e:
234+
except (Exception, KeyboardInterrupt) as e:
235235
print(f"An exception of {e} happened while the bot was trying to close.")
236236
self.log.exception(e)
237237
await log_error(e)
238238
await asyncio.sleep(3)
239-
except KeyboardInterrupt as err:
240-
print(f"An exception of {err} happened while the bot was trying to close.")
241-
self.log.exception(err)
242-
await log_error(err)
243-
await asyncio.sleep(3)
244239
finally:
245240
await super().close()
246241
self.is_closing = False
247242

248243
async def maybe_send_closing_message(self):
249244
guild = self.support_server
250245
channel = guild.get_channel(ANNOUNCEMENTS_CHANNEL)
251-
await channel.send(
252-
f"This process will stop functioning in {TIME_TO_WAIT} seconds (if waiting is enabled)"
253-
)
246+
if WAIT:
247+
await channel.send(
248+
f"This bot will stop in {TIME_TO_WAIT} seconds."
249+
)
250+
else:
251+
await channel.send("This bot will stop functioning immediately.")
254252

255253
def add_closing_thing(self, thing: FunctionType) -> None:
256254
if asyncio.iscoroutinefunction(thing):

0 commit comments

Comments
 (0)