mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-01-31 09:09:00 +03:00
Remove timeout from user if it exists, but there is a mute role configured
This commit is contained in:
parent
552ebdd4e0
commit
a06376443f
2 changed files with 3 additions and 7 deletions
|
@ -39,7 +39,7 @@ public class UnmuteCommand : Command {
|
||||||
var requestOptions = Utils.GetRequestOptions($"({author}) {reason}");
|
var requestOptions = Utils.GetRequestOptions($"({author}) {reason}");
|
||||||
var role = Utils.GetMuteRole(ref guild);
|
var role = Utils.GetMuteRole(ref guild);
|
||||||
|
|
||||||
if (role != null) {
|
if (role != null && toUnmute.Roles.Contains(role)) {
|
||||||
var rolesRemoved = Boyfriend.GetRemovedRoles(guild.Id);
|
var rolesRemoved = Boyfriend.GetRemovedRoles(guild.Id);
|
||||||
|
|
||||||
if (rolesRemoved.ContainsKey(toUnmute.Id)) {
|
if (rolesRemoved.ContainsKey(toUnmute.Id)) {
|
||||||
|
@ -48,10 +48,7 @@ public class UnmuteCommand : Command {
|
||||||
CommandHandler.ConfigWriteScheduled = true;
|
CommandHandler.ConfigWriteScheduled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toUnmute.Roles.Contains(role)) { await toUnmute.RemoveRoleAsync(role, requestOptions); } else {
|
await toUnmute.RemoveRoleAsync(role, requestOptions);
|
||||||
Error(Messages.MemberNotMuted, false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (toUnmute.TimedOutUntil == null || toUnmute.TimedOutUntil.Value.ToUnixTimeMilliseconds() <
|
if (toUnmute.TimedOutUntil == null || toUnmute.TimedOutUntil.Value.ToUnixTimeMilliseconds() <
|
||||||
DateTimeOffset.Now.ToUnixTimeMilliseconds()) {
|
DateTimeOffset.Now.ToUnixTimeMilliseconds()) {
|
||||||
|
|
|
@ -57,9 +57,8 @@ public class EventHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task MessageReceivedEvent(SocketMessage messageParam) {
|
private static async Task MessageReceivedEvent(SocketMessage messageParam) {
|
||||||
if (messageParam is not SocketUserMessage message) return;
|
if (messageParam is not SocketUserMessage { Author: SocketGuildUser user } message) return;
|
||||||
|
|
||||||
var user = (SocketGuildUser)message.Author;
|
|
||||||
var guild = user.Guild;
|
var guild = user.Guild;
|
||||||
var guildConfig = Boyfriend.GetGuildConfig(guild.Id);
|
var guildConfig = Boyfriend.GetGuildConfig(guild.Id);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue