mirror of
https://github.com/allthingslinux/tux.git
synced 2024-10-02 16:43:12 +00:00
feat(bookmarks.py): import 'cast' from 'typing' to ensure type safety
refactor(bookmarks.py): cast 'channel' to 'discord.TextChannel | discord.Thread' to improve type safety refactor(bookmarks.py): change 'emoji' parameter type from 'str' to 'discord.PartialEmoji' for better type consistency
This commit is contained in:
parent
72169b3198
commit
9b634a7dbe
1 changed files with 4 additions and 1 deletions
|
@ -1,3 +1,5 @@
|
|||
from typing import cast
|
||||
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from loguru import logger
|
||||
|
@ -20,6 +22,7 @@ class Bookmarks(commands.Cog):
|
|||
if channel is None:
|
||||
logger.error(f"Channel not found for ID: {payload.channel_id}")
|
||||
return
|
||||
channel = cast(discord.TextChannel | discord.Thread, channel)
|
||||
|
||||
# Fetch the message that was reacted to
|
||||
try:
|
||||
|
@ -70,7 +73,7 @@ class Bookmarks(commands.Cog):
|
|||
user: discord.User,
|
||||
message: discord.Message,
|
||||
embed: discord.Embed,
|
||||
emoji: str,
|
||||
emoji: discord.PartialEmoji,
|
||||
) -> None:
|
||||
"""
|
||||
Send a bookmarked message to the user.
|
||||
|
|
Loading…
Reference in a new issue