Poké-guesser Bot is a discord bot that runs a Pokemon guessing game. The bot automatically tracks the score of participating users.
The bot has the following roles:
- Admin
- Mod
- Player
You can learn more about the roles here.
Each role has access to certain commands. You can find out more from this wiki page.
You can simply guess the pokémon name by clicking or tapping on Catch This Pokémon!
-button below the message that shows the pokémon that needs to be guessed. After that a modal opens up that asks you for the name where you need to enter it and press or tap on Submit
.
You can set which channels the bot is allowed to reply in. The bot can listen and reply on all channels if no channels are set.
Generate a Leaderboard of the top players.
You can clone this repository to run it yourself through Docker Compose so you know exactly what this bot is doing. You can also fork this repo and make any modifications you want!
Poké-guesser Bot supports guesses in any language supported by Poké-API.
In order to use Poke-guesser-bot, you need to setup a discord bot first using the Discord Developer Portal.
- Login to the Discord Developer portal.
- Follow these instructions to setup the discord bot. Save the token from this step for later.
- Create the Bot Invite Link, but select the below permissions before using the invite link:
- Clone or download the repo.
-
Create a
.env
file if it doesn't exist. Copy the contents ofexample.env
into the.env
-
Add the Discord Token to the
.env
file.- TOKEN: This is your discord token from previous steps.
-
Add the Database configuration to the
.env
file. There are two options:-
If you use a Database URL, add it to the
.env
file as below:DATABASE_URL: "postgres://user:[email protected]:5432/dbname"
(your string) -
If you want to pass the parameters separately to the Sequelize constructor, change the below fields in the .env file:
- POSTGRES_HOST: Connection string for Postgres server. Leave as
db
if using Docker. - POSTGRES_USER & POSTGRES_PASSWORD: User/pass for postgres server. Doesn't need to be changed if using Docker.
- POSTGRES_HOST: Connection string for Postgres server. Leave as
-
If you use a Database URL, add it to the
-
Copy the contents of
.env
intodocker.env
The bot uses slash commands which need to be registered with discord.
- While still in the project directory, run
npm install
to install the required packages - Then run
node setupCommands.js
to register slash commands for the bot with discord
This bot was written to run locally or on docker with NodeJS and PostgreSQL and uses Env-Files for the senstive data that will get loaded in NodeJS as Environment Variables.
Important: You must have already set up a Discord bot on the Discord Developer portal. If you haven't, follow the instructions in this section first.
- Set up Docker if you haven't already.
-
Run the bot with Docker Compose. You can do this by running either:
sudo docker-compose up -d
or if that doesn't work, then try:sudo docker-compose --env-file docker.env up -d
You can also run the bot using node, but the database has to be set up manually.
-
Set up your database if you haven't already. The bot was built using Postgres but other DBs can work if they allow a connection string with user/pass. If you don't use the
DATABASE_URL
environment variable, you'd have to adjust the dialect for Sequelize in data/postgres.js. -
Run the command:
node index.js
ornpm start
The database.
This project is written entirely using JavaScript in the Node.JS runtime environment.
All interactions with discord were handled thanks to the discord.js library.
This bot would not be possible without PokeAPI. This API provided a list of all pokémon, including their variants, as well as sprites that were instrumental in building this Poke-guesser Bot.
This bot was originally written in Replit, but has since been rewritten to run in a Docker container instead. Replit is no longer supported.
To contribute to the bot, please fork this repository and open up a pull request to merge changes back into the repository.
If your change adds a feature, please include proof that the feature is working as intended. Make sure you also test the bot to ensure other features aren't broken. I will expand this section soon to be more detailed, and add Pull Request templates to follow as well.
Contribution guideline coming soon!
Code Contributions by Wissididom
Replit Cover Image by PIRO4D from Pixabay
Leaderboard Image by Aurelia Candeloro