Updated discord.net
This commit is contained in:
		 Submodule Discord.Net updated: 7c0cce6d35...05e7377142
									
								
							| @@ -25,7 +25,6 @@ namespace NadekoBot.Modules.Administration | ||||
|             static AutoAssignRoleCommands() | ||||
|             { | ||||
|                 _log = LogManager.GetCurrentClassLogger(); | ||||
|                 var sw = Stopwatch.StartNew(); | ||||
|  | ||||
|                 AutoAssignedRoles = new ConcurrentDictionary<ulong, ulong>(NadekoBot.AllGuildConfigs.Where(x => x.AutoAssignRoleId != 0) | ||||
|                     .ToDictionary(k => k.GuildId, v => v.AutoAssignRoleId)); | ||||
| @@ -46,9 +45,6 @@ namespace NadekoBot.Modules.Administration | ||||
|                     } | ||||
|                     catch (Exception ex) { _log.Warn(ex); } | ||||
|                 }; | ||||
|  | ||||
|                 sw.Stop(); | ||||
|                 _log.Debug($"Loaded in {sw.Elapsed.TotalSeconds:F2}s"); | ||||
|             } | ||||
|  | ||||
|             [NadekoCommand, Usage, Description, Aliases] | ||||
|   | ||||
| @@ -132,7 +132,7 @@ namespace NadekoBot.Modules.Administration | ||||
|                 if (ids[1].ToUpperInvariant().StartsWith("C:")) | ||||
|                 { | ||||
|                     var cid = ulong.Parse(ids[1].Substring(2)); | ||||
|                     var ch = (await server.GetTextChannelsAsync()).Where(c => c.Id == cid).FirstOrDefault(); | ||||
|                     var ch = server.TextChannels.Where(c => c.Id == cid).FirstOrDefault(); | ||||
|                     if (ch == null) | ||||
|                     { | ||||
|                         return; | ||||
| @@ -159,9 +159,7 @@ namespace NadekoBot.Modules.Administration | ||||
|             [OwnerOnly] | ||||
|             public async Task Announce([Remainder] string message) | ||||
|             { | ||||
|                 var channels = await Task.WhenAll(NadekoBot.Client.GetGuilds().Select(g => | ||||
|                     g.GetDefaultChannelAsync() | ||||
|                 )).ConfigureAwait(false); | ||||
|                 var channels = NadekoBot.Client.GetGuilds().Select(g => g.DefaultChannel).ToArray(); | ||||
|                 if (channels == null) | ||||
|                     return; | ||||
|                 await Task.WhenAll(channels.Where(c => c != null).Select(c => c.SendConfirmAsync($"🆕 Message from {Context.User} `[Bot Owner]`:", message))) | ||||
|   | ||||
| @@ -57,7 +57,7 @@ namespace NadekoBot.Modules.Administration | ||||
|                     { | ||||
|                         try | ||||
|                         { | ||||
|                             await (await guild.GetOwnerAsync()).SendErrorAsync( | ||||
|                             await guild.Owner.SendErrorAsync( | ||||
|                                 "⚠️ I don't have **manage server** and/or **manage channels** permission," + | ||||
|                                 $" so I cannot run `voice+text` on **{guild.Name}** server.").ConfigureAwait(false); | ||||
|                         } | ||||
| @@ -75,16 +75,16 @@ namespace NadekoBot.Modules.Administration | ||||
|                     var beforeVch = before.VoiceChannel; | ||||
|                     if (beforeVch != null) | ||||
|                     { | ||||
|                         var textChannel = (await guild.GetTextChannelsAsync()).Where(t => t.Name == GetChannelName(beforeVch.Name).ToLowerInvariant()).FirstOrDefault(); | ||||
|                         var textChannel = guild.TextChannels.Where(t => t.Name == GetChannelName(beforeVch.Name).ToLowerInvariant()).FirstOrDefault(); | ||||
|                         if (textChannel != null) | ||||
|                             await textChannel.AddPermissionOverwriteAsync(user, | ||||
|                                 new OverwritePermissions(readMessages: PermValue.Deny, | ||||
|                                                    sendMessages: PermValue.Deny)).ConfigureAwait(false); | ||||
|                     } | ||||
|                     var afterVch = after.VoiceChannel; | ||||
|                     if (afterVch != null && guild.AFKChannelId != afterVch.Id) | ||||
|                     if (afterVch != null && guild.AFKChannel.Id != afterVch.Id) | ||||
|                     { | ||||
|                         var textChannel = (await guild.GetTextChannelsAsync()) | ||||
|                         ITextChannel textChannel = guild.TextChannels | ||||
|                                                     .Where(t => t.Name == GetChannelName(afterVch.Name).ToLowerInvariant()) | ||||
|                                                     .FirstOrDefault(); | ||||
|                         if (textChannel == null) | ||||
|   | ||||
| @@ -37,9 +37,7 @@ namespace NadekoBot.Modules.ClashOfClans | ||||
|                         .Select(cw => | ||||
|                         { | ||||
|                             cw.Channel = NadekoBot.Client.GetGuild(cw.GuildId) | ||||
|                                                          ?.GetTextChannelAsync(cw.ChannelId) | ||||
|                                                          .GetAwaiter() | ||||
|                                                          .GetResult(); | ||||
|                                                          .GetTextChannel(cw.ChannelId); | ||||
|                             return cw; | ||||
|                         }) | ||||
|                         .Where(cw => cw.Channel != null) | ||||
| @@ -322,7 +320,7 @@ namespace NadekoBot.Modules.ClashOfClans | ||||
|  | ||||
|         public static async Task<ClashWar> CreateWar(string enemyClan, int size, ulong serverId, ulong channelId) | ||||
|         { | ||||
|             var channel = await NadekoBot.Client.GetGuild(serverId)?.GetTextChannelAsync(channelId); | ||||
|             var channel = NadekoBot.Client.GetGuild(serverId)?.GetTextChannel(channelId); | ||||
|             using (var uow = DbHandler.UnitOfWork()) | ||||
|             { | ||||
|                 var cw = new ClashWar | ||||
|   | ||||
| @@ -59,7 +59,7 @@ namespace NadekoBot.Modules.Gambling | ||||
|                     catch | ||||
|                     { | ||||
|                         try { await msg.DeleteAsync().ConfigureAwait(false); } | ||||
|                         catch { } | ||||
|                         catch { return; } | ||||
|                     } | ||||
|                 } | ||||
|                 using (msg.OnReaction(async (r) => | ||||
|   | ||||
| @@ -76,9 +76,9 @@ namespace NadekoBot.Modules.Games.Trivia | ||||
|  | ||||
|                     questionMessage = await channel.EmbedAsync(questionEmbed).ConfigureAwait(false); | ||||
|                 } | ||||
|                 catch (HttpException ex) when (ex.StatusCode == System.Net.HttpStatusCode.NotFound ||  | ||||
|                                                ex.StatusCode == System.Net.HttpStatusCode.Forbidden || | ||||
|                                                ex.StatusCode == System.Net.HttpStatusCode.BadRequest) | ||||
|                 catch (HttpException ex) when (ex.HttpCode == System.Net.HttpStatusCode.NotFound ||  | ||||
|                                                ex.HttpCode == System.Net.HttpStatusCode.Forbidden || | ||||
|                                                ex.HttpCode == System.Net.HttpStatusCode.BadRequest) | ||||
|                 { | ||||
|                     return; | ||||
|                 } | ||||
| @@ -106,7 +106,7 @@ namespace NadekoBot.Modules.Games.Trivia | ||||
|                                 await questionMessage.ModifyAsync(m => m.Embed = questionEmbed.WithFooter(efb => efb.WithText(CurrentQuestion.GetHint())).Build()) | ||||
|                                     .ConfigureAwait(false); | ||||
|                             } | ||||
|                             catch (HttpException ex) when (ex.StatusCode == System.Net.HttpStatusCode.NotFound || ex.StatusCode == System.Net.HttpStatusCode.Forbidden) | ||||
|                             catch (HttpException ex) when (ex.HttpCode == System.Net.HttpStatusCode.NotFound || ex.HttpCode == System.Net.HttpStatusCode.Forbidden) | ||||
|                             { | ||||
|                                 break; | ||||
|                             } | ||||
|   | ||||
| @@ -105,7 +105,7 @@ namespace NadekoBot.Modules.Searches | ||||
|                                 var server = NadekoBot.Client.GetGuild(fs.GuildId); | ||||
|                                 if (server == null) | ||||
|                                     return; | ||||
|                                 var channel = await server.GetTextChannelAsync(fs.ChannelId); | ||||
|                                 var channel = server.GetTextChannel(fs.ChannelId); | ||||
|                                 if (channel == null) | ||||
|                                     return; | ||||
|                                 try | ||||
|   | ||||
| @@ -40,7 +40,7 @@ namespace NadekoBot.Modules.Utility | ||||
|                 { | ||||
|                     _log = LogManager.GetCurrentClassLogger(); | ||||
|                     this.Repeater = repeater; | ||||
|                     this.Channel = channel ?? NadekoBot.Client.GetGuild(repeater.GuildId)?.GetTextChannelAsync(repeater.ChannelId).GetAwaiter().GetResult(); | ||||
|                     this.Channel = channel ?? NadekoBot.Client.GetGuild(repeater.GuildId)?.GetTextChannel(repeater.ChannelId); | ||||
|                     if (Channel == null) | ||||
|                         return; | ||||
|                     Task.Run(Run); | ||||
| @@ -69,12 +69,12 @@ namespace NadekoBot.Modules.Utility | ||||
|                             { | ||||
|                                 oldMsg = await Channel.SendMessageAsync(toSend).ConfigureAwait(false); | ||||
|                             } | ||||
|                             catch (HttpException ex) when (ex.StatusCode == System.Net.HttpStatusCode.Forbidden) | ||||
|                             catch (HttpException ex) when (ex.HttpCode == System.Net.HttpStatusCode.Forbidden) | ||||
|                             { | ||||
|                                 _log.Warn("Missing permissions. Repeater stopped. ChannelId : {0}", Channel?.Id); | ||||
|                                 return; | ||||
|                             } | ||||
|                             catch (HttpException ex) when (ex.StatusCode == System.Net.HttpStatusCode.NotFound) | ||||
|                             catch (HttpException ex) when (ex.HttpCode == System.Net.HttpStatusCode.NotFound) | ||||
|                             { | ||||
|                                 _log.Warn("Channel not found. Repeater stopped. ChannelId : {0}", Channel?.Id); | ||||
|                                 return; | ||||
|   | ||||
| @@ -68,9 +68,7 @@ namespace NadekoBot.Modules.Utility | ||||
|                     } | ||||
|                     else | ||||
|                     { | ||||
|                         var t = NadekoBot.Client.GetGuild(r.ServerId)?.GetTextChannelAsync(r.ChannelId).ConfigureAwait(false); | ||||
|                         if (t != null) | ||||
|                             ch = await t.Value; | ||||
|                         ch = NadekoBot.Client.GetGuild(r.ServerId)?.GetTextChannel(r.ChannelId); | ||||
|                     } | ||||
|                     if (ch == null) | ||||
|                         return; | ||||
|   | ||||
| @@ -75,7 +75,8 @@ namespace NadekoBot | ||||
|  | ||||
|             //initialize Services | ||||
|             CommandService = new CommandService(new CommandServiceConfig() { | ||||
|                 CaseSensitiveCommands = false | ||||
|                 CaseSensitiveCommands = false, | ||||
|                 DefaultRunMode = RunMode.Sync | ||||
|             }); | ||||
|             Google = new GoogleApiService(); | ||||
|             CommandHandler = new CommandHandler(Client, CommandService); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user