Updated the linkage between the NanoTrasen IRC bot and the server.

- Server will now send adminhelps to the admin channel, with information if there is no admins online.
- Server will inform the admin channel if the last admin online logs out.
- When a round ends, the server will alert the main channel, supplying some statistics.
Additionally, laid the groundwork for an external scripts system.
This is fully configurable/togglable in the config.txt file.

Signed-off-by: Mloc-Argent <colmohici@gmail.com>
This commit is contained in:
Mloc-Argent
2013-07-02 23:41:40 +01:00
parent 12a79e4ade
commit cf4bd39f6e
11 changed files with 100 additions and 35 deletions

View File

@@ -106,15 +106,10 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an","of","monkey","
log_admin("HELP: [key_name(src)]: [original_msg] - heard by [admin_number_present] non-AFK admins.")
if(admin_number_present <= 0)
if(!admin_number_afk)
send2irc(ckey, "[original_msg] - No admins online")
send2adminirc("ADMINHELP from [key_name(src)]: [original_msg] - !!No admins online!!")
else
send2irc(ckey, "[original_msg] - All admins AFK ([admin_number_afk])")
send2adminirc("ADMINHELP from [key_name(src)]: [original_msg] - !!All admins AFK ([admin_number_afk])!!")
else
send2irc(ckey, original_msg)
send2adminirc("ADMINHELP from [key_name(src)]: [original_msg]")
feedback_add_details("admin_verb","AH") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
return
proc/send2irc(msg,msg2)
if(config.useircbot)
shell("python [config.nudge_script_path] [msg] [msg2]")
return

View File

@@ -0,0 +1,14 @@
/proc/send2irc(var/channel, var/msg)
if(config.use_irc_bot)
ext_python("ircbot_message.py", "[channel] [msg]")
return
/proc/send2mainirc(var/msg)
if(config.use_irc_bot && config.main_irc)
ext_python("ircbot_message.py", "[config.main_irc] [msg]")
return
/proc/send2adminirc(var/msg)
if(config.use_irc_bot && config.admin_irc)
ext_python("ircbot_message.py", "[config.admin_irc] [msg]")
return

View File

@@ -0,0 +1,9 @@
/proc/ext_python(var/script, var/args, var/scriptsprefix = 1)
if(scriptsprefix) script = "scripts/" + script
if(world.system_type == MS_WINDOWS)
script = replacetext(script, "/", "\\")
var/command = config.python_path + " " + script + " " + args
return shell(command)

View File

@@ -7,26 +7,7 @@
message_admins("Admin logout: [key_name(src)]")
if(admins_number == 0) //Apparently the admin logging out is no longer an admin at this point, so we have to check this towards 0 and not towards 1. Awell.
var/cheesy_message = pick( list( \
"I have no admins online!",\
"I'm all alone :(",\
"I'm feeling lonely :(",\
"I'm so lonely :(",\
"Why does nobody love me? :(",\
"I want a man :(",\
"Where has everyone gone?",\
"I need a hug :(",\
"Someone come hold me :(",\
"I need someone on me :(",\
"What happened? Where has everyone gone?",\
"Forever alone :("\
) )
if(cheesy_message)
cheesy_message += " (No admins online)"
send2irc("Server", "[cheesy_message]")
send2adminirc("[key_name(src)] logged out - no more admins online.")
..()
return 1