1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-05-10 16:03:15 +03:00

Add mute role support & fix /unmute (#109)

- Added support for `MuteRole`, now if you add any role to this setting,
then try to mute a member, all his roles will be removed except for the
one you set in this setting.
- Fixed `/unmute`, that tried to set target's display name to unmute
reason.

---------

Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
This commit is contained in:
Macintxsh 2023-09-21 20:16:09 +03:00 committed by GitHub
parent b796b885a1
commit 1e8b7e5373
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 172 additions and 16 deletions

View file

@ -23,7 +23,11 @@ public class GuildMemberUpdateResponder : IResponder<IGuildMemberUpdate>
public async Task<Result> RespondAsync(IGuildMemberUpdate gatewayEvent, CancellationToken ct = default)
{
var memberData = await _guildData.GetMemberData(gatewayEvent.GuildID, gatewayEvent.User.ID, ct);
memberData.Roles = gatewayEvent.Roles.ToList().ConvertAll(r => r.Value);
if (memberData.MutedUntil is null)
{
memberData.Roles = gatewayEvent.Roles.ToList().ConvertAll(r => r.Value);
}
return Result.FromSuccess();
}
}