diff --git a/modules/active/xp.go b/modules/active/xp.go index 9e907e1..645be4f 100644 --- a/modules/active/xp.go +++ b/modules/active/xp.go @@ -8,14 +8,11 @@ import ( "github.com/bwmarrin/discordgo" "PermissionGacha/db" + "PermissionGacha/modules/config" "PermissionGacha/modules/level" "PermissionGacha/modules/log" ) -const notInGeneralNerf = 10 - -const generalChannelID = "645550570001924098" - var lastMessage = make(map[string]time.Time) var incrementMutex = sync.Mutex{} @@ -25,8 +22,8 @@ func Reward(s *discordgo.Session, m *discordgo.MessageCreate) { } amountToIncrement := calculateIncrement(m.Author.ID) - if m.ChannelID != generalChannelID { - amountToIncrement /= notInGeneralNerf + if m.ChannelID != config.GeneralChannelID { + amountToIncrement /= config.NotInGeneralNerf } multiplier, err := db.GetPrestigeMultiplier(m.Author.ID) if err != nil { diff --git a/modules/commands/prestige.go b/modules/commands/prestige.go index d68c9a7..5790357 100644 --- a/modules/commands/prestige.go +++ b/modules/commands/prestige.go @@ -8,13 +8,13 @@ import ( "github.com/bwmarrin/discordgo" "PermissionGacha/db" + "PermissionGacha/modules/config" "PermissionGacha/modules/level" "PermissionGacha/modules/log" "PermissionGacha/modules/roles" ) const emojiCheck = "✅" -const prestigeRequirement = 90000 var prestigeList = make(map[string]string) @@ -28,7 +28,7 @@ func handlePrestigeCommand(s *discordgo.Session, args []string, m *discordgo.Mes if err != nil { return fmt.Errorf("commands: handlePrestigeCommand: error while getting current XP: %w", err) } - newPrestigeLevel := xp/prestigeRequirement + 1 + newPrestigeLevel := xp/config.PrestigeRequirement + 1 currentLevel, _ := level.ConvertXPIntoLevel(xp) @@ -52,7 +52,7 @@ func handlePrestigeCommand(s *discordgo.Session, args []string, m *discordgo.Mes m.Author.ID, currentPrestigeLevel, newPrestigeLevel, - nextNearestLogicalPrestige, float64(xp)/float64(prestigeRequirement*(nextNearestLogicalPrestige-1))*100, + nextNearestLogicalPrestige, float64(xp)/float64(config.PrestigeRequirement*(nextNearestLogicalPrestige-1))*100, lowerLevelWarning, ), ) @@ -86,7 +86,7 @@ func ListenPrestigeReact(s *discordgo.Session, m *discordgo.MessageReactionAdd) log.Error(s, "checkPrestigeReact", "GetXP", err) return } - newPrestigeLevel := xp/prestigeRequirement + 1 + newPrestigeLevel := xp/config.PrestigeRequirement + 1 go roles.RemoveAllLevelRoles(s, m.UserID) err = db.SetPrestigeMultiplier(m.UserID, newPrestigeLevel) if err != nil { diff --git a/modules/config/active.go b/modules/config/active.go new file mode 100644 index 0000000..e0ecc3d --- /dev/null +++ b/modules/config/active.go @@ -0,0 +1,4 @@ +package config + +const GeneralChannelID = "645550570001924098" +const NotInGeneralNerf = 10 diff --git a/modules/config/prestige.go b/modules/config/prestige.go new file mode 100644 index 0000000..afbc8ea --- /dev/null +++ b/modules/config/prestige.go @@ -0,0 +1,3 @@ +package config + +const PrestigeRequirement = 90000 diff --git a/modules/config/starboard.go b/modules/config/starboard.go new file mode 100644 index 0000000..3b4f1f6 --- /dev/null +++ b/modules/config/starboard.go @@ -0,0 +1,3 @@ +package config + +const StarChannel = "645551408283648000" diff --git a/modules/starboard/starboard.go b/modules/starboard/starboard.go index 2a8cc76..733c118 100644 --- a/modules/starboard/starboard.go +++ b/modules/starboard/starboard.go @@ -9,16 +9,16 @@ import ( "github.com/bwmarrin/discordgo" "PermissionGacha/db" + "PermissionGacha/modules/config" "PermissionGacha/modules/log" ) const starEmoji = "⭐" -const starChannel = "645551408283648000" var starboardMutex sync.Mutex func ReactListener(s *discordgo.Session, m *discordgo.MessageReactionAdd) { - if m.ChannelID == starChannel { + if m.ChannelID == config.StarChannel { return } if m.Emoji.Name != starEmoji { @@ -81,7 +81,7 @@ func ReactListener(s *discordgo.Session, m *discordgo.MessageReactionAdd) { ) msg, err = s.ChannelMessageSendEmbed( - starChannel, + config.StarChannel, &discordgo.MessageEmbed{ Title: "Starred Message", Description: content,