Pokemon Mystery Dungeon bot

Kylie Jo Swistak f4ef9441d9 add embed class 6 年之前
app f4ef9441d9 add embed class 6 年之前
config 347e0412eb Initial Setup 6 年之前
.env.template 347e0412eb Initial Setup 6 年之前
.gitignore 347e0412eb Initial Setup 6 年之前
Gemfile 347e0412eb Initial Setup 6 年之前
Gemfile.lock 347e0412eb Initial Setup 6 年之前
README.md ece1c56ae7 spice up the readme 6 年之前
bot.rb 3daa404578 add very basic hello command 6 年之前

README.md

Rotom Bot

The best ghosty-electric boy that runs your devices!

This bot was created for use in the Pokemon Mystery Dungeon, Kink Teams 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 ch -b [branch_name]             #to create a branch
$ git push origin/[branch_name]       #to push branch

Features

  • None yet

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 DATABSE [name] WITH OWNER [username]
    

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

    ALTER DATABSE [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