Skip to content

Commit

Permalink
Immediately fetch new reaction role message
Browse files Browse the repository at this point in the history
  • Loading branch information
BluDood committed Nov 3, 2022
1 parent db42aa7 commit 044b5ab
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion commands/reactionroles.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = {
content: 'That message and emoji combo already has a reaction role!',
ephemeral: true
})
reactionroles.add(emoji, messageId, role.id, channelId, interaction.options.getString('emoji'))
reactionroles.add(emoji, messageId, role.id, channelId, interaction.options.getString('emoji'), interaction.client)
return interaction.reply({
content: `Added reaction role with emoji ${interaction.options.getString('emoji')}, [this message](${interaction.options.getString('message')}) and role <@&${role.id}>`,
ephemeral: true
Expand Down
3 changes: 2 additions & 1 deletion utils/reactionroles.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function getDatabase() {
}

module.exports = {
add: (emoji, id, role, channel, emojiName) => {
add: async (emoji, id, role, channel, emojiName, client) => {
ensureDatabase()
const database = getDatabase()
const foundIndex = database.findIndex(d => d.id == id)
Expand All @@ -45,6 +45,7 @@ module.exports = {
emojiName
})
}
await (await client.channels.fetch(channel)).messages.fetch(id)
writeDatabase(database)
},
remove: (emoji, id) => {
Expand Down

0 comments on commit 044b5ab

Please sign in to comment.