SShttp + SSdiscord | ASYNCHRONOUS STUFF IN BYOND! (#14762)

* SShttp + SSdiscord | ASYNCHRONOUS STUFF IN BYOND!

* Cleanup

* HTTP Callback example

* Fixes rust instability

* More refactors

* This works

* The sanitizer (Now worth £3000)

* New configs + other stuff

* Lets give this a shot

* Farie changes

* Mentor support

* Farie fixes
This commit is contained in:
AffectedArc07
2020-11-07 16:57:47 +00:00
committed by GitHub
parent dbe4e00f43
commit 56752b0e78
29 changed files with 652 additions and 213 deletions
+8 -3
View File
@@ -43,9 +43,6 @@
// comment out the line below when debugging locally to enable the options & messages menu
//control_freak = 1
var/received_irc_pm = -99999
var/irc_admin //IRC admin that spoke with them last.
var/mute_irc = 0
var/ssd_warning_acknowledged = FALSE
////////////////////////////////////
@@ -99,3 +96,11 @@
var/byondacc_date
/// Days since the client's BYOND account was created
var/byondacc_age = 0
// Do not attempt to merge these vars together. They are for different things
/// Last world.time that a PM was send to discord by a player
var/last_discord_pm_time = 0
/// Last world/time that a PM was sent to the player by an admin
var/received_discord_pm = -99999 // Yes this super low number is intentional
+10 -9
View File
@@ -113,14 +113,14 @@
cmd_admin_pm(ckey_txt, null, href_list["type"])
return
if(href_list["irc_msg"])
if(!holder && received_irc_pm < world.time - 6000) //Worse they can do is spam IRC for 10 minutes
to_chat(usr, "<span class='warning'>You are no longer able to use this, it's been more then 10 minutes since an admin on IRC has responded to you</span>")
if(href_list["discord_msg"])
if(!holder && received_discord_pm < world.time - 6000) // Worse they can do is spam discord for 10 minutes
to_chat(usr, "<span class='warning'>You are no longer able to use this, it's been more then 10 minutes since an admin on Discord has responded to you</span>")
return
if(mute_irc)
to_chat(usr, "<span class='warning'You cannot use this as your client has been muted from sending messages to the admins on IRC</span>")
if(prefs.muted & MUTE_ADMINHELP)
to_chat(usr, "<span class='warning'>You cannot use this as your client has been muted from sending messages to the admins on Discord</span>")
return
cmd_admin_irc_pm()
cmd_admin_discord_pm()
return
@@ -561,7 +561,7 @@
var/watchreason = check_watchlist(ckey)
if(watchreason)
message_admins("<font color='red'><B>Notice: </B></font><font color='blue'>[key_name_admin(src)] is on the watchlist and has just connected - Reason: [watchreason]</font>")
send2irc(config.admin_notify_irc, "Watchlist - [key_name(src)] is on the watchlist and has just connected - Reason: [watchreason]")
SSdiscord.send2discord_simple_noadmins("**\[Watchlist]** [key_name(src)] is on the watchlist and has just connected - Reason: [watchreason]")
//Just the standard check to see if it's actually a number
@@ -760,7 +760,7 @@
if(!cidcheck_failedckeys[ckey])
message_admins("<span class='adminnotice'>[key_name(src)] has been detected as using a CID randomizer. Connection rejected.</span>")
send2irc(config.cidrandomizer_irc, "[key_name(src)] has been detected as using a CID randomizer. Connection rejected.")
SSdiscord.send2discord_simple_noadmins("[key_name(src)] has been detected as using a CID randomizer. Connection rejected.")
cidcheck_failedckeys[ckey] = TRUE
note_randomizer_user()
@@ -773,7 +773,7 @@
if(cidcheck_failedckeys[ckey])
// Atonement
message_admins("<span class='adminnotice'>[key_name_admin(src)] has been allowed to connect after showing they removed their cid randomizer</span>")
send2irc(config.cidrandomizer_irc, "[key_name(src)] has been allowed to connect after showing they removed their cid randomizer.")
SSdiscord.send2discord_simple_noadmins("[key_name(src)] has been allowed to connect after showing they removed their cid randomizer.")
cidcheck_failedckeys -= ckey
if (cidcheck_spoofckeys[ckey])
message_admins("<span class='adminnotice'>[key_name_admin(src)] has been allowed to connect after appearing to have attempted to spoof a cid randomizer check because it <i>appears</i> they aren't spoofing one this time</span>")
@@ -988,6 +988,7 @@
* Returns the data in a parsed, associative list
*/
/client/proc/retrieve_byondacc_data()
// Do not refactor this to use SShttp, because that requires the subsystem to be firing for requests to be made, and this will be triggered before the MC has finished loading
var/list/http[] = world.Export("http://www.byond.com/members/[ckey]?format=text")
if(http)
var/status = text2num(http["STATUS"])