Skip to content
A new powerful and simple JavaScript StackExchange Chat Bot that doesn't rely on a browser with documentation!
Branch: master
Clone or download
jbis9051 Plugins are now listed in config file instead of app.js as per https:…
…//stackoverflow.com/users/2615209/ben-fortune suggestion. Added a check to see if AFK message is from bot in which case it is ignored. Fixed stats command bugs.
Latest commit 756dc76 Jun 16, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config Plugins are now listed in config file instead of app.js as per https:… Jun 16, 2019
docs Updated basic API for BOILERPLATE docs. Updated CHAT_API fkey csrf to… Jun 7, 2019
src
.gitignore Initial Commit May 18, 2019
README.md Plugins are now listed in config file instead of app.js as per https:… Jun 16, 2019
app.js Plugins are now listed in config file instead of app.js as per https:… Jun 16, 2019
package-lock.json Removed puppeteer dependency :) | Stability is unknown May 31, 2019
package.json Removed puppeteer dependency :) | Stability is unknown May 31, 2019

README.md

SO-ChatBot

Description

I could not find a simple and easy to understand StackExchange chat bot API so I decided to create my own. This can be easily used to create your own bot, simply remove the plugins and add your own!

I am also planning on writing full documentation for the how SO Chat works, as none currently exists.

Usage

|| command args 

Bot Documentation Here

Stack Exchange API Documentation

Commands Documentation Here

Note: The format for commands on the documentation page is wrong. It is displayed like to make it easier to understand (aka I couldn't figure out how to make it the proper format with the docs generator I am using). Instead it is the format above (|| command args). Any return values listed are sent in the chat.

Plugin API Function Documentation

More in depth explanation coming soon

Most plugins will require just a simple addCommand function. For more advanced functions see below:

module.exports = function (bot) {
    bot.addCommand({
        name: "name",
        args: ["some","args"],
        description: "description",
        shortcuts: [ /* aliases of the command */
            "diffname",
            "morenames"
        ],
        ignore: false, /* should be ignored in help menu */
        permissions: ["all"], /* who can run this command */
        func: (msg, args, client, sudo) => {
            if (!sudo) { /* is sudo required? */
              bot.client.send("Try `sudo`");
              return;
            }
            bot.json_request('https://example.com', (err, res, body) => { /* make a JSON request */
                bot.client.send(body.text); /* Send message */
            });
        }
    });
    bot.RegisterListener({ /* register custom listner for the msg */
            func: (msg) =>{ /* returns true if you want to activate the callback, false otherwise
                return (msg.content.toLowerCase().includes("java"));
            },
            callback:(msg) => {
                bot.client.send(`Hey @${msg.user_name}...`); /* get msg's author's username */
                setTimeout(() => bot.client.send(`Did you know...`), 1500);
                setTimeout(() => bot.client.send(`__***3 BILLION DEVICES RUN JAVA***__`), 2000);
            }
        });
       
};

You can’t perform that action at this time.