Skip to content

Instantly share code, notes, and snippets.

@raa0121
Created July 30, 2014 12:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raa0121/8569d9a99235bc888a1f to your computer and use it in GitHub Desktop.
Save raa0121/8569d9a99235bc888a1f to your computer and use it in GitHub Desktop.
$LOAD_PATH << File.dirname(__FILE__) # require_relative対策
require 'net/irc'
require 'configBcDice.rb'
require 'bcdiceCore.rb'
require 'ArgsAnalizer.rb'
require 'IniFile.rb'
require 'diceBot/DiceBotLoader'
$LOAD_PATH << File.dirname(__FILE__) + "/irc"
require 'ircLib.rb'
require 'ircBot.rb'
server = "irc.trpg.net"
port = 6667
defaultLoginChannelsText = "#irc_test"
nick = ""
userName = ""
ircName = ""
defaultGameType = ""
ircCode = "UTF-8"
extraCardFileName = ""
ircBot = IrcClient.new(server, port, {:nick => nick, :user => userName, :real => ircName})
room = defaultLoginChannelsText.split(',').first
ircBot.setRoom(room)
ircBot.setGameByTitle( defaultGameType )
unless( extraCardFileName.empty? )
ircBot.readExtraCard( extraCardFileName )
end
ircBot.setQuitFuction( Proc.new{destroy} )
ircBot.setPrintFuction( Proc.new{|message| printText(message) } )
ircThread = Thread.new do
begin
p "start!"
ircBot.start
rescue Exception => e
p "error"
p e.to_s
ensure
ircBot = nil
end
end
ircThread.join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment