diff options
| author | 2023-05-17 12:23:29 +0530 | |
|---|---|---|
| committer | 2023-05-17 12:23:29 +0530 | |
| commit | 7876744fedab9fbb22a160c8950ee22262570270 (patch) | |
| tree | f7189b5f3e9c0947d71f86461f151e50092f6e2c /bot/exts/utilities/bookmark.py | |
| parent | nit (diff) | |
| parent | Bump sentry-sdk from 1.22.2 to 1.23.0 (#1277) (diff) | |
Merge branch 'main' into undeprecate-bookmark
Diffstat (limited to 'bot/exts/utilities/bookmark.py')
| -rw-r--r-- | bot/exts/utilities/bookmark.py | 7 | 
1 files changed, 3 insertions, 4 deletions
diff --git a/bot/exts/utilities/bookmark.py b/bot/exts/utilities/bookmark.py index 0b7ce429..a2d1d1d4 100644 --- a/bot/exts/utilities/bookmark.py +++ b/bot/exts/utilities/bookmark.py @@ -1,6 +1,5 @@  import logging  import random -from typing import Optional  import discord  from discord.ext import commands @@ -234,15 +233,15 @@ class Bookmark(commands.Cog):          This command allows deleting any message sent by Sir-Lancebot in the user's DM channel with the bot.          The command invocation must be a reply to the message that is to be deleted.          """ -        target_message: Optional[discord.Message] = getattr(ctx.message.reference, "resolved", None) +        target_message: discord.Message | None = getattr(ctx.message.reference, "resolved", None)          if target_message is None:              raise commands.UserInputError("You must reply to the message from Sir-Lancebot you wish to delete.")          if not isinstance(ctx.channel, discord.DMChannel):              raise commands.UserInputError("You can only run this command your own DMs!") -        elif target_message.channel != ctx.channel: +        if target_message.channel != ctx.channel:              raise commands.UserInputError("You can only delete messages in your own DMs!") -        elif target_message.author != self.bot.user: +        if target_message.author != self.bot.user:              raise commands.UserInputError("You can only delete messages sent by Sir Lancebot!")          await target_message.delete()  |