botyo-api
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

Botyo API

npm npm npm

The Botyo API module is a collection of types, interfaces and classes for developing modules for Botyo.

Requirements

  • Node.js >= 8.3.0

Install

npm install --save botyo-api

Documentation

The documentation for the Botyo API is available here:

Example

TypeScript

import { AbstractCommandModule, Message } from "botyo-api";
 
export default class HelloCommand extends AbstractCommandModule
{
    getCommand(): string
    {
        return "hello";
    }
 
    getDescription(): string
    {
        return "Responds to the hello";
    }
 
    getUsage(): string
    {
        return "";
    }
 
    validate(msg: Message, args: string): boolean
    {
        return true;
    }
 
    async execute(msg: Message, args: string): Promise<any>
    {
        return this.getRuntime().getChatApi().sendMessage("Hello world!", msg.threadID);
    }
}

JavaScript

const AbstractCommandModule = require('botyo-api').AbstractCommandModule;
 
class HelloCommand extends AbstractCommandModule
{
    getCommand() {
        return "hello";
    }
 
    getDescription() {
        return "Responds to the hello";
    }
 
    getUsage() {
        return "";
    }
 
    validate(msg, args) {
        return true;
    }
 
    async execute(msg, args) {
        return this.getRuntime().getChatApi().sendMessage("Hello world!", msg.threadID);
    }
}
 
module.exports = HelloCommand;

Readme

Keywords

none

Package Sidebar

Install

npm i botyo-api

Weekly Downloads

3

Version

2.0.1

License

Apache-2.0

Unpacked Size

61.1 kB

Total Files

94

Last publish

Collaborators

  • ivkos