Code Monkey home page Code Monkey logo

so-chatbot's Introduction

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
);

so-chatbot's People

Contributors

5pitf1re avatar amaanc avatar awalgarg avatar benjamingr avatar bobvul avatar canop avatar erikroyall avatar incognito avatar jimmyhoffa avatar kendfrey avatar petkaantonov avatar ralt avatar retsam avatar rlemon avatar schas002 avatar shmiddty avatar somekittens avatar teward avatar the-quill avatar zirak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

so-chatbot's Issues

!!/lmgtfy Troll okok (and others)

New function: Whenever a user in a given list (that admins can add to) posts in the chat, the bot responds as if the user had said !!/google $USERS_MESSAGE

Add Error on /fuckable Ages Less Than 14

The algorithm gets a little strange at values less than 14.

!!/fuckable 12
You're one sick puppy. A person that age can shag down to 13, and is the lower limit of a person of 10 year.

Poll command

Kinda like karma but more controlled.

!!/poll <pollname>
> <pollname> #<<optionIndex> option1 <score>> #<<optionIndex> option2 <score>> [#<<optionIndex> optionN <score>> ..]

so basically you have named 'polls' which have defined values which you can vote on by index or name (case sensitive?)

!!/poll <pollname> <optionName||optionIndex>
> Vote registered!

now to create a poll we could take two avenues.

  1. we could use a separate command !!/createpoll []
  2. we could create a keyword 'create' before the poll names and follow the same structure as the previous option

The polls would only allow each user to vote once per poll, and would expire after a 7(?) day timespan (at which point it would ping the user who created it with the results).

I feel this would be much better than just the karma bot, because the only real use we had for that command was for polls. but they could be abused and were uncontrollable.

anyways, tell me what you guys think?

De-troll bored plugin

The basic idea of the plugin is not bad. At the moment, some of the content the bot posts is mediocre at best.

I like the idea of having quotes if we'd add a link to background information on each quote as well.

What I'd like to see removed are all the trolling quotes as they don't add anything valuable, we have enough trolls anyway, we don't need an automated trolling mechanism.

/learn shouldn't allow invalid commands

When using /learn the bot will accept simply "<>" as a new command
(Example: !!/learn '<>')

This in turn throws a 400 error when she tries to run the command later and it's empty.

Add a stop watch function to ze bot

It would be cool to let the bot count for us if we need it.

You'd start it with !!/count and end it with !!/stop. It would then return the time it took between start and stop.

Implement ze stop watch!

help for user commands

optional: make a way to add additional help for user commands.

!!/help google2 set "This duplicates the functionality of the !!/google command"

Add link to search page in /google

As requested here.

Example:

/google justice
[*](http://www.google.com/search?q=justice) [Justice](http://www.shopjustice.com/) ; [Justice - Wikipedia, the free encyclopedia](http://en.wikipedia.org/wiki/Justice) ; [Justice (band) - Wikipedia, the free encyclopedia](http://en.wikipedia.org/wiki/Justice_(band))

Code-eval isn't working

Because you're (me!?) an idiot, code-eval isn't working. Fix it by actually making a proper build system, so you can get around the un-comfortableness of manually passing the worker-code through the encoding process.

add !!/undo command or similar

Basically, say we're watching some idiot interacting with the bot and he decides to make it say or do something stupid. Yea we can just bin the message, but I was thinking; while the edit grace period exists and the bot can edit or remove it's own message... maybe make that a owner command.

Make /convert syntax unambiguous

Currently, /convert accepts two syntaxes:

/convert <number><unit>
/convert <number><currency> to <currency>

The former prints out all known units in the same "group" as <unit>; latter prints out the (hopefully) converted currency.

That sucks. How about this:

/convert <number><unit> [to|in <unit>]

If is a currency, the other is required. Otherwise, every known translation is used.

Editing commanding message results in new bot message

If someone sends a command, and has a typo or just edits the results later, the bot (instead of editing the already sent message) sends a new one.

Change it so that replying to edited messages results in an edited message.

Spam Detection

At the moment spam detection is left to the active members in the room; however if we are not monitoring the room full time often people feel the need to post the same link or question multiple times to get help.

It would be cool if the bot could monitor this type of chatter and either 1) warn the user then bin it, or 2) publicly call the user out for spamming, or 3) warn, bin, then call out the user, then flag.

Mechanics can be determined by the room. However I really feel this type of spam detection would be helpful for keeping the transcript free of clutter.

eval syntax errors unhelpful

When entering an invlalid syntax into eval "!!/eval 3x5", the bot doesn't say what the problem is: "SyntaxError: Unexpected token ILLEGAL"

Make commands excuted/learned, room specific

Users are abusing the bot, by summoning it to private rooms, or going into sandbox and doing things maliciously behind cover, e.g.

Going into sandbox / private room and going
!!/mute user 'whatever reason'
!!/forget 'command'

Which goes across all rooms undetected, I believe this should be addressed and fixed, or commands like !!/forget should be admin only, non-room-owner users are using this command which I don't think they should have access too.

Spam, damned spam

Currently there is no sort of spam-control. The bot will happily send hundreds and thousands and possibly gagillions of messages, were a gagillion a number.

Not cool, bro (self). Not cool.

ELIZA mode

There are quite a few sites out there with open source JS implementations of ELIZA (example. Maybe we could have the bot have an Eliza mode? Something like !!/eliza on which will make the bot go ELIZA on any direct pings.

Can has?

user list is taken on load, not live.

You changed the way you list owners, and now you pass in the users list from the chat. This is done on Instantiation and never again (it seems), so if the owner is not in the room when the bot is loaded they get no permissions.

idk if reloading the user list at the point of a protected command would be bad? talk to me in chat if this issue makes no sense to you.

Learn is broken

When trying to teach the bot stuff you get "(temporarily disabled)"

Add vote-based command invocation

Some commands, like /ban and /die, are limited to owner-only, so that if a user starts abusing the bot and nobody's around, other users can't do anything about it.

Add support for vote-based invocation of some privileged commands. When 2 (or more) users invoke privileged command with the same parameters, it'll be executed.

A "vote" will be cleared after 10 minutes (10? maybe more?)

Eval and dice notation different

Dice notation should allow for parenthesis, and the eval function should use the same engine. (Eval should also be able to use 3d6)

github command

/github repoName

pings the user with a git link , of the first root git.

Takes an additional command for opening a specific users git repo [ since they can fork ]

/github reponame target-users

pings the user with the link to target-users fork of the repo

Idle responsiveness

I'd really like to be able to feed the bot some stuff for idling, for instance, random quotes, questions, jokes, site feeds. Also, it would be nice to turn the idle chatter on or off, manipulate the duration, and invoke it on command (like !!/idle would produce something random to talk about).

Dice notation awesome, but incomplete

You have 2*3d6+4 working, good job.

http://en.wikipedia.org/wiki/Dice_notation lists additional notations that might be nice to support:

Some games extend the standard notation to "AdXkY" where Y is the number of dice kept from the roll. Notation of the form 8d10k6 should be interpreted as "Roll eight ten-sided dice, keep the highest six, and sum them". Some people use "AdX-L" (where L is the letter L, not a number) to mean drop the lowest one. If that could be supported too, that'd be great. (And H instead of L for dropping the highest)

Another mechanic is "penetration", designated by "AdXp", which means for each dice that got the max roll, roll one additional dice, recursive. "3d6p" would mean roll 3d6 with penetration. If those three are [2, 6, 6], then the roller rolls two additional dice for the sixes. If those two are [3, 6], then the roller rolls one more dice. If that's a [6], then it rolls again. (etc). So a "3d6p" might result in [2, 6, 6; 3, 6; 6; 1 => 30]

If someone uses both mechanics at the same time, keep in mind that dice dropped from the first mechanic should not be re-reolled even if they're a max roll: "5d2K4p" might result in [2, 2, 2, 2, 2], in which case only the top four are kept, [2, 2, 2, 2], and then the penetration kicks in and rolls four additional dice. There is no penetration dice for the 2 that was dropped.

Welcoming users

RebolBot in the Rebol room maintains a list of users it has already seen, and welcomes new users to the room, prompting them with a link to the FAQ.

I think this could be an interesting feature for SOChatBot

inhistory command

It would be nice (interesting) to have a [today]inhistory command for the bot which would give interesting facts about specific days in history.
I imagine the implementation working something like this:
!!/inhistory

  • would return a interesting fact from any year about the current date in history. (example: for today it could say "April 19th 1552 - Mauritius of Saksen captures Karel")

if a date is given; instead of searching the current date you could provide information on the given date, like:
!!/inhistory MM-DD

  • would return a interesting fact for that date.

The other side of this is to provide just the year:
!!/inhistory YYYY

  • would return the fact for todays date with the given year.

Then the full ISO8601 format for the date and given year
!!/inhistory YYYY-MM-DD

I do suggest for any date handling we follow ISO8601 and possible in the help/info for the command link to the wikipedia page explaining the format.

I have found a python implementation that searches wikipedia if it helps. I have to imagine there are APIs out there to provide this information as well.

Voting mechanism

http://chat.stackoverflow.com/transcript/message/8357632#8357632

the bot needs a voting mechanism, like !!/vote "is AmberRoxanna real?" yes no

My thoughts go in a different direction than just voting: Karma. In some IRC rooms, the bots allowed you to write username++ or username-- to increase/decrease username's karma.

It could go as general a voting mechanism; for this example, AmberRoxannaReal++ or AmberRoxannaReal--

So, proposal:

  • Listen to messages containing something++, something--
  • Expose via command /vote something 1 or /vote something -1 (RFC on arguments)
  • Lacking a 2nd argument, /vote something, display the karma (votes) for something

MDN link routing sucks balls

Make it better:

  • Global object tests should be way more limited;
  • Better window and general DOM object detection;
  • Be stricter. Search pages are better than dead links.

clever SO ChatBot

You have asked us our opinions on what should be the future of the bored response plugin. http://chat.stackoverflow.com/transcript/message/9366762#9366762 I ultimately think the idea was sound, but the implementation of a finite and rather small amount of responses to select from was the issue.

I have a solution that would also make the bot appear more sentient. attach the cleverbot api (unofficial) to the bot so when we ping it @SOChatBot <text> it will respond from cleverbot.

I realize some filtering for profanities should probably be done to prevent the bot from being banned for a 'fuck' or two.

https://github.com/fojas/cleverbot-node here is a node.js project for the cleverbot api.

http://pastebin.com/s0fFWU0g python example.

I'm sure there are more similar ones out there. Thoughts everyone?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.