npm.io
2023.5.22 • Published 3 years ago

meowerbot

Licence
MIT
Version
2023.5.22
Deps
2
Size
13 kB
Vulns
0
Weekly
0
DeprecatedThis package is deprecated

MeowerBot.js

Port of meower.py to Node.js and TypeScript

Installation

npm install meowerbot

Example Bot

import Bot from "meowerbot";

const bot = new Bot(); 

bot.onLogin(() => { // Runs when logged in
    bot.post("Hello from MeowerBot.js!");
});

bot.onCommand("help", (ctx) => { // Runs when a new post with a bot command is sent
    ctx.reply("Commands: @username help");
});

bot.onMessage((data) => { // Runs when the server sends a new message
    console.log(`New message: ${data}`);
});

bot.onClose(() => { // Runs when the bot gets disconnected
    console.log("Disconnected");
    bot.login("username", "password");
});

bot.login("username", "password"); // Init, then login to Meower