Changing the position of the Bot Role in Discord

898 Views Asked by At

I'm currently trying to get my bot working properly. One problem is that the Role that is automatically assigned to the bot is below all other roles and I don't want that the users have to drag them above the other roles. So I decided to try to change the roles position when the bot joins the server but nothing works. Here's my code:
First I connect my method to the event
_client.JoinedGuild += InviteHandler;
Secondly, I get the role and try to change the properties.

SocketRole BotRole = null;
        foreach(var role in guild.Roles)
        {
            if(role.Name.Equals("KingFive"))
            {
                BotRole = role;
            } else
            {
                continue;
            }
        }

        BotRole.ModifyAsync(x =>
        {
            x.Color = Color.Gold;
            x.Hoist = false;
            x.Position = 10;
        });

        return Task.CompletedTask;

If anyone could help me, I would be happy :)

0

There are 0 best solutions below