pretty console
This commit is contained in:
parent
aa432b6f2c
commit
5130009644
|
@ -41,19 +41,16 @@ func createHandler(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||||
func createModalHandler(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
func createModalHandler(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||||
data := i.ModalSubmitData()
|
data := i.ModalSubmitData()
|
||||||
if len(data.Components) <= 0 {
|
if len(data.Components) <= 0 {
|
||||||
aid.Print("No components found")
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
components, ok := data.Components[0].(*discordgo.ActionsRow)
|
components, ok := data.Components[0].(*discordgo.ActionsRow)
|
||||||
if !ok {
|
if !ok {
|
||||||
aid.Print("Failed to assert TextInput")
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
display, ok := components.Components[0].(*discordgo.TextInput)
|
display, ok := components.Components[0].(*discordgo.TextInput)
|
||||||
if !ok {
|
if !ok {
|
||||||
aid.Print("Failed to assert TextInput")
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +186,6 @@ func codeHandler(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||||
decrypt, err := aid.KeyPair.DecryptAndVerifyB64(encrypted, sig)
|
decrypt, err := aid.KeyPair.DecryptAndVerifyB64(encrypted, sig)
|
||||||
|
|
||||||
if err || string(decrypt) != code {
|
if err || string(decrypt) != code {
|
||||||
aid.Print("Failed to verify code that was just generated so we're not going to send it")
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ func (c *DiscordClient) UnregisterCommands() {
|
||||||
for _, command := range commands {
|
for _, command := range commands {
|
||||||
err := c.Client.ApplicationCommandDelete(aid.Config.Discord.ID, aid.Config.Discord.Guild, command.ID)
|
err := c.Client.ApplicationCommandDelete(aid.Config.Discord.ID, aid.Config.Discord.Guild, command.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aid.Print("Failed to delete command: " + command.Name)
|
aid.Print("(discord) failed to delete command: " + command.Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ func (c *DiscordClient) UnregisterCommands() {
|
||||||
for _, command := range commands {
|
for _, command := range commands {
|
||||||
err := c.Client.ApplicationCommandDelete(aid.Config.Discord.ID, "", command.ID)
|
err := c.Client.ApplicationCommandDelete(aid.Config.Discord.ID, "", command.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aid.Print("Failed to delete command: " + command.Name)
|
aid.Print("(discord) failed to delete command: " + command.Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ func (c *DiscordClient) RegisterCommands() {
|
||||||
|
|
||||||
_, err := c.Client.ApplicationCommandBulkOverwrite(aid.Config.Discord.ID, aid.Config.Discord.Guild, update)
|
_, err := c.Client.ApplicationCommandBulkOverwrite(aid.Config.Discord.ID, aid.Config.Discord.Guild, update)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aid.Print("Failed to register commands", err)
|
aid.Print("(discord) failed to register commands", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ func (c *DiscordClient) RegisterCommands() {
|
||||||
func (c *DiscordClient) GetRegisteredCommands() []*discordgo.ApplicationCommand {
|
func (c *DiscordClient) GetRegisteredCommands() []*discordgo.ApplicationCommand {
|
||||||
commands, err := c.Client.ApplicationCommands(aid.Config.Discord.ID, aid.Config.Discord.Guild)
|
commands, err := c.Client.ApplicationCommands(aid.Config.Discord.ID, aid.Config.Discord.Guild)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aid.Print("Failed to get commands")
|
aid.Print("(discord) failed to get commands")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ func (c *DiscordClient) GetRegisteredCommands() []*discordgo.ApplicationCommand
|
||||||
func (c *DiscordClient) GetGlobalRegisteredCommands() []*discordgo.ApplicationCommand {
|
func (c *DiscordClient) GetGlobalRegisteredCommands() []*discordgo.ApplicationCommand {
|
||||||
commands, err := c.Client.ApplicationCommands(aid.Config.Discord.ID, "")
|
commands, err := c.Client.ApplicationCommands(aid.Config.Discord.ID, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aid.Print("Failed to get commands")
|
aid.Print("(discord) failed to get commands")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ func (c *DiscordClient) GetGlobalRegisteredCommands() []*discordgo.ApplicationCo
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *DiscordClient) readyHandler(s *discordgo.Session, event *discordgo.Ready) {
|
func (c *DiscordClient) readyHandler(s *discordgo.Session, event *discordgo.Ready) {
|
||||||
aid.Print("Discord bot is ready")
|
aid.Print("(discord) bot is ready")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *DiscordClient) interactionHandler(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
func (c *DiscordClient) interactionHandler(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||||
|
|
|
@ -345,5 +345,5 @@ func GeneratePlaylistImages() {
|
||||||
GenerateTrioImage()
|
GenerateTrioImage()
|
||||||
GenerateSquadImage()
|
GenerateSquadImage()
|
||||||
|
|
||||||
aid.Print("Generated playlist images")
|
aid.Print("(snow) generated playlist images")
|
||||||
}
|
}
|
|
@ -235,7 +235,7 @@ func (f *FortniteAPI) GetPlaylistImage(playlist string) (any, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func PreloadCosmetics(max int) error {
|
func PreloadCosmetics(max int) error {
|
||||||
aid.Print("Fortnite Assets from", StaticAPI.URL)
|
aid.Print("(snow) assets from", StaticAPI.URL)
|
||||||
|
|
||||||
list, err := StaticAPI.GetAllCosmetics()
|
list, err := StaticAPI.GetAllCosmetics()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -324,7 +324,7 @@ func PreloadCosmetics(max int) error {
|
||||||
|
|
||||||
withDisplayAssets++
|
withDisplayAssets++
|
||||||
}
|
}
|
||||||
aid.Print("Preloaded", len(Cosmetics.Items), "cosmetics with", withDisplayAssets, "display assets", "(", float64(withDisplayAssets)/float64(len(assetData))*100, "% ) coverage" )
|
aid.Print("(snow) preloaded", len(Cosmetics.Items), "cosmetics")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,6 +145,5 @@ func GiveEverything(person *p.Person) {
|
||||||
}
|
}
|
||||||
|
|
||||||
storage.Repo.BulkCreateItems(&items)
|
storage.Repo.BulkCreateItems(&items)
|
||||||
aid.Print("Gave everything to " + person.DisplayName)
|
|
||||||
person.Save()
|
person.Save()
|
||||||
}
|
}
|
|
@ -432,5 +432,5 @@ func GenerateRandomStorefront() {
|
||||||
storefront.Add(weekly)
|
storefront.Add(weekly)
|
||||||
|
|
||||||
StaticCatalog = storefront
|
StaticCatalog = storefront
|
||||||
aid.Print("Generated new random storefront")
|
aid.Print("(snow) generated random storefront")
|
||||||
}
|
}
|
|
@ -35,7 +35,6 @@ func PostClientProfileAction(c *fiber.Ctx) error {
|
||||||
|
|
||||||
profile := person.GetProfileFromType(c.Query("profileId"))
|
profile := person.GetProfileFromType(c.Query("profileId"))
|
||||||
if profile == nil {
|
if profile == nil {
|
||||||
aid.Print(c.Query("profileId"), "not found")
|
|
||||||
return c.Status(404).JSON(aid.ErrorBadRequest("No Profile Found"))
|
return c.Status(404).JSON(aid.ErrorBadRequest("No Profile Found"))
|
||||||
}
|
}
|
||||||
defer profile.ClearProfileChanges()
|
defer profile.ClearProfileChanges()
|
||||||
|
|
4
main.go
4
main.go
|
@ -26,8 +26,8 @@ func init() {
|
||||||
case "postgres":
|
case "postgres":
|
||||||
postgresStorage := storage.NewPostgresStorage()
|
postgresStorage := storage.NewPostgresStorage()
|
||||||
if aid.Config.Database.DropAllTables {
|
if aid.Config.Database.DropAllTables {
|
||||||
aid.Print("Dropping all tables")
|
|
||||||
postgresStorage.DropTables()
|
postgresStorage.DropTables()
|
||||||
|
aid.Print("(snow) all tables dropped and reset")
|
||||||
}
|
}
|
||||||
postgresStorage.MigrateAll()
|
postgresStorage.MigrateAll()
|
||||||
device = postgresStorage
|
device = postgresStorage
|
||||||
|
@ -127,7 +127,7 @@ func main() {
|
||||||
player.Get("/locker", handlers.GetPlayerLocker)
|
player.Get("/locker", handlers.GetPlayerLocker)
|
||||||
|
|
||||||
r.Hooks().OnListen(func(ld fiber.ListenData) error {
|
r.Hooks().OnListen(func(ld fiber.ListenData) error {
|
||||||
aid.Print("Listening on " + aid.Config.API.Host + ":" + ld.Port)
|
aid.Print("(fiber) listening on " + aid.Config.API.Host + ":" + ld.Port)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,6 @@ func (a *Attribute) Delete() {
|
||||||
|
|
||||||
func (a *Attribute) Save() {
|
func (a *Attribute) Save() {
|
||||||
if a.ProfileID == "" {
|
if a.ProfileID == "" {
|
||||||
aid.Print("error saving attribute", a.Key, "profile id is empty")
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
storage.Repo.SaveAttribute(a.ToDatabase(a.ProfileID))
|
storage.Repo.SaveAttribute(a.ToDatabase(a.ProfileID))
|
||||||
|
|
|
@ -116,7 +116,6 @@ func (g *Gift) ToDatabase(profileId string) *storage.DB_Gift {
|
||||||
|
|
||||||
func (g *Gift) Save() {
|
func (g *Gift) Save() {
|
||||||
if g.ProfileID == "" {
|
if g.ProfileID == "" {
|
||||||
aid.Print("error saving gift", g.ID, "no profile id")
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,6 @@ func (i *Item) ToDatabase(profileId string) *storage.DB_Item {
|
||||||
|
|
||||||
func (i *Item) Save() {
|
func (i *Item) Save() {
|
||||||
if i.ProfileID == "" {
|
if i.ProfileID == "" {
|
||||||
aid.Print("error saving item", i.ID, "no profile id")
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user