![The all-seeing eye of the RebolBot! Well, maybe it's just a Rebol block.](http://www.rebolsource.net/assets/img/rebol-3d-160x160.png) RebolBot is a chat bot with a natural English dialect interface, specifically targeting the StackOverflow chat rooms. Yet it has a modular design, can post tweets to Twitter, and could be modified with only a little effort to work with other chat systems. An instance of the bot hangs out in the [[Rebol and Red]](http://chat.stackoverflow.com/rooms/291/rebol-and-red) room, where it runs under its own account. There are many features, including logging the chats in a database and providing additional searchability. But especially useful on SO is that it executes code in a sandboxed environment for teaching and testing purposes. For instance, addressing the bot with the following input *(using shift-enter to generate chat newlines)* @RebolBot code: [1 +] append code 2 do code Will cause it to reply with: == 3 The bot can currently do evaluations for [any language supported by ideone.com](http://ideone.com/faq#faq_supported_langs). However, since Rebol is its "native tongue", arbitrary expressions from other languages need to be enclosed in a string literal, as those languages may have different parse rules. Do note that asymmetric curly braces can be used in Rebol for string constants, which **{allows {matched pairs of braces} without escaping, not to mention "quotes AND apostro'phes"}** @RebolBot do/ideone ruby { puts "You need curly braces, though this specific case could parse as Rebol." } [Source is available on GitHub](https://github.com/gchiu/rebolbot). It is currently under 400 lines for the main bot (not including command modules which can be included or not, as desired). Commands vary from a couple of lines to around 130 for the most complex. --- ##Screenshot / Code Snippet Addressing the bot in chat with: > @RebolBot help Will produce: > I respond to these commands > Note: `[]` means optional input or shows expected datatype, `(|)` means choice: > **( do | do/2 | do/red | do/boron )** `expression` *"evaluates Rebol/Rebol-like expression in a sandboxed interpreter"* > **( hi | hello | goodnight | goodbye | bye | [ good ] [ night | morning | afternoon | evening ])** `some-text` *"returns a greeting to the user who greeted bot"* > **cc** `id` "retrieves curecode data" > **delete [ loud ]** *"in reply to a bot message will delete if in time"* > **do/ideone** `which-lang [word! string! integer!] expression` *"evaluates a source expression for the specified language"* > **fetch** `id` *"retrieves stored JSON message by its message-id"* > **help** *"this help"* > **present[ ? ]** *"prints users currently online"* > **private session [ in ]** `room-number` *"Starts a private session with the bot in another room."* > **save** `key [string! word!] description [string!] link [url!]` *"save key with description and link"* > **keys** *"returns known keys"* > **remove key** *"removes key (requires authorized user)"* > **find** `descript [string! word!]` *"shows keys with description containing descript"* > **save my** `details url! [ timezone [ time! ] ]` *"saves your details with url +/- timezone"* > **search** `key` *"retrieves all messages in store that contains key"* > **show ( me | all ) links** [**like** `url` ] *"shows saved links (like url, if provided)"* > **show me your youtube videos** *"shows saved youtube videos"* > **show [ me ][ recent ] links ( by | from )** `user` *"shows links posted in messages by user"* > **source** `name` *"provides Rebol source for named function"* > **tweet** `[12345678 | "string"]` "Sends tweet of message number or string as @rebolbot" > **version** *"version of bot"* > **what is the ( meaning | purpose ) of life?** *"answers the biggest question of all"* > **what is the time?** > **who do you know** *"returns a list of all known users"* > **who is** `user` *"returns user details and page"* > **? key** `[ for user | @user ]` *"Returns link and description"* --- ##About The bot runs as a console process. As implemented it is using the REST API that is visible (but not documented) when you use *chat.stackoverflow.com*. It can reflect on itself, and will provide its own source code on questioning. To see what the RebolBot does with the HTML that is returned from the remote service it is currently using, take a look at the [`evaluate-expression`](https://github.com/gchiu/rebolbot/blob/78c689f41b2f51f18d47159f1ac34cfaba52d470/commands/do-rebol-and-rebol-like-expression-command.r3#L134) function. This doesn't have to be a "service" in a formal sense - any of the many REPLs out there could serve as an evaluation target. But please: before sending traffic to a site from the bot, make make sure you have the OK of the site owner. *(Quick shout out to Ideone for giving RebolBot a free extended requests API key!)* Keep in mind that this bot is quite young so you can still expect some rough edges to show here and there. Again, you are welcome to drop by the Rebol chat room and discuss the script in general, or have us try to help with customizing it for your needs. [Rebol](http://rebol.com) (and [Red](http://www.red-lang.org)) - keepin' it simple! ###License [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html) ###Download [Rebol Binaries](http://rebolsource.net) - So tiny! Yes, that's all you'll need. No install. The script can be run on any platform supported by Rebol (Linux, OS X, Windows, Android) --- ##Contact [Graham Chiu on GitHub](https://github.com/gchiu); [Graham Chiu on SO chat](http://chat.stackoverflow.com/users/76852/graham-chiu) [Adrian Sampaleanu on GitHub](https://github.com/asampal); [Adrian Sampaleanu on SO chat](http://chat.stackoverflow.com/users/1792095/adrian)