Files
dcbot/bot/handleSlashGreet.go
Yi-Ting Shih cb11672817 Refactor: cleanup
- Introduce tracing
- Introduce cobra / viper framework
- Introduce resty client
- Seperate files in api/ and bot/
- Trim unused functions
2025-12-12 23:51:48 +08:00

29 lines
567 B
Go

package bot
import (
"fmt"
"github.com/bwmarrin/discordgo"
)
func (b *Bot) handleSlashGreet(
s *discordgo.Session,
i *discordgo.InteractionCreate,
) {
var username string
if i.Member != nil {
username = i.Member.User.Username
} else if i.User != nil {
username = i.User.Username
} else {
username = "Unknown"
}
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
Content: fmt.Sprintf("Ciallo, %s!", username),
},
})
}