Skip to content

Commit

Permalink
chore(general): handle log error (#1509)
Browse files Browse the repository at this point in the history
  • Loading branch information
phucledien authored Oct 3, 2023
1 parent a871d25 commit 5d19bf9
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/commands/help/index/slash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const run = async (interaction: CommandInteraction) => {
const embed = getHelpEmbed(interaction.user)
await buildHelpInterface(embed, pageType)

interaction
await interaction
.editReply({
embeds: [embed],
components: pagination(pageType),
Expand All @@ -37,7 +37,7 @@ const run = async (interaction: CommandInteraction) => {
})
})
.on("end", () => {
interaction.editReply({ components: [] }).catch(() => null)
await interaction.editReply({ components: [] }).catch(() => null)
})

return {}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/nft/query/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -941,5 +941,5 @@ export async function queryNft(msg: Message, symbol: string, tokenId: string) {
}),
buttonCollector: { handler: buttonHandler },
}
reply(msg, response)
await reply(msg, response)
}
6 changes: 3 additions & 3 deletions src/commands/nft/ticker/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ export async function handleNftTicker(
})),
buttonCollector: { handler: buttonHandler },
}
reply(msg, response)
await reply(msg, response)
return
}

Expand All @@ -442,7 +442,7 @@ export async function handleNftTicker(
})),
buttonCollector: { handler: buttonHandler },
}
reply(msg, response)
await reply(msg, response)
return
}

Expand Down Expand Up @@ -517,7 +517,7 @@ export async function handleNftTicker(
handler: buttonHandler,
},
}
reply(msg, response)
await reply(msg, response)
}

async function askToSetDefault(
Expand Down
4 changes: 2 additions & 2 deletions src/commands/pay/me/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export async function run({
})
}
if (!isDm) {
reply(msgOrInteraction, {
await reply(msgOrInteraction, {
messageOptions: {
embeds: [
composeEmbedMessage(null, {
Expand Down Expand Up @@ -292,7 +292,7 @@ export async function run({
null,
null,
)
reply(msgOrInteraction, {
await reply(msgOrInteraction, {
messageOptions: {
embeds: [
composeEmbedMessage(null, {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/quest/daily/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export async function handleBackToQuestList(i: ButtonInteraction) {
msgOpts: { embeds },
} = await run(i.user.id, msg)

i.editReply({
await i.editReply({
embeds,
...getClaimButton(true, authorId),
})
Expand Down Expand Up @@ -109,7 +109,7 @@ export async function handleClaimReward(i: ButtonInteraction) {
}
})

i.editReply({
await i.editReply({
embeds: [embed],
components: [
new MessageActionRow().addComponents(
Expand Down
10 changes: 6 additions & 4 deletions src/commands/sales/remove/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ async function undo(i: ButtonInteraction) {
options,
i.channelId,
)
i.editReply({
embeds: [embed],
...(state === "queued-detail" ? { components: [] } : { components }),
}).catch(() => null)
await i
.editReply({
embeds: [embed],
...(state === "queued-detail" ? { components: [] } : { components }),
})
.catch(() => null)
buttonCollector?.stop()
buttonCollector = null
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/setup/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ async function execute(i: ButtonInteraction, ctx: Context) {
})
}

i.editReply({
await i.editReply({
content: [
...opts.map((opt) => {
if (!ctx.currentOptions.includes(opt.value)) {
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/tagme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class Tagme {

const gotoMessageBtn = i.message.components?.[0].components[0]

i.editReply({
await i.editReply({
components: [
new MessageActionRow().addComponents(
...(gotoMessageBtn ? [gotoMessageBtn] : []),
Expand Down
10 changes: 6 additions & 4 deletions src/utils/default-setters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ export function getDefaultSetter({
title: "Default ENABLED",
description,
})
i.editReply({
embeds: [embed],
components: [],
}).catch(() => null)
await i
.editReply({
embeds: [embed],
components: [],
})
.catch(() => null)
}
}
4 changes: 2 additions & 2 deletions src/utils/dm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ export async function dmUser(
return await author.send(options)
} catch (e) {
if (msgOrInteraction) {
reply(msgOrInteraction, {
await reply(msgOrInteraction, {
messageOptions: {
embeds: [enableDMMessage(prefixDesc, suffixDesc)],
components: [],
},
})
} else {
button?.editReply({
await button?.editReply({
embeds: [enableDMMessage(prefixDesc, suffixDesc)],
components: [],
})
Expand Down

0 comments on commit 5d19bf9

Please sign in to comment.