A simple discord bot for thonking made using Node.js, Discord.js and TypeScript.
The slash-commands added should be visible by doing /
in a text field in the Discord
client. Most of the slash-commands have normal text-command equivilants, which can be
accessed using !
instead of /
(example: /cat
and !cat
). Some text commands also have
additional aliases. All currently available text-commands and aliases can be found using
!commands
;
Contributions are more than welcome! Fork the repository, do your changes and make a pull request.
If you want to test features before making a pull request or if you want to host your own version of the bot, you'll have to create a bot instance and add it to a server where you have sufficient permissions before running the bot as a Node.JS application.
- First go to the Discord developer portal
- Create a new application (if you don't have one ready already)
- Attach a bot to your application
- Clone the repository locally:
git clone https://github.com/andesyv/ThonkBot.git
- Copy the
template.env
to a file called.env
in the root directory of the repository and fill it with you discord client ID, your bot token and a Giphy API key (optional). - This bot reads nicknames and message content, and therefore requires the "server member intent" and "message content intent" to be checked.
- Head to the OAuth2 -> URL Generator tab
- Mark the bot and applications.commands scopes, and any additional permissions you think you'll need (or just Administrator for everything). You may get error messages if attempting to perform actions the bot does not have access to.
- Use the generated link to add your bot to a server.
- Install all the requirements for the bot. Below are some Linux instructions, but Windows follows a similar approach:
# Some Debian distros don't ship with the version of Node.JS used by the bot in their package managers, so to install Node.JS > 18 do this to fetch the package repos:
curl -sL https://deb.nodesource.com/setup_18.x | sudo bash -
# Install Node.JS > 18
sudo apt install -y nodejs
# (Optional) Install node packages used by the project.:
sudo npm install -g yarn typescript
# Install required packages:
yarn install # with yarn
npm install # with NPM
- Finally, run the application. If
node-dev
is installed (npm install -g node-dev
) you can run thestart
script directly:
yarn start # Using yarn
npm start # Using npm
or you can compile the typescript and run the JS instead:
tsc # requires TypeScript to be globally installed
node ./dist/src/main.js
The application is licenced under a standard MIT license