diff --git a/cogs/modmail.py b/cogs/modmail.py index 3207bcdd5b..b977d8fdf4 100644 --- a/cogs/modmail.py +++ b/cogs/modmail.py @@ -899,7 +899,9 @@ async def note_persistent(self, ctx, *, msg: str = ""): async with ctx.typing(): msg = await ctx.thread.note(ctx.message, persistent=True) await msg.pin() - await self.bot.api.create_note(recipient=ctx.thread.recipient, message=ctx.message, message_id=msg.id) + await self.bot.api.create_note( + recipient=ctx.thread.recipient, message=ctx.message, message_id=msg.id + ) @commands.command() @checks.has_permissions(PermissionLevel.SUPPORTER) diff --git a/core/clients.py b/core/clients.py index 300425be53..62f565f91c 100644 --- a/core/clients.py +++ b/core/clients.py @@ -424,7 +424,7 @@ async def create_note(self, recipient: Member, message: Message, message_id: Uni "id": str(message.author.id), "name": message.author.name, "discriminator": message.author.discriminator, - "avatar_url": str(message.author.avatar_url) + "avatar_url": str(message.author.avatar_url), }, "message": message.content, "message_id": str(message_id), @@ -436,13 +436,17 @@ async def find_notes(self, recipient: Member): async def update_note_ids(self, ids: dict): for object_id, message_id in ids.items(): - await self.db.notes.update_one({"_id": object_id}, {"$set": {"message_id": message_id}}) + await self.db.notes.update_one( + {"_id": object_id}, {"$set": {"message_id": message_id}} + ) async def delete_note(self, message_id: Union[int, str]): await self.db.notes.delete_one({"message_id": str(message_id)}) async def edit_note(self, message_id: Union[int, str], message: str): - await self.db.notes.update_one({"message_id": str(message_id)}, {"$set": {"message": message}}) + await self.db.notes.update_one( + {"message_id": str(message_id)}, {"$set": {"message": message}} + ) def get_plugin_partition(self, cog): cls_name = cog.__class__.__name__ diff --git a/core/thread.py b/core/thread.py index 3562d98ee3..b9bf261b12 100644 --- a/core/thread.py +++ b/core/thread.py @@ -229,7 +229,9 @@ class Author: "author": Author(), } message = discord.Message(state=State(), channel=None, data=data) - ids[note["_id"]] = str((await self.note(message, persistent=True, thread_creation=True)).id) + ids[note["_id"]] = str( + (await self.note(message, persistent=True, thread_creation=True)).id + ) await self.bot.api.update_note_ids(ids) @@ -242,7 +244,10 @@ async def activate_auto_triggers(): pass await asyncio.gather( - send_genesis_message(), send_recipient_genesis_message(), activate_auto_triggers(), send_persistent_notes(), + send_genesis_message(), + send_recipient_genesis_message(), + activate_auto_triggers(), + send_persistent_notes(), ) self.bot.dispatch("thread_ready", self) @@ -687,11 +692,19 @@ async def edit_dm_message(self, message: discord.Message, content: str) -> None: self.bot.api.edit_message(message.id, content), linked_message.edit(embed=embed) ) - async def note(self, message: discord.Message, persistent=False, thread_creation=False) -> None: + async def note( + self, message: discord.Message, persistent=False, thread_creation=False + ) -> None: if not message.content and not message.attachments: raise MissingRequiredArgument(SimpleNamespace(name="msg")) - msg = await self.send(message, self.channel, note=True, persistent_note=persistent, thread_creation=thread_creation) + msg = await self.send( + message, + self.channel, + note=True, + persistent_note=persistent, + thread_creation=thread_creation, + ) self.bot.loop.create_task( self.bot.api.append_log(