EngiBot/commands.go
2022-07-02 00:53:19 -06:00

47 lines
1.5 KiB
Go

package main
import (
"log"
"time"
"github.com/bwmarrin/discordgo"
)
func ping(session *discordgo.Session, interaction *discordgo.InteractionCreate) {
session.InteractionRespond(interaction.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
//Flags: 1 << 6, // Only lets issuer see initial response
Content: "Pong!",
},
})
}
func sping(session *discordgo.Session, interaction *discordgo.InteractionCreate) {
session.InteractionRespond(interaction.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
Flags: 1 << 6, // Only lets issuer see initial response
Content: "Pong!",
},
})
}
func slowping(session *discordgo.Session, interaction *discordgo.InteractionCreate) {
session.InteractionRespond(interaction.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
//Flags: 1 << 6, // Only lets issuer see initial response
Content: "...",
},
})
time.Sleep(10 * time.Second)
_, err := session.FollowupMessageCreate(interaction.Interaction, true, &discordgo.WebhookParams{
Content: "Pong!",
})
if err != nil {
log.Println(err)
}
}