@@ -59,7 +59,6 @@ async def close(self, *, closer, after=0, silent=False,
5959 # TODO: Add somewhere to clean up broken closures
6060 # (when channel is already deleted)
6161 await self .bot .config .update ()
62- closures = self .bot .config .get ('closures' , {})
6362 now = datetime .datetime .utcnow ()
6463 items = {
6564 # 'initiation_time': now.isoformat(),
@@ -69,8 +68,7 @@ async def close(self, *, closer, after=0, silent=False,
6968 'delete_channel' : delete_channel ,
7069 'message' : message
7170 }
72- closures [str (self .id )] = items
73- self .bot .config ['closures' ] = closures
71+ self .bot .config .closures [str (self .id )] = items
7472 await self .bot .config .update ()
7573
7674 self .close_task = self .bot .loop .call_later (
@@ -84,10 +82,9 @@ async def _close(self, closer, silent=False, delete_channel=True,
8482 message = None , scheduled = False ):
8583 del self .manager .cache [self .id ]
8684
87- closures = self .bot .config .get ('closures' , {})
88- closures .pop (str (self .id ))
89- self .bot .config ['closures' ] = closures
90- await self .bot .config .update ()
85+ if scheduled :
86+ self .bot .config .closures .pop (str (self .id ), None )
87+ await self .bot .config .update ()
9188
9289 if str (self .id ) in self .bot .config .subscriptions :
9390 del self .bot .config .subscriptions [str (self .id )]
0 commit comments