A self-hosted Discord bot is provided in /scripts/discord/discord_bot.py
.
To get this bot configured, you need to follow each part of this page.
- Navigate to the Discord Developer Portal
- Create a New Application
- Fill out the name, description, etc for it
- Navigate to Bot and create a new bot, making a note of the TOKEN (
ItWill.LookLike.ThisTypeOfThing
)- This will be going inside the
discord_config.json
file later and MUST be kept private
- This will be going inside the
- Configure the bot's permissions
Create a copy of /scripts/discord/discord_config.json.template
called /scripts/discord/discord_config.json
, filling in the properties as follows:
- token: The Bot Token from the Discord Developer Portal, which must be kept secret
- prefix: The prefix to use if not using slash commands (since some people prefer straight text input), defaulting to !
Run your bot the same way you'd run dream.py
, but instead using /scripts/discord/discord_bot.py
:
Windows .bat example:
call C:\ProgramData\Miniconda3\Scripts\activate.bat
call conda activate ldm
python scripts/discord/discord_bot.py
Once the bot is running successfully, it will print out the INVITE url for you to invite it to servers:
Bot is ready, oauth url: https://discord.com/oauth2/authorize?client_id=1234&scope=bot+applications.commands&permissions=2147535872
Follow the invite link to invite it to the server of your choice.
Once the bot is inside your discord server, you can use it straight away with the !dream
, but this is limited in its capabilities.
Alternatively, use the command !sync *
which will immediately make the slash command available to your server, giving all capabilities, accessible through the /dream
command: