fix (rooms): Cancel rooms on system shutdown.
Fix typos in the `success_response` for `accountability_category`. Make the `TimeSlot.cancel()` method more robust.
This commit is contained in:
@@ -409,12 +409,13 @@ class TimeSlot:
|
||||
if self.channel:
|
||||
try:
|
||||
await self.channel.delete()
|
||||
self.channel = None
|
||||
except discord.HTTPException:
|
||||
pass
|
||||
|
||||
if self.message:
|
||||
try:
|
||||
timestamp = self.start_time.timestamp()
|
||||
timestamp = int(self.start_time.timestamp())
|
||||
embed = discord.Embed(
|
||||
title="Session <t:{}:t> - <t:{}:t>".format(
|
||||
timestamp, timestamp + 3600
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import asyncio
|
||||
import discord
|
||||
|
||||
import settings
|
||||
@@ -37,12 +38,12 @@ class accountability_category(settings.Channel, settings.GuildSetting):
|
||||
return "The accountability system has been started in **{}**.".format(self.value.name)
|
||||
else:
|
||||
if self.id in AG.cache:
|
||||
aguild = AG.cache[self.id]
|
||||
aguild = AG.cache.pop(self.id)
|
||||
if aguild.current_slot:
|
||||
aguild.current_lost.cancel()
|
||||
asyncio.create_task(aguild.current_slot.cancel())
|
||||
if aguild.upcoming_slot:
|
||||
aguild.upcoming_slot.cancel()
|
||||
return "The accountability system has been stopped."
|
||||
asyncio.create_task(aguild.upcoming_slot.cancel())
|
||||
return "The accountability system has been shut down."
|
||||
else:
|
||||
return "The accountability category has been unset."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user