/// <inheritdoc /> public async Task <bool> UnmuteAsync(SocketGuildUser user, SocketUser unmuter, string reason = null) { if (!await DataBaseUtil.ExpireMuteAsync(user.Id)) { if (unmuter != _client.CurrentUser) { await _data.ChannelLog($"Failure Unmuting {user}", "No active mute found."); } return(false); } // No need to check if the user has the role. await user.RemoveRoleAsync( _data.MuteRole, new RequestOptions { AuditLogReason = $"{unmuter}: {reason}".Truncate(512, true) }); #region Messages string message = "You have been unmuted" + (reason == null ? "!" : $" because:```{reason}```"); try { // Tries to send a DM. await user.SendMessageAsync(message); } catch { // Mentions the author in the the general channel instead. await _data.GeneralChannel.SendMessageAsync($"Hey {user.Mention}!\n{message}"); } await _data.ChannelLog($"Unmuted {user}", $"Unmuter: {unmuter}\n{reason}"); #endregion return(true); }