Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redbot #131

Merged
merged 3 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions code/controllers/configuration/entries/comms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@

/datum/config_entry/string/cross_comms_network
protection = CONFIG_ENTRY_LOCKED

/datum/config_entry/string/medal_hub_password
protection = CONFIG_ENTRY_HIDDEN

/datum/config_entry/string/bot_ip
22 changes: 22 additions & 0 deletions code/datums/world_topic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -256,3 +256,25 @@
.["admins"] += adm["afk"]

return list2params(.)

/datum/world_topic/whois
keyword = "whoIs"

/datum/world_topic/whois/Run(list/input)
. = list()
.["players"] = GLOB.clients

return list2params(.)

/datum/world_topic/getadmins
keyword = "getAdmins"

/datum/world_topic/getadmins/Run(list/input)
. = list()
var/list/adm = get_admin_counts()
var/list/presentmins = adm["present"]
var/list/afkmins = adm["afk"]
.["admins"] = presentmins
.["admins"] += afkmins

return list2params(.)
27 changes: 27 additions & 0 deletions deadspace/code/_subsystems/redbot.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
SUBSYSTEM_DEF(redbot)
name = "Bot Comms"
flags = SS_NO_FIRE

/datum/controller/subsystem/redbot/Initialize(timeofday)
var/comms_key = CONFIG_GET(string/comms_key)
var/bot_ip = CONFIG_GET(string/bot_ip)
var/round_id = GLOB.round_id
if(config && bot_ip)
var/query = "http://[bot_ip]/?serverStart=1&roundID=[round_id]&key=[comms_key]"
world.Export(query)
return ..()

/datum/controller/subsystem/redbot/proc/send_discord_message(var/channel, var/message, var/priority_type)
var/bot_ip = CONFIG_GET(string/bot_ip)
var/list/adm = get_admin_counts()
var/list/allmins = adm["present"]
. = allmins.len
if(!config || !bot_ip)
return
if(priority_type && !.)
send_discord_message(channel, "@here - A new [priority_type] requires/might need attention, but there are no admins online.") //Backup message should redbot be unavailable
var/list/data = list()
data["key"] = CONFIG_GET(string/comms_key)
data["announce_channel"] = channel
data["announce"] = message
world.Export("http://[bot_ip]/?[list2params(data)]")
Loading