mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-27 06:00:23 +01:00
General Cleanup (#19088)
* Remove unused news_articles system * Rip out the webhook system * Merk bot/ * Rip out old IRC code * Move the malf_ai manual * Clean up the tools folder * Revert "Remove unused news_articles system" This reverts commit b1295ce8fa714ea35d768365c267b4b60fcd2faa. * Put these back
This commit is contained in:
@@ -82,14 +82,6 @@ SUBSYSTEM_DEF(ticker)
|
||||
|
||||
/datum/controller/subsystem/ticker/Initialize()
|
||||
start_at = world.time + (CONFIG_GET(number/lobby_countdown) * 10)
|
||||
SSwebhooks.send(
|
||||
WEBHOOK_ROUNDPREP,
|
||||
list(
|
||||
"map" = station_name(),
|
||||
"url" = get_world_url()
|
||||
)
|
||||
)
|
||||
|
||||
return SS_INIT_SUCCESS
|
||||
|
||||
/datum/controller/subsystem/ticker/fire(resumed = FALSE)
|
||||
@@ -218,7 +210,6 @@ SUBSYSTEM_DEF(ticker)
|
||||
GLOB.round_start_time = REALTIMEOFDAY
|
||||
SEND_SIGNAL(src, COMSIG_TICKER_ROUND_STARTING, world.time)
|
||||
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_ROUND_START)
|
||||
SSwebhooks.send(WEBHOOK_ROUNDSTART, list("url" = get_world_url()))
|
||||
|
||||
// Spawn randomized items
|
||||
for(var/id, value in GLOB.multi_point_spawns)
|
||||
|
||||
@@ -363,12 +363,8 @@ SUBSYSTEM_DEF(vote)
|
||||
|
||||
if(VOTE_RESTART)
|
||||
if(config.allow_vote_restart || usr.client.holder)
|
||||
var/admin_number_present = send2irc_adminless_only(usr.ckey, usr)
|
||||
if(admin_number_present <= 0 || usr.client.holder)
|
||||
if(tgui_alert(usr, "Are you sure you want to start a RESTART VOTE? You should only do this if the server is dying and no staff are around to investigate.", "RESTART VOTE", list("No", "Yes I want to start a RESTART VOTE")) == "Yes I want to start a RESTART VOTE")
|
||||
initiate_vote(VOTE_RESTART, usr.key)
|
||||
else
|
||||
to_chat(usr, span_warning("You can't start a RESTART VOTE while there are staff around. If you are having an issue with the round, please ahelp it."))
|
||||
if(tgui_alert(usr, "Are you sure you want to start a RESTART VOTE? You should only do this if the server is dying and no staff are around to investigate.", "RESTART VOTE", list("No", "Yes I want to start a RESTART VOTE")) == "Yes I want to start a RESTART VOTE")
|
||||
initiate_vote(VOTE_RESTART, usr.key)
|
||||
if(VOTE_GAMEMODE)
|
||||
if(config.allow_vote_mode || usr.client.holder)
|
||||
initiate_vote(VOTE_GAMEMODE, usr.key)
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
SUBSYSTEM_DEF(webhooks)
|
||||
name = "Webhooks"
|
||||
dependencies = list(
|
||||
/datum/controller/subsystem/server_maint,
|
||||
)
|
||||
flags = SS_NO_FIRE
|
||||
var/list/webhook_decls = list()
|
||||
|
||||
/datum/controller/subsystem/webhooks/Initialize()
|
||||
load_webhooks()
|
||||
return SS_INIT_SUCCESS
|
||||
|
||||
/datum/controller/subsystem/webhooks/proc/load_webhooks()
|
||||
|
||||
if(!fexists(HTTP_POST_DLL_LOCATION))
|
||||
log_world("Unable to locate HTTP POST lib at [HTTP_POST_DLL_LOCATION], webhooks will not function on this run.")
|
||||
return
|
||||
|
||||
var/list/all_webhooks_by_id = list()
|
||||
var/list/all_webhooks = decls_repository.get_decls_of_subtype(/decl/webhook)
|
||||
for(var/wid in all_webhooks)
|
||||
var/decl/webhook/webhook = all_webhooks[wid]
|
||||
if(webhook.id)
|
||||
all_webhooks_by_id[webhook.id] = webhook
|
||||
|
||||
webhook_decls.Cut()
|
||||
var/webhook_config = safe_file2text("config/webhooks.json")
|
||||
if(webhook_config)
|
||||
for(var/webhook_data in cached_json_decode(webhook_config))
|
||||
var/wid = webhook_data["id"]
|
||||
var/wurl = webhook_data["url"]
|
||||
var/list/wmention = webhook_data["mentions"]
|
||||
if(wmention && !islist(wmention))
|
||||
wmention = list(wmention)
|
||||
log_world("Setting up webhook [wid].")
|
||||
if(wid && wurl && all_webhooks_by_id[wid])
|
||||
var/decl/webhook/webhook = all_webhooks_by_id[wid]
|
||||
webhook.urls = islist(wurl) ? wurl : list(wurl)
|
||||
for(var/url in webhook.urls)
|
||||
if(!webhook.urls[url])
|
||||
webhook.urls[url] = list()
|
||||
else if(!islist(webhook.urls[url]))
|
||||
webhook.urls[url] = list(webhook.urls[url])
|
||||
if(wmention)
|
||||
webhook.mentions = wmention?.Copy()
|
||||
webhook_decls[wid] = webhook
|
||||
log_world("Webhook [wid] ready.")
|
||||
else
|
||||
log_world("Failed to set up webhook [wid].")
|
||||
|
||||
/datum/controller/subsystem/webhooks/proc/send(var/wid, var/wdata)
|
||||
var/decl/webhook/webhook = webhook_decls[wid]
|
||||
if(webhook)
|
||||
if(webhook.send(wdata))
|
||||
log_world("Sent webhook [webhook.id].")
|
||||
// to_chat(world, "Webhook sent: [webhook.id].")
|
||||
else
|
||||
log_world("Failed to send webhook [webhook.id].")
|
||||
// to_chat(world, "Webhook failed to send: [webhook.id].")
|
||||
|
||||
/client/proc/reload_webhooks()
|
||||
set name = "Reload Webhooks"
|
||||
set category = "Debug"
|
||||
|
||||
if(!check_rights_for(src, R_HOLDER))
|
||||
return
|
||||
|
||||
if(!SSwebhooks.initialized)
|
||||
to_chat(usr, span_warning("Let the webhook subsystem initialize before trying to reload it."))
|
||||
return
|
||||
|
||||
log_world("[usr.key] has reloaded webhooks.")
|
||||
log_and_message_admins("has reloaded webhooks.")
|
||||
SSwebhooks.load_webhooks()
|
||||
|
||||
/client/proc/ping_webhook()
|
||||
set name = "Ping Webhook"
|
||||
set category = "Debug"
|
||||
|
||||
if(!check_rights_for(src, R_HOLDER))
|
||||
return
|
||||
|
||||
if(!length(SSwebhooks.webhook_decls))
|
||||
to_chat(usr, span_warning("Webhook list is empty; either webhooks are disabled, webhooks aren't configured, or the subsystem hasn't initialized."))
|
||||
return
|
||||
|
||||
var/choice = tgui_input_list(usr, "Select a webhook to ping.", "Ping Webhook", SSwebhooks.webhook_decls)
|
||||
if(choice && SSwebhooks.webhook_decls[choice])
|
||||
var/decl/webhook/webhook = SSwebhooks.webhook_decls[choice]
|
||||
log_and_message_admins("has pinged webhook [choice].", usr)
|
||||
log_world("[usr.key] has pinged webhook [choice].")
|
||||
webhook.send()
|
||||
Reference in New Issue
Block a user