Refactor: cleanup

- Introduce tracing
- Introduce cobra / viper framework
- Introduce resty client
- Seperate files in api/ and bot/
- Trim unused functions
This commit is contained in:
2025-12-12 23:51:48 +08:00
parent 344176063b
commit cb11672817
15 changed files with 575 additions and 466 deletions

28
bot/handleSlashEcho.go Normal file
View File

@@ -0,0 +1,28 @@
package bot
import "github.com/bwmarrin/discordgo"
func (b *Bot) handleSlashEcho(
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,
},
})
}