Pixl is a Discord utility bot and bot 'framework' based on Pycord. By itself, it does nothing interesting. It acts as a host for various cogs (plug-ins) that do useful things.
Please note, this bot is a hobby project and is somewhat idiosyncratic as a result. It has been built up over a couple of years, and so has some annoying inconsistencies I have yet to address.
You require:
- Python 3.9 or later
pip
for installing libraries
The basic installation looks like this:
git clone https://github.com/Karunamon/pixlbot.git
python3 -m ensurepip
pip install pipenv
cd pixlbot
pipenv install
(But you should really consider using Docker, it's so much easier. See below…)
You will need to register a bot account on the Discord developer portal.
- Select 'new application' and enter what you want your bot to be named.
- Select Bot on the left bar and add a bot account. Upload an avatar if you want.
- Hit 'reset token' and copy this text aside
- On this page, enable all privileged gateway intents
- Save changes
- Select OAuth2 on the left bar, then URL Generator
- Check
bot
andapplications.commands
. A new panel will appear, checkAdministrator
- Press copy on the URL that appears, paste into a web browser, and follow the instructions to add the bot to your server
It would also be helpful to enable developer mode in your Discord client (under advanced in your settings), this will allow you to copy numeric IDs you will need for the configuration file.
Copy config.yml.example
to config.yml
and open it in a good text editor (i.e. not Notepad). Insert your bot's token from the developer portal in the appropriate place. You should also add the name of a role or two that can do administrative tasks like move messages. These have to match up with the names in Discord exactly, with the same case and everything.
You will notice a few plug-ins commented out. These require further configuration before they can be used. Read on to see how to set these up.
python3 main.py
Once the bot is running, the db folder will be used to store any persistent, non-configuration data. Make sure to keep it safe.
Or using Docker:
docker run ghcr.io/karunamon/pixlbot:release -v /path/to/your/config.yml:/app/config.yml -v /path/to/your/db/:/app/db/
A thing to redirect messages posted in inappropriate places to more appropriate places. To use it, right click on any message and a select "bonk this message". The bot will then delete the message, re-post it in the desired channel, and send the author a private message castigating them for their for poor posting habits.
This also results in the author getting mentioned like three or four times which is actually kind of annoying, and so this serves as an effective deterrent.
Grab your server ID, and under that, add the ID of the channel bonked messages should go to. You should also upload a sticker which will be used as a reply to the bonked message, and grab its ID as well. Fill these numeric IDs in config.yml
and uncomment - cogs.bonk
The ChatGPT cog allows users to interact with OpenAI's GPT model via Discord. The main features of this cog include:
- Sending user messages to the GPT model and posting AI-generated responses (Only when the bot is @mentioned).
- Resetting, showing, and saving a user's conversation history with the bot.
- Summarizing the conversation in a channel
You will require a paid account with OpenAI. Using the GPT 3.5 turbo model is extremely, extremely cheap but it is not free.
Generate an API key and add it to the config.yml file.
You may also customize the "system" prompt, this is a blurb that the AI sees before every conversation, it can be used to provide instructions or set the general flavor of the conversation.