Skip to content

Commit

Permalink
fix: fix bugs with /hub delete and reactions
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-737 committed Oct 2, 2023
1 parent 3b388d5 commit d3d379b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Scripts/hub/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default {
componentType: ComponentType.Button,
}).catch(() => null);

if (!confirmation || confirmation.customId !== 'confirm_delete') {
if (!confirmation || confirmation.customId === 'confirm_delete') {
await msg.delete().catch(() => null);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Scripts/reactions/updateMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ export default {
const webhook = new WebhookClient({ url: connection.webhookURL });
const message = await webhook.fetchMessage(dbMsg.messageId, {
threadId: connection.parentId ? connection.channelId : undefined,
});
}).catch(() => null);

// remove all reaction buttons from components
// customId should not start with 'reaction_' or 'view_all_reactions'
const components = message.components?.filter((row) => {
const components = message?.components?.filter((row) => {
const filteredRow = row.components.filter((component) => {
if (component.type === ComponentType.Button && component.style === ButtonStyle.Secondary) {
return !component.custom_id.startsWith('reaction_') && component.custom_id !== 'view_all_reactions';
Expand Down
7 changes: 4 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ export class ExtendedClient extends Client {
this.loadCommands();
this.loadEvents();

// Error monitoring (sentry.io)
Sentry.init({ dsn: process.env.SENTRY_DSN, tracesSampleRate: 1.0 });

await this.login(token || process.env.TOKEN);
}

Expand Down Expand Up @@ -70,4 +67,8 @@ const client = new ExtendedClient({
},
});


// Error monitoring (sentry.io)
Sentry.init({ dsn: process.env.SENTRY_DSN, tracesSampleRate: 1.0 });

client.start();

0 comments on commit d3d379b

Please sign in to comment.