'Assign/Unassign roles using discord.NET
I am trying to assign and unassign roles using discord.net, I tried this:
if (message.Author is SocketGuildUser socketUser)
{
SocketGuild socketGuild = socketUser.Guild;
var user = socketGuild.GetUser(UserID);
var role = socketGuild.GetRole(RoleID);
user.RemoveRoleAsync(role);
}
Although it didn't remove the role. I used the same code with the addrole but changed the RemoveRoleAsync with AddRoleAsync
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
