Skip to content

GeorgeCiesinski/poke-guesser-bot

Repository files navigation

Poké-guesser Bot

Poké-guesser Bot is a discord bot that runs a Pokemon guessing game. The bot automatically tracks the score of participating users.

Features

Bot Roles

The bot has the following roles:

  • Admin
  • Mod
  • Player

You can learn more about the roles here.

Commands

Each role has access to certain commands. You can find out more from this wiki page.

Guessing / Catching

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. catch

Lightning Round

You can start a lightning round, meaning one explore after each other for a given amount of loops, by doing /lightning start instead of /explore.

It will then automatically explore a new pokemon if the current one was caught or revealed.

Channel configuration

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.

Leaderboard

Generate a Leaderboard of the top players.

Hosted by YOU on Docker

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!

Multi-language Support

Poké-guesser Bot supports guesses in any language supported by Poké-API.

Installation

Discord Bot Setup

In order to use Poke-guesser-bot, you need to setup a discord bot first using the Discord Developer Portal.

  1. Login to the Discord Developer portal.
  2. Follow these instructions to setup the discord bot. Save the token from this step for later.
  3. Create the Bot Invite Link, but select the below permissions before using the invite link: bot-4

Create the .env and docker.env files

  1. Clone or download the repo.
  2. Create a .env file if it doesn't exist. Copy the contents of example.env into the .env
  3. Add the Discord Token to the .env file.
    • TOKEN: This is your discord token from previous steps.
  4. Add the Database configuration to the .env file. There are two options:
    1. If you use a Database URL, add it to the .env file as below:
      DATABASE_URL: "postgres://user:pass@example.com:5432/dbname" (your string)
    2. 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.
  5. Copy the contents of .env into docker.env

Adding Slash Commands

The bot uses slash commands which need to be registered with discord.

  1. While still in the project directory, run npm install to install the required packages
  2. Then run node setupCommands.js to register slash commands for the bot with discord

Running the Bot

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.

Run in Docker

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.

  1. Set up Docker if you haven't already.
  2. Run the bot with Docker Compose:
    docker compose up -d

Run Locally

You can also run the bot using node, but the database has to be set up manually.

  1. 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.
  2. Run the command:
    node index.js
    or
    npm start

Technology

PostgreSQL

The database.

node.js

This project is written entirely using JavaScript in the Node.JS runtime environment.

discord.js

All interactions with discord were handled thanks to the discord.js library.

Poké-API

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.

Contributions

If you are interested in making a contribution, please read our Contributions Guidelines located in docs/CONTRIBUTING.md.

Terms of Conduct

Before participating in this community, please read our Code of Conduct located in docs/CODE_OF_CONDUCT.md.

License

MIT

Additional Credit

Code Contributions by Wissididom

Replit Cover Image by PIRO4D from Pixabay

Leaderboard Image by Aurelia Candeloro

About

Discord bot that lets you guess pokemon

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •