add debug tools

This commit is contained in:
bignutty 2025-01-08 23:58:18 +01:00
parent 4ca9780fec
commit 13e4fb2976
2 changed files with 13 additions and 1 deletions

View file

@ -19,11 +19,23 @@ module.exports.acknowledge = async function(context, incognito = false, permissi
// Handle permissions for user commands in a guild context
if(context.member && permissions.length >= 1){
let perr=[]
for(const p of permissions){
if(!checkPermissions(context.member.permissions, p)){
incognito = true;
context._meta.incognitoReason = INCOGNITO_REASONS.permissions;
}
perr.push([PERMISSIONS_TEXT[p], checkPermissions(context.member.permissions, p)])
}
if(perr.length >= 1) {
// via pbdiag (https://canary.discord.com/channels/949405492491452496/949414053418242118/1326684780355653815)
context._meta.incognitoMetadata = "https://bignutty.gitlab.io/diag?pbdiag=" + Buffer.from(JSON.stringify([
1,
[
perr.map((p)=>p[0]),
perr.map((p)=>p[1]),
]
])).toString("base64");
}
}

View file

@ -43,7 +43,7 @@ module.exports.editOrReply = function(context, message, disableReference = false
}
} else {
// Uses new subtext formatting to look more "native"
message.content = `-# ${icon("flask_mini")} This response has been made incognito due to ${MESSAGE_BLOCK_REASONS[context._meta.incognitoReason].message}${link("https://support.discord.com/hc/en-us/articles/" + MESSAGE_BLOCK_REASONS[context._meta.incognitoReason].support_article, "Learn More", "Support Article")}`
message.content = `-# ${icon("flask_mini")} This response has been made incognito due to ${MESSAGE_BLOCK_REASONS[context._meta.incognitoReason].message}${link("https://support.discord.com/hc/en-us/articles/" + MESSAGE_BLOCK_REASONS[context._meta.incognitoReason].support_article, "Learn More", "Support Article")}${(context._meta.incognitoMetadata ? " • " + link(context._meta.incognitoMetadata, "Debug", "Debugging Information", false) : "")}`
}
}