forked from Baystation12/Baystation12
-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: xeno whitelist panel, FBP whitelist (#1917)
- Loading branch information
Showing
12 changed files
with
771 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#define WEBHOOK_XENO_WHITELIST "webhook_xeno_whitelist" | ||
#define COLOR_WEBHOOK_XENO 0xf2b000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/singleton/webhook/xeno_msg | ||
id = WEBHOOK_XENO_WHITELIST | ||
|
||
/singleton/webhook/xeno_msg/get_message(list/data) | ||
. = ..() | ||
|
||
if(!length(data)) | ||
.["content"] = "Тут должно быть сообщение о вайтлисте, но кто то вызвал вебхук вручную." | ||
return | ||
|
||
if(!data["grant"] && !data["revoke"]) | ||
return | ||
if(!data["ckey"]) data["ckey"] = "ДАННЫЕ УДАЛЕНЫ" | ||
if(!data["type"]) data["type"] = "ДАННЫЕ УДАЛЕНЫ" | ||
|
||
var/list/desc = list() | ||
desc["title"] = "Ксеномодератор - [data["ckey"]]" | ||
desc["description"] = "Изменения внесены в [data["type"]]" | ||
desc["color"] = COLOR_WEBHOOK_XENO | ||
desc["author"] = list( | ||
"name" = "Изменение вайтлиста на расы", | ||
"icon_url" = "https://cdn.discordapp.com/emojis/244791612268347392.png") // :inf: emoji | ||
|
||
var/list/grant = data["grant"] | ||
var/list/revoke = data["revoke"] | ||
var/icon = "https://cdn.discordapp.com/emojis/680793066415980576.png" // :SeemsRichKot: emoji | ||
if(length(revoke) >= length(grant)) | ||
icon = "https://cdn.discordapp.com/emojis/601028456675016706.png" // :resomisad: emoji | ||
desc["thumbnail"] = list("url" = icon) | ||
/* | ||
var/list/unite = list() | ||
for(var/ckey in grant) | ||
var/list/temp = list() | ||
var/list/check = grant[ckey] | ||
for(var/race in check) | ||
temp += "++[race]" | ||
unite[ckey] += list(temp) | ||
for(var/ckey in revoke) | ||
var/list/temp = list() | ||
var/list/check = revoke[ckey] | ||
for(var/race in check) | ||
temp += "--[race]" | ||
unite[ckey] += list(temp) | ||
*/ | ||
var/list/A = list() | ||
var/list/B = list() | ||
for(var/ckey in grant) | ||
var/list/check = grant[ckey] | ||
for(var/race in check) | ||
B += "+ [race]" | ||
A[ckey] = B.Copy() | ||
B.Cut() | ||
grant = A.Copy() | ||
A.Cut() | ||
B.Cut() | ||
for(var/ckey in revoke) | ||
var/list/check = revoke[ckey] | ||
for(var/race in check) | ||
B += "- [race]" | ||
A[ckey] = B.Copy() | ||
B.Cut() | ||
revoke = A.Copy() | ||
|
||
var/list/unite = list() | ||
for(var/ckey in grant) | ||
unite[ckey] = grant[ckey] | ||
for(var/ckey in revoke) | ||
unite[ckey] += revoke[ckey] | ||
|
||
if(!length(unite)) | ||
.["content"] = "Сюда пришло изменение вайтлиста, но мы потеряли список." | ||
return | ||
var/list/fields = list() | ||
unite = sortAssoc(unite) //sorting by ckey | ||
for(var/ckey2 in unite) | ||
var/list/check = unite[ckey2] | ||
check = sortList(check) //sorting by race | ||
var/list/text = list("diff") | ||
for(var/race in check) | ||
text += race | ||
fields[++length(fields)] = list( | ||
"name" = ckey2, | ||
"value" = "```[jointext(text, "\n")]```" | ||
) | ||
if(length(fields)) | ||
desc["fields"] = fields | ||
.["embeds"] = list(desc) |
Oops, something went wrong.