Merge pull request #6 from 2vb/master

Skins in game + discord full locker command
This commit is contained in:
Eccentric 2023-12-31 14:35:41 +00:00 committed by GitHub
commit fcaa81dfbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 60 additions and 8 deletions

View File

@ -5,6 +5,7 @@ import (
"github.com/bwmarrin/discordgo" "github.com/bwmarrin/discordgo"
"github.com/ectrc/snow/aid" "github.com/ectrc/snow/aid"
"github.com/ectrc/snow/fortnite"
"github.com/ectrc/snow/person" "github.com/ectrc/snow/person"
"github.com/ectrc/snow/storage" "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
}
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
Content: player.DisplayName + " has been granted everything.",
},
})
fortnite.GiveEverything(player)
}
func unbanHandler(s *discordgo.Session, i *discordgo.InteractionCreate) { func unbanHandler(s *discordgo.Session, i *discordgo.InteractionCreate) {
looker := person.FindByDiscord(i.Member.User.ID) looker := person.FindByDiscord(i.Member.User.ID)
if looker == nil { if looker == nil {

View File

@ -110,6 +110,29 @@ func addCommands() {
AdminOnly: true, 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{ addCommand(&DiscordCommand{
Command: &discordgo.ApplicationCommand{ Command: &discordgo.ApplicationCommand{
Name: "unban", Name: "unban",

View File

@ -148,7 +148,7 @@ func GetUserStorageFiles(c *fiber.Ctx) error {
} }
func GetUserStorageFile(c *fiber.Ctx) error { func GetUserStorageFile(c *fiber.Ctx) error {
return c.Status(fiber.StatusOK).JSON(aid.JSON{}) return c.Status(fiber.StatusOK).JSON(aid.JSON{})
} }
func PutUserStorageFile(c *fiber.Ctx) error { func PutUserStorageFile(c *fiber.Ctx) error {

View File

@ -108,6 +108,7 @@ func main() {
profile := game.Group("/profile/:accountId") profile := game.Group("/profile/:accountId")
profile.Use(handlers.MiddlewareFortnite) profile.Use(handlers.MiddlewareFortnite)
profile.Post("/client/:action", handlers.PostProfileAction) profile.Post("/client/:action", handlers.PostProfileAction)
profile.Post("/dedicated_server/:action", handlers.PostProfileAction)
lightswitch := r.Group("/lightswitch/api") lightswitch := r.Group("/lightswitch/api")
lightswitch.Use(handlers.MiddlewareFortnite) lightswitch.Use(handlers.MiddlewareFortnite)