first commit
This commit is contained in:
21
bot/handlers_setup.go
Normal file
21
bot/handlers_setup.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package bot
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/bwmarrin/discordgo"
|
||||
)
|
||||
|
||||
func (b *Bot) handleSetChannel(ctx context.Context, s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||
if !b.isAdmin(i) {
|
||||
respondEphemeral(s, i, "You need the **Manage Server** permission to use this command.")
|
||||
return
|
||||
}
|
||||
ch := i.ApplicationCommandData().Options[0].ChannelValue(s)
|
||||
if err := b.db.SetSetting(ctx, i.GuildID, settingChannel, ch.ID); err != nil {
|
||||
respondEphemeral(s, i, "Error saving channel setting.")
|
||||
return
|
||||
}
|
||||
respondEphemeral(s, i, fmt.Sprintf("✅ Now tracking distances in <#%s>.", ch.ID))
|
||||
}
|
||||
Reference in New Issue
Block a user