Commit bb72cfc 1 parent 6566944 commit bb72cfc Copy full SHA for bb72cfc
File tree 1 file changed +19
-1
lines changed
1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -298,7 +298,25 @@ async def calendar_updater(self):
298
298
print (f'Explosions! Calendar failed to update...' )
299
299
traceback .print_exc ()
300
300
301
-
301
+ @commands .Cog .listener ()
302
+ async def on_guild_channel_delete (self , channel ):
303
+ if not isinstance (channel , discord .CategoryChannel ):
304
+ return
305
+
306
+ cur .execute ('SELECT * FROM calendar WHERE category_id = ?' , (channel .id ,))
307
+ if not cur .fetchone ():
308
+ return
309
+
310
+ cat = get_categories (channel .guild )[channel .id ]
311
+ try :
312
+ msg = await cat .fetch_message (channel .guild )
313
+ await msg .delete ()
314
+ except :
315
+ pass
316
+
317
+ cur .execute ('DELETE FROM calendar WHERE category_id = ?' , (cat .category_id ,))
318
+ db .commit ()
319
+
302
320
@commands .Cog .listener ()
303
321
async def on_ready (self ):
304
322
#self.channel_name_updater.add_exception_type(Exception)
You can’t perform that action at this time.
0 commit comments