tags:

views:

211

answers:

1
+1  Q: 

Ruby IRC With DCC

I cant seem to figure out DCC using Isaac but I cant seem to figure out how to receive and send files with the bot. I found a different IRC bot here that supports DCC but I cant figure out how to implement it with my app. Can anyone help me?

This is the current state of my app:

require 'isaac'

configure do |c|
    c.nick     = "TheBot"
    c.realname = "TheBot"
    c.server   = "irc.quakenet.org"
    c.verbose  = true
    c.port     = 6667
end

trap("INT") do
    quit "Bye bye." # Doesnt work
end

on :connect do
    join "#thechannelhere"
end

on :private,  /DCC SEND (.*) (.*) 0 (.*) (.*)/ do |filename, ip, filesize, token|
    position = 0
    raw "PRIVMSG #{nick} :\001DCC RESUME #{filename} 0 #{position} #{token}\001"
end

on :private,  /DCC ACCEPT (.*) 0 (.*) (.*)/ do |filename, filesize, token|
    peer_ip = IPSocket.getaddress(Socket.gethostname)
    raw "PRIVMSG #{nick} :\001DCC SEND #{filename} #{peer_ip} 6667 #{filesize} #{token}\001"
end
+1  A: 

Hi

I have some code here

Its not the greatest, but sending does work. Only problem I noticed with your code is that you're not converting your ip address to a long. DCC expects it in this format

Tim Sjoberg