This discord bot provides a basic interface for making sell/trade listings for your private discord server. I wrote this due to forum channels being unavailable to private discord servers. This is a clunky, yet workable solution.
- Allows users to make new listings through an interactive modal prompt.
- Makes new threads for each listing so buyer/seller conversations can be kept relatively clean.
- Provides a "/sold" slash command to allow the original poster to close and delete their threads.
- Keeps the bazaar chats clean through automated cleanup
- Deploys in a docker container or locally for a fast and easy setup.
- Python 3.13.2
- Discord.py
First, create a Discord bot registration. Instructions to do so are here. When selecting scopes and permissions use the following settings:
- Scopes:
bot
- Privileged Gateway Intents:
Message Content Intent
- Turn off
Public bot
Invite the bot to your server and restrict it from all channels as necessary to prevent interacting with it from outside of the 'Bazaar'.
-
Create 2 channels, 1 "setup" channel, and 1 "listings" channel. The setup channel will only be used to interact with the bot, the listings channel will contain the sale listing threads.
-
Setup the permissions of these channels as follows:
- For the Setup channel
- For normal users:
- View Channel
- Send Messages
- Read Message History
- Use Application Commands
- For the bot account:
- View Channel
- Send Messages
- Manage Messages
- Read Message History
- For normal users:
- For the Listings channel
- For normal users:
- View Channel
- Send Messages in Threads
- Attach Files
- Add Reactions
- Read Message History
- Use Application Commands
- For the bot account:
- View Channel
- Send Messages
- Send Messages in Threads
- Create Public Threads
- Embed Links
- Attach Files
- Add Reactions
- Manage Messages
- Manage Threads
- Read Message History
- For normal users:
- For the Setup channel
We will assume that you are deploying via Docker container. The same steps apply to a local installtion, but you will need to setup a script as a service or similar mechanism to keep it running.
- Setup your
.env
file. This will contain the environment variables required to connect to discord.- There is a
.env.example
file for reference.
- There is a
- Deploy the docker container.
- Ensure your
.env
file is mapped into the container with a volume mount, or you provide the required settings as environment variables. - There is an example
docker-compose.yml
file for reference.
- Ensure your
That's it.
- Threads are clunky and can cause some data to be left behind when the bot is deleting them. Unfortunately, without proper forums support in private servers this is about the best visual organization we can get.
- There's currently no automated cleanup for stale threads.
- Discord interactions have a timeout of 15 minutes or less, which can cause submission errors if users take too long to craft their listing.