several small adjustments smiley

This commit is contained in:
bignutty 2024-08-08 23:11:40 +02:00
parent f280311212
commit cd624c9066
4 changed files with 47 additions and 37 deletions

View file

@ -1,27 +1,9 @@
const { Permissions, MessageFlags } = require("detritus-client/lib/constants")
const { basecamp } = require("../logging")
const { createEmbed } = require("./embed")
const { COLORS } = require("#constants")
const { COLORS, MESSAGE_BLOCK_REASONS } = require("#constants")
const { icon, link } = require("./markdown")
/**
* These will force the command to become "incognito".
*/
const BLOCK_REASONS = {
20016: {
message: "the channel's slowmode settings",
support_article: 360016150952
},
200000: {
message: "the server's AutoMod setup",
support_article: 4421269296535
},
// TODO: Handle permissions properly, this works as a "hack" for now.
50013: {
message: "the channel's permission setup",
support_article: 10543994968087
}
}
module.exports.editOrReply = function(context, message, disableReference = false){
// Apply message_reference
@ -52,7 +34,7 @@ module.exports.editOrReply = function(context, message, disableReference = false
return context.editOrRespond(message).catch(async (e)=>{
const errorData = await e.response.json();
if(BLOCK_REASONS[errorData.code]){
if(MESSAGE_BLOCK_REASONS[errorData.code]){
// Delete the public response
await context.deleteResponse();
@ -62,13 +44,13 @@ module.exports.editOrReply = function(context, message, disableReference = false
if(message.content){
if(message.embeds && message.embeds.length <= 4){
message.embeds.unshift({
description: `${icon("flask_incognito")} This response has been made incognito due to ${BLOCK_REASONS[errorData.code].message}.`,
description: `${icon("flask_incognito")} This response has been made incognito due to ${MESSAGE_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")}`
message.content = `-# ${icon("flask_mini")} This response has been made incognito due to ${MESSAGE_BLOCK_REASONS[errorData.code].message} ${link("https://support.discord.com/hc/en-us/articles/" + MESSAGE_BLOCK_REASONS[errorData.code].support_article, "Learn More", "Support Article")}`
}
let replacementMessage = await context.createMessage(message);