mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 22:23:03 -04:00
37 lines
No EOL
2.3 KiB
JavaScript
37 lines
No EOL
2.3 KiB
JavaScript
const { Permissions } = require("detritus-client/lib/constants")
|
||
const { basecamp } = require("../logging")
|
||
const { STATICS } = require("./statics")
|
||
|
||
module.exports.editOrReply = function(context, message, disableReference = false){
|
||
// Apply message_reference
|
||
if(!message.content && !message.embed && !message.embeds && !message.components && !message.files) message = {embeds: [message]}
|
||
if(!message.message_reference && !disableReference) message.reference = true
|
||
// Disable mentions
|
||
if(!message.allowedMentions) message.allowedMentions = {parse: [], repliedUser: false}
|
||
|
||
// you can figure out what this does on your own time
|
||
//message.nonce = Math.floor(Math.random() * 9999 + 1000)
|
||
|
||
// fools2024
|
||
if(message.embeds?.length){
|
||
for (let i = 0; i < message.embeds.length; i++) {
|
||
const embed = message.embeds[i];
|
||
console.log(embed)
|
||
if(embed.footer) {
|
||
message.embeds[i].footer.text = message.embeds[i].footer.text.replace('labsCore', '𝕃 - the everything bot')
|
||
if(embed.footer.iconUrl = STATICS.labscore) message.embeds[i].footer.iconUrl = "https://cdn.discordapp.com/attachments/839367089801527306/1224142999207022822/everything.png?ex=661c6b02&is=6609f602&hm=62ae387bafcc85a4e9c9a1fd3f4ad1839d19881f3d915ab442b4cb8cbba2adcf&"
|
||
}
|
||
}
|
||
}
|
||
|
||
// Handle responses for interaction context
|
||
if(context.editOrRespond){
|
||
return context.editOrRespond(message).catch((e)=>{
|
||
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.
|
||
if(!context.message.deleted && context.channel.can(Permissions.SEND_MESSAGES)) return context.editOrReply(message).catch((e)=>
|
||
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)
|
||
)
|
||
} |