-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor to TypeScript #19
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- migrated all event handlers to separate files - moved helper functions into Client for cross-file usability - still very messy
- replaced all manual embed declarations with discord.js EmbedBuilder - fixed bug in messageCreate handler - moved to discord.js standard for partial imports
- cleaned up messy string concatenation with template literals and console.log argument stringing - switched to EmbedBuilder in /help command
In whitelisted channels, the bot only responds when directly mentioned. In such scenarios, gathering the previous messages of the channel shouldn't be necessary.
- moved lastUpdated, typingSpeed, debugTheme to parameters.js - made all scripts that need them pull from parameters.js - created embedColors in parameters.js - made all embeds pull colors from embedColors - made whitelist/unwhitelist commands reference client's methods instead of "extraInfo"
- created a Whitelist Manager script - moved all whitelist functions from client to manager - made all whitelist usage reference the manager - increased whitelist efficiency
Not sure where this came from or what it does, so I cleaned it up
Bot crashed when it tried to repeat setUserActivity and resumeConversations
- made all commands use methods to generate embeds - made whitelist/unwhitelist only generate the embed they need
- switched to the official client application command setter instead of bootleg rest API - removed reset option because it does that anyway
- created message-analyzer script - removed message helper methods from client to analyzer - made all helper method reference reference the analyzer
- created an index in the events folder - moved all event file gathering + registering logic to the index - moved event-related helper functions to index - made all event-related requests reference the handler
- fix deploy-commands bug from moving to ./src - add npm script to deploy commands - update README to reflect changes
- improve README - improve gitignore - better method passing for client events
- abstracted out the logger - standardized output - moved to type-safe colors usage
JstnMcBrd
added
bug
Something isn't working
documentation
Improvements or additions to documentation
enhancement
New feature or request
labels
Jun 17, 2023
This was
linked to
issues
Jun 19, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
./src
folderCommands
CommandHandler
class built offSlashCommandBuilder
to standardize commands execution and error handlingindex.ts
to manage command scripts/help
replies and redundant/whitelist
and/unwhitelist
replies ephemeral/help
embed/invite
command with automatic invite link generationEvents
EventHandler
builder class modeled afterSlashCommandBuilder
to standardize event execution and error handlingindex.ts
to manage themMemory
dotenv
token
field to environment variables instead ofconfig.json
memory file.env
config.json
memory fileWhitelist
Thinking
Context
resumeConversations
use context instead of fetching messages manually (Have conversation resuming respond to oldest unresponded message, not most recent message #5)Activity
Parameters
parameters.ts
DeployCommands
reset
optionUtils
./src/utils
folderisFromUser()
withisFromSelf()
doesMentionUser()
withdoesMentionSelf()
Linting
eslint
flat config file (eslint.config.js
instead of.eslintrc.json
)eslint
rulesLogging
colors
importProject
package.json
.vscode
settings and extensions and debugger setupnpm run commands
script to deploy commands.nvmrc
andengine
field inpackage.json
for node 18discord-cleverbot
instead ofDiscord-Cleverbot
) to match npm project standards.gitignore
cleverbot-free
API statusMisc Improvements
discord.js
mention formatterspath.join
for file paths instead of string concatenationSnowflake
type for Discord IDs instead of basic stringscleverbot-free
(Throw error object instead of string IntriguingTiles/cleverbot-free#47)async
/await
rather than.then().catch()
GuildTyping
andDMTyping
GatewayIntentBits
from the clientBug Fixes
cleverbot-free
(Typescript types don't import correctly when using ESM IntriguingTiles/cleverbot-free#45)Tweaks
And much more!