mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-09 16:14:13 +00:00
Adds Discord bot messaging. (#11583)
* Adds Discord bot messaging. * More verbose admin messages
This commit is contained in:
@@ -180,6 +180,10 @@
|
||||
var/error_silence_time = 6000 // How long a unique error will be silenced for
|
||||
var/error_msg_delay = 50 // How long to wait between messaging admins about occurrences of a unique error
|
||||
|
||||
// Discord crap.
|
||||
var/discord_url
|
||||
var/discord_password
|
||||
|
||||
/datum/configuration/New()
|
||||
. = ..()
|
||||
var/list/L = typesof(/datum/game_mode) - /datum/game_mode
|
||||
@@ -232,10 +236,10 @@
|
||||
switch (name)
|
||||
if ("resource_urls")
|
||||
config.resource_urls = splittext(value, " ")
|
||||
|
||||
if("tts_server")
|
||||
|
||||
if("tts_server")
|
||||
config.tts_server = value
|
||||
|
||||
|
||||
if ("admin_legacy_system")
|
||||
config.admin_legacy_system = 1
|
||||
|
||||
@@ -559,6 +563,10 @@
|
||||
error_silence_time = value
|
||||
if("error_msg_delay")
|
||||
error_msg_delay = value
|
||||
if("discord_url")
|
||||
discord_url = value
|
||||
if("discord_password")
|
||||
discord_password = value
|
||||
|
||||
else
|
||||
diary << "Unknown setting in configuration: '[name]'"
|
||||
|
||||
@@ -247,6 +247,7 @@ datum/shuttle_controller/emergency_shuttle/process()
|
||||
|
||||
settimeleft(SHUTTLELEAVETIME)
|
||||
send2mainirc("The Emergency Shuttle has docked with the station.")
|
||||
send2maindiscord("The **Emergency Shuttle** has docked with the station.")
|
||||
captain_announce("The Emergency Shuttle has docked with the station. You have [round(timeleft()/60,1)] minutes to board the Emergency Shuttle.")
|
||||
world << sound('sound/AI/shuttledock.ogg')
|
||||
|
||||
@@ -366,4 +367,3 @@ datum/shuttle_controller/emergency_shuttle/process()
|
||||
S.direction = spawndir
|
||||
spawn()
|
||||
S.startmove()
|
||||
|
||||
|
||||
@@ -164,6 +164,7 @@
|
||||
feedback_set("escaped_on_pod_5",escaped_on_pod_5)
|
||||
|
||||
send2mainirc("A round of [src.name] has ended - [surviving_total] survivors, [ghosts] ghosts.")
|
||||
send2maindiscord("A round of **[name]** has ended - **[surviving_total]** survivors, **[ghosts]** ghosts.")
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
@@ -216,6 +216,7 @@ var/global/datum/controller/gameticker/ticker
|
||||
|
||||
if(0 == admins.len)
|
||||
send2adminirc("Round has started with no admins online.")
|
||||
send2admindiscord("**Round has started with no admins online.** {ADMIN_PING}")
|
||||
|
||||
/*
|
||||
supply_shuttle.process() //Start the supply shuttle regenerating points -- TLE
|
||||
|
||||
@@ -117,9 +117,14 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an","of","monkey","
|
||||
if(admin_number_present <= 0)
|
||||
if(!admin_number_afk)
|
||||
send2adminirc("HELP [key_name(src)]: [original_msg] - No admins online")
|
||||
send2admindiscord("**Help**: [key_name(src)]: `[original_msg]` - **No admins online** {ADMIN_PING}")
|
||||
|
||||
else
|
||||
send2adminirc("HELP [key_name(src)]: [original_msg] - All admins AFK ([admin_number_afk])")
|
||||
send2admindiscord("**Help**: [key_name(src)]: `[original_msg]` - **All admins AFK** ([admin_number_afk]) {ADMIN_PING}")
|
||||
|
||||
else
|
||||
send2adminirc("HELP [key_name(src)]: [original_msg]")
|
||||
send2admindiscord("**Help**: [key_name(src)]: `[original_msg]` - **[admin_number_present]** Active admins, **[admin_number_afk]** AFK admins.")
|
||||
|
||||
feedback_add_details("admin_verb","AH") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
return
|
||||
12
code/modules/ext_scripts/discord.dm
Normal file
12
code/modules/ext_scripts/discord.dm
Normal file
@@ -0,0 +1,12 @@
|
||||
/proc/send2maindiscord(var/msg)
|
||||
send2discord(msg, FALSE)
|
||||
|
||||
/proc/send2admindiscord(var/msg)
|
||||
send2discord(msg, TRUE)
|
||||
|
||||
/proc/send2discord(var/msg, var/admin = FALSE)
|
||||
if (!global.config.discord_url || !global.config.discord_password)
|
||||
return
|
||||
|
||||
var/url = "[global.config.discord_url]?pass=[url_encode(global.config.discord_password)]&admin=[admin ? "true" : "false"]&content=[url_encode(msg)]"
|
||||
world.Export(url)
|
||||
@@ -27,10 +27,17 @@
|
||||
if(admin_datums[src.ckey])
|
||||
if (ticker && ticker.current_state == GAME_STATE_PLAYING) //Only report this stuff if we are currently playing.
|
||||
var/admins_number = admins.len
|
||||
var/admin_number_afk = 0
|
||||
for(var/client/X in admins)
|
||||
if(X.is_afk())
|
||||
admin_number_afk++
|
||||
|
||||
var/available_admins = admins_number - admin_number_afk
|
||||
|
||||
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.
|
||||
if(available_admins == 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.
|
||||
send2adminirc("[key_name(src)] logged out - no more admins online.")
|
||||
send2admindiscord("[key_name(src)] logged out. **No more non-AFK admins online.** - **[admin_number_afk]** AFK {ADMIN_PING}")
|
||||
|
||||
INVOKE_EVENT(on_logout, list())
|
||||
|
||||
|
||||
@@ -137,6 +137,7 @@ var/savefile/panicfile
|
||||
sleep_offline = 1
|
||||
|
||||
send2mainirc("Server starting up on [config.server? "byond://[config.server]" : "byond://[world.address]:[world.port]"]")
|
||||
send2maindiscord("**Server starting up** on `[config.server? "byond://[config.server]" : "byond://[world.address]:[world.port]"]`. Map is **[map.nameLong]**")
|
||||
|
||||
processScheduler = new
|
||||
master_controller = new /datum/controller/game_controller()
|
||||
|
||||
@@ -308,3 +308,7 @@ SKIP_MINIMAP_GENERATION
|
||||
## ENABLE_WAGES
|
||||
## Comment out to disable wages being enabled by default.
|
||||
ENABLE_WAGES
|
||||
|
||||
# HTTP URL to send Discord messages to.
|
||||
# DISCORD_URL
|
||||
# DISCORD_PASSWORD
|
||||
|
||||
@@ -1128,6 +1128,7 @@
|
||||
#include "code\modules\events\viral_outbreak.dm"
|
||||
#include "code\modules\events\wallrot.dm"
|
||||
#include "code\modules\ext_scripts\copylogs.dm"
|
||||
#include "code\modules\ext_scripts\discord.dm"
|
||||
#include "code\modules\ext_scripts\irc.dm"
|
||||
#include "code\modules\ext_scripts\python.dm"
|
||||
#include "code\modules\ext_scripts\watchdog.dm"
|
||||
|
||||
Reference in New Issue
Block a user