mirror of
https://github.com/sern-handler/sern-community
synced 2026-06-06 01:16:57 +00:00
removed entry can't win giveaway
This commit is contained in:
@@ -144,6 +144,8 @@ export default commandModule({
|
||||
)
|
||||
|
||||
embedMessage.edit({embeds: [embed]})
|
||||
|
||||
embedMessage.reply(`Congratulations <@${winnerId}> on winning the ${item} giveaway!`)
|
||||
}
|
||||
else if (stmt.length > 1 && stmt[winnerIndex].user_id === ctx.userId) {
|
||||
winnerIndex = Math.floor(Math.random() * stmt.length)
|
||||
@@ -164,4 +166,4 @@ export default commandModule({
|
||||
|
||||
db.prepare(`DELETE FROM entrees`).run()
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -6,10 +6,12 @@ export default discordEvent({
|
||||
execute: async (reaction, potentialWinners) => {
|
||||
const startTime = reaction.message.createdTimestamp
|
||||
|
||||
const stmt = db.prepare(`INSERT INTO entrees(timestamp, user_id) VALUES (?, ?)`)
|
||||
if (reaction.emoji.name === '🎉') {
|
||||
const stmt = db.prepare(`INSERT INTO entrees(timestamp, user_id) VALUES (?, ?)`)
|
||||
|
||||
if (potentialWinners.bot === false) {
|
||||
stmt.run([startTime, potentialWinners.id])
|
||||
if (potentialWinners.bot === false) {
|
||||
stmt.run([startTime, potentialWinners.id])
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
15
src/events/embedRemoveReact.ts
Normal file
15
src/events/embedRemoveReact.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { discordEvent } from "@sern/handler";
|
||||
import { db } from "../utils/db.js"
|
||||
|
||||
export default discordEvent({
|
||||
name: 'messageReactionRemove',
|
||||
execute: async (reaction, deletedEntry) => {
|
||||
const deletedId = deletedEntry.id
|
||||
|
||||
if (reaction.emoji.name === '🎉') {
|
||||
const stmt = db.prepare(`DELETE FROM entrees WHERE user_id = ?`)
|
||||
|
||||
stmt.run(deletedId)
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user