Full locker discord command

This commit is contained in:
2vb 2023-12-26 20:35:12 -08:00
parent 04f2aab84f
commit 1d1e81d8a6
3 changed files with 85 additions and 34 deletions

View File

@ -5,6 +5,7 @@ import (
"github.com/bwmarrin/discordgo"
"github.com/ectrc/snow/aid"
"github.com/ectrc/snow/fortnite"
"github.com/ectrc/snow/person"
"github.com/ectrc/snow/storage"
)
@ -133,6 +134,33 @@ func banHandler(s *discordgo.Session, i *discordgo.InteractionCreate) {
})
}
func GiveFLHandler(s *discordgo.Session, i *discordgo.InteractionCreate) {
looker := person.FindByDiscord(i.Member.User.ID)
if looker == nil {
s.InteractionRespond(i.Interaction, &ErrorNoPermission)
return
}
if !looker.HasPermission(person.PermissionBan) {
s.InteractionRespond(i.Interaction, &ErrorNoPermission)
return
}
player := getPersonFromOptions(i.ApplicationCommandData(), s)
if player == nil {
s.InteractionRespond(i.Interaction, &ErrorInvalidDisplayOrDiscord)
return
}
fortnite.GiveEverything(player)
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
Content: player.DisplayName + " has been granted everything.",
},
})
}
func unbanHandler(s *discordgo.Session, i *discordgo.InteractionCreate) {
looker := person.FindByDiscord(i.Member.User.ID)
if looker == nil {

View File

@ -110,6 +110,29 @@ func addCommands() {
AdminOnly: true,
})
addCommand(&DiscordCommand{
Command: &discordgo.ApplicationCommand{
Name: "give-everything",
Description: "Give a player full locker",
Options: []*discordgo.ApplicationCommandOption{
{
Type: discordgo.ApplicationCommandOptionUser,
Name: "discord",
Description: "The discord account of the player.",
Required: false,
},
{
Type: discordgo.ApplicationCommandOptionString,
Name: "display",
Description: "The display name of the player.",
Required: false,
},
},
},
Handler: GiveFLHandler,
AdminOnly: true,
})
addCommand(&DiscordCommand{
Command: &discordgo.ApplicationCommand{
Name: "unban",