npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@autobot/module-docsbot

v1.0.248

Published

![logo.png](logo.png)

Downloads

328

Readme

logo.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 for users to be able to query.

Additionaly, this bot comes with the !ping command to show bot latency and uptime.

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

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

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.