Skip to main content

Chat Documentation

GitHub Link:

https://github.com/jbis9051/SO-ChatBot/blob/master/CHAT_API.mdhttps://github.com/jbis9051/JamesSOBot/blob/master/docs/CHAT_API.md

Description:

I know many people have created bots in different languages. Thats why I need your help to contribute to the documentation so we can finally have documentation for how the Stack Exchange Chat works.

I have started with some main information on stuff like obtaining the fkey and establishing the WebSocket, but I encourage you to contribute your own findings and correct any inaccuracies!

Bot - Boilerplate

GitHub Link:

https://github.com/jbis9051/SO-ChatBot

Description:

I could not find a simple and easy to understand Stack Exchange 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!

Bot Documentation

You can test the bot here.

Chat Documentation

GitHub Link:

https://github.com/jbis9051/SO-ChatBot/blob/master/CHAT_API.md

Description:

I know many people have created bots in different languages. Thats why I need your help to contribute to the documentation so we can finally have documentation for how the Stack Exchange Chat works.

I have started with some main information on stuff like obtaining the fkey and establishing the WebSocket, but I encourage you to contribute your own findings and correct any inaccuracies!

Bot - Boilerplate

GitHub Link:

https://github.com/jbis9051/SO-ChatBot

Description:

I could not find a simple and easy to understand Stack Exchange 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!

Bot Documentation

You can test the bot here.

Chat Documentation

GitHub Link:

https://github.com/jbis9051/JamesSOBot/blob/master/docs/CHAT_API.md

Description:

I know many people have created bots in different languages. Thats why I need your help to contribute to the documentation so we can finally have documentation for how the Stack Exchange Chat works.

I have started with some main information on stuff like obtaining the fkey and establishing the WebSocket, but I encourage you to contribute your own findings and correct any inaccuracies!

Bot - Boilerplate

GitHub Link:

https://github.com/jbis9051/SO-ChatBot

Description:

I could not find a simple and easy to understand Stack Exchange 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!

Bot Documentation

You can test the bot here.

deleted 1446 characters in body
Source Link

Bot - Boilerplate

I could not find a simple and easy to understand Stack Exchange 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!

To add a plugin is really simple:

    module.exports = function (bot) {
    bot.addCommand({
        name: "name",
        args: ["some","args"],
        description: "description",
        shortcuts: [ /* aliases of the command */
            "diffname",
            "morenames"
        ],
        ignore: false, /* should it be listed in the 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);
            }
        });
       
};

Bot Documentation

You can test the bot here.

Bot

I could not find a simple and easy to understand Stack Exchange 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!

To add a plugin is really simple:

    module.exports = function (bot) {
    bot.addCommand({
        name: "name",
        args: ["some","args"],
        description: "description",
        shortcuts: [ /* aliases of the command */
            "diffname",
            "morenames"
        ],
        ignore: false, /* should it be listed in the 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);
            }
        });
       
};

Bot Documentation

Bot - Boilerplate

I could not find a simple and easy to understand Stack Exchange 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!

Bot Documentation

You can test the bot here.

added 73 characters in body
Source Link
added 2 characters in body; edited tags
Source Link
Brock Adams
  • 13k
  • 5
  • 39
  • 64
Loading
Source Link
Loading