Merge pull request #6 from 2vb/master
Skins in game + discord full locker command
This commit is contained in:
commit
fcaa81dfbe
|
@ -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
|
||||
}
|
||||
|
||||
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) {
|
||||
looker := person.FindByDiscord(i.Member.User.ID)
|
||||
if looker == nil {
|
||||
|
|
|
@ -109,6 +109,29 @@ func addCommands() {
|
|||
Handler: banHandler,
|
||||
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{
|
||||
|
|
|
@ -148,9 +148,9 @@ func GetUserStorageFiles(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 {
|
||||
return c.Status(fiber.StatusOK).JSON(aid.JSON{})
|
||||
}
|
||||
}
|
||||
|
|
13
main.go
13
main.go
|
@ -20,7 +20,7 @@ var configFile []byte
|
|||
|
||||
func init() {
|
||||
aid.LoadConfig(configFile)
|
||||
|
||||
|
||||
var device storage.Storage
|
||||
switch aid.Config.Database.Type {
|
||||
case "postgres":
|
||||
|
@ -97,7 +97,7 @@ func main() {
|
|||
user.Get("/:accountId", handlers.GetUserStorageFiles)
|
||||
user.Get("/:accountId/:fileName", handlers.GetUserStorageFile)
|
||||
user.Put("/:accountId/:fileName", handlers.PutUserStorageFile)
|
||||
|
||||
|
||||
game := fortnite.Group("/game/v2")
|
||||
game.Get("/enabled_features", handlers.GetGameEnabledFeatures)
|
||||
game.Post("/tryPlayOnPlatform/account/:accountId", handlers.PostGamePlatform)
|
||||
|
@ -108,6 +108,7 @@ func main() {
|
|||
profile := game.Group("/profile/:accountId")
|
||||
profile.Use(handlers.MiddlewareFortnite)
|
||||
profile.Post("/client/:action", handlers.PostProfileAction)
|
||||
profile.Post("/dedicated_server/:action", handlers.PostProfileAction)
|
||||
|
||||
lightswitch := r.Group("/lightswitch/api")
|
||||
lightswitch.Use(handlers.MiddlewareFortnite)
|
||||
|
@ -119,7 +120,7 @@ func main() {
|
|||
|
||||
discord := snow.Group("/discord")
|
||||
discord.Get("/", handlers.GetDiscordOAuthURL)
|
||||
|
||||
|
||||
player := snow.Group("/player")
|
||||
player.Use(handlers.MiddlewareWeb)
|
||||
player.Get("/", handlers.GetPlayer)
|
||||
|
@ -129,11 +130,11 @@ func main() {
|
|||
aid.Print("Listening on " + aid.Config.API.Host + ":" + ld.Port)
|
||||
return nil
|
||||
})
|
||||
|
||||
|
||||
r.All("*", func(c *fiber.Ctx) error { return c.Status(fiber.StatusNotFound).JSON(aid.ErrorNotFound) })
|
||||
|
||||
|
||||
err := r.Listen("0.0.0.0" + aid.Config.API.Port)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("Failed to listen: %v", err))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user