Skip to content

Commit f683023

Browse files
committed
Black formatting.
1 parent 1a5a2bd commit f683023

File tree

1 file changed

+28
-15
lines changed

1 file changed

+28
-15
lines changed

core/thread.py

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ async def snooze(self, moderator=None, command_used=None):
143143
if not self.log_key:
144144
# Try to fetch from DB using channel_id
145145
log_entry = await self.bot.api.get_log(self.channel.id)
146-
if log_entry and 'key' in log_entry:
147-
self.log_key = log_entry['key']
146+
if log_entry and "key" in log_entry:
147+
self.log_key = log_entry["key"]
148148
# Fallback: try by recipient id
149-
elif hasattr(self, 'id'):
149+
elif hasattr(self, "id"):
150150
log_entry = await self.bot.api.get_log(str(self.id))
151-
if log_entry and 'key' in log_entry:
152-
self.log_key = log_entry['key']
151+
if log_entry and "key" in log_entry:
152+
self.log_key = log_entry["key"]
153153

154154
self.snooze_data = {
155155
"category_id": channel.category_id,
@@ -171,10 +171,10 @@ async def snooze(self, moderator=None, command_used=None):
171171
"mod_only"
172172
if (
173173
m.embeds
174-
and getattr(m.embeds[0], 'author', None)
174+
and getattr(m.embeds[0], "author", None)
175175
and (
176-
getattr(m.embeds[0].author, 'name', '').startswith('Note') or
177-
getattr(m.embeds[0].author, 'name', '').startswith('Persistent Note')
176+
getattr(m.embeds[0].author, "name", "").startswith("Note")
177+
or getattr(m.embeds[0].author, "name", "").startswith("Persistent Note")
178178
)
179179
)
180180
else None
@@ -185,12 +185,13 @@ async def snooze(self, moderator=None, command_used=None):
185185
# Only include if not already internal/note, safe check for embed author
186186
if not (
187187
m.embeds
188-
and getattr(m.embeds[0], 'author', None)
188+
and getattr(m.embeds[0], "author", None)
189189
and (
190-
getattr(m.embeds[0].author, 'name', '').startswith('Note') or
191-
getattr(m.embeds[0].author, 'name', '').startswith('Persistent Note')
190+
getattr(m.embeds[0].author, "name", "").startswith("Note")
191+
or getattr(m.embeds[0].author, "name", "").startswith("Persistent Note")
192192
)
193-
) and getattr(m, "type", None) not in ("internal", "note")
193+
)
194+
and getattr(m, "type", None) not in ("internal", "note")
194195
],
195196
"snoozed_by": getattr(moderator, "name", None) if moderator else None,
196197
"snooze_command": command_used,
@@ -264,10 +265,19 @@ async def restore_from_snooze(self):
264265
username = msg.get("author_name") or (getattr(author, "name", None)) or "Unknown"
265266
user_id = msg.get("author_id")
266267
if embeds:
267-
embeds[0].set_author(name=f"{username} ({user_id})", icon_url=author.display_avatar.url if author and hasattr(author, "display_avatar") else None)
268+
embeds[0].set_author(
269+
name=f"{username} ({user_id})",
270+
icon_url=(
271+
author.display_avatar.url
272+
if author and hasattr(author, "display_avatar")
273+
else None
274+
),
275+
)
268276
await channel.send(embeds=embeds)
269277
else:
270-
formatted = f"**{username} ({user_id})**: {content}" if content else f"**{username} ({user_id})**"
278+
formatted = (
279+
f"**{username} ({user_id})**: {content}" if content else f"**{username} ({user_id})**"
280+
)
271281
await channel.send(formatted)
272282
else:
273283
await channel.send(content=content or None, embeds=embeds or None)
@@ -289,7 +299,10 @@ async def restore_from_snooze(self):
289299
if result.modified_count == 0:
290300
result = await self.bot.api.logs.update_one(
291301
{"channel_id": str(channel.id)},
292-
{"$set": {"snoozed": False, "channel_id": str(channel.id)}, "$unset": {"snooze_data": ""}},
302+
{
303+
"$set": {"snoozed": False, "channel_id": str(channel.id)},
304+
"$unset": {"snooze_data": ""},
305+
},
293306
)
294307
import logging
295308

0 commit comments

Comments
 (0)