mirror of
https://github.com/Penguin-71630/meme-bot-frontend-dc.git
synced 2026-03-12 12:30:15 +08:00
- Introduce tracing - Introduce cobra / viper framework - Introduce resty client - Seperate files in api/ and bot/ - Trim unused functions
29 lines
567 B
Go
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),
|
|
},
|
|
})
|
|
}
|