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",

View File

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