Skip to content

ThatTransSky/Color-Bot

Repository files navigation

Changelog

(Note: This changelog will only cover meaningful commits and changes)

Latest - I lost so much sleep on this... (at least ManageRoles is almost done)

  • IMPORTANT - Adding and editing types is (mostly) finished! Only thing that's left is adding roles. (I know, I'm so amazing)
  • New/Modified tempData methods:
    • static expiredDataResponse - generic Interaction response when data gets expired.
    • static typeToSavedData, editedTypeToSavedData and rolesToSavedData - takes given data and returns it in a SavedData.manageRoles format.
    • defaultExpire and defaultExpireAmount are now static methods.
    • checkExpire and updateFile have been renamed to checkExpireLoop and updateFileLoop, respectively, for clarity.
    • extendExpire now returns the updated expire timestamp.
    • updateSavedData - Finds existing data using a given Identifiers object (returns false if not found) and updates its SavedData.
    • addOrUpdateData now returns the data back.
    • getManageRolesData - returns DataObject.savedData.manageRoles. (I know, I'm lazy)
    • getTypeFromData and updateTypeFromData - take a wild guess what these methods do. (also, don't look at the code. It's a mess, I'm aware.)
    • removeData now returns true/false based on whether the data existed before.
    • instantFileUpdate - instantly updates the local tempData file to avoid race conditions.
  • newButtonRow (from componentBuilders) now also takes an array of ButtonBuilder's as a parameter.
  • New componentBuilder method - restartRoleMenuButtons: Returns the buttons usually used at the end of an action,
    whether to restart to 'Choose Roles'/'Manage Roles'.
    • Important distinction: This method returns Array<ButtonBuilder>, rather than ActionRowBuilder<ButtonBuilder>.
  • Did a lot of renaming for the sake of clarity (mostly buttonRow ---> whatever the row is being used for).
  • Fixed a lot of formatting issues that came up on mobile specifically. (god knows why, the issues were so random)
  • Removed a bunch of queueUpdate's from tempData. Like, a lot.
  • Removed getRoleByName from verifyStoredRoles (roleConfig) since verifying roles by name is unreliable. (If a stored role doesn't have an ID, it gets removed)
  • New roleConfig methods:
    • findTypeIndex - pretty straight forward, me thinks.
    • getTotalTypelessRoles - Return the amount of roles (given by parameter) are not attached to a type. (not counting roles with any admin perms)
    • isRoleInAnyType - Similar to getTotalTypelessRoles just with a single role and returns true/false.
    • editType & removeType - come on, do I have to spell it out for you?
  • Renamed validateData ---> validateStoredTypes and added more checks (that I am too lazy to document here, sue me).
  • Added checks so if minChoices and/or maxChoices don't exist, set multiRoleType to false rather than undefined.
  • Also, if multiRoleType is false, delete minChoices and maxChoices.
  • New LocalUtils methods:
    • isStringEmpty - same as isArrayEmpty but for strings. (revolutionary, I know)
    • isStringSame - takes two strings and returns true/false if they are the same. (if you couldn't tell)
    • execCurrRoute - takes care of the sorting and pre-responding to interactions instead of having it on file.
  • New discordHelpers methods:
    • getTotalRolesCount - returns the amount of roles in a given guild, with the option to include/exclude roles with admim perms.
    • doesHaveAdminPerms - takes a Role or GuildMember and returns true/false if it has any admin perms.
    • getAdminPerms - takes a Role or GuildMember and returns an Array<string> of all the admin perms it has.
  • Changed the debug log level's colors to alternate for more readability.
  • Changed Globals.logInteractionType's structure for more readability.
  • The process now automatically catches unhandled errors and rejections.
  • Discord's API limits select menus to 25 so had to implement that limit into codes.
  • New guildConfigs methods:
    • getGuildConfig, getRoleConfig and getBotConfig. (I'm sure you can figure out what each method does)
  • A bunch of rewrites (like, so much).
  • Added a bunch more logs (mostly debug stuff).

24e8f14 - Dev Update (and some other stuff idk).

  • HOTFIX - Removed a log that I forgot to delete lol.
  • FIXED - applyChanges (in roleMenu) no longer errors (because I forgot to make the second action row have actual buttons).
  • Renamed GUILD_ID to MAIN_GUILD_ID.
  • Added another Global variable - DEV_GUILD_ID:
    • This variable will house the ID for the Dev's guild.
    • It is used for identifying which guild to register the Dev commands to.
    • If not set, the Dev Commands will not register for that instance.
  • Added an identifier (although not a good one) to Dev commands:
    • If the command's description starts with 'Dev - ', that command will be marked as a Dev command.
    • For that to work (and for TypeScript's sake), modified CommandStructure to include the command's description (regardless of it's type).
  • Added a check in ready to seperate between Regular and Dev commands, as well as checking if DEV_GUILD_ID is set and valid (throwing an error if not).
  • Added more debug info to interactionCreate (such as 'who created the interaction', 'in what guild', 'if it's a command, what is the command name', etc.)
  • Added a log message (in toggleDevMode) for when someone toggles off Dev Mode™ (because I didn't already do that for some reason).
  • Added another case for LocalUtils.log - success.
    • Until now, I've used the log case to indicate when something was done but success made a lot more sense for the logs that I wanted to make.
    • Speaking of, logged the loading of: BotConfig (per guild), RoleConfig (per guild) and GuildConfig (per guild).
  • Modified the method outputBypassList (in GlobalBotConfig) to not rely on MAIN_GUILD_ID and instead search for the users in the bypass list in each of the guilds that the bot is in.
  • Also added a new method bypassToString, which is a WIP (because I'm lazy).

69d40f5 - I really need to commit more often.

  • Condensed every util function into one class - LocalUtils.
    • Added new helper functions: extractCustomId, isArrayEmpty, inputPredicate, findCurrRoute, invalidCharacters.
  • Renamed RoleConstants to RoleConfig
  • Made every config nested under a guild ID so each guild has its own config:
    • RoleConfig - Consists of all role related settings.
    • BotConfig - Consists of all bot related settings (not really used atm).
  • Added a class which handles all guild configs (GuildConfigs).
  • Also, the ready event now creates a GuildConfigs instance for all of the bot's guilds.
  • devMode is now under a global config (globalBotConfig.ts).
  • Added regexConstants - Includes common regex strings for whenever I check strings for invalid characters.
  • Added routes - An interface for any route an interaction can take.
  • tempData:
    • Renamed initializeData to validateData and takes a DataObject array instead of an instance of tempData.
      The reason for these changes is so the method could be used in cases other than when creating the class (which was its previous use-case).
      Also removed the line this.UpdateFile() for the same reasons.
    • Added new methods: extendExpire, countTotalData, clearData.
    • Added more properties to SavedData.
  • Added new commands: clearTemp, toggleDevMode.
  • You can now create categories without editing roleConfig.json manually. (still a Work-In-Progress, I wanted to get this commit out)
  • General rewrites & cleanups.

901b65f - Role Menu is done (finally).

  • Finally finished the role menu so it is fully functioning. All that I have really done
    was move the 1,000+ lines to a seperate file (roleMenu.ts), with a few major (but mostly minor) changes and additions.
    • As part of this rewrite, I used a temporary local data storage system (tempData.json, which would be under localData)
      to store important information between interactions without using the customId property,
      allowing for a lot more freedom with how I choose to use it in the future.
  • Renamed this to README.md so it appears in the main page of the repository.
  • Took the bot out of Dev Mode™ - Currently working on a system so that Dev Mode™ is toggle-able,
    didn't make much progress in that regard.
  • A lot of code cleanup - which consisted of me hating on if statements and only using
    statement ? true : false statements cause why not.
  • Added checkRolesAgainstUser and checkRolesToReplace methods because declattering is important (learned that the hard way).
  • Added more component builders because... do I need to repeat myself?
  • Renamed constants.ts to globals.ts (both the file and class name) and moved
    all classes (for example, RoleConstants) to their respective file under the folder classes.
  • Updated .gitignore to include the folder localData but exclude anything inside.
  • I probably missed something (like I always do) 🤷‍♀️

82e3161 - This changelog (and other stuff).

  • Created this changelog
  • Removed Role Menu Handling From interactionCreate.ts - which means that, for now, the menu is not fully implemented yet.
    Sure, some might question why the fuck would I do that but the answer is simple: The current code was so bad that I'd rather rewrite it all.
  • Added buildCustomId function to utils.ts
  • Added ground work for a change-able Role Menu config (see the class RoleConstants):
    • The class supports removing and updating roles, as well as updating local role data with the server's role data.
    • The function verifyStoredRoles now runs after the client is ready and it updates the local data with the data from the server.
  • Started reworking the role menu handling - current plan is to seperate stages into different functions.
  • Added roleUpdate.ts & roleDelete.ts to allow the RoleConstants class to stay up to date with changes to the roles registered under it.
  • Moved mainAction, secondaryAction, etc. to one object (called customIdObj). I don't know if I'm going to keep it this way but that's how it is for now.
  • General rewrites and cleanups.

a4380f5 - The start of a painful rewrite.

  • Updated .gitignore.
  • Added settings to .prettierrc to support uniform formatting.
  • Moved everything out of src to the top level to fix an issue with relative pathing.
  • (WIP) Started rewriting and seperating the code in interactionCreate.ts to declatter the massive file (1,600+ lines o_0).
  • Created new builders to minimize repeated code writing
  • Added constants.ts to further declatter the code.
  • Seperated the getting and loading of the event & command files into functions.
  • Added interactionTypeToString & uppercaseWord functions to utils.ts.
  • Other misc. changes that I can't remember 🤷‍♀️.

About

Ignore the name, this was *originally* just a color role bot.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •