update forced incognito visuals

This commit is contained in:
bignutty 2024-07-09 23:19:56 +02:00
parent bfc30b5ac3
commit 65e416add3
2 changed files with 24 additions and 8 deletions

View file

@ -56,6 +56,7 @@ module.exports.BADGE_ICONS = Object.freeze({
module.exports.ICONS = Object.freeze({
"brand": "<:ico_brand:1237843729880977459>",
"flask_mini": "<:ico_flask_mini:1260342544600928286>",
"home": "<:ico_home:1165257185488551976>",
"image": "<:ico_image:1165257188235825274>",

View file

@ -2,15 +2,25 @@ const { Permissions, MessageFlags } = require("detritus-client/lib/constants")
const { basecamp } = require("../logging")
const { createEmbed } = require("./embed")
const { COLORS } = require("#constants")
const { icon, link } = require("./markdown")
/**
* These will force the command to become "incognito".
*/
const BLOCK_REASONS = {
20016: "Slowmode",
200000: "AutoMod",
20016: {
message: "the channels slowmode settings",
support_article: 360016150952
},
200000: {
message: "the servers AutoMod setup",
support_article: 4421269296535
},
// TODO: Handle permissions properly, this works as a "hack" for now.
50013: "Missing Permissions"
50013: {
message: "the channels permission setup",
support_article: 10543994968087
}
}
module.exports.editOrReply = function(context, message, disableReference = false){
@ -49,11 +59,16 @@ module.exports.editOrReply = function(context, message, disableReference = false
message.flags = MessageFlags.EPHEMERAL
// Create a notice
if(message.embeds && message.embeds.length <= 4){
message.embeds.unshift({
description: `<:incognito:1250198171859161199> This response has been made incognito due to ${BLOCK_REASONS[errorData.code]}.`,
color: COLORS.incognito
})
if(message.content){
if(message.embeds && message.embeds.length <= 4){
message.embeds.unshift({
description: `<:incognito:1250198171859161199> This response has been made incognito due to ${BLOCK_REASONS[errorData.code].message}.`,
color: COLORS.incognito
})
}
} else {
// Uses new subtext formatting to look more "native"
message.content = `-# ${icon("flask_mini")} This response has been made incognito due to ${BLOCK_REASONS[errorData.code].message}${link("https://support.discord.com/hc/en-us/articles/" + BLOCK_REASONS[errorData.code].support_article, "Learn More", "Support Article")}`
}
let replacementMessage = await context.createMessage(message);