-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Derek
committed
Aug 13, 2021
1 parent
bca2f5d
commit 202de4d
Showing
3 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
exports.run = async (client, message, args, level) => { | ||
const language = client.getSettings(message.guild.id).language | ||
const lang = require("../lib/languages/" + language + ".json") | ||
|
||
const { | ||
ReactionRole | ||
} = require("reaction-role"); | ||
|
||
try { | ||
const emoji = args[0] | ||
const role = args[1] | ||
const channel = args[2] | ||
const msg = args[3] | ||
const add = args[4] | ||
const remove = args[5] | ||
|
||
const rr = new ReactionRole(process.env.BOT_TOKEN, process.env.MONGODB_URI); | ||
const c = await rr.channels.fetch(channel); | ||
const m = await c.messages.fetch(msg); | ||
await m.react(emoji); | ||
|
||
const option = rr.createOption(emoji, [role], add, remove); | ||
await rr.createMessage(channel, msg, 1, option); | ||
message.reply("created!"); | ||
} catch (err) { | ||
const errors = require('../modules/errors.js') | ||
errors.embedError(err, lang, message) | ||
} | ||
} | ||
|
||
exports.conf = { | ||
enabled: true, | ||
aliases: ['rr'], | ||
guildOnly: false, | ||
permLevel: 'User' | ||
} | ||
|
||
exports.help = { | ||
name: 'reactionrole', | ||
category: 'Utility', | ||
description: 'Gives a role to a user when they react to a message.', | ||
usage: 'reactionrole <reaction> <role> <message ID>' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const fs = require("fs"); | ||
const Discord = require("discord.js"); | ||
const colors = require("../lib/colors.json"); | ||
|
||
const client = new ReactionRole(process.env.BOT_TOKEN, process.env.MONGODB_URI); | ||
|
||
module.exports = (client, message) => { | ||
if (message.author.bot) return; | ||
if (!message.guild) return; | ||
if (message.channel.type === `dm`) return; | ||
|
||
const c = await client.channels.fetch(channel); | ||
const m = await c.messages.fetch(msg); | ||
await m.react(emoji); | ||
const option = client.createOption(emoji, [role], add, remove); | ||
await client.createMessage(channel, msg, 1, option); | ||
message.reply("created!"); | ||
}; |