The Botyo API module is a collection of types, interfaces and classes for developing modules for Botyo.
- Node.js >= 8.3.0
npm install --save botyo-api
The documentation for the Botyo API is available here:
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);
}
}
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;