Merge pull request #225 from lbryio/Coolguy3289-patch-2

Add Ability to Self-Add Baserole
This commit is contained in:
Niko 2018-12-17 08:37:24 -05:00 committed by GitHub
commit f06fdcab71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View file

@ -103,5 +103,9 @@ npm install
to run prettier before submitting your code simply run the following in the bots root directory.
```
npm run precommit
```
npm run prettier
```
To be sure your build will pass with TravisCI, also be sure to run
```
npm run test
```

View file

@ -20,7 +20,7 @@ exports.addrole = {
if (suffix) {
//suffix = suffix.toLowerCase();
// Checks if the role mentioned in the message is in the allowed roles listed in the wunderbot config.
if (rolelist.allowedroles.includes(suffix)) {
if (rolelist.allowedroles.includes(suffix) || rolelist.baserole.includes(suffix)) {
// Checks if the role even exists in the discord server
if (newrole !== null) {
// Checks if the member has the role that they are trying to add
@ -28,7 +28,8 @@ exports.addrole = {
msg.member.addRole(newrole).then(msg.channel.send(msg.member + ' has been added to the ' + suffix + ' role!'));
if (rolelist.baserole !== ' ') {
if (baserole !== null) {
if (!msg.member.roles.find('name', rolelist.baserole)) {
// Checks if Member has the baserole, and also checks if they just added the baserole
if (!msg.member.roles.find('name', rolelist.baserole) && suffix !== rolelist.baserole) {
msg.member.addRole(baserole).then(msg.channel.send(msg.member + ' has been added to the ' + rolelist.baserole + ' role!'));
}
} else {
@ -91,7 +92,7 @@ exports.roles = {
fields: [
{
name: 'List of roles',
value: buildRoleString(rolelist.allowedroles),
value: buildRoleString(rolelist.allowedroles) + '`' + rolelist.baserole + '`',
inline: false
},
{