05-20-2014, 03:40 PM
I made an IRC bot in ruby that actually looks good and works good.
Code:
require 'cinch'
#create a shutdown passcode thingdoodle
passcode = String Random.rand 9999
puts passcode
bot = Cinch::Bot.new do
configure do |c|
c.server = "irc.freenode.org"
c.channels = ["#OREServerChat"]
c.nick = "Malcy"
end
#yell at noobs
on :message, /^!apply (.+) \| (.+)/ do |m, player, insult|
m.reply "Hey! #{player}! You need to apply on http://openredstone.org you #{insult}!"
end
#give free milk
on :message, /^!freemilk (.+)/ do |m, player|
player.upcase!
m.reply "OHH YEAH GET THAT WHITE JUICE RIGHT OUT OF THERE, #{player}!"
end
#whack folk
on :message, /^!whack (.+) \| (.+)/ do |m, player, object|
m.reply "*Wacks #{player} about a bit with a #{object}*"
end
#help folk
on :message, /^!help/ do |m|
m.reply "Malcy is an ignorant asshole."
end
#insult link posters
on :message, /http|https/ do |m|
m.reply "HA! LINK POSTING IS FOR NUBS!"
end
#die in a fire
on :message, /^!killwithfire (.+)/ do |m, pass|
if pass == passcode
m.reply "CYA SUCKAS"
exit
end
end
end
bot.start