diff options
author | 2023-05-09 16:01:01 +0100 | |
---|---|---|
committer | 2023-05-09 16:01:01 +0100 | |
commit | c3e23e60278d34658f801bd7d7ed721d5a272637 (patch) | |
tree | e159a0fae7850d706d713cf2b49dfed2140ce655 /bot/exts/utilities/bookmark.py | |
parent | Bump sentry-sdk from 1.21.1 to 1.22.1 (#1273) (diff) | |
parent | Move unshared contants inside modules (diff) |
Merge pull request #1270 from python-discord/migrate-to-ruff
Migrate to ruff
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 65a32203..150dfc48 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 @@ -145,15 +144,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() |