1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-05-01 19:49:55 +03:00

Continue adapting code to new guild data storage

This commit is contained in:
Octol1ttle 2022-12-30 18:34:48 +05:00
parent 163e3ac46b
commit fe2cfb3b3c
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF
10 changed files with 145 additions and 94 deletions

View file

@ -20,10 +20,12 @@ public sealed class UnmuteCommand : ICommand {
public static async Task UnmuteMemberAsync(CommandProcessor cmd, SocketGuildUser toUnmute,
string reason) {
var requestOptions = Utils.GetRequestOptions($"({cmd.Context.User}) {reason}");
var role = GuildData.FromSocketGuild(cmd.Context.Guild).MuteRole;
var data = GuildData.FromSocketGuild(cmd.Context.Guild);
var role = data.MuteRole;
if (role is not null && toUnmute.Roles.Contains(role)) {
// TODO: Return roles
await toUnmute.AddRolesAsync(data.MemberData[toUnmute.Id].Roles, requestOptions);
await toUnmute.RemoveRoleAsync(role, requestOptions);
} else {
if (toUnmute.TimedOutUntil is null || toUnmute.TimedOutUntil.Value.ToUnixTimeSeconds() <
DateTimeOffset.Now.ToUnixTimeSeconds()) {
@ -31,7 +33,7 @@ public sealed class UnmuteCommand : ICommand {
return;
}
await toUnmute.RemoveTimeOutAsync();
await toUnmute.RemoveTimeOutAsync(requestOptions);
}
var feedback = string.Format(Messages.FeedbackMemberUnmuted, toUnmute.Mention, Utils.Wrap(reason));