Socket
Socket
Sign inDemoInstall

@gramio/autoload

Package Overview
Dependencies
30
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @gramio/autoload

Autoload commands plugin for GramIO


Version published
Maintainers
1
Install size
3.17 MB
Created

Readme

Source

@gramio/autoload

Autoload commands plugin for GramIO.

Usage

full example

Register the plugin

// index.ts
import { Bot } from "gramio";
import { autoload } from "@gramio/autoload";

const bot = new Bot(process.env.TOKEN as string)
    .extend(autoload())
    .onStart(console.log);

bot.start();

export type BotType = typeof bot;

Create command

// commands/command.ts
import type { BotType } from "..";

export default (bot: BotType) =>
    bot.command("start", (context) => context.send("hello!"));

Options

KeyTypeDefaultDescription
pattern?string"**/*.{ts,js,cjs,mjs}"Glob patterns
path?string"./commands"the path to the folder
onLoad?(params: { absolute: string; relative: string }) => unknownthe hook that is called when loading a file
onFinish?(paths: { absolute: string; relative: string }[]) => unknown;the hook that is called after loading all files

and other glob package options

Keywords

FAQs

Last updated on 10 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc