@@ -94,9 +94,8 @@ async def on_reaction_add(reaction: discord.Reaction, _: (discord.User | discord
9494
9595 await star_message (reaction .message , f"Message reached { config .STARBOARD_MINIMUM_STARS } stars!" )
9696
97- # TODO: This could probably be part of the application menu Discord added
98- @command_tree .command (name = "force-star" , description = "Force star a message" )
99- async def force_star (interaction : discord .Interaction , message_url : str ) -> None :
97+ @command_tree .context_menu (name = "Force Star" )
98+ async def force_star (interaction : discord .Interaction , message : discord .Message ) -> None :
10099 await interaction .response .defer ()
101100
102101 if interaction .guild is None :
@@ -108,29 +107,7 @@ async def force_star(interaction: discord.Interaction, message_url: str) -> None
108107 await interaction .followup .send ("This command can only be ran by administrators" )
109108 return
110109
111- # https://discord.com/channels/1142838164310999151/1142838261534961816/1335619665602412636
112- parts = message_url .split ("/" )
113- if len (parts ) != 7 :
114- await interaction .followup .send (f"The provided message URL (`{ message_url } `) does not seem to be a valid Discord message URL" )
115- return
116-
117- # NOTE: First 4 items are ignored because they're irrelevant
118- # [ 'https:', '', 'discord.com', 'channels' ]
119- _ , _ , _ , _ , guild_id , channel_id , message_id = parts
120- if int (guild_id ) != interaction .guild .id :
121- await interaction .followup .send (f"Attempting to star a message from another guild, this is not allowed." )
122- return
123-
124- channel = interaction .guild .get_channel (int (channel_id ))
125-
126- # TODO: This should probably not be forced to be a TextChannel
127- if channel is None or not isinstance (channel , TextChannel ):
128- await interaction .followup .send (f"The provided channel (`{ channel_id } `) does not seem to be a valid Text Channel" )
129- return
130-
131- message : discord .Message = await channel .fetch_message (int (message_id ))
132110 await star_message (message , f"Message was force starred by @{ interaction .user .name } " )
133-
134111 await interaction .followup .send (f"Starred message by @{ message .author .name } " )
135112
136113discord_client .run (config .DISCORD_TOKEN )
0 commit comments