Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Bumped version to v2.2.14 - Check whether value contains blanks or is 0 length instead of whether it is fully blank for configuration "prefix" and "token" - Check if value is all numbers for configuration "developerIDs" and "developmentGuildIDs", IDs must be a non 0 length string consisting only 0~9 - "use strict" - Added optional second parameter "nick" to function createMentionForUser(), when "nick" is true, the user mention will be created in the nickname format - Added a cooldown of 30 minutes to the "/opensourcelicenses" command, as the response from bot is too long. Cooldown allows chat to not be flooded even if users want to view licenses for 3rd party libraries, and it also helps reduce the server workload and the chance of hitting Discord API rate limit. - Added new configuration developmentGuildIDs, used to mark Discord servers as bot testing servers - Added constant botUnavailableString, used to notify bot users when the bot is in testing - Added a constant Map to map libraries to versions - Stop the bot from responding to commands executed outside of developmentGuilds when developmentEnvironment is set to true - Allow a user to be shipped with himself/herself/themselves when shipMaxAttempt is 0 or less - Allow reminders to never be cancelled when reminderListMaxEntries is 0 or less. Note that the server might eventually run out of memory if too many reminders are tracked - Allow a user to give positive infinite amount of items when giveMaxAmount is 0 or less. Note that it still doesn't accept users giving 0 or negative number of items - Added an utility function isSentInDevelopmentGuild() to check if a message is sent in one of the developmentGuilds - Renamed constant "package" to "packageJSON", as package is a future reserved word - Added "keywords", "homepage", "bugs", "contributors", and "repository" field - Fixed "author" field, which is supposed to be a person Object and not a string - Updated node version in "engines" field - Reorganized fields by the sequence they appear in NPM documentation, see https://docs.npmjs.com/files/package.json - Updated license information everywhere - Added a link to invite ChillBot to servers to README.md - Added icon.png as avatar for ChillBot - Added token-example.json as a sample for how to set bot token without environment variables - Several configurations, "restartTimeout" to set time to wait for between stopping old process and starting new one, "presenceName" to set the game ChillBot is currently playing, "shipMaxAttempts" to specify maximum number of times to retry when using "/ship" if two random users are the same, "reminderListMaxEntries" to specify maximum entries of reminders to keep (set a lower number to reduce memory usage), "giveMaxAmount" to specify the maximum number of items a user can give when using "/give", and "changelogFetchTimeout" to set time to wait for GitHub API - Added files containing license information for async-limiter, discord.js, long, ms, node, npm, prism-media, snekfetch (deprecated but still used by discord.js), tweetnacl-js, ws - Changed overall formatting for index.js - Added handler for uncaughtException event. Uncaught exceptions will now be logged, will no longer crash the bot, and will shutdown the bot cleanly (or if commandline option "restartOnFatalError" is present, restart the bot) - Added an Object representing default option for sending messages, if the message could potentially exceed 2000 characters - Added a constant message to send to channel where the command is invoked if DMs cannot be send for certain reasons - Added a constant message to send when an error occur whilst fetching changelog - Added a constant message for "/invite" command - Added base URL for GitHub Releases API as a constant string - Added permission strings as properties of const Object - Added some animation to display in console when the bot is restarting - Changed error logging, now error names and error messages will be shown besides generic logging info - Added additional check for if a message author is a bot user - Added additional check for if a message is sent in DM channel (or group DM channel). Commands in DMs are not tested and may produce undesirable effects - Added a helper function respondToNonCommands() for responding to users when ChillBot is mentioned outside of command executions - Fixed a serious bug where if your message arguments contain more than one whitespace between them, commands would fail as a result of incorrect method of dealing with argument processing. Now you can add as many whitespaces as you like - Added permission checking everywhere, SEND_MESSAGES is required for most commands and ADD_REACTIONS is required for "/help" - Tweaked logic, only after the help message has been successfully sent will ChillBot add the reaction to the original message - "/ship me" now accepts mixed case message too - Greatly improved the handling for whitespaces, now the whitespaces will remain as they were when you use "/remindme" and "/give". - Warn a user if DMs are unable to be sent, most likely because "Allow direct messages from server members" has been turned off - Added a utility function isDeveloper() to check if the message author is one of the developers listed in the configuration.json - Added "/restart" command to auto start ChillBot again after it shuts down by command - Added "/opensourcelicenses" command to display all license information for used open source tools and libraries. The items are in the following order: node, npm, direct dependencies ordered by first alphabet of the name from A-Z, indirect dependencies ordered by first alphabet of the name from A-Z. For node and direct dependencies, version numbers are also displayed. Don't wilfully overuse the command, as it will flood the chat *and it is rather resource demanding for the bot*! - Added "/changelog" command to display the changelog of the latest release of ChillBot. If a tag name is provided and the provided tag name exists, the changelog of the release corresponding to the tag name will be sent instead. Tag name must be in the format of a.b.c or va.b.c, where a, b, and c are numbers without leading 0s - Added "/invite" command to send the link for inviting ChillBot to other Discord servers - Errors are now handled more gracefully - Added a helper function exitProcess(), to attempt to log out the bot and terminate the process. If "shouldRestart" is true, a new detached process will be spawned - Added a helper function login() - Added a utility function clientHasPermissionInChannel() to check if the bot client has certain permission(s) in a given channel - Added a helper function getMatchedOriginalFromArgs() to match original message with RegExp constructed from the arguments array - Added a helper function handleGenerically() for handling errors - Added "start" command to "script" field - Added "engines" field and "node" version - Removed "Procfile", the leftover from Heroku hosting - Added missing 2nd argument of parseInt() - Log "Chilled!" only after the presence has been set, not before - Used concise body for all arrow functions - Moved bot token into token.json - Added configuration.json for setting prefix and other configurations - Moved "/remindme" time string length limit to a constant - Added "/stop" command to properly terminate node process, usable by bot developers - Added the ability to log bot token on login error. Only enabled when configuration "developmentEnvironment" is set to true. - Refined "/give" messages - Added getConfiguration() to get configurations from JSON files - Changed heading in README.md to "ChillBot" - Added "Commands" section to README.md for features overview - Added new configuration "developerIDs" to configuration.json - Removed all economy related features as discord-eco is deprecated - Changed package description from "Chill" to "Chill!" - Added license information to README.md and source files, corrected license information in other places - Updated discord.js from 11.2.1 to 11.4.2 - Updated ms from 2.0.0 to 2.1.1 - Changed test script to exit with exit code 0 - Added .gitignore - Changed author in package.json to match the one listed in LICENSE - Used JSDoc style license block - Added author doc - Moved most constants out of functions to the top of script - Reimplemented "8ball" and mention-to-respond features, and fixed the bugs in previous implementation. See 43600be and a67e789 . - Fixed some typos and missing space in predefined responses - Added "repository" command - Chained calls as on() returns the bot client - Replaced deprecated setGame() with setPresence() - Changed all emojis in the source file and the shortname ( :emoji: ) to their JavaScript representations - Properly utilize Promise, added more loggings too - Used raw string literal syntax everywhere needed for consistency and readability - Updated help message - Removed the dangerous "eval" command - Tried to prevent "ship" from shipping the same user with himself/herself/themselves - Added checks to fail early for "remindme" command if the time string is too long, time string is invalid, or time is negative - Updated behavior so that the bot only keep timers for at most 300 reminders by default. Upon exceeding the limit, the oldest timer is removed, and the new one is added. Note that the oldest timer might not actually be the one with the longest timeout. - Added a check so that one can not give others items with negative numbers or 0 - Added hasMentionForUser() for checking if a message contains mentions for the specific user - Added getRandomFromArray() utility function to get a random item from an array or an array like object - Added bold() and code(), this addresses the issue where manually inserting * and ` in strings is more error prone. - Added getFirstMentionedUser() to get the first mention in a message - Added isInteger() utility function to quickly check if a string only contains 0 ~ 9 and optionally the "+" or "-" sign. Note that numbers presented in other formats will still make the function return false. - Added createMentionForUser() to get a string in the format of a user mention
- Loading branch information