Skip to content

Commit 110755a

Browse files
committed
fix to deferal
1 parent 36c4898 commit 110755a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/utils/voteHelpers.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export async function handleVoting(
132132
if (!interaction) return console.error('no interaction found for voting')
133133
if (!interaction.message)
134134
return console.error('No message found in interaction')
135-
if (!interaction.deferred)
135+
if (!interaction.deferred && !interaction.replied)
136136
await interaction.deferReply({ flags: MessageFlags.Ephemeral })
137137
const embed = interaction.message.embeds[0]
138138
if (!embed) return console.error('No embed found in message')
@@ -151,7 +151,7 @@ export async function handleVoting(
151151

152152
// Check if user is allowed to vote
153153
if (participants.length && !participants.includes(interaction.user.id)) {
154-
if (!interaction.deferred)
154+
if (!interaction.deferred && !interaction.replied)
155155
await interaction.deferReply({ flags: MessageFlags.Ephemeral })
156156
if (interaction.deferred || interaction.replied) {
157157
return interaction.editReply({
@@ -254,7 +254,7 @@ export async function handleTwoPlayerMatchVoting(
254254
if (!fields) return console.error('No fields found in embed')
255255
if (!interaction)
256256
return console.error('no interaction found for two player voting')
257-
if (!interaction.deferred)
257+
if (!interaction.deferred && !interaction.replied)
258258
await interaction.deferReply({ flags: MessageFlags.Ephemeral })
259259

260260
const winMatchData: string[] = interaction.values[0].split('_')
@@ -264,7 +264,7 @@ export async function handleTwoPlayerMatchVoting(
264264

265265
// Restrict to allowed voters
266266
if (participants.length && !participants.includes(interaction.user.id)) {
267-
if (!interaction.deferred)
267+
if (!interaction.deferred && !interaction.replied)
268268
await interaction.deferReply({ flags: MessageFlags.Ephemeral })
269269
if (interaction.deferred || interaction.replied) {
270270
return interaction.editReply({

0 commit comments

Comments
 (0)