package commands import ( "gitea.konchin.com/go2025/backend/bot" "github.com/bwmarrin/discordgo" ) type EchoCommand struct { bot *bot.Bot } func NewEchoCommand(bot *bot.Bot) bot.Command { return &EchoCommand{bot: bot} } func (self *EchoCommand) ApplicationCommand() *discordgo.ApplicationCommand { return &discordgo.ApplicationCommand{ Name: "echo", Description: "Bot repeats what you say", Options: []*discordgo.ApplicationCommandOption{ { Type: discordgo.ApplicationCommandOptionString, Name: "message", Description: "Message to echo", Required: true, }, }, } } func (self *EchoCommand) Handler() bot.CommandHandler { return func(s *discordgo.Session, i *discordgo.InteractionCreate) { options := i.ApplicationCommandData().Options if len(options) == 0 { s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{ Type: discordgo.InteractionResponseChannelMessageWithSource, Data: &discordgo.InteractionResponseData{ Content: "No message provided!", }, }) return } message := options[0].StringValue() s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{ Type: discordgo.InteractionResponseChannelMessageWithSource, Data: &discordgo.InteractionResponseData{ Content: message, }, }) } }