A bot for searching commands from MathWorks docs within Discord. Allows for Octave integration through Discord chat when installed on a Linux system.
See help.md for all commands or type !help in chat.
Clone this repository (either to your PC or a host). Create a file called .env in the root directory, where the token of the bot has to be posted:
BOT_TOKEN=<your token here>
NEWS_CHANNEL_ID=<channel ID> # The discord chanenl ID for newest MathWorks blog posts and videos. Can leave blank.
DM_INTRO=<0 or 1> # If true (1) bot will send an intro message to new users who join the server.
YOUTUBE_AUTH_KEY=<Youtube authentication key> # The Youtube authentication key used in the Youtube data api v3 for getting the last
youtube video published on the MATLAB channel.
TWITTER_BEARER_TOKEN=<Bearer Token> # Twitter API OAuth 2.0 Bearer authorization token used for tweet pulling
OWNER_ID=<Discord ID of owner> # The ID for the owner of the bot (You, probably!) for debugging purposes only.
Install library dependencies with npm install
The following libraries have been used:
Start the bot:
node index.js
Once a message is posted, all regular expressions in the router will be tested. If a regular expression is triggered, the function provided via use will be applied on the message and the tokens from the regular expression.
Usually the bot has to respond with a rendered message. The templates for these messages are in the msg directory.
The last regular expression is chosen in a way, that if no command applies, it will search for a template with the name of the command. This way "static" messages can be provided just by creating the template (e.g. help.md and code.md).