Skip to content

Commit

Permalink
Merge pull request #3202 from GremlingSS/Planetopics
Browse files Browse the repository at this point in the history
Adds a whitelist wrapper for the bot
  • Loading branch information
Tk420634 authored Sep 28, 2023
2 parents b150135 + a0226da commit fb09f63
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions code/datums/world_topic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@

/datum/world_topic/jsonrevision
keyword = "jsonrevision"
require_comms_key = TRUE

/datum/world_topic/jsonrevision/Run(list/input, addr)
var/datum/getrev/revdata = GLOB.revdata
Expand All @@ -311,3 +312,44 @@
))

return json_encode(data)

// Border Control Wrapper for removing/adding whitelists - Gremling da smoothbrain
// Keyword - "border" // The method to call this wrapper
// Mode Choice - "mode" // 0 - 1 - 2, 0: Check whitelist
// 1: Whitelist,
// 2: Unwhitelist.
// CKey - "ckey" // The target user.

#define CHK_WHTLST 0
#define WHTLST 1
#define UNWHTLST 2

/datum/world_topic/bordercontrol
keyword = "border"
require_comms_key = TRUE

/datum/world_topic/bordercontrol/Run(list/input, addr)
var/ckey = input["ckey"]
var/modeInput = text2num(input["mode"])
var/whitelistResult = BC_IsKeyWhitelisted(ckey)
switch(modeInput)
if(CHK_WHTLST)
return "[ckey] is [whitelistResult ? "" : "**NOT** "]whitelisted"

if(WHTLST) // If the proc returns true, they have been whitelisted, if not, they have already been whitelisted.
if(BC_WhitelistKey(ckey))
return "[ckey] has been whitelisted."
else
return "[ckey] has already been whitelisted."

if(WHTLST) // If the proc returns true, they have been removed, if not, they weren't on it originally.
if(BC_RemoveKey(ckey))
return "[ckey] has been removed."
else
return "[ckey] is already not on the whitelist."

return "Formatting error - KEY: [input["key"]] | MODE: [input["mode"]] | CKEY: [input["ckey"]] | WhitelistResult: [whitelistResult]"

#undef CHK_WHTLST
#undef WHTLST
#undef UNWHTLST

0 comments on commit fb09f63

Please sign in to comment.