Merge pull request #316 from lbryio/Coolguy3289-patch-1

Add baserole check to avoid dupe messages
This commit is contained in:
Ralph 2020-05-30 03:31:01 -04:00 committed by GitHub
commit 8d398f53d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 437 additions and 1195 deletions

View file

@ -42,6 +42,8 @@ exports.addrole = {
if (!rolelist.baserole) return; if (!rolelist.baserole) return;
// Confirm that the role exists on the server and if not then be sure to send a nag message // Confirm that the role exists on the server and if not then be sure to send a nag message
if (!baserole) return send('The base role of ' + rolelist.baserole + ' has been set in config but is missing from the server'); if (!baserole) return send('The base role of ' + rolelist.baserole + ' has been set in config but is missing from the server');
// Checks if the new role being added is the same as the baserole, then skips the messages below if this is the case.
if (newrole == baserole) return;
// Confirm if the user has the baserole already, including if it was added just now // Confirm if the user has the baserole already, including if it was added just now
if (msg.member.roles.find(item => item.name === baserole.name)) return; if (msg.member.roles.find(item => item.name === baserole.name)) return;
// Add the base role and avoid spamming the user by only mentioning them in the previous message // Add the base role and avoid spamming the user by only mentioning them in the previous message

1604
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -2,22 +2,22 @@
"dependencies": { "dependencies": {
"app-root-path": "^2.2.1", "app-root-path": "^2.2.1",
"bitcoin": "^3.0.1", "bitcoin": "^3.0.1",
"braces": "^2.3.1", "braces": "^3.0.2",
"chrono-node": "^1.3.11", "chrono-node": "^1.4.6",
"config": "^3.2.4", "config": "^3.3.1",
"discord-irc": "^2.8.0", "discord-irc": "^2.8.1",
"discord.js": "^11.5.1", "discord.js": "^11.6.4",
"file-exists": "^5.0.1", "file-exists": "^5.0.1",
"jsonfile": "^5.0.0", "jsonfile": "^5.0.0",
"jsonpath": "^1.0.1", "jsonpath": "^1.0.1",
"moment": "^2.24.0", "moment": "^2.26.0",
"mongodb": "^3.4.1", "mongodb": "^3.5.8",
"mongoose": "^5.8.3", "mongoose": "^5.9.16",
"needle": "^2.4.0", "needle": "^2.5.0",
"numeral": "^2.0.6", "numeral": "^2.0.6",
"request": "^2.88.0", "request": "^2.88.2",
"request-promise": "^4.2.5", "request-promise": "^4.2.5",
"sleep": "^6.1.0", "sleep": "^6.2.0",
"wget": "^0.0.1" "wget": "^0.0.1"
}, },
"scripts": { "scripts": {
@ -26,11 +26,11 @@
"test": "prettier --write \"{bot,.}/**/*.{js,json}\" --single-quote --print-width 240 --list-different && npm audit && npm i" "test": "prettier --write \"{bot,.}/**/*.{js,json}\" --single-quote --print-width 240 --list-different && npm audit && npm i"
}, },
"devDependencies": { "devDependencies": {
"husky": "^3.1.0", "husky": "^4.2.5",
"prettier": "^1.19.1" "prettier": "^1.19.1"
}, },
"name": "wunderbot-discord", "name": "wunderbot-discord",
"version": "1.0.5", "version": "1.0.6",
"description": "LBRY bot for Discord", "description": "LBRY bot for Discord",
"main": "bot/bot.js", "main": "bot/bot.js",
"repository": "https://github.com/lbryio/lbry-wunderbot", "repository": "https://github.com/lbryio/lbry-wunderbot",