Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

hey, how can i make the reposting commands moderator only? #42

Open
saatvikn opened this issue Aug 9, 2020 · 6 comments
Open

hey, how can i make the reposting commands moderator only? #42

saatvikn opened this issue Aug 9, 2020 · 6 comments
Assignees

Comments

@saatvikn
Copy link

saatvikn commented Aug 9, 2020

No description provided.

@MysteryPancake
Copy link
Owner

This bot does not currently have an admin filter, but it should not be too difficult. There is a good guide for this here.

With this bot I think it could be possible by adding the following check below line 484:
if (!message.member.hasPermission("ADMINISTRATOR")) return;

Hopefully this will prevent the rest of the message event from running if they are not an administrator.

@saatvikn
Copy link
Author

saatvikn commented Aug 9, 2020

ok let me see

@saatvikn
Copy link
Author

if i put if (!message.member.hasPermission("ADMINISTRATOR")) return; under line 484 then wont it return the bot and make it not respond to the command for people with the admin permission?

@MysteryPancake
Copy link
Owner

MysteryPancake commented Aug 10, 2020

Returning can be used to end a function early. It would be the same as doing this:

if (message.member.hasPermission("ADMINISTRATOR")) {
    // code
}

^ This way should also work
With returning, the logic should be the same but without extra brackets:

if (!message.member.hasPermission("ADMINISTRATOR")) return;
// code

It reads as "if member does not have permission administrator, stop"
Which should act the same as "if member has permission administrator, continue"

@saatvikn
Copy link
Author

saatvikn commented Aug 10, 2020

ok
so i will just if (!message.member.hasPermission("ADMINISTRATOR")) return; put this it will work. right?

@saatvikn
Copy link
Author

btw tysm

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants