public static async void Mute(string moderator, ITextChannel channel, SocketGuildUser user) { var guild = user.Guild; //Mute the specified user in each text channel if it's not a bot if (!user.IsBot) { foreach (SocketTextChannel chan in user.Guild.TextChannels) { //Don't mess with channel permissions if nonmembers can't speak there anyway if (IsPublicChannel(chan)) { try { await chan.AddPermissionOverwriteAsync(user, new OverwritePermissions(sendMessages : PermValue.Deny, addReactions : PermValue.Deny), RequestOptions.Default); } catch { Processing.LogConsoleText($"Failed to mute in {guild.Name}#{chan.Name.ToString()}", guild.Id); } } } } //Announce the mute var embed = Embeds.Mute(user); await channel.SendMessageAsync("", embed : embed).ConfigureAwait(false); //Log the mute in the bot-logs channel embed = Embeds.LogMute(moderator, channel, user); var botlog = await channel.Guild.GetTextChannelAsync(UserSettings.Channels.BotLogsId(user.Guild.Id)); if (botlog != null) { await botlog.SendMessageAsync("", embed : embed).ConfigureAwait(false); } }