mirror of
https://github.com/SrIzan10/vinci.git
synced 2026-06-06 01:07:00 +00:00
fix: upvote or downvote entries
This commit is contained in:
@@ -6,7 +6,7 @@ export default commandModule({
|
||||
type: CommandType.Button,
|
||||
async execute(interaction) {
|
||||
const convertToNumber = Number(interaction.component.label!)
|
||||
const upvotebuttons = new ActionRowBuilder<ButtonBuilder>().setComponents(
|
||||
const downvotebuttons = new ActionRowBuilder<ButtonBuilder>().setComponents(
|
||||
new ButtonBuilder(interaction.message!.components[0].components[0].data),
|
||||
new ButtonBuilder()
|
||||
.setCustomId('suggestions-no')
|
||||
@@ -21,10 +21,11 @@ export default commandModule({
|
||||
} else {
|
||||
const addToDB = new db({
|
||||
msgid: interaction.message.id,
|
||||
userid: interaction.user.id
|
||||
userid: interaction.user.id,
|
||||
upordown: -1
|
||||
})
|
||||
await addToDB.save()
|
||||
await interaction.message.edit({components: [upvotebuttons]})
|
||||
await interaction.message.edit({components: [downvotebuttons]})
|
||||
await interaction.deferUpdate()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -21,7 +21,8 @@ export default commandModule({
|
||||
} else {
|
||||
const addToDB = new db({
|
||||
msgid: interaction.message.id,
|
||||
userid: interaction.user.id
|
||||
userid: interaction.user.id,
|
||||
upordown: 1
|
||||
})
|
||||
await addToDB.save()
|
||||
await interaction.message.edit({components: [upvotebuttons]})
|
||||
|
||||
@@ -2,6 +2,7 @@ import mongoose from 'mongoose'
|
||||
const schema = new mongoose.Schema({
|
||||
msgid: {type: String, required: true},
|
||||
userid: {type: String, required: true},
|
||||
upordown: {type: Number, required: true}
|
||||
});
|
||||
const db = mongoose.model('suggestions', schema, 'suggestions');
|
||||
export default db
|
||||
Reference in New Issue
Block a user