Makes changes to allow IRC bot output at Sparky's request.

This commit is contained in:
Jon
2015-12-11 19:58:05 +00:00
parent 5d3e3cf863
commit 238292a9a6
2 changed files with 26 additions and 14 deletions

View File

@@ -171,6 +171,8 @@ var/list/gamemode_cache = list()
var/enter_allowed = 1
var/use_irc_bot = 0
var/use_node_bot = 0
var/irc_bot_port = 0
var/irc_bot_host = ""
var/irc_bot_export = 0 // whether the IRC bot in use is a Bot32 (or similar) instance; Bot32 uses world.Export() instead of nudge.py/libnudge
var/main_irc = ""
@@ -538,6 +540,12 @@ var/list/gamemode_cache = list()
if("use_irc_bot")
use_irc_bot = 1
if("use_node_bot")
use_node_bot = 1
if("irc_bot_port")
config.irc_bot_port = value
if("irc_bot_export")
irc_bot_export = 1

View File

@@ -1,21 +1,25 @@
/proc/send2irc(var/channel, var/msg)
if(config.use_irc_bot && config.irc_bot_host)
if(config.irc_bot_export)
spawn(-1) // spawn here prevents hanging in the case that the bot isn't reachable
world.Export("http://[config.irc_bot_host]:45678?[list2params(list(pwd=config.comms_password, chan=channel, mesg=msg))]")
if (config.use_irc_bot)
if (config.use_node_bot)
shell("node bridge.js -h \"[config.irc_bot_host]\" -p \"[config.irc_bot_port]\" -c \"[channel]\" -m \"[msg]\"")
else
if(config.use_lib_nudge)
var/nudge_lib
if(world.system_type == MS_WINDOWS)
nudge_lib = "lib\\nudge.dll"
if (config.irc_bot_host)
if(config.irc_bot_export)
spawn(-1) // spawn here prevents hanging in the case that the bot isn't reachable
world.Export("http://[config.irc_bot_host]:45678?[list2params(list(pwd=config.comms_password, chan=channel, mesg=msg))]")
else
nudge_lib = "lib/nudge.so"
if(config.use_lib_nudge)
var/nudge_lib
if(world.system_type == MS_WINDOWS)
nudge_lib = "lib\\nudge.dll"
else
nudge_lib = "lib/nudge.so"
spawn(0)
call(nudge_lib, "nudge")("[config.comms_password]","[config.irc_bot_host]","[channel]","[msg]")
else
spawn(0)
ext_python("ircbot_message.py", "[config.comms_password] [config.irc_bot_host] [channel] [msg]")
spawn(0)
call(nudge_lib, "nudge")("[config.comms_password]","[config.irc_bot_host]","[channel]","[msg]")
else
spawn(0)
ext_python("ircbot_message.py", "[config.comms_password] [config.irc_bot_host] [channel] [msg]")
return
/proc/send2mainirc(var/msg)