mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-19 16:33:36 +03:00
Add DateTimeOffset to MutedUntil only if result is success
Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
This commit is contained in:
parent
d20a0c54c9
commit
baa377add6
1 changed files with 5 additions and 2 deletions
|
@ -173,8 +173,6 @@ public class MuteCommandGroup : CommandGroup
|
|||
IUser target, string reason, Snowflake guildId, GuildData data, MemberData memberData,
|
||||
IUser user, DateTimeOffset until, Snowflake muteRole, CancellationToken ct = default)
|
||||
{
|
||||
memberData.MutedUntil = until;
|
||||
|
||||
var assignRoles = new List<Snowflake> { muteRole };
|
||||
|
||||
if (!GuildSettings.RemoveRolesOnMute.Get(data.Settings))
|
||||
|
@ -185,6 +183,11 @@ public class MuteCommandGroup : CommandGroup
|
|||
var muteResult = await _guildApi.ModifyGuildMemberAsync(
|
||||
guildId, target.ID, roles: assignRoles,
|
||||
reason: $"({user.GetTag()}) {reason}".EncodeHeader(), ct: ct);
|
||||
if (muteResult.IsSuccess)
|
||||
{
|
||||
memberData.MutedUntil = until;
|
||||
}
|
||||
|
||||
return muteResult;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue