mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
Made IRCbot's password and host a config option.
Added a hook to send a message to the bot when a round starts. Signed-off-by: Mloc-Argent <colmohici@gmail.com>
This commit is contained in:
@@ -118,7 +118,10 @@
|
|||||||
var/gateway_delay = 18000 //How long the gateway takes before it activates. Default is half an hour.
|
var/gateway_delay = 18000 //How long the gateway takes before it activates. Default is half an hour.
|
||||||
var/ghost_interaction = 0
|
var/ghost_interaction = 0
|
||||||
|
|
||||||
|
var/comms_password = ""
|
||||||
|
|
||||||
var/use_irc_bot = 0
|
var/use_irc_bot = 0
|
||||||
|
var/irc_bot_host = ""
|
||||||
var/main_irc = ""
|
var/main_irc = ""
|
||||||
var/admin_irc = ""
|
var/admin_irc = ""
|
||||||
var/python_path = "" //Path to the python executable. Defaults to "python" on windows and "/usr/bin/env python2" on unix
|
var/python_path = "" //Path to the python executable. Defaults to "python" on windows and "/usr/bin/env python2" on unix
|
||||||
@@ -407,6 +410,12 @@
|
|||||||
if("ghost_interaction")
|
if("ghost_interaction")
|
||||||
config.ghost_interaction = 1
|
config.ghost_interaction = 1
|
||||||
|
|
||||||
|
if("comms_password")
|
||||||
|
config.comms_password = value
|
||||||
|
|
||||||
|
if("irc_bot_host")
|
||||||
|
config.irc_bot_host = value
|
||||||
|
|
||||||
if("main_irc")
|
if("main_irc")
|
||||||
config.main_irc = value
|
config.main_irc = value
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
/proc/send2irc(var/channel, var/msg)
|
/proc/send2irc(var/channel, var/msg)
|
||||||
if(config.use_irc_bot)
|
if(config.use_irc_bot && config.irc_bot_host)
|
||||||
ext_python("ircbot_message.py", "[channel] [msg]")
|
ext_python("ircbot_message.py", "[config.comms_password] [config.irc_bot_host] [channel] [msg]")
|
||||||
return
|
return
|
||||||
|
|
||||||
/proc/send2mainirc(var/msg)
|
/proc/send2mainirc(var/msg)
|
||||||
if(config.use_irc_bot && config.main_irc)
|
if(config.use_irc_bot && config.main_irc && config.irc_bot_host)
|
||||||
ext_python("ircbot_message.py", "[config.main_irc] [msg]")
|
ext_python("ircbot_message.py", "[config.comms_password] [config.irc_bot_host] [config.main_irc] [msg]")
|
||||||
return
|
return
|
||||||
|
|
||||||
/proc/send2adminirc(var/msg)
|
/proc/send2adminirc(var/msg)
|
||||||
if(config.use_irc_bot && config.admin_irc)
|
if(config.use_irc_bot && config.admin_irc && config.irc_bot_host)
|
||||||
ext_python("ircbot_message.py", "[config.admin_irc] [msg]")
|
ext_python("ircbot_message.py", "[config.comms_password] [config.irc_bot_host] [config.admin_irc] [msg]")
|
||||||
return
|
return
|
||||||
@@ -82,6 +82,8 @@
|
|||||||
|
|
||||||
sleep_offline = 1
|
sleep_offline = 1
|
||||||
|
|
||||||
|
send2mainirc("Server starting up on [config.server? "byond://[config.server]" : "byond://[world.address]:[world.port]"]")
|
||||||
|
|
||||||
master_controller = new /datum/controller/game_controller()
|
master_controller = new /datum/controller/game_controller()
|
||||||
spawn(1)
|
spawn(1)
|
||||||
master_controller.setup()
|
master_controller.setup()
|
||||||
|
|||||||
@@ -211,15 +211,21 @@ USEALIENWHITELIST
|
|||||||
##Remove the # to let ghosts spin chairs
|
##Remove the # to let ghosts spin chairs
|
||||||
#GHOST_INTERACTION
|
#GHOST_INTERACTION
|
||||||
|
|
||||||
|
## Password used for authorizing ircbot and other external tools.
|
||||||
|
#COMMS_PASSWORD
|
||||||
|
|
||||||
## Uncomment to enable sending data to the IRC bot.
|
## Uncomment to enable sending data to the IRC bot.
|
||||||
#USE_IRC_BOT
|
#USE_IRC_BOT
|
||||||
|
|
||||||
|
## Host where the IRC bot is hosted. Port 45678 needs to be open.
|
||||||
|
#IRC_BOT_HOST localhost
|
||||||
|
|
||||||
## IRC channel to send information to. Leave blank to disable.
|
## IRC channel to send information to. Leave blank to disable.
|
||||||
#MAIN_IRC #main
|
#MAIN_IRC #main
|
||||||
|
|
||||||
## IRC channel to send adminhelps to. Leave blank to disable adminhelps-to-irc.
|
## IRC channel to send adminhelps to. Leave blank to disable adminhelps-to-irc.
|
||||||
#ADMIN_IRC #admin
|
#ADMIN_IRC #admin
|
||||||
|
|
||||||
## Path to the python executable on the system. Leave blank for default.
|
## Path to the python2 executable on the system. Leave blank for default.
|
||||||
## Default is "python" on Windows, "/usr/bin/env python2" on UNIX.
|
## Default is "python" on Windows, "/usr/bin/env python2" on UNIX.
|
||||||
PYTHON_PATH
|
#PYTHON_PATH
|
||||||
|
|||||||
@@ -6,18 +6,18 @@
|
|||||||
import sys,cPickle,socket
|
import sys,cPickle,socket
|
||||||
|
|
||||||
def pack():
|
def pack():
|
||||||
ip = sys.argv[1]
|
passwd = sys.argv[1]
|
||||||
|
ip = sys.argv[3]
|
||||||
try:
|
try:
|
||||||
data = sys.argv[2:] #The rest of the arguments is data
|
data = sys.argv[4:] #The rest of the arguments is data
|
||||||
except:
|
except:
|
||||||
data = "NO DATA SPECIFIED"
|
data = "NO DATA SPECIFIED"
|
||||||
dictionary = {"ip":ip,"data":["PASSWORD"] + data}
|
dictionary = {"ip":ip,"data":[passwd] + data}
|
||||||
pickled = cPickle.dumps(dictionary)
|
pickled = cPickle.dumps(dictionary)
|
||||||
nudge(pickled)
|
nudge(pickled)
|
||||||
def nudge(data):
|
def nudge(data):
|
||||||
HOST = "IRCBOT IP"
|
HOST = sys.argv[2]
|
||||||
PORT = 45678
|
PORT = 45678
|
||||||
size = 1024
|
|
||||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
s.connect((HOST,PORT))
|
s.connect((HOST,PORT))
|
||||||
s.send(data)
|
s.send(data)
|
||||||
|
|||||||
Reference in New Issue
Block a user