Skip to content

chingu-x/sherpabot-original

Repository files navigation

Sherpabot - Helping to guide the Chingu Community

Table of Contents

Overview

Sherpa 'Bot is designed to help members of the Chingu Community in Discord by displaying useful information, posting reminders, and performing routine tasks on members' behalf.

Commands

Commands are entered in the Discord message input box as:

sherpa!<command> <arguments>

Help Command

Description:

Display a list of commands that are available to the user.

Command:

sherpa!, sherpa!cmds, or sherpa!help

Arguments:

N/a

Example:

sherpa! will display:

@johndoe, Sherpa Commands:
sherpatest! - List Sherpa commands
sherpatest!help - List Sherpa commands
sherpatest!help ask - Access tips on how to ask for help
sherpatest!help doc - Access the Chingu Handbook
sherpatest!help issue - How to open an issue for the Chingu team
sherpatest!help sched|schedule - Access the Chingu Schedule of Events
sherpatest!help social - Display URLs for Chingu social media sites
sherpatest!help time - Display the time


Ask Command

Description: Display guidelines and tips for how to ask a question in Discord to maximize your results.

Command:

sherpa!ask

Arguments:

N/a

Example:

`sherpa!ask will display:

@johndoe, https://chingu.docs.chingu.io/about/askhelp


Doc Command

Description:

Display one or more URLs to the Chingu documentation you have requested.

Command:

sherpa!doc <arguments>

Arguments:

Omitted - Display a link to the Chingu organization documentation
chingu - Display a link to the Chingu organization documentation
voyage - Display a link to the documentation defining the Voyage program
pair - Display a link to the documentation defining the Pair Programming program
tech - Display a link to Technical Resources
proj - Display a link to Project Resources

Example:

sherpa!doc voyage will display:

@johndoe, https://chingu.docs.chingu.io/


Issue Command

Description: Display information to help you open an issue for the Chingu team to look into.

Command:

sherpa!issue

Arguments:

N/a

Example:

sherpa!issue will display:

@johndoe, https://chingu.docs.chingu.io/about/rptissue


Schedule Command

Description: Display a link to the Chingu Schedule of Events.

Command:

sherpa!sched sherpa!schedule

Arguments:

N/a

Example:

sherpa!sched or sherpa!schedule will display:

@johndoe, https://chingu.docs.chingu.io/intro/schedule


Social Command

Description: Display a list of URL's for Chingu social media sites.

Command:

sherpa!social

Arguments:

N/a

Example:

sherpa!social will display:

@johndoe, https://dev.to/chingu
@johndoe, https://medium.com/chingu
@johndoe, https://twitter.com/ChinguCollabs


Time Command

Description: Display a the current time in another location.

Command:

sherpa!time in <city-name>

Arguments:

city-name the name of the city you who's current time you need to display

Example:

sherpa!time in new york will display:

@johndoe, In New York it is currently 11:05:32 AM

sherpa!time in london will display:

@johndoe, 3 locations were found.
@johndoe, In London, Canada it is currently 11:05:45 AM
@johndoe, In London, United Kingdom it is currently 4:05:45 PM
@johndoe, In London, KY United States of America it is currently 11:05:45 AM


Building & Running

Environment Variables

Environment variables are defined in both the .env and app.yaml files in root of the project. Environment variables in .env are used when NODE_ENV is set to development and from app.yaml when NODE_ENV is production.

Both the .env and app.yaml files have been added to .gitignore to keep the Discord 'bot token confidential.

The specific variables and their usage are shown in the table below.

Environment Variable Description Example Setting
DISCORD_TOKEN Discord Bot token DISCORD_TOKEN=A8H3RNL.35UAJD26JEOKJMNDAD0.UDNLADMEMCI2UCNH5UF48KDMB3DD5NW
COMMAND_PREFIX Sherpa command prefix sherpa!

Building & Deploying Sherpabot

Building Sherpabot requires defining the 'bot in the Discord Developer site through the Applications screen. As part of this process a 'bot token will be generated which must be added to both the .env and app.yaml files as the value of the DISCORD_TOKEN variable.

Your app.yaml file, used by Gcloud, should contain:

runtime: nodejs10
service: sherpa

handlers:
  - url: /.*
    script: auto
    secure: always
    redirect_http_response_code: 301

automatic_scaling:
  max_instances: 1

env_variables:
  DISCORD_TOKEN: "<discord-bot-token>"
  COMMAND_PREFIX: "sherpa!"

Sherpabot currently runs on Gcloud. Deploying it requires the Google Cloud SDK. To deploy the app execute the following:

git checkout master
gcloud app deploy

from your terminal session. Once successfully deployed you should manually terminate old versions from the GCloud App Engine dashboard.

Starting Sherpabot

The following environment-specific commands may be used to start Sherpa:

Production: npm start Development: npm run startdev

Note that for testing purposes you may find it useful to set the COMMAND_PREFIX environment variable in the .env file to something different from what it is set to in the app.yaml file. For example, if it's set to sherpa! in app.yaml, you can set it to sherpatest! in .env to allow testing using a local development server without disrupting production users.

Sherpa also has a webpage containing its current status. When running locally this can be accessed at the URL http://localhost:8080.

Testing

Use the script test in package.json to test the commands made available through Sherpa.

Dependencies

The Chuseok Bot extracts message traffic accessed through the Discord API using the Discord.JS package.

Change Log

For more information see Change Log

Contributing

See Contributing and our Collaborator Guide.

Authors

Developers on this project can be found on the Contributors page of this repo.

License

MIT

About

Sherpabot - Helping to guide the Chingu Community

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published