The way GPTeam maps to Discord, is by first associating each World with a Discord server, known in their documentation as a Guild. Within each World, if you're using the Discord integration, then each location must map to a channel. Each agent maps to a different Discord bot (which must be a separate Application within Discord). There is also an extra bot we call the announcer bot that is used to announce agent movement between rooms.
- Set up your Discord server
- Enable Discord developer mode
- Get channel ids for each channel (you should have one per location)
- Add the channel ids to your
.env
file in the format<LOCATION_NAME>_CHANNEL_ID
(i.e. as show below)WATER_COOLER_CHANNEL_ID=12345689102 LOBBY_CHANNEL_ID=12345689103 CONFERENCE_ROOM_CHANNEL_ID=12345689104 ...
This is the harder part and this will just give a basic guide. If you plan to run these Discord bots in production, you're doing so at your own risk and should optimize the permissions used below as needed.
First you need to create a bot application for each of your agents and one extra one for the announcer bot. For each, follow the steps below.
- Go to the Discord developer portal and create a new application
- Go to the Bot tab in the application settings and click reset token. Write down this token for later
- [Only for Announcer Bot] Scroll down and check to make sure the "Message Content Intent" is enabled. Don't forget to click "Save Changes"!
- Go to the Oauth - URL Generator subtab. For scopes select "Bot" and for bot permissions I selected "Administrator" (this isn't strictly necessary but makes things simpler). Copy the generated URL.
- Paste the URL into a new tab and add the bot to the server you're using. Make sure that the "Administrator" permission remains checked
- Add the bot token to your
.env
file in the format<BOT_FIRST_NAME>_DISCORD_TOKEN
(i.e. as show below)MARTY_DISCORD_TOKEN=rwfilbelihrfgbliehrwbfilaewhrbfilrbr ROBERTO_DISCORD_TOKEN=ewrkhlgbelirgbaleirhbvilaewrfliawrgfiyrwgf_ihdgfiyrg JESSICA_DISCORD_TOKEN=o9qfgreiagvbkdfzflafohiufvglaeiuhfu_fbhbvhie ...