@@ -270,16 +270,22 @@ async def restore_from_snooze(self):
270
270
# Store snooze_data for notification before clearing
271
271
snooze_data_for_notify = self .snooze_data
272
272
self .snooze_data = None
273
- # Update channel_id in DB and clear snooze_data (robust: try recipient.id, then channel_id)
274
- result = await self .bot .api .logs .update_one (
275
- {"recipient.id" : str (self .id )},
276
- {"$set" : {"snoozed" : False , "channel_id" : str (channel .id )}, "$unset" : {"snooze_data" : "" }},
277
- )
278
- if result .modified_count == 0 :
273
+ # Update channel_id in DB and clear snooze_data (robust: try log_key first)
274
+ if self .log_key :
275
+ result = await self .bot .api .logs .update_one (
276
+ {"key" : self .log_key },
277
+ {"$set" : {"snoozed" : False , "channel_id" : str (channel .id )}, "$unset" : {"snooze_data" : "" }},
278
+ )
279
+ else :
279
280
result = await self .bot .api .logs .update_one (
280
- {"channel_id " : str (channel .id )},
281
+ {"recipient.id " : str (self .id )},
281
282
{"$set" : {"snoozed" : False , "channel_id" : str (channel .id )}, "$unset" : {"snooze_data" : "" }},
282
283
)
284
+ if result .modified_count == 0 :
285
+ result = await self .bot .api .logs .update_one (
286
+ {"channel_id" : str (channel .id )},
287
+ {"$set" : {"snoozed" : False , "channel_id" : str (channel .id )}, "$unset" : {"snooze_data" : "" }},
288
+ )
283
289
import logging
284
290
285
291
logging .info (f"[UNSNOOZE] DB update result: { result .modified_count } " )
0 commit comments