Merge pull request #49601 from optimumtact/discordisliterallyafuck

Improves discord roleapi system
This commit is contained in:
81Denton
2020-03-01 21:29:13 +01:00
committed by GitHub
3 changed files with 36 additions and 2 deletions
+32
View File
@@ -43,3 +43,35 @@
alert(usr, "Account link started. Please ping the bot of the server you\'re currently on, followed by \"verify [usr.ckey]\" in Discord to successfully verify your account (Example: @Mr_Terry verify [usr.ckey])")
// This is so people cant fill the notify list with a fuckload of ckeys
SSdiscord.notify_members -= "[stored_id]" // The list uses strings because BYOND cannot handle a 17 digit integer
// IF you have linked your account, this will trigger a verify of the user
/client/verb/verify_in_discord()
set category = "OOC"
set name = "Verify Discord Account"
set desc = "Reverify your account to the discord if you get banned, you bad banana"
// Safety checks
if(!CONFIG_GET(flag/sql_enabled))
to_chat(src, "<span class='warning'>This feature requires the SQL backend to be running.</span>")
return
if(!SSdiscord) // SS is still starting
to_chat(src, "<span class='notice'>The server is still starting up. Please wait before attempting to link your account!</span>")
return
if(!SSdiscord.enabled)
to_chat(src, "<span class='warning'>This feature requires the server is running on the TGS toolkit.</span>")
return
if(SSdiscord.reverify_cache[usr.ckey] == TRUE)
to_chat(src, "<span class='warning'>Thou can only do this once a round, if you're stuck seek help.</span>")
return
SSdiscord.reverify_cache[usr.ckey] = TRUE
var/stored_id = SSdiscord.lookup_id(usr.ckey)
if(!stored_id) // Account is not linked
to_chat(usr, "Link your discord account via the linkdiscord verb in the OOC tab first");
return;
else // Account is already linked
// Role the user
SSdiscord.grant_role(stored_id)
+3 -2
View File
@@ -20,12 +20,13 @@
/datum/tgs_chat_command/verify/Run(datum/tgs_chat_user/sender, params)
var/lowerparams = replacetext(lowertext(params), " ", "") // Fuck spaces
var/discordid = SSdiscord.id_clean(sender.mention)
if(SSdiscord.account_link_cache[lowerparams]) // First if they are in the list, then if the ckey matches
if(SSdiscord.account_link_cache[lowerparams] == "[SSdiscord.id_clean(sender.mention)]") // If the associated ID is the correct one
if(SSdiscord.account_link_cache[lowerparams] == discordid) // If the associated ID is the correct one
// Link the account in the DB table
SSdiscord.link_account(lowerparams)
// Role the user
SSdiscord.grant_role(lowerparams)
SSdiscord.grant_role(discordid)
return "Successfully linked accounts"
else
return "That ckey is not associated to this discord account. If someone has used your ID, please inform an administrator"