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:
|
if self.channel:
|
||||||
try:
|
try:
|
||||||
await self.channel.delete()
|
await self.channel.delete()
|
||||||
|
self.channel = None
|
||||||
except discord.HTTPException:
|
except discord.HTTPException:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if self.message:
|
if self.message:
|
||||||
try:
|
try:
|
||||||
timestamp = self.start_time.timestamp()
|
timestamp = int(self.start_time.timestamp())
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
title="Session <t:{}:t> - <t:{}:t>".format(
|
title="Session <t:{}:t> - <t:{}:t>".format(
|
||||||
timestamp, timestamp + 3600
|
timestamp, timestamp + 3600
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import asyncio
|
||||||
import discord
|
import discord
|
||||||
|
|
||||||
import settings
|
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)
|
return "The accountability system has been started in **{}**.".format(self.value.name)
|
||||||
else:
|
else:
|
||||||
if self.id in AG.cache:
|
if self.id in AG.cache:
|
||||||
aguild = AG.cache[self.id]
|
aguild = AG.cache.pop(self.id)
|
||||||
if aguild.current_slot:
|
if aguild.current_slot:
|
||||||
aguild.current_lost.cancel()
|
asyncio.create_task(aguild.current_slot.cancel())
|
||||||
if aguild.upcoming_slot:
|
if aguild.upcoming_slot:
|
||||||
aguild.upcoming_slot.cancel()
|
asyncio.create_task(aguild.upcoming_slot.cancel())
|
||||||
return "The accountability system has been stopped."
|
return "The accountability system has been shut down."
|
||||||
else:
|
else:
|
||||||
return "The accountability category has been unset."
|
return "The accountability category has been unset."
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user