Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADMIN & MODS commands are accessible to everyone. #7

Closed
vincentdchn opened this issue Jun 4, 2021 · 6 comments
Closed

ADMIN & MODS commands are accessible to everyone. #7

vincentdchn opened this issue Jun 4, 2021 · 6 comments
Labels
bug Something isn't working

Comments

@vincentdchn
Copy link

Hi !

I look through the code and tested the bot quit a bit and figured out that mods and admin commands are usable by everyone on the server.

config.json is configured like this :

"adminRoleName": "MODÉRATEUR",
"modRoleName": "MODÉRATEUR",

start.js is set up like this (I didn't touche anything) :

let AdminR = g.roles.find(role => role.name === config.adminRoleName);
if (!AdminR) {
AdminR = { "id": "111111111111111111" };
console.info("[ERROR] [CONFIG] I could not find admin role: " + config.adminRoleName);
}
let ModR = g.roles.find(role => role.name === config.modRoleName);
if (!ModR) {
ModR = { "id": "111111111111111111" };
console.info("[ERROR] [CONFIG] I could not find mod role: " + config.modRoleName);
}

But still, when a regular member try the command <temprole add @hisname>it works ...

The condition before the command output is :

if (g.members.filter(m => m.roles.includes(AdminR.id)) || g.members.filter(m => m.roles.includes(ModR.id)))

Any ideas ?

@acocalypso
Copy link
Owner

Let me debug that, I'll get back to you.

@acocalypso acocalypso added the bug Something isn't working label Jun 4, 2021
@vincentdchn
Copy link
Author

Thanks 🙏🏼 It's been 4h and I don't understand why... I'm a beginner btw.

@acocalypso
Copy link
Owner

git pull should fix the issue now.

@vincentdchn
Copy link
Author

Hey, yeah role permissions works thank you !

But now the bot can't reconnect to the database ...

We agree that I only have to create a new database and then change the infos in the config.json right ?

@acocalypso
Copy link
Owner

@vincentdchn just create an empty mysql database and put the information in the config.json.

if you haven't installed the depencies yet, do it now with npm install.
node start.js will start the bot and fill the needed tables for the database and the bot should work.

@vincentdchn
Copy link
Author

Yay. Everything's working ! Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants