pretty console

This commit is contained in:
Eccentric 2024-01-03 19:56:23 +00:00
parent aa432b6f2c
commit 5130009644
11 changed files with 12 additions and 21 deletions

View File

@ -41,19 +41,16 @@ func createHandler(s *discordgo.Session, i *discordgo.InteractionCreate) {
func createModalHandler(s *discordgo.Session, i *discordgo.InteractionCreate) {
data := i.ModalSubmitData()
if len(data.Components) <= 0 {
aid.Print("No components found")
return
}
components, ok := data.Components[0].(*discordgo.ActionsRow)
if !ok {
aid.Print("Failed to assert TextInput")
return
}
display, ok := components.Components[0].(*discordgo.TextInput)
if !ok {
aid.Print("Failed to assert TextInput")
return
}
@ -189,7 +186,6 @@ func codeHandler(s *discordgo.Session, i *discordgo.InteractionCreate) {
decrypt, err := aid.KeyPair.DecryptAndVerifyB64(encrypted, sig)
if err || string(decrypt) != code {
aid.Print("Failed to verify code that was just generated so we're not going to send it")
return
}

View File

@ -68,7 +68,7 @@ func (c *DiscordClient) UnregisterCommands() {
for _, command := range commands {
err := c.Client.ApplicationCommandDelete(aid.Config.Discord.ID, aid.Config.Discord.Guild, command.ID)
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 {
err := c.Client.ApplicationCommandDelete(aid.Config.Discord.ID, "", command.ID)
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)
if err != nil {
aid.Print("Failed to register commands", err)
aid.Print("(discord) failed to register commands", err)
return
}
}
@ -104,7 +104,7 @@ func (c *DiscordClient) RegisterCommands() {
func (c *DiscordClient) GetRegisteredCommands() []*discordgo.ApplicationCommand {
commands, err := c.Client.ApplicationCommands(aid.Config.Discord.ID, aid.Config.Discord.Guild)
if err != nil {
aid.Print("Failed to get commands")
aid.Print("(discord) failed to get commands")
return nil
}
@ -114,7 +114,7 @@ func (c *DiscordClient) GetRegisteredCommands() []*discordgo.ApplicationCommand
func (c *DiscordClient) GetGlobalRegisteredCommands() []*discordgo.ApplicationCommand {
commands, err := c.Client.ApplicationCommands(aid.Config.Discord.ID, "")
if err != nil {
aid.Print("Failed to get commands")
aid.Print("(discord) failed to get commands")
return nil
}
@ -122,7 +122,7 @@ func (c *DiscordClient) GetGlobalRegisteredCommands() []*discordgo.ApplicationCo
}
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) {

View File

@ -345,5 +345,5 @@ func GeneratePlaylistImages() {
GenerateTrioImage()
GenerateSquadImage()
aid.Print("Generated playlist images")
aid.Print("(snow) generated playlist images")
}

View File

@ -235,7 +235,7 @@ func (f *FortniteAPI) GetPlaylistImage(playlist string) (any, error) {
}
func PreloadCosmetics(max int) error {
aid.Print("Fortnite Assets from", StaticAPI.URL)
aid.Print("(snow) assets from", StaticAPI.URL)
list, err := StaticAPI.GetAllCosmetics()
if err != nil {
@ -324,7 +324,7 @@ func PreloadCosmetics(max int) error {
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
}

View File

@ -145,6 +145,5 @@ func GiveEverything(person *p.Person) {
}
storage.Repo.BulkCreateItems(&items)
aid.Print("Gave everything to " + person.DisplayName)
person.Save()
}

View File

@ -432,5 +432,5 @@ func GenerateRandomStorefront() {
storefront.Add(weekly)
StaticCatalog = storefront
aid.Print("Generated new random storefront")
aid.Print("(snow) generated random storefront")
}

View File

@ -35,7 +35,6 @@ func PostClientProfileAction(c *fiber.Ctx) error {
profile := person.GetProfileFromType(c.Query("profileId"))
if profile == nil {
aid.Print(c.Query("profileId"), "not found")
return c.Status(404).JSON(aid.ErrorBadRequest("No Profile Found"))
}
defer profile.ClearProfileChanges()

View File

@ -26,8 +26,8 @@ func init() {
case "postgres":
postgresStorage := storage.NewPostgresStorage()
if aid.Config.Database.DropAllTables {
aid.Print("Dropping all tables")
postgresStorage.DropTables()
aid.Print("(snow) all tables dropped and reset")
}
postgresStorage.MigrateAll()
device = postgresStorage
@ -127,7 +127,7 @@ func main() {
player.Get("/locker", handlers.GetPlayerLocker)
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
})

View File

@ -51,7 +51,6 @@ func (a *Attribute) Delete() {
func (a *Attribute) Save() {
if a.ProfileID == "" {
aid.Print("error saving attribute", a.Key, "profile id is empty")
return
}
storage.Repo.SaveAttribute(a.ToDatabase(a.ProfileID))

View File

@ -116,7 +116,6 @@ func (g *Gift) ToDatabase(profileId string) *storage.DB_Gift {
func (g *Gift) Save() {
if g.ProfileID == "" {
aid.Print("error saving gift", g.ID, "no profile id")
return
}

View File

@ -184,7 +184,6 @@ func (i *Item) ToDatabase(profileId string) *storage.DB_Item {
func (i *Item) Save() {
if i.ProfileID == "" {
aid.Print("error saving item", i.ID, "no profile id")
return
}