(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
- genericInteraction
response when data gets expired. - static
typeToSavedData
,editedTypeToSavedData
androlesToSavedData
- takes given data and returns it in aSavedData.manageRoles
format. defaultExpire
anddefaultExpireAmount
are now static methods.checkExpire
andupdateFile
have been renamed tocheckExpireLoop
andupdateFileLoop
, respectively, for clarity.extendExpire
now returns the updated expire timestamp.updateSavedData
- Finds existing data using a givenIdentifiers
object (returns false if not found) and updates itsSavedData
.addOrUpdateData
now returns the data back.getManageRolesData
- returnsDataObject.savedData.manageRoles
. (I know, I'm lazy)getTypeFromData
andupdateTypeFromData
- 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 localtempData
file to avoid race conditions.
- static
newButtonRow
(fromcomponentBuilders
) now also takes an array ofButtonBuilder
'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 thanActionRowBuilder<ButtonBuilder>
.
- Important distinction: This method returns
- 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 fromtempData
. Like, a lot. - Removed
getRoleByName
fromverifyStoredRoles
(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 togetTotalTypelessRoles
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/ormaxChoices
don't exist, setmultiRoleType
to falserather
thanundefined
. - Also, if
multiRoleType
isfalse
, deleteminChoices
andmaxChoices
. - New
LocalUtils
methods:isStringEmpty
- same asisArrayEmpty
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 aRole
orGuildMember
and returns true/false if it has any admin perms.getAdminPerms
- takes aRole
orGuildMember
and returns anArray<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
andgetBotConfig
. (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
(inroleMenu
) no longer errors (because I forgot to make the second action row have actual buttons). - Renamed
GUILD_ID
toMAIN_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'sdescription
(regardless of it's type).
- Added a check in
ready
to seperate between Regular and Dev commands, as well as checking ifDEV_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 butsuccess
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) andGuildConfig
(per guild).
- Until now, I've used the
- Modified the method
outputBypassList
(inGlobalBotConfig
) to not rely onMAIN_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
.
- Added new helper functions:
- Renamed
RoleConstants
toRoleConfig
- 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 aGuildConfigs
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
tovalidateData
and takes aDataObject
array instead of an instance oftempData
.
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 linethis.UpdateFile()
for the same reasons. - Added new methods:
extendExpire
,countTotalData
,clearData
. - Added more properties to
SavedData
.
- Renamed
- 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 underlocalData
)
to store important information between interactions without using thecustomId
property,
allowing for a lot more freedom with how I choose to use it in the future.
- As part of this rewrite, I used a temporary local data storage system (
- 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.- Ignore
botConfig.ts
for now.
- Ignore
- 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
andcheckRolesToReplace
methods because declattering is important (learned that the hard way). - Added more component builders because... do I need to repeat myself?
- Renamed
constants.ts
toglobals.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 folderlocalData
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 toutils.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 theRoleConstants
class to stay up to date with changes to the roles registered under it. - Moved
mainAction
,secondaryAction
, etc. to one object (calledcustomIdObj
). 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 toutils.ts
. - Other misc. changes that I can't remember 🤷♀️.