Merge pull request #253 from AlexanderHOtt/feat/better-docs

Write better documentation for getting started with discord bot development.
This commit is contained in:
Yannic Kilcher
2023-01-02 11:44:55 +01:00
committed by GitHub
+40 -13
View File
@@ -9,7 +9,7 @@ the bot's outputs. If you want to learn more about RLHF please refer
## Invite official bot
To add the official Open-Assistant data collection bot to your discord server
[click here](https://discord.com/api/oauth2/authorize?client_id=1054078345542910022&permissions=1634235579456&scope=bot).
[click here](https://discord.com/api/oauth2/authorize?client_id=1054078345542910022&permissions=1634235579456&scope=bot%20applications.commands).
The bot needs access to read the contents of user text messages.
## Contributing
@@ -17,7 +17,41 @@ The bot needs access to read the contents of user text messages.
If you are unfamiliar with `hikari`, `lightbulb`, or `miru`, please refer to the
[large list of examples](https://gist.github.com/AlexanderHOtt/7805843a7120f755938a3b75d680d2e7)
### Setup
### Bot Setup
1. Create a new discord application at the
[Discord Developer Portal](https://discord.com/developers/applications)
1. Go to the "Bot" tab and create a new bot
1. Scroll down to "Privileged Gateway Intents" and enable the following options:
- Server Members Intent
- Presence Intent
- Message Content Intent
This page also contains the bot token, which you will need to add to the `.env`
file later.
2. Go to the "OAuth2" tab scroll to "Default Authorization Link"
3. Set "AUTHORIZATION METHOD" to "In-app Authorization"
4. Select the "bot" and "applications.commands" scopes
5. For testing and local development, it's easiest to set "BOT PERMISSIONS" to
"Administrator"
Remember to save your changes.
6. Copy the "CLIENT ID" from the top of the page and replace it in the link
below to invite your bot.
```
https://discord.com/oauth2/authorize?client_id=YOUR_ID_HERE&permissions=8&scope=bot%20applications.commands
```
### Environment Setup
To run the bot:
@@ -29,12 +63,15 @@ pip install -e .
```
```bash
cd ../discord-bot
cp .env.example .env
# edit .env and add your bot token and other values
python -V # 3.10
pip install -r requirements.txt
# in the discord-bot folder
python -m bot
```
@@ -54,16 +91,6 @@ git add .
git commit -m "<good commit message>"
```
To test the bot on your own discord server you need to register a discord
application at the
[Discord Developer Portal](https://discord.com/developers/applications) and get
at bot token.
1. Follow a tutorial on how to get a bot token, for example this one:
[Creating a discord bot & getting a token](https://github.com/reactiflux/discord-irc/wiki/Creating-a-discord-bot-&-getting-a-token)
2. The bot script expects the bot token to be in the `.env` file under the
`TOKEN` variable.
### Resources
#### Structure