84 |
}); |
}); |
85 |
|
|
86 |
await ballot.save(); |
await ballot.save(); |
87 |
|
|
|
// await client.db.runAsync('INSERT INTO ballots(content, author, msg_id, guild_id, date, channel_id) VALUES(?, ?, ?, ?, ?, ?)', [content, anonymous ? null : msg.member?.user.id, message.id, msg.guild!.id, new Date().toISOString(), msg.channel!.id]); |
|
|
// const ballot = await client.db.getAsync("SELECT * FROM ballots WHERE msg_id = ? AND guild_id = ? ORDER BY id DESC LIMIT 0, 1", [message.id, msg.guild!.id]); |
|
|
|
|
88 |
await message.react(<EmojiIdentifierResolvable> await fetchEmoji('check')); |
await message.react(<EmojiIdentifierResolvable> await fetchEmoji('check')); |
89 |
await message.react(<EmojiIdentifierResolvable> await fetchEmoji('error')); |
await message.react(<EmojiIdentifierResolvable> await fetchEmoji('error')); |
90 |
|
|
107 |
} |
} |
108 |
|
|
109 |
try { |
try { |
110 |
const id = options.isInteraction ? options.options.getInteger('id') : options.args[0]; |
const id = options.isInteraction ? options.options.getString('id') : options.args[0]; |
111 |
//const ballot = await client.db.getAsync("SELECT * FROM ballots WHERE id = ? ORDER BY id DESC LIMIT 0, 1", [id]); |
//const ballot = await client.db.getAsync("SELECT * FROM ballots WHERE id = ? ORDER BY id DESC LIMIT 0, 1", [id]); |
112 |
const ballot = (await Ballot.findOne({ |
const ballot = await Ballot.findById(id); |
|
where: { |
|
|
id |
|
|
} |
|
|
}))?.get(); |
|
113 |
|
|
114 |
if (!ballot) |
if (!ballot) |
115 |
throw new Error(); |
throw new Error(); |