A documentation bot built using slash-create for its documentation, functionality derived from Eris Docs bot.

Related tags

Video/Audio docs-bot
Overview

docs-bot

A service that handles navigation of a docgen project manifest.

Commands

All arguments are required.

$ npx slash-up list

/docs - Search documentation entries.
    class - Get entry for a class.
        class* string - The class to retrieve.
        share? boolean - Share the outcome of your query to the channel.
    event - Get entry for an event.
        class* string - The class to retrieve.
        event* string - The event to retrieve.
        share? boolean - Share the outcome of your query to the channel.
    method - Get entry for a method.
        class* string - The class to retrieve.
        method* string - The method to retrieve.
        share? boolean - Share the outcome of your query to the channel.
    prop - Get entry for a class prop.
        class* string - The class to retrieve.
        prop* string - The prop to retrieve.
        share? boolean - Share the outcome of your query to the channel.
    typedef - Get entry for a type definition.
        typedef* string - The typedef to retrieve.
        share? boolean - Share the outcome of your query to the channel.

/search - Search for a documentation entry.
    query* string - The query to search all entries.

/code - Get a section of code from the source repository.
    entity - Fetch a file from a type entity.
        query* string - The query to search all entries.
        around? integer - How many lines to retrieve around the entity. (default = 3)
        share? boolean - Share your result with others in the channel. (default = false)
    lines - Fetch specific lines from the source code.
        query* string - The query to search all entries.
        start integer - Where to select from.
        end integer - Where to select to.
        share? boolean - Share your result with others in the channel. (default = false)

Installation

git clone https://github.com/slash-create/docs-bot.git
cd docs-bot
# create the ".env" file and edit the variables (Configuration below)!
npx slash-up sync
yarn build
yarn start

Configuration

Derived from the default configration without debug options.

Key Description
DISCORD_APP_ID The application ID of the Discord app.
DISCORD_PUBLIC_KEY The public key of the Discord app.
DISCORD_BOT_TOKEN The bot token of the Discord app.
PORT The port to listen on.
Comments
  • `/search` fails to fetch class and typedef entity keys

    `/search` fails to fetch class and typedef entity keys

    The typeMap is shown to have these contained within all, yet TypeError occurs when it fails to find a class or typedef.

    An additional change to /search requires the consideration of an entity if it's a typedef to treat it similar to a class, but also as it's own type (/docs class class: * -> /docs typedef typedef: *).

    https://github.com/slash-create/docs-bot/blob/98c07eb007ca3d699b37f530f3a66e6cb1e690d8/src/commands/search.ts#L42-L43

    For now, an onError catch would work for the command itself - but it would be troubling if it persists after fix is implemented.

    bug 
    opened by sudojunior 3
  • fix: ensure user has `SEND_MESSAGES` before attempting to respond using the `share` argument

    fix: ensure user has `SEND_MESSAGES` before attempting to respond using the `share` argument

    Fixes #23

    Warning Access to app commands appears to be refused if SEND_MESSAGES isn't available. - I guess the main reason I misunderstood it was due to how USE_APP_COMMANDS was described and how API Docs describe what users have access to when they have certain permissions granted or revoked (which has been quite unclear to me in some cases in the past - TinkerStorm/interaction-prototypes#4).

    enhancement 
    opened by sudojunior 2
  • feat: type resolution

    feat: type resolution

    This is functional for both internal documentation, and a limited number of entries on MDN known to be contained within the docgen manifest. Brace replacement is also fully functional with the forced escape sequence and having it join together for Discord to safely render it. - 9dd8b974c8dc1355445b220b4602e214bda1d96f

    In addition to that...

    • 815b26748736d6116418ec8fefd36818fabcd5e4 now uses default limit for fuzzy filtering on class autocompletion.
    • 067723e8ff8743eb62cf906ce628a849839e72b3 finally adds a description for the parent structures.
    • 55a3337f7e61088c0e1657bf4fd33658c2c0d958 getArgumentEntityFields now accepts an entityType argument.

      This was intended for class constructors, but the spacing and layout of the resulting embed became a concern, so it was commented out for classes specifically. - Still there, it just won't show for now until another opportunity arises to improve its structure.

    enhancement 
    opened by sudojunior 2
  • build(deps): bump fastify from 4.7.0 to 4.10.2

    build(deps): bump fastify from 4.7.0 to 4.10.2

    Bumps fastify from 4.7.0 to 4.10.2.

    Release notes

    Sourced from fastify's releases.

    v4.10.2

    ⚠️ Security Release ⚠️

    Full Changelog: https://github.com/fastify/fastify/compare/v4.10.1...v4.10.2

    v4.10.1

    What's Changed

    New Contributors

    Full Changelog: https://github.com/fastify/fastify/compare/v4.10.0...v4.10.1

    v4.10.0

    What's Changed

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • build(deps): bump fastify from 4.7.0 to 4.8.1

    build(deps): bump fastify from 4.7.0 to 4.8.1

    Bumps fastify from 4.7.0 to 4.8.1.

    Release notes

    Sourced from fastify's releases.

    v4.8.1

    ⚠️ Security Release ⚠️

    This release fixes https://github.com/fastify/fastify/security/advisories/GHSA-455w-c45v-86rg for the v4.x line. This is a HIGH vulnerability that can lead to a crash, resulting in a total loss of availability. The CVE for this vulnerability is CVE-2022-39288.

    Full Changelog: https://github.com/fastify/fastify/compare/v4.8.0...v4.8.1

    v4.8.0

    What's Changed

    New Contributors

    Full Changelog: https://github.com/fastify/fastify/compare/v4.7.0...v4.8.0

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • feat(/code *): Indent everything?

    feat(/code *): Indent everything?

    Given the constrains content indents have on code blocks, it is a considerable choice to sling it forward - but also a hinderance as mentioned in #24 with regard to content limits. This would require all code specific lines to be prefixed with >, which isn't difficult - but is more concerning for the effect it would have on the limits described... and the reasons to justify the change in formatting without impacting user experience.

    https://github.com/slash-create/docs-bot/blob/445f311298a1bb44992a7ff4416927356606a03e/src/commands/code.ts#L214-L215

    enhancement 
    opened by sudojunior 1
  • fix(/code *): Open comment markup errors

    fix(/code *): Open comment markup errors

    When content is trimmed or requested content does not include an opening comment brace /*, formatting errors cascade throughout the file.

    Comparing between around: 6 and around: 10 when running /code entity on query: SlashCommand#throttle.

    This isn't as big of a problem as other hitches, but it does persist when comment braces are not included - and HighlightJS takes over by considering them as standard markup.

    A solution would be to inject a forward slash / before the first asterisk * of the requested content, and then add an 'amendment' #24 stating it's inaccuracy for formatting reasons - but also... inaccurate in general.

    documentation enhancement 
    opened by sudojunior 1
  • fix: ensure user has `SEND_MESSAGES` before attempting to respond using the `share` argument

    fix: ensure user has `SEND_MESSAGES` before attempting to respond using the `share` argument

    In the unlikelihood that commands can be run from a command mention in a channel a user would not normally have access to send messages, a failover should trip to ensure its response remains ephemeral.

    import { CommandContext } from 'slash-create';
    
    class DocsCommand {
      async run(ctx: CommandContext) {
        // ...
        const shouldRemainEphemeral = !ctx.permissions.has("SEND_MESSAGES");
        // ...
       
        ctx.send({
          // ...
          ephemeral: shouldRemainEphemeral || !options.share
          // ...
        });
      }
    }
    
    enhancement 
    opened by sudojunior 1
  • feat: default `/docs` to an ephemeral response, add `share: boolean` to share it to the channel

    feat: default `/docs` to an ephemeral response, add `share: boolean` to share it to the channel

    This feature requires an additional option on each subcommand, and the behavioural change internally to handle the presence of the option as a default inversion.

    {
      "name": "share",
      "description": "Share the documentation entry to the channel (=false)",
      "type": 5,
      "required": false
    }
    

    It should be worth noting that a command sent with /docs ... share: true won't be dismissible, and default back to the regular behaviour of needing access to MANAGE_MESSAGES. On the plus side, users would be able to query the documentation alongside a conversation - and then decide to share when they've found what they wanted.

    documentation enhancement 
    opened by sudojunior 1
  • refactor(minor): trunc() + % -> round()

    refactor(minor): trunc() + % -> round()

    Math.round(...) is pretty much the same as floor and trunc along with the modulus operation. Although based on the provided logic, it will always be raised to the nearest whole number - leaving no room for alternating line trimming.

    Line trimming has always been a problem when dealing with Discord's content limit and ensuring a response is always delivered correctly. Another option can be provided as trim_from with it's available choices as Start and End or Top and Bottom, etc.

    https://github.com/slash-create/docs-bot/blob/8109ff639778e5db7f3fd94f52041dbba5324ced/src/commands/code.ts#L176-L185

    That is all it would be affecting, and it would have to be a boolean - or require a rework of it's trimming logic.

    enhancement 
    opened by sudojunior 0
  • feat: force comment injection

    feat: force comment injection

    • comment initiators are injected only if the comment is not defined as open
    • if line numbers have not been requested, it then reassigns commentOpen to revert to it's standard behavior of searching for the next comment terminator

    image

    Using a Set<string> is probably a bit of a cheat when it comes to handling alteration notes, but it's better than having to build a wrapper around an array and then also performing an O(n + 1) check and insertion (below). My only remaining concern is how the defined Set is handled within it's context after it is assembled.

    It's not an exact solution, but the principle is there. - Expected to fail.

    interface AmendNotesConstructor {
      (note: string): AmendNotesConstructor;
      (): string[];
    }
    
    const getNoteInstance = (): AmendNotesConstructor => {
      const notes: string[] = [];
      return function $internal(note?: string) {
        if (!note) return notes;
        if (notes.indexOf(note) <= -1) notes.push(note);
        return $internal;
      };
    };
    
    const func = getNoteInstance();
    func('note1');
    func('note2');
    func('note1');
    console.log(func()); // ['note1', 'note2']
    
    documentation enhancement 
    opened by sudojunior 0
  • feat: Localization

    feat: Localization

    Given the functional complexity of this service, localization is impossible for documentation entries in the way it is currently built... but localization for command names, options and descriptions as well as button components can be within an achievable scope.

    ... that said, they'd be hard coded into the response.

    enhancement 
    opened by sudojunior 0
  • feat(/* branch: string): Allow branch queries to other versions

    feat(/* branch: string): Allow branch queries to other versions

    This is something I've wanted to do for a while, only hitch being the version either has to be optional (and after all the required arguments) or an entirely new command to specifically handle versioning (which is what Eris Docs does /vdocs). It's not a bad way of handling distinct logic between latest and {branch/tag/ref}.

    Some files on the docs branch refer to branches that may have been merged or outright removed, but their manifest remains - docs site has filtered this out.

    enhancement 
    opened by sudojunior 0
  • feat: `/help` command

    feat: `/help` command

    This intends to be a long-term enhancement, uncommon knowledge about the framework and it's nuances can be documented here - similar to how docs site has guides. The recent inclusion of Select Menus in modals serves to be a good example.

    Given the structure of an FAQ, autocomplete would serve better over a series of choices.

    https://github.com/sudojunior/hack-n-slash/blob/d1f6c876551de09727465ef39e7cc7b9529fc47d/src/commands/about.ts#L26-L34

    Current structure of Hack 'n Slash's /about command, but it could be structured better.

    Close ties with #6 and #7

    documentation enhancement 
    opened by sudojunior 0
Owner
/create
/create
An open-source ERIS bot, made by the DashCruft Nation contributors with love <3

ErisCruft-Bot The official community bot for the DashCruft Nation. This time in eris! Requirements & Rules You HAVE to be a member in our Offical Disc

DashCruft-Nation 4 Apr 5, 2022
Ceci est un handler utilisant la librairie Eris qui est une alternative à discord.js et MySQL

DiscordEris-Bot-Handler Prérequis des connaissances avec MySQL des connaissances en javascript Configuration Ouvrir le fichier config.js et modifier c

NEYFOX 2 Mar 30, 2022
SlashCommands-Bot - An advanced discord bot, with Slash Commands !

SlashCommands Bot Github post is a discord bot handler with slashcommands in v13 How to install ? You need to have Node.JS 16+ git clone https://githu

null 9 Nov 16, 2022
Discord.JTS - Slash Commands for Discord.JS 13 using Typescript

Installation Requirements and Recommendations: Node.js Git Visual Studo Code An empty test Discord server Step 0: Login into Discord in the Browser Go

null 1 Jan 13, 2022
Discord.js Music Bot with buttons and slash support!

Music Bot Vote for us! (Please) How to use? Download the repo, create a .env file, and add your token into it. You need to change guildOnly to your gu

Garlic Team 59 Nov 24, 2022
Skeleton for a discord.js v13 bot written in TS with Slash Command support.

Discord.js v13 Bot Skeleton/Core This repository is a template for creating a Discord bot using Discord.js v13 with Slash Command support. This projec

Derock 6 Nov 2, 2022
Typescript Discord Bot Supporting Slash Commands.

Typescript Discord Bot Supporting Slash Commands.

Andrew Von Stieglitz 1 Jan 22, 2022
A feature-rich Giveaway Bot For Discord Written In Discord.js v13. Ft. Slash Commands & Buttons. Make Giveaways and…

Giveaway - Discord Bot A feature-rich Giveaway Bot For Discord Written In Discord.js v13. Ft. Slash Commands. Make Giveaways and more..! Explore the d

Chethan Yadav 27 Dec 5, 2022
Um bot discord usando Discord.js v14 (slash commands)

ANTES DE TUDO LEMBRE-SE: COPIAR CÓDIGOS NÃO É PROGRAMAR! USE APENAS PARA FINS EDUCATIVOS E QUE APRENDA COM ESSE REPOSITÓRIO!!! Descrição Fiz esse repo

Yurii 8 Dec 20, 2022
A simple Multi Guild Modmail Bot coded in v13 using the enmap Database Working on any host, like repl.it or vps! Its fast and working bug free + Security options!

Multiguild-Modmail A simple Multi Guild Modmail Bot coded in v13 using the enmap Database Working on any host, like repl.it or vps! Its fast and worki

Tomato6966 54 Oct 20, 2022
A Simple Discord.js Slash Commands For You <3

Simple Discord.js Slash Commands For You NPM Install You Need : Node.js v16+ Discord.js Dotenv Mongoose Visual Studio Code ( Ye Code Editor K Man Az V

null 15 Jun 2, 2022
JavaScript / TypeScript templates for Discord.js v13, Slash Commands only!

discord.js-v13-template Slash Command Template Command Handler Events Handler Commands Example JavaScript Template TypeScript Template I will be const

null 10 Nov 15, 2022
Erela.js & Discord.js@v13 (SLASH COMMAND!)

?? READ THIS NEED USE WITH PREFIX? HERE: >> NanoSpace ?? Short Feature Music System Playlists System Premium System Setup Request System Multi Languag

Nanotect. 44 Jan 1, 2023
Discord.js V13 Slash Commands, Events , Button Handler

Discord-js-v13-handler An advanced discord.js v13 command/events handler. Environment Variables To run this project, you will need to add the followin

Chethan Yadav 14 Oct 14, 2022
Yet another advanced djs slash command handler made by dano with ❤️

Advanced djs slash command handler Yet another advanced djs slash command handler made by dano with ❤️ Ultimate, Efficient, Slash command handler for

null 5 Nov 7, 2022
V13 kullanılarak yapılmış slash destekli guard botu. Basit bir şekilde yapılıp geliştirmesi size bırakılmıştır.

V13 Slash Guard V13 kullanılarak yapılmış slash destekli guard botu. Basit bir şekilde yapılıp geliştirmesi size bırakılmıştır. Config dosyasını doldu

Aris Lesnar 29 Dec 10, 2022
Discord.js V14 Slash-Command and Context-Menu Handler. Most efficient and advanced Handler out there!

Base discord.js v14 Command Handler Written by Tomato6966 Made for Deezcord Features ✔ Slash Commands ✔ Sub-Slash Commands ✔ Group-Sub-Slash Commands

Tomato6966 9 Dec 21, 2022
Music bot that uses Lavalink for its audio player

Msv Music ?? A Advanced Discord Music Bot Made With Lavalink And Have Many Premium Features with filters and more willl be add soon About Msv Music ??

M s v 36 Jan 4, 2022
A URL Shortener That Allow Users To Interact With Its API Through A Discord Bot

Shortem A URL Shortener That Allow Users To Interact With Its API Through A Discord Bot About Supports Multiple Databases Performant Uses discord.js v

Bots Studios 19 Sep 1, 2022