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/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
}
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) { 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

@ -109,6 +109,29 @@ func addCommands() {
Handler: banHandler, Handler: banHandler,
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{

View File

@ -82,39 +82,39 @@ func GetCloudStorageFiles(c *fiber.Ctx) error {
return c.Status(fiber.StatusOK).JSON([]aid.JSON{ return c.Status(fiber.StatusOK).JSON([]aid.JSON{
{ {
"uniqueFilename": "DefaultEngine.ini", "uniqueFilename": "DefaultEngine.ini",
"filename": "DefaultEngine.ini", "filename": "DefaultEngine.ini",
"hash": hex.EncodeToString(engineHash[:]), "hash": hex.EncodeToString(engineHash[:]),
"hash256": hex.EncodeToString(engineHash256[:]), "hash256": hex.EncodeToString(engineHash256[:]),
"length": len(TEMP_STORAGE["DefaultEngine.ini"]), "length": len(TEMP_STORAGE["DefaultEngine.ini"]),
"contentType": "application/octet-stream", "contentType": "application/octet-stream",
"uploaded": "2021-01-01T00:00:00.000Z", "uploaded": "2021-01-01T00:00:00.000Z",
"storageType": "S3", "storageType": "S3",
"doNotCache": false, "doNotCache": false,
"storageIds": []string{"primary"}, "storageIds": []string{"primary"},
}, },
{ {
"uniqueFilename": "DefaultGame.ini", "uniqueFilename": "DefaultGame.ini",
"filename": "DefaultGame.ini", "filename": "DefaultGame.ini",
"hash": hex.EncodeToString(gameHash[:]), "hash": hex.EncodeToString(gameHash[:]),
"hash256": hex.EncodeToString(gameHash256[:]), "hash256": hex.EncodeToString(gameHash256[:]),
"length": len(TEMP_STORAGE["DefaultGame.ini"]), "length": len(TEMP_STORAGE["DefaultGame.ini"]),
"contentType": "application/octet-stream", "contentType": "application/octet-stream",
"uploaded": "2021-01-01T00:00:00.000Z", "uploaded": "2021-01-01T00:00:00.000Z",
"storageType": "S3", "storageType": "S3",
"doNotCache": false, "doNotCache": false,
"storageIds": []string{"primary"}, "storageIds": []string{"primary"},
}, },
{ {
"uniqueFilename": "DefaultRuntimeOptions.ini", "uniqueFilename": "DefaultRuntimeOptions.ini",
"filename": "DefaultRuntimeOptions.ini", "filename": "DefaultRuntimeOptions.ini",
"hash": hex.EncodeToString(runtimeHash[:]), "hash": hex.EncodeToString(runtimeHash[:]),
"hash256": hex.EncodeToString(runtimeHash256[:]), "hash256": hex.EncodeToString(runtimeHash256[:]),
"length": len(TEMP_STORAGE["DefaultRuntimeOptions.ini"]), "length": len(TEMP_STORAGE["DefaultRuntimeOptions.ini"]),
"contentType": "application/octet-stream", "contentType": "application/octet-stream",
"uploaded": "2021-01-01T00:00:00.000Z", "uploaded": "2021-01-01T00:00:00.000Z",
"storageType": "S3", "storageType": "S3",
"doNotCache": false, "doNotCache": false,
"storageIds": []string{"primary"}, "storageIds": []string{"primary"},
}, },
}) })
} }
@ -122,13 +122,13 @@ func GetCloudStorageFiles(c *fiber.Ctx) error {
func GetCloudStorageConfig(c *fiber.Ctx) error { func GetCloudStorageConfig(c *fiber.Ctx) error {
return c.Status(fiber.StatusOK).JSON(aid.JSON{ return c.Status(fiber.StatusOK).JSON(aid.JSON{
"enumerateFilesPath": "/api/cloudstorage/system", "enumerateFilesPath": "/api/cloudstorage/system",
"enableMigration": true, "enableMigration": true,
"enableWrites": true, "enableWrites": true,
"epicAppName": "Live", "epicAppName": "Live",
"isAuthenticated": true, "isAuthenticated": true,
"disableV2": true, "disableV2": true,
"lastUpdated": "0000-00-00T00:00:00.000Z", "lastUpdated": "0000-00-00T00:00:00.000Z",
"transports": []string{}, "transports": []string{},
}) })
} }