GithubHelp home page GithubHelp logo

autobots-rocks / autobot-docsbot Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 4.0 938 KB

devdocs.io + cheat.sh discord bot

Home Page: https://autobots.rocks

Dockerfile 10.95% Makefile 52.50% TypeScript 36.55%
autobots

autobot-docsbot's Introduction

logo.png

screen2.png screen1.png

devdocs.io + cheat.sh discord bot

Queries devdocs.io json schema for names via !js strict_mode etc. This bot comes with a simple monitoring endpoint for monitoring the bot being up (used with kubernetes). This bot uses the docsbot role by default for users who are allowed to query.

Additionally, this bot comes with the ;;ping command to show bot latency and uptime.

Module

This repository represents the actual bot itself and uses the following module: https://github.com/autobots-rocks/autobot-module-docsbot.

Commands

Command Description
;<language> <function> Searches for
;;update <language> Downloads a language pack from devdocs.io.
;;list Lists downloaded language packs.
;;terms <language> Lists terms searchable by language pack.
;;cheat <command> Displays documentation from cheat.sh for a command.
;;aliaslist Lists configured aliases.
;;aliasadd language=javascript,alias=js Create or replace a new language alias.
;;aliasdelete language=javascript Deletes alias(es) associated with a language.

Setup

Clone the repo, run npm install inside of it, and copy the template .env file.

git clone https://github.com/autobots-rocks/autobot-docsbot
cd autobot-docsbot
npm install
cp .env.sample .env

The .env file has the following configurable options which are required:

PORT=8080
TOKEN=<your discord bot token>

#
# Initial configuration
#
DOCSBOT_SAVE_PATH=<some full path to a direcgtory save json files to>
DOCSBOT_ADMIN_ROLE_NAME=docsbot
DOCSBOT_LIMIT_CHARS=1000

#
# Command Prefixes
#
DOCSBOT_PREFIX_SEARCH=;
DOCSBOT_PREFIX_CHEAT=;;cheat
DOCSBOT_PREFIX_LIST=;;list
DOCSBOT_PREFIX_TERMS=;;terms
DOCSBOT_PREFIX_UPDATE=;;update

#
# Aliases Configuration
#
DOCSBOT_ALIASES_CONFIG_PATH=<some path>.json
DOCSBOT_PREFIX_ALIAS_ADD=;;aliasadd
DOCSBOT_PREFIX_ALIAS_LIST=;;aliaslist
DOCSBOT_PREFIX_ALIAS_DELETE=;;aliasdelete

Make sure the role you specified exists and is assigned to the user(s) that want to use any of the docsbot commands!

Building

npm run build

Starting

npm run start

± |master S:395 U:390 ?:598 ✗| → npm run start

> @autobots/[email protected] start /Users/yomateod/workspace/work/autobots/autobot-docsbot
> node dist/main.js

[Nest] 11223   - 06/02/2019, 2:01 PM   [NestFactory] Starting Nest application...
Sun Jun 02 2019 14:01:52 GMT-0500 (Central Daylight Time): Logging into discord
[Nest] 11223   - 06/02/2019, 2:01 PM   [InstanceLoader] AppModule dependencies initialized +494ms
[Nest] 11223   - 06/02/2019, 2:01 PM   [InstanceLoader] MonitoringModule dependencies initialized +0ms
[Nest] 11223   - 06/02/2019, 2:01 PM   [RoutesResolver] MonitoringController {/monitoring}: +4ms
[Nest] 11223   - 06/02/2019, 2:01 PM   [RouterExplorer] Mapped {/is_alive, GET} route +2ms
[Nest] 11223   - 06/02/2019, 2:01 PM   [NestApplication] Nest application successfully started +2ms
Sun Jun 02 2019 14:01:52 GMT-0500 (Central Daylight Time): Bootstrapping /Users/yomateod/workspace/work/autobots/autobot-docsbot/node_modules/@autobot/module-docsbot
Sun Jun 02 2019 14:01:52 GMT-0500 (Central Daylight Time): Command Registered: !js (!js <search term>)
Sun Jun 02 2019 14:01:52 GMT-0500 (Central Daylight Time): Bot Started
Sun Jun 02 2019 14:01:53 GMT-0500 (Central Daylight Time): Connected to discord

Installing languages

Once up and running you'll need to install languages that match devdocs.io. i.e.:

;;update javascript
;;update kotlin

Monitoring

The monitoring endpoint is available at http://localhost:8080/monitoring/is_alive.

Docker

This bot comes with its own Dockerfile.

Building

docker build -t docsbot .

Running

docker run -d -p8080:8080 --name docsbot docsbot

Viewing Logs

 docker logs -f docsbot

Stopping

 docker rm -f docsbot

Kubernetes

To deploy to kubernetes simply run the make install command. This will kubectl apply the files in the manifests directory installing the deployment and service. You will want to edit the image name in the Makefile or the deployment.yaml file.

autobot-docsbot's People

Contributors

jhburns avatar mateothegreat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

autobot-docsbot's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.