Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Commit

Permalink
feat: update errs, update reports
Browse files Browse the repository at this point in the history
  • Loading branch information
wdhdev committed Jul 2, 2023
1 parent 9d67829 commit e5bbcf8
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 10 deletions.
2 changes: 2 additions & 0 deletions src/buttons/logs/delete-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ module.exports = {
deleted++;
resolve(true);
} catch(err) {
client.logError(err);

resolve(false);
}
}))
Expand Down
6 changes: 5 additions & 1 deletion src/commands/dev/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,8 @@ module.exports = {

await interaction.editReply({ embeds: [sent] });
} catch(err) {
client.logError(err);

const error = new Discord.EmbedBuilder()
.setColor(client.config_embeds.error)
.setDescription(`${emoji.error} The appeal menu could not be sent.`)
Expand Down Expand Up @@ -437,6 +439,8 @@ module.exports = {

await interaction.editReply({ embeds: [sent] });
} catch(err) {
client.logError(err);

const error = new Discord.EmbedBuilder()
.setColor(client.config_embeds.error)
.setDescription(`${emoji.error} The list could not be sent.`)
Expand Down Expand Up @@ -503,7 +507,7 @@ module.exports = {
const verifiedUsers = new Discord.EmbedBuilder()
.setColor(client.config_embeds.default)
.setTitle("✅ Verified Users")
.setDescription(`<@${users.join(">\n<@")}>`)
.setDescription(`<@${users.join(">, <@")}>`)

await interaction.editReply({ embeds: [verifiedUsers] });
return;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/info/developers.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = {
const developers = new Discord.EmbedBuilder()
.setColor(client.config_embeds.default)
.setTitle("💻 Developers")
.setDescription(`<@${users.join(">\n<@")}>`)
.setDescription(`<@${users.join(">, <@")}>`)

await interaction.editReply({ embeds: [developers] });
} catch(err) {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/info/moderators.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = {
const moderators = new Discord.EmbedBuilder()
.setColor(client.config_embeds.default)
.setTitle("🔨 Moderators")
.setDescription(`<@${users.join(">\n<@")}>`)
.setDescription(`<@${users.join(">, <@")}>`)

await interaction.editReply({ embeds: [moderators] });
} catch(err) {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/info/supporters.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = {
const supporters = new Discord.EmbedBuilder()
.setColor(client.config_embeds.default)
.setTitle("💖 Supporters")
.setDescription(`<@${users.join(">\n<@")}>`)
.setDescription(`<@${users.join(">, <@")}>`)

await interaction.editReply({ embeds: [supporters] });
} catch(err) {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/user/suggest.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module.exports = {
message.react(`${emoji.tick}`);
message.react(`${emoji.cross}`);
} catch(err) {
client.logCommandError(err, interaction, Discord);
client.logError(err);

const error = new Discord.EmbedBuilder()
.setColor(client.config_embeds.error)
Expand Down
17 changes: 13 additions & 4 deletions src/context-menu/message/Report Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
name: "Report Message",
type: 3,
botPermissions: [],
cooldown: 3,
cooldown: 30,
enabled: true,
hidden: false,
async execute(interaction, client, Discord) {
Expand All @@ -26,6 +26,15 @@ module.exports = {
const data = await messageSchema.findOne({ messages: message.url });
const reportChannel = client.channels.cache.get(client.config_channels.reports);

if(data.user === interaction.user.id) {
const error = new Discord.EmbedBuilder()
.setColor(client.config_embeds.error)
.setDescription(`${emoji.error} You can't report yourself!`)

await interaction.editReply({ embeds: [error], ephemeral: true });
return;
}

try {
const report = new Discord.EmbedBuilder()
.setColor(client.config_embeds.default)
Expand All @@ -49,7 +58,7 @@ module.exports = {
.setStyle(Discord.ButtonStyle.Secondary)
.setCustomId(`delete-message-${data._id}`)
.setEmoji("🗑️")
.setLabel("Delete Message")
.setLabel("Delete")
)

const msgData = await messageSchema.findOne({ messages: message.url });
Expand All @@ -70,9 +79,9 @@ module.exports = {
if(msgData.content) messageEmbed.setDescription(msgData.content);
if(msgData.attachment) messageEmbed.setImage(msgData.attachment);

reportChannel.send({ embeds: [report, messageEmbed], components: [actions] });
reportChannel.send({ content: `<@&${client.config_roles.mod}>`, embeds: [report, messageEmbed], components: [actions] });
} catch(err) {
client.logContextError(err, interaction, Discord);
client.logError(err);

const error = new Discord.EmbedBuilder()
.setColor(client.config_embeds.error)
Expand Down
4 changes: 4 additions & 0 deletions src/handlers/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ module.exports = (client, Discord) => {

load(client, Discord);

client.logError = async function(err) {
client.sentry.captureException(err);
}

client.logEventError = async function(err) {
client.sentry.captureException(err);
}
Expand Down
2 changes: 1 addition & 1 deletion src/util/interaction/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = async (client, Discord, interaction) => {

const error = new Discord.EmbedBuilder()
.setColor(client.config_embeds.error)
.setDescription(`${emoji.error} There was an error while executing that command!`)
.setDescription(`${emoji.error} There was an error while executing that button!`)

await interaction.reply({ embeds: [error], ephemeral: true });
}
Expand Down

0 comments on commit e5bbcf8

Please sign in to comment.