mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-18 10:57:05 -04:00
Merge branch 'main' into nextgen/cardstack
This commit is contained in:
commit
8c036e714a
3 changed files with 41 additions and 34 deletions
|
@ -48,33 +48,37 @@ module.exports.editOrReply = function(context, message, disableReference = false
|
|||
}
|
||||
|
||||
return context.editOrRespond(message).catch(async (e)=>{
|
||||
const errorData = await e.response.json();
|
||||
if(MESSAGE_BLOCK_REASONS[errorData.code]){
|
||||
// Delete the public response
|
||||
await context.deleteResponse();
|
||||
|
||||
message.flags = MessageFlags.EPHEMERAL
|
||||
try{
|
||||
|
||||
// Create a notice
|
||||
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 ${MESSAGE_BLOCK_REASONS[errorData.code].message}.`,
|
||||
color: COLORS.incognito
|
||||
})
|
||||
const errorData = await e.response.json();
|
||||
if(MESSAGE_BLOCK_REASONS[errorData.code]){
|
||||
// Delete the public response
|
||||
await context.deleteResponse();
|
||||
|
||||
message.flags = MessageFlags.EPHEMERAL
|
||||
|
||||
// Create a notice
|
||||
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 ${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 ${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")}`
|
||||
}
|
||||
} 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[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);
|
||||
|
||||
if(!context._meta) context._meta = {}
|
||||
context._meta.replacementMessageId = replacementMessage.id;
|
||||
|
||||
return replacementMessage;
|
||||
|
||||
let replacementMessage = await context.createMessage(message);
|
||||
|
||||
if(!context._meta) context._meta = {}
|
||||
context._meta.replacementMessageId = replacementMessage.id;
|
||||
|
||||
return replacementMessage;
|
||||
}
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
}
|
||||
basecamp(formatErrorMessage(3, "SHARD_MESSAGE_ERROR", `\`[Shard ${context.client.shardId}]\` Command \`${context.command.name}\` failed to respond: @ \`${Date.now()}\`\nGuild: \`${context.guild?.id}\`\nChannel: \`${context.channel?.id}\`\nUser: \`${context.user?.id}\`\`\`\`js\n${e}\`\`\``), message);
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue