Skip to content

Commit

Permalink
Merge pull request #253 from AlexanderHOtt/feat/better-docs
Browse files Browse the repository at this point in the history
Write better documentation for getting started with discord bot development.
  • Loading branch information
yk committed Jan 2, 2023
2 parents 9ed5fbc + 8e831f8 commit c489f3d
Showing 1 changed file with 40 additions and 13 deletions.
53 changes: 40 additions & 13 deletions discord-bot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,49 @@ 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

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:

Expand All @@ -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
```

Expand All @@ -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
Expand Down

0 comments on commit c489f3d

Please sign in to comment.