Pokemon Mystery Dungeon bot

Kylie Jo Swistak 80a4b1c1c7 fix capitalization error, not sure why classes got downcased in some areas 4 years ago
app 80a4b1c1c7 fix capitalization error, not sure why classes got downcased in some areas 4 years ago
config 347e0412eb Initial Setup 6 years ago
db b64eac01ed more recent data 6 years ago
deploy 50c7f2df9c make script executable 4 years ago
images 31e5cab82a ignore more generated images 5 years ago
lib aed8ca6a2f add aliases and alternate form sections to characters 4 years ago
.env.template 7ef63c298e Prepare docker-compose for VPS deployment 5 years ago
.gitignore b2ee1e55dc update ignored images, and fix matchup image fetching and generation 4 years ago
Dockerfile 9d41508d5d Add docker config 6 years ago
Gemfile 6d7429b9f5 add gems 6 years ago
Gemfile.lock 7119c89a6a So. Many. Changes. Complete code refactor 5 years ago
OpenSans-SemiBold.ttf 5a877d2686 level up 6 years ago
README.md 7297299ad3 Update 'README.md' 4 years ago
bot.rb da7e926f6d Attempt to fix connection pooling issues 5 years ago
docker-compose.yml 7ef63c298e Prepare docker-compose for VPS deployment 5 years ago

README.md

Rotom Bot

The best ghosty-electric boy that runs your devices!

This bot was created for use in the Pokemon Mystery Dungeon Discord. It manages users, characters, items and places in a fictional world full of Pokemon. This bot works in junction with webhooks, to recieve information submitted via google forms.

To collaborate on this project, create and work on a branch. Don't forget to list new features in the list below. When you are ready to merge your branch, you may create a pull request at ajsw.is

$ git checkout -b [branch_name]       #to create a branch
$ git push origin [branch_name]       #to push branch

In order to import, or dump a schema, use the following command. To learn more about Postgres, visit the wiki tab or postgresql.org

$ psql [db_name] < db/schema.sql        # Imports schema
$ pg_dump -O -f db/schma.sql [db_name]  # Exports schema

Features

  • Says hello
  • Displays type matchups
  • Communicates with users to create and edit character applications
  • Uses reactions to approve or deny applications
  • Displays help information for the available commands
  • Allows modular polls in any channel
  • Allows users to add, view, and delete images for their characters
  • Display all kinds of information about guild members
  • Accepts Item applications
  • Displays information about existing Items
  • Keeps track of characters' inventories
  • Communicates with users to create and edit landmark applications
  • Displays landmark information in paginated segments, navigatable by reactions

Setup

This application runs using Ruby and Postgres. In order to run the bot locally you can create a bot in the discord developer portal and use it to test

To pull in the project, we'll navigate where we want to keep the project in a terminal

$ cd [directory\ name]  # 'cd' changes directory, and if it has spaces '\' is the escape character

once there we clone the project!

$ git clone git@code.ajsw.is:PMD/rotom_bot.git

Prereqs

  • Installing RVM and Ruby

    We can Install RVM and Ruby with the following:

    $ \curl -sSL https://get.rvm.io | bash -s stable
    $ rvm install ruby 2.6.3
    

    If you are a windows user, you can follow my guide

    • Install Bundler and Bundle Install
    $ gem install bundler
    $ bundle install
    
  • Setup Environment Variables

    For this step, we're going to copy the .env.template and create a .env from it.

    The first 3 variables are related to the database, and the last 3 are related to the bot

  • Setup Postgresql

    For installation, documentation, and setup instructions visit postgresql.org

    We need to create a user and database for the bot to use. The actual user and Database names don't matter so create them, and use them to fillout a .env file in the root of the project

    CREATE USER [name] WITH PASSWORD '[password]';
    CREATE DATABASE [name] WITH OWNER [username];
    

    If the db gets created with initail setup this is how to change owner

    ALTER DATABASE [name] OWNER TO [new_owner];
    
  • Create Test Bot To run your code, we need a bot! You can create one through the Discord Developer Portal

    Create a new project, and name it whatever you want. We're going to need 3 codes from there. Client ID and Client Secret are on the General Information page, and the last code we need is on the Bot page. Simply create a bot here, and copy its Token

  • Run the bot

    Now our setup is complete, and you should be able to run the bot!

    $ ruby bot.rb
    

    How to setup RVM for Windows Users

    • Enable Developer Mode

    Open your settings, and navigate to Update and Security

    On the left, click For Developers, and check Developer Mode

    • Subsystem for Linux

    Next open the Control Panel, and select Programs and select Turn Windows features on or off on the side bar

    Search for Windows Subsystem for Linux, check it and wait for the install, then restart

    • Installing bash

    Now you can open a Command Prompt and type in:

    C:\Users\YourUserName> bash
    

    If it returns saying you have no installed distributions, open up the Microsoft Store and install Ubuntu (its free), and try again

    If it is asking for verification, reply with y and wait for the install

    Once prompted you can provide a username and password of your choice, you should then get a prompt:

    username@ComputerName: $
    
  • Installing RVM and Ruby

    We need to install GPG, and get a public key , install RVM, access the command and then use it to install Ruby

    $ sudo apt-get install gpg
    $ gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
    

    We can Install RVM and Ruby with the following:

    $ \curl -sSL https://get.rvm.io | bash -s stable
    $ source ~/.rvm/scripts/rvm
    $ rvm install ruby 2.6.3