RS Bot

This project was developed in 2008, when I was 15 years old, mostly for fun. It is now deprecated, as the Jabber server is not running anymore, nor is GTalk Jabber-based anymore, and most of the online services would not work anymore to begin with. This page only exists for archival purposes.

Project summary

RS Bot was a chatting bot on Jabber, sometimes available at bot@lab.rolisoft.net.

The bot was written in C#, and its primary objective is not chatting but to provide quick access to some utilities, like dictionaries and other online tools.

Complete rewrite

This project was started back in 2008 when I was a medium-ish level C# developer. Although I could implement all the features here, I wasn't really doing it the right way.

When you sent a message to the bot, it would split it at the spaces, and pass the first element of the array to a big switch statement, which would then call the functions. And yeah, the whole bot was a huge .cs file.

In July 2010, I started rewriting the whole bot. Now every function is in a category and every category has its own namespace. Every public static function with a Command(string command) attribute is a command, like this:

[Command("gt")]
[Description("Translate a text using Google Translate")]
[Parameters("Language pairs", "Message to translate")]
public static string[] GoogleTranslate(string languagePair, string message){
    return new[] { "..." };
}

At startup, the software scans its namespace for such functions. Using the Description(string description) and Parameters(params string[] parameters) attributes, it can automatically generate and provide help for the commands.

Disabled commands

There are commands which are implemented, but disabled on the live demo at bot@lab.rolisoft.net. These usually use a web service which forbids using them through bots. For example, currency exchange using xe.com and translation using webforditas.net are such services.

An interactive C# shell (similar to Mono's interactive C# shell) is also implemented, but obviously disabled in the live example. Letting users run Process.Start("rm", "-rf /"); wouldn't be a good idea. The live example runs on the rolisoft.net's server from under Mono, so rm -rf / is the correct command to run, not del /f /s /q C:\

Commands

Basic stuff

!ver - get bot version

RoliSoft: !ver
RS-Bot: RS Bot v0.2
RS-Bot: Copyright© 2008-2009 RoliSoft

!date - get server time

RoliSoft: !date
RS-Bot: 2008 Nov 29 05:08:19 +02:00

!leet string - leetify string

RoliSoft: !leet rolisoft
RS-Bot: 201150PH7

!rot string - rotate string 180° with the Revfad algorithm

RoliSoft: !rot rolisoft
RS-Bot: ʇɟosıloɹ

!md5 string - calculate md5 hash of the string

RoliSoft: !md5 rolisoft
RS-Bot: 72f6d46cebd24c765f77220b16c2bfe3

!sha1 string - calculate sha1 hash of the string

RoliSoft: !sha1 rolisoft
RS-Bot: c96bca3042a2323b2b6b438a3385ed651872f9a6

!sha256 string - calculate sha256 hash of the string

RoliSoft: !sha256 rolisoft
RS-Bot: 6182f7e5492cab428b6f14d58a5bcb9882bd37662c8bf9ea10f62d530a9eba4b

!sha512 string - calculate sha512 hash of the string

RoliSoft: !sha512 rolisoft
RS-Bot: 4da7ec65d456815578ddff08c7c3ec75045df78c82774677e4e6fb05a8135e1ea31a02f95ad6fabd0bc5cad23abff95661ea18477417fadb5e4a862eb70dc6b0

Online tools

!gc query - ask Google Calculator

RoliSoft: !gc 8.12 GB / 10 MB/s
RS-Bot: (8.12 GB) / (10 (MB / s)) = 13.8581333 minutes

!define acronym - search for the word’s definition with Google

RoliSoft: !define HDMI
RS-Bot: High Definition Multimedia Interface (www.digital-cp.com/glossary)

!xe amount from to - XE.com’s Universal Currency Converter

RoliSoft: !xe 25 eur ron
RS-Bot: 25.00 EUR = 94.4677 RON

!rss url - feed reader

RoliSoft: !rss http://www.sg.hu/plain/rss.xml
RS-Bot: SG.hu Hírmagazin
RS-Bot: Tovább zuhan a Terminátor-sorozat (2009-02-26 16:57:58)
RS-Bot: Védőréteggel a graffitik ellen (2009-02-26 16:39:52)
RS-Bot: Csak 2010-ben érkezik az Office 14 (2009-02-26 10:45:11)
RS-Bot: Európai kutatót díjazott a Google (2009-02-26 10:12:04)
RS-Bot: Ingyenes WLAN-hálózat lesz Berlinben (2009-02-26 08:56:17)

!msnw city - get weather information from MSN Weather

RoliSoft: !msnw targu mures
RS-Bot: Tîrgu Mureș, ROU
RS-Bot: Now: Clear, -1°C
RS-Bot: Tomorrow: Flurries, -5°C - 2°C

!joke - get a random hungarian joke

RoliSoft: !joke
RS-Bot: Miért nem tudja leírni a szőke nő a 11-et?
Mert nem tudja, melyik szám van elől.

!quote - get a random programming/math/science quote

RoliSoft: !quote
RS-Bot: “Some people, when confronted with a problem, think “I know, I’ll use regular expressions.” Now they have two problems.”- Jamie Zawinski

!regex group url pattern - extract information from an URL using regular expressions

RoliSoft: !regex 1 http://eztv.it/shows/186/house/ 41">([^<]+)
RS-Bot: House S05E16 720p HDTV x264-CTU

If you’re not using groups or you just want the whole matching string, use 0 for the group parameter.

!lolcat text - translate a text from english to lolcat (uses speaklolcat.com - slow due to HTTP requests to speaklolcat’s server)

RoliSoft: !lolcat I'm a robot who is speaking the cats' language!
RS-Bot: IM ROBOT HOO IZ SPEAKIN TEH KATS LANGUAGE!

!lolca2 text - translate a text from english to lolcat (uses LOLcatizer Translation Engine - fast, implemented in C#)

RoliSoft: !lolca2 I'm a robot who is speaking the cats' language!
RS-Bot: Iz a robot hoo iz meaowin teh catkind’ languaeg!

!shuffle text - encode text using the Cambridge theorem

RoliSoft: !shuffle According to Cambridge, only the start and stop letters are necessary to let your brain interpret a word.
RS-Bot: Adccirnog to Ciamdrgbe, olny the srtat and sotp leetrts are nsecasrey to let yuor biran ipntrreet a wrod.

!search engine keywords - search the web

RoliSoft: !search g chatting bot in C#
RS-Bot: Google Search for “chatting bot in C#” (~267,000 results)
RS-Bot: chat bot in C#.. need help improving it… please - C#
RS-Bot: CodeProject: Building an AI Chatbot using a Regular Expression
RS-Bot: chat bot in C# [Archive] - DevMaster.net Forums
RS-Bot: How to write a simple chat Skype Bot using C# « Igor Yalovoy’s Weblog
RS-Bot: AIM Chat Bot (C#, C++ / C, Programming, Visual Basic .Net)

Available search engines are: g Google, y Yahoo, l Live.

!tv view country channel - get TV information from port.ro/hu

RoliSoft: !tv next hu discovery channel
RS-Bot: Discovery Channel
RS-Bot: 16:00 - Piszkos munkák
RS-Bot: 17:00 - Allítólag…
RS-Bot: 18:00 - Smash Lab

view can be: next - print the current and next two shows, today - print full listing, search - see below
country can be: ro, hu, cz, sk
channel is a regular expression which will be run against port.xx’s channel list

!tv search country channel | show - search for a show on a TV channel; only today and in the show’s name

RoliSoft: !tv search ro axn sci-fi | star trek
RS-Bot: AXN SCI-FI
RS-Bot: 20:00 - Star Trek S01E16
RS-Bot: 2:00 - Star Trek S01E17

!online url - check if a site is online or not (due to the small timeouts we’re using, there may be false negatives)

RoliSoft: !online stackoverflow.com
RS-Bot: Stack Overflow is online!

Dictionaries

All dictionaries below use ISO 639-1 language codes.

!gt from/to text - translate text with Google Translator

RoliSoft: !gt en/ro This car is green.
RS-Bot: Această maşină este verde.

Available languages are: ar, bg, ca, cs, da, de, el, en, es, fi, fr, hi, hr, id, it, iw, ja, ko, lt, lv, nl, no, pl, pt, ro, ru, sk, sl, sr, sv, tl, uk, vi, zh-CN, zh-TW.

!sztaki from/to word - search in the SZTAKI dictionary

RoliSoft: !sztaki en/hu accommodate
RS-Bot: hozzáalkalmaz, elszállásol, illeszkedik, hozzászokik

Available language pairs are: en/hu, hu/en, de/hu, hu/de, fr/hu, hu/fr, it/hu, hu/it, nl/hu, hu/nl, pl/hu, hu/pl.

!wf from/to text - translate text with Webforditas.hu

RoliSoft: !wf en/hu Time flies like an arrow.
RS-Bot: Az időlegyek kedvelnek egy nyilat.

Available language pairs are: en/hu, hu/en.

!trans from/to word - search in Transylvania.info’s dictionary

RoliSoft: !trans hu/ro eros
RS-Bot: solid, tare, puternic

Available language pairs are: hu/ro, ro/hu, en/ro, ro/en, hu/en, en/hu.

In the last two dictionaries it is better to search for words without accents due to the GET’s encoding.

!ud word - search in Urban Dictionary

RoliSoft: !ud arachnophobia
RS-Bot: Somebody that fears spiders

Spelling

Available languages are: english, hungarian.

!mspell lang word - check for spelling using Microsoft Office 2007

RoliSoft: !mspell en acomodate
RS-Bot: accomodate

!msyn lang word - get the synonymes of a word using Microsoft Office 2007

RoliSoft: !msyn hu autó
RS-Bot: gépkocsi, személygépkocsi, kocsi, automobil, gépjármű, jármű;

!aspell lang word - check for spelling using Aspell

RoliSoft: !aspell hu jukas
RS-Bot: lyukas, lukas

Reminders

!reminder list - list reminders

RoliSoft: !reminder list
RS-Bot: 1 — MythBusters on Discovery — 2008-11-29 18:06:53

!reminder add text | date - create a new reminder (date can be relative, in 3 hours, or full, 20:45, 2008/12/10 15:00…)

RoliSoft: !reminder add MythBusters on Discovery | in 15 minutes
RS-Bot: Reminder added!

!reminder del id - delete a reminder

RoliSoft: !reminder del 2
RS-Bot: Reminder deleted.

Alert:

RS-Bot: MythBusters on Discovery (reminder)

Error debugging

In case you do something that results in an exception (bold red text), type !strace and send the whole answer with the error message to my email address.

Example:

RoliSoft: !note list
RS-Bot: Could not find file ‘notes.xml’.
RoliSoft: !strace
RS-Bot: listNotes(user) @ Program.cs:562
RS-Bot: xmpp_OnMessage(sender, msg) @ Program.cs:114

Other

Components

Download

This software is not available for download at this time.

If you want to use the bot add bot@lab.rolisoft.net to your contact list, and when it’s online have fun with it. Available from any Jabber network, including GTalk. You must use a HTML-capable client, because RS Bot returns some texts formatted with HTML.