Python native Pokemon bot for Discord
Please see the Wiki Page for more information about the bots design.
Create a server if you do not have on already
Server Settings
Roles
menu and for an existing role (or a new role you create), enable the Manage Server
optionOnce you have a server, you need to get a OAuth token for your bot
PikamonBot
.Bot
menu on the left-hand sideAdd Bot
and then Yes, do it!
TOKEN
section click either Click to Reveal Token
or Copy
to copy the token. This is the OAuth token your bot will use when connecting to your server. Save this permanently and do not lose this.Add the bot to the discord server
SCOPES
section check the box for bot
BOT PERMISSIONS
section check the boxes for Read Message History
and Send Messages
Authorize
.At this point, your bot has already been registered. You already have a OAuth token for your bot that you have saved. If you still have the URL you saved in step 3 under Add the bot to the discord server
, then adding the bot to a new server is as easy as doing the following:
Authorize
And that's it! A single instance of your bot will now work across multiple servers, and it will maintain data between each. What this means is that if the same user is on multiple servers which contain the bot, then that user can catch Pokemon on any server and have it saved to their account. They can then list their caught Pokemon on any server, and it will show Pokemon caught from any server.
To run the bot, simply run bot.py
. Note that before you do this, you must set the following environment variables:
TOKEN
: Your OAuth token from when you created the botLOGGING_CONFIG_JSON
: Path to logging configuration file on the systemDATABASE_CONFIG_PATH
: Path to the SQL definition files of the SQLite tables for the Pikamon bot. By default,
it is under this projects database configuration directory.SQLITE_DATA_PATH
: Directory path for where the SQLite database should be stored. If no path is provided, then the
SQLite data will be stored in the same directory as pikamon/bot.py
.Different IDEs and editors have different ways to do this. Here are a few ways to do this:
.env
fileThe below instructions assume that you already have Docker installed on the host system where you will run the Pikamon Bot container. If you do not already have Docker installed, then follow the directions on the Get Docker webpage. Once you have installed Docker, continue with the below instructions.
Create an environment configuration file named env_vars.txt
for the Docker image:
# Your Discord Bot OAuth token. REPLACE BEFORE STARTING BOT WITH YOUR TOKEN
TOKEN=<bot_token>
# Path to logging configuration file in the Docker container
LOGGING_CONFIG_JSON=/bot/configuration/logging.json
# Directory path for SQLite database configuration files
DATABASE_CONFIG_PATH=/bot/configuration/database
# Directory path for where the SQLite database should be stored
SQLITE_DATA_PATH=/bot/data
Be sure to replace <bot_token>
with your OAuth token.
Build the bot using Docker
docker build -t pikamon:latest .
Run the bot providing the environment variable
docker run --env-file <path to env_vars.txt> pikamon:latest
Be sure to replace <path to env_vars.txt>
with the path to the env_vars.txt
file you created
as part of step 1.
Note: With these instructions the Docker container will not be mounting a volume for the SQLite database. If you wish to persist the SQLite database between run, then follow the Docker Volume Mount documentation.