How to make it so a certain role is required in order to execute a command

1.5k Views Asked by At

I would like require a certain role on the user in order for them to use/execute specific commands.

Is there an easy way to do this for individual commands?

1

There are 1 best solutions below

0
On BEST ANSWER

This is using Discord.Net 1.0

        var User = Context.User as SocketGuildUser;
        var role = Context.Guild.Roles.FirstOrDefault(x => x.Name == "ROLENAME");

        if (User.Roles.Contains(role))
        {
            // do stuff
        }