@@ -12,6 +12,7 @@ import { CommandSetBuilder } from "../../../command-abstractions/command-set-bui
1212import { Wheatley } from "../../../wheatley.js" ;
1313import { EarlyReplyMode , TextBasedCommandBuilder } from "../../../command-abstractions/text-based-command-builder.js" ;
1414import { TextBasedCommand } from "../../../command-abstractions/text-based-command.js" ;
15+ import { MessageContextMenuInteractionBuilder } from "../../../command-abstractions/context-menu.js" ;
1516
1617const star_threshold = 5 ;
1718const other_threshold = 5 ;
@@ -140,6 +141,12 @@ export default class Starboard extends BotComponent {
140141 . set_handler ( this . list_config . bind ( this ) ) ,
141142 ) ,
142143 ) ;
144+
145+ commands . add (
146+ new MessageContextMenuInteractionBuilder ( "Add to starboard" )
147+ . set_permissions ( Discord . PermissionFlagsBits . Administrator )
148+ . set_handler ( this . add_to_starboard_context_menu . bind ( this ) ) ,
149+ ) ;
143150 }
144151
145152 override async on_ready ( ) {
@@ -576,4 +583,24 @@ export default class Starboard extends BotComponent {
576583 ] . join ( "\n" ) ,
577584 ) ;
578585 }
586+
587+ async add_to_starboard_context_menu ( interaction : Discord . MessageContextMenuCommandInteraction ) {
588+ await interaction . deferReply ( { ephemeral : true } ) ;
589+
590+ const message = interaction . targetMessage ;
591+
592+ if ( ! ( await this . is_valid_channel ( message . channel ) ) ) {
593+ await interaction . editReply ( "Cannot add messages from this channel to the starboard." ) ;
594+ return ;
595+ }
596+
597+ const existing_entry = await this . database . starboard_entries . findOne ( { message : message . id } ) ;
598+ if ( existing_entry ) {
599+ await interaction . editReply ( "This message is already on the starboard." ) ;
600+ return ;
601+ }
602+
603+ await this . update_starboard ( message ) ;
604+ await interaction . editReply ( "Message added to the starboard." ) ;
605+ }
579606}
0 commit comments