Skip to content
No description, website, or topics provided.
JavaScript Shell
Branch: master
Clone or download
Latest commit accbfb4 Aug 28, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
pics Use headless chrome instead of nightmare Aug 12, 2017
source fixed url Jul 19, 2019
.eslintrc.json Fix styling issues per eslint Apr 26, 2016
.gitignore Add npm-debug to .gitignore Apr 27, 2016
README.md Update README.md Mar 15, 2018
bookmarklet-dev.js Fix broken link in chrome Jan 28, 2015
bookmarklet.js Change CDN to rawgit.com Jan 2, 2016
build.js fixed the build, unlink wants a callback Jul 19, 2019
license.txt fixed license Nov 17, 2012
loader.user.js changed the config to omit the keys, those are loaded in loader.user.js Apr 18, 2018
master.js parts not args Aug 28, 2019
master.min.js parts not args Aug 28, 2019
package-lock.json Fresh build before I make any changes May 3, 2018
package.json Use headless chrome instead of nightmare Aug 12, 2017
publi.sh no more silly killy Oct 17, 2016
run-headless.config.json.SAMPLE Implement external config file Nov 7, 2015
run-headless.js Use headless chrome instead of nightmare Aug 12, 2017
style.md

README.md

For usage info, on how to use the bot, see here.

Running the bot

The bot is currently a big dangle-on script running in your browser. Run bookmarklet.js in your browser to get it up an' running. For some tips on handling the bot, see Bot Handling.

If you wish, you can also run it headlessly on top of phantomjs and node:

  • Install phantomjs 2 (yes, it has to be 2 and above). Differs from platform to platform.
  • Install nightmare: npm install nightmare
  • Edit your credentials into run-headless.js
  • Hit the road: env DEBUG=nightmare node run-headless.js

Building

# one must first get the repo
$ git clone https://github.com/Zirak/SO-ChatBot.git
$ cd SO-ChatBot

# linting
npm run lint

# building
$ node build.js
# or
$ npm run build

The result will be in master.js and master.min.js

The provided publi.sh automagically does building, adds all changed items to commit and publishes for you:

$ ./publi.sh commit-message

The Bot API

(, a very short explanation of a limited subset of)

For a real cover, check the source code or this wiki page or console.log(bot). Should be straightforward.

//add a bot command
bot.addCommand({
    name : 'command_name',
    fun : commandFunction,

    //permissions object (can be ommitted for all-can-use, all-can-del)
    permissions : {
        use : 'NONE' /*or*/ 'ALL' /*or*/ [array of usrids],
        del : 'NONE' /*or*/ 'ALL' /*or*/ [array of usrids]
    },

    //whether the command is asynchronous or not (default false)
    async : true /*or*/ false
});

//add a listening regex and a corresponding callback
bot.listen(
    //regular expression or array of regular expressions
    pattern,

    callbackFun
);
You can’t perform that action at this time.