Norsk-bott is a Discord bot that provides various features for the Norwegian Language Learning community (NLL).
The bot is written in TypeScript and uses the Discord.js library. discord-nestjs is used to provide a modular, dependency-injected architecture as a NestJS application.
Make sure you have Node.js and Yarn installed.
Tip
It is recommended to use Volta to manage Node.js versions. If Volta is installed, you do not need to do anything. When you run any commands in this repository, Volta will automatically install and install the correct versions of both Node.js and Yarn.
- Clone the repository.
- Run
yarn
to install dependencies. - Configure the environment variables by copying the
template.env
file to.env
and filling in the values. See Environment Variables for more information. - Run
yarn start:dev
to start the bot in development mode. The bot will now be running and you can make changes to the code. The bot will automatically restart when you save changes.
git clone https://github.com/nllcommunity/discord-norsk-bott.git
cd discord-norsk-bott
yarn
cp template.env .env
# Fill in the values in the .env file
yarn start:dev
The bot requires the following environment variables to be set.
Required. The bot token from the Discord Developer Portal.
Required. The API key from DeepL. Used for translation.
Optional. The integration token from Notion. Used for syncing content from Notion.
Optional. The API key from OpenAI. Used to check random words pulled from the dictionary for appropriateness before sending them to the chat.
The bot requires the following permissions to function correctly.
https://discord.com/oauth2/authorize?client_id=<client_id>&permissions=397821422656&scope=bot+applications.commands
Replace <client_id>
with the client ID of the bot.
bot
— Needed to join serversapplication.commands
— Needed to register slash commands
- Manage Webhooks — Used by the Notion sync feature to get webhook secrets
- Read Messages/View Channels — Required to translate messages
- Send Messages — Required to send messages with translations or with Notion content
- Create Public Threads — Required to sync Notion content to threads
- Create Private Threads — Required to sync Notion content to threads
- Send Messages in Threads — Required to send messages with translations or with Notion content in threads
- Manage Messages — Required to delete old content from Notion, and to delete translation reactions
- Manage Threads — Required to delete old content from Notion
- Read Message History — Required to look up old messages synced from Notion
- Add Reactions — Required to add translation-complete reactions
- Use Slash Commands — Required to use slash commands