From 238292a9a6e6dd41197022d4ae345e1c735d71a3 Mon Sep 17 00:00:00 2001 From: Jon Date: Fri, 11 Dec 2015 19:58:05 +0000 Subject: [PATCH] Makes changes to allow IRC bot output at Sparky's request. --- code/controllers/configuration.dm | 8 ++++++++ code/modules/ext_scripts/irc.dm | 32 +++++++++++++++++-------------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index aba57b47a2..06b6208e6d 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -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 diff --git a/code/modules/ext_scripts/irc.dm b/code/modules/ext_scripts/irc.dm index 7975316508..4b125a9604 100644 --- a/code/modules/ext_scripts/irc.dm +++ b/code/modules/ext_scripts/irc.dm @@ -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)