diff --git a/commands/handlers/suggestions-no.ts b/commands/handlers/suggestions-no.ts index 059a542..da53846 100644 --- a/commands/handlers/suggestions-no.ts +++ b/commands/handlers/suggestions-no.ts @@ -6,7 +6,7 @@ export default commandModule({ type: CommandType.Button, async execute(interaction) { const convertToNumber = Number(interaction.component.label!) - const upvotebuttons = new ActionRowBuilder().setComponents( + const downvotebuttons = new ActionRowBuilder().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() } }) diff --git a/commands/handlers/suggestions-yes.ts b/commands/handlers/suggestions-yes.ts index 3c2feed..4e558d8 100644 --- a/commands/handlers/suggestions-yes.ts +++ b/commands/handlers/suggestions-yes.ts @@ -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]}) diff --git a/schemas/suggestions.js b/schemas/suggestions.js index cec7458..65ad254 100644 --- a/schemas/suggestions.js +++ b/schemas/suggestions.js @@ -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 \ No newline at end of file