mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-07 21:53:07 -04:00
automod fix
This commit is contained in:
parent
ef6eb91bbe
commit
8b77808950
2 changed files with 38 additions and 3 deletions
|
@ -26,6 +26,8 @@ module.exports.maintower = async function (packages, type){
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.basecamp = async function (log, content = ""){
|
module.exports.basecamp = async function (log, content = ""){
|
||||||
|
// This begins the list of errors that i simply cannot fix. thank you discord.
|
||||||
|
if(content.includes(`"code": 200000`)) return;
|
||||||
try{
|
try{
|
||||||
let res = await superagent.post(MAINTOWER_BASE_URL + 'basecamp')
|
let res = await superagent.post(MAINTOWER_BASE_URL + 'basecamp')
|
||||||
.set({
|
.set({
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
const { Permissions } = require("detritus-client/lib/constants")
|
const { Permissions, InteractionCallbackTypes, MessageFlags } = require("detritus-client/lib/constants")
|
||||||
const { basecamp } = require("../logging")
|
const { basecamp } = require("../logging")
|
||||||
const { STATICS } = require("./statics")
|
const { STATICS } = require("./statics")
|
||||||
|
const { createEmbed } = require("./embed")
|
||||||
|
|
||||||
module.exports.editOrReply = function(context, message, disableReference = false){
|
module.exports.editOrReply = function(context, message, disableReference = false){
|
||||||
// Apply message_reference
|
// Apply message_reference
|
||||||
|
@ -15,12 +16,44 @@ module.exports.editOrReply = function(context, message, disableReference = false
|
||||||
// Handle responses for interaction context
|
// Handle responses for interaction context
|
||||||
if(context.editOrRespond){
|
if(context.editOrRespond){
|
||||||
return context.editOrRespond(message).catch((e)=>{
|
return context.editOrRespond(message).catch((e)=>{
|
||||||
|
/*
|
||||||
|
Discord in their infinite wisdom decided that *bots* should
|
||||||
|
be the one to handle automod errors on their own, deciding
|
||||||
|
against adding a notice/response type for their frontend.
|
||||||
|
|
||||||
|
This is the awesome solution to this problem, that isn't
|
||||||
|
actually very awesome and actually sucks a lot.
|
||||||
|
*/
|
||||||
|
if(e.code == 200000){
|
||||||
|
try{
|
||||||
|
let embedResponse = createEmbed("error", context, "Response was filtered by AutoMod.")
|
||||||
|
embedResponse.description = `Try running the command somewhere else or ask server admins for help.`
|
||||||
|
return context.editOrRespond({
|
||||||
|
allowedMentions: { parse: [], repliedUser: false },
|
||||||
|
embeds: [
|
||||||
|
embedResponse
|
||||||
|
]
|
||||||
|
})
|
||||||
|
}catch(e){
|
||||||
|
/*
|
||||||
|
another error? suck it.
|
||||||
|
there is genuinely nothing left that we can do.
|
||||||
|
|
||||||
|
create followup message has an awesome 'hack' that prevents
|
||||||
|
the bot from creating a new ephemeral followup response
|
||||||
|
if the original one isn't/couldn't be acknowledged.
|
||||||
|
|
||||||
|
https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
basecamp(`<:ico_w3:1086624963047460874>\`[${process.env.HOSTNAME}]\` **\` 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)
|
basecamp(`<:ico_w3:1086624963047460874>\`[${process.env.HOSTNAME}]\` **\` 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)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only respond if the command is still available and we have permissions to respond.
|
// Only respond if the command is still available and we have permissions to respond.
|
||||||
if(!context.message.deleted && context.channel.can(Permissions.SEND_MESSAGES)) return context.editOrReply(message).catch((e)=>
|
if(!context.message.deleted && context.channel.can(Permissions.SEND_MESSAGES)) return context.editOrReply(message).catch((e)=>{
|
||||||
|
console.log(e.status)
|
||||||
basecamp(`<:ico_w3:1086624963047460874>\`[${process.env.HOSTNAME}]\` **\` SHARD_MESSAGE_ERROR \`** \`[Shard ${context.client.shardId}]\` Command \`${context.message?.content}\` failed to reply: @ \`${Date.now()}\`\nGuild: \`${context.guild?.id}\`\nChannel: \`${context.channel?.id}\`\nUser: \`${context.user?.id}\`\`\`\`js\n${e}\`\`\``, message)
|
basecamp(`<:ico_w3:1086624963047460874>\`[${process.env.HOSTNAME}]\` **\` SHARD_MESSAGE_ERROR \`** \`[Shard ${context.client.shardId}]\` Command \`${context.message?.content}\` failed to reply: @ \`${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