Omnimaga

General Discussion => Technology and Development => Web Programming and Design => Topic started by: epic7 on December 30, 2012, 09:16:48 pm

Title: EpicBot (epic7's IRC bot)
Post by: epic7 on December 30, 2012, 09:16:48 pm
So, here's my IRC bot that has a bunch of random utilities :P
It'll be around 24/7 once I get my withg account all set up
(Thanks, alberthro! :P)

The bot is coded in Java using PircbotX.
Source code (https://dl.dropbox.com/u/93019118/EpicBot.java)

Also, when I say pastebin, I'm referring to pastehtml.com.

Here are the commands that it has so far:

%define [word]

Retrieves the definition of a word.

Example:
<epic7> %define enigma
<epic7> [EpicBot] mystery , enigma , secret , closed book (noun) - something that baffles understanding and cannot be explained; "how it got out is a mystery"; "it remains one of nature's secrets"
<epic7> [EpicBot] For full definition, go to http://goo.gl/JvAje

<epic7> %define Sorunome
<epic7> [EpicBot] Sorunome (noun) - Derpy Hooves
<epic7> [EpicBot] For full definition, go to THE GAME


%shorten [URL]

Shortens a URL

Example:
<epic7> %shorten http://omnimaga.org
<epic7> [EpicBot] Shortened URL: http://goo.gl/q6Cjv


%paste [message]

Sends a message to a pastebin; html code is accepted

Example:
<epic7> %paste <h1>I AM HUNGRY</h1>
<epic7> [EpicBot] Pasted message: http://goo.gl/3rgBJ


%log

Pastes a log of the past 64 posts on your channel.
Html tags are apparently accepted in the log; that's a bug :P

Example:
<epic7> %log
<epic7> [EpicBot] Log for #omnimaga-spam: http://goo.gl/44jTJ


%dice [amount]

Rolls a given amount of dice, up to 2048. Even though nobody would ever need to roll 2048 dice at once :P

Example:
<epic7> %dice 2048
<epic7> [EpicBot] http://goo.gl/Z5CRK


%translate [from] [to] [message]

Translates text and sends it to pastebin. Sends to pastebin by default because I can't get the special characters to work correctly in omnom.
Uses bing translator api. Probably won't be very reliable, but whatever :P

For from and two, accepted values are
e- English
f- French
d or g- German
s- Spanish

Example:
<epic7> %translate e d Where's my dinner?
<epic7> [EpicBot] http://goo.gl/pUeGS


%stranslate [from] [to] [message]

Does the same as above, but posts to IRC instead of giving a pastebin link.

Example:
<epic7> %stranslate s e quise comer un reloj porque ellos son deliciosos
<epic7> [EpicBot] I wanted to eat a clock because they are delicious


%translol [message]

Does nothing useful, but can be kinda funny.
Translates from English to French, French to German, German to Spanish, and Spanish back to English :P

Example:
<epic7> %translol Felicitations, malefactors! I am endeavoring to misappropriate the formulary for the preparation of affordable comestibles! WHO WILL JOIN ME?!
<epic7> [EpicBot] Congratulations of the jury, the criminals! I'm trying to capture the list of medicinal products for the preparation of affordable edible! WHO WILL JOIN ME?


Other commands
%time
%test
%whoami
Title: Re: EpicBot (epic7's IRC bot)
Post by: Sorunome on December 31, 2012, 01:19:11 am
Oh, nice!
And to your html bug: When loggin replace < with &lt; and replace > with &gt; and " with &quot; and & with &amp; and watch the magic happen :D
Title: Re: EpicBot (epic7's IRC bot)
Post by: epic7 on December 31, 2012, 01:45:21 am
And that just makes it show the tags in text instead of the actual HTML?
Title: Re: Re: EpicBot (epic7's IRC bot)
Post by: Nick on December 31, 2012, 02:18:03 am
Wow, nice one, very nice :)
I like the define sorunome, that definition seems about right.
Title: Re: EpicBot (epic7's IRC bot)
Post by: ElementCoder on December 31, 2012, 04:34:01 am
And that just makes it show the tags in text instead of the actual HTML?
That's right :)
Also I didn't know about PircbotX :O and have always been using the plaing old Pircbot, maybe it's time to remake my bots with this one :P
Nice bot :)
[edit] Like the pastebin feature, mind if I use it in my bots as well (with credit ofc :P)?
Title: Re: EpicBot (epic7's IRC bot)
Post by: epic7 on December 31, 2012, 11:20:18 am
Sure, you can use that.

This was running regular pircbot until yesterday. I switched because pircbot didn't have support for SSL like pircbotx does, and I need SSL to get on the withg server.
Title: Re: EpicBot (epic7's IRC bot)
Post by: Sorunome on January 28, 2013, 07:08:05 pm
Logging has a bug: it doesn't display any /me messages.
Title: Re: EpicBot (epic7's IRC bot)
Post by: epic7 on January 28, 2013, 07:09:16 pm
Maybe I'll try to fix that someday :P

Also, when I log into other channels, like #THE_GAME for example, those also get logged into the #omnimaga one
Title: Re: EpicBot (epic7's IRC bot)
Post by: Sorunome on January 28, 2013, 07:10:28 pm
/me lost

How about you have a array in which are all channels you are in?
That way it might be easier with logging
or have in front of the message stuff like
#omnimaga:message
and then when logging you only grab the ones from #omnimaga/#THE_GAME etc.