|
|
|
@ -220,12 +220,13 @@ class _Client extends Client
|
|
|
|
|
{
|
|
|
|
|
this.on('messageReactionAdd', (reaction, user)=>
|
|
|
|
|
{
|
|
|
|
|
console.log('Lib: Message: Reaction: Added');
|
|
|
|
|
(async ()=>
|
|
|
|
|
{
|
|
|
|
|
const rule = await roleRulesM.findOne({mID:reaction.message.id,roleEmoji:reaction._emoji.id}).then(rule =>{return rule}).catch(err=>{return null})
|
|
|
|
|
if(rule)
|
|
|
|
|
{
|
|
|
|
|
console.log(`RoleAssignment: Guild:${this.guilds.cache.get(rule.gID)} Role ${rule.roleName} given to ${user.username}`)
|
|
|
|
|
console.log(`RoleAssignment: Guild:${this.guilds.cache.get(rule.gID)}: Adding role ${rule.roleName} given to ${user.username}`)
|
|
|
|
|
this.channels.cache.get(reaction.message.channelId).members.get(user.id).roles.add(rule.roleID)
|
|
|
|
|
}
|
|
|
|
|
})()
|
|
|
|
@ -237,7 +238,7 @@ class _Client extends Client
|
|
|
|
|
const rule = await roleRulesM.findOne({mID:reaction.message.id,roleEmoji:reaction._emoji.id}).then(rule =>{return rule}).catch(err=>{return null})
|
|
|
|
|
if(rule)
|
|
|
|
|
{
|
|
|
|
|
console.log(`RoleAssignment: Guild:${this.guilds.cache.get(rule.gID)}: Removing, ${user.username}'s ${rule.roleName} role. `)
|
|
|
|
|
console.log(`RoleAssignment: Guild:${this.guilds.cache.get(rule.gID)}: Removing ${user.username}'s ${rule.roleName} role. `)
|
|
|
|
|
this.channels.cache.get(reaction.message.channelId).members.get(user.id).roles.remove(rule.roleID)
|
|
|
|
|
}
|
|
|
|
|
})()
|
|
|
|
|