moved some stuff around
This commit is contained in:
		@@ -250,12 +250,16 @@ namespace NadekoBot.Modules.Gambling
 | 
			
		||||
 | 
			
		||||
                private Task Client_MessageReceived(SocketMessage imsg)
 | 
			
		||||
                {
 | 
			
		||||
                    var msg = imsg as SocketUserMessage;
 | 
			
		||||
                    if (msg == null)
 | 
			
		||||
                    var _ = Task.Run(() =>
 | 
			
		||||
                    {
 | 
			
		||||
                        var msg = imsg as SocketUserMessage;
 | 
			
		||||
                        if (msg == null)
 | 
			
		||||
                            return Task.CompletedTask;
 | 
			
		||||
                        if ((msg.Author.Id == _client.CurrentUser.Id) || !(imsg.Channel is ITextChannel) || imsg.Channel != _raceChannel)
 | 
			
		||||
                            return Task.CompletedTask;
 | 
			
		||||
                        Interlocked.Increment(ref _messagesSinceGameStarted);
 | 
			
		||||
                        return Task.CompletedTask;
 | 
			
		||||
                    if ((msg.Author.Id == _client.CurrentUser.Id) || !(imsg.Channel is ITextChannel) || imsg.Channel != _raceChannel)
 | 
			
		||||
                        return Task.CompletedTask;
 | 
			
		||||
                    Interlocked.Increment(ref _messagesSinceGameStarted);
 | 
			
		||||
                    });
 | 
			
		||||
                    return Task.CompletedTask;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -122,7 +122,7 @@ namespace NadekoBot.Modules.Gambling
 | 
			
		||||
                    });
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                return Task.Delay(0);
 | 
			
		||||
                return Task.CompletedTask;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public async Task FlowerReactionEvent(ICommandContext context, int amount)
 | 
			
		||||
 
 | 
			
		||||
@@ -184,9 +184,8 @@ $@"--
 | 
			
		||||
                await End().ConfigureAwait(false);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            private async Task PotentialAcro(SocketMessage arg)
 | 
			
		||||
            private Task PotentialAcro(SocketMessage arg)
 | 
			
		||||
            {
 | 
			
		||||
                await Task.Yield();
 | 
			
		||||
                var _ = Task.Run(async () =>
 | 
			
		||||
                {
 | 
			
		||||
                    try
 | 
			
		||||
@@ -285,6 +284,7 @@ $@"--
 | 
			
		||||
                        _log.Warn(ex);
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
                return Task.CompletedTask;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            public async Task End()
 | 
			
		||||
 
 | 
			
		||||
@@ -117,9 +117,8 @@ namespace NadekoBot.Modules.Games.Hangman
 | 
			
		||||
                await GameChannel.EmbedAsync(embed.WithOkColor()).ConfigureAwait(false);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private async Task PotentialGuess(SocketMessage msg)
 | 
			
		||||
        private Task PotentialGuess(SocketMessage msg)
 | 
			
		||||
        {
 | 
			
		||||
            await Task.Yield();
 | 
			
		||||
            var _ = Task.Run(async () =>
 | 
			
		||||
            {
 | 
			
		||||
                try
 | 
			
		||||
@@ -194,6 +193,7 @@ namespace NadekoBot.Modules.Games.Hangman
 | 
			
		||||
                }
 | 
			
		||||
                catch (Exception ex) { _log.Warn(ex); }
 | 
			
		||||
            });
 | 
			
		||||
            return Task.CompletedTask;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public string GetHangman() => $@". ┌─────┐
 | 
			
		||||
 
 | 
			
		||||
@@ -107,9 +107,8 @@ namespace NadekoBot.Modules.Games.Models
 | 
			
		||||
            _client.MessageReceived += AnswerReceived;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private async Task AnswerReceived(SocketMessage imsg)
 | 
			
		||||
        private Task AnswerReceived(SocketMessage imsg)
 | 
			
		||||
        {
 | 
			
		||||
            await Task.Yield();
 | 
			
		||||
            var _ = Task.Run(async () =>
 | 
			
		||||
            {
 | 
			
		||||
                try
 | 
			
		||||
@@ -145,6 +144,7 @@ namespace NadekoBot.Modules.Games.Models
 | 
			
		||||
                }
 | 
			
		||||
                catch (Exception ex) { _log.Warn(ex); }
 | 
			
		||||
            });
 | 
			
		||||
            return Task.CompletedTask;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private bool Judge(int errors, int textLength) => errors <= textLength / 25;
 | 
			
		||||
 
 | 
			
		||||
@@ -178,9 +178,8 @@ namespace NadekoBot.Modules.Games.Trivia
 | 
			
		||||
                try { await Channel.SendConfirmAsync(GetText("trivia_game"), GetText("trivia_stopping")).ConfigureAwait(false); } catch (Exception ex) { _log.Warn(ex); }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private async Task PotentialGuess(SocketMessage imsg)
 | 
			
		||||
        private Task PotentialGuess(SocketMessage imsg)
 | 
			
		||||
        {
 | 
			
		||||
            await Task.Yield();
 | 
			
		||||
            var _ = Task.Run(async () =>
 | 
			
		||||
            {
 | 
			
		||||
                try
 | 
			
		||||
@@ -242,6 +241,7 @@ namespace NadekoBot.Modules.Games.Trivia
 | 
			
		||||
                }
 | 
			
		||||
                catch (Exception ex) { _log.Warn(ex); }
 | 
			
		||||
            });
 | 
			
		||||
            return Task.CompletedTask;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public string GetLeaderboard()
 | 
			
		||||
 
 | 
			
		||||
@@ -34,7 +34,7 @@ namespace NadekoBot.Modules
 | 
			
		||||
 | 
			
		||||
        protected override void BeforeExecute()
 | 
			
		||||
        {
 | 
			
		||||
            _cultureInfo =_localization.GetCultureInfo(Context.Guild?.Id);
 | 
			
		||||
            _cultureInfo = _localization.GetCultureInfo(Context.Guild?.Id);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //public Task<IUserMessage> ReplyConfirmLocalized(string titleKey, string textKey, string url = null, string footer = null)
 | 
			
		||||
@@ -111,16 +111,20 @@ namespace NadekoBot.Modules
 | 
			
		||||
 | 
			
		||||
            Task MessageReceived(SocketMessage arg)
 | 
			
		||||
            {
 | 
			
		||||
                if (!(arg is SocketUserMessage userMsg) ||
 | 
			
		||||
                    !(userMsg.Channel is ITextChannel chan) ||
 | 
			
		||||
                    userMsg.Author.Id != userId ||
 | 
			
		||||
                    userMsg.Channel.Id != channelId)
 | 
			
		||||
                var _ = Task.Run(() =>
 | 
			
		||||
                {
 | 
			
		||||
                    return Task.CompletedTask;
 | 
			
		||||
                }
 | 
			
		||||
                    if (!(arg is SocketUserMessage userMsg) ||
 | 
			
		||||
                        !(userMsg.Channel is ITextChannel chan) ||
 | 
			
		||||
                        userMsg.Author.Id != userId ||
 | 
			
		||||
                        userMsg.Channel.Id != channelId)
 | 
			
		||||
                    {
 | 
			
		||||
                        return Task.CompletedTask;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                userInputTask.SetResult(arg.Content);
 | 
			
		||||
                userMsg.DeleteAfter(1);
 | 
			
		||||
                    userInputTask.SetResult(arg.Content);
 | 
			
		||||
                    userMsg.DeleteAfter(1);
 | 
			
		||||
                    return Task.CompletedTask;
 | 
			
		||||
                });
 | 
			
		||||
                return Task.CompletedTask;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -187,7 +187,6 @@ namespace NadekoBot.Services
 | 
			
		||||
 | 
			
		||||
        private async Task MessageReceivedHandler(SocketMessage msg)
 | 
			
		||||
        {
 | 
			
		||||
            await Task.Yield();
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                if (msg.Author.IsBot || !_bot.Ready) //no bots, wait until bot connected and initialized
 | 
			
		||||
 
 | 
			
		||||
@@ -97,19 +97,18 @@ namespace NadekoBot.Services.Games
 | 
			
		||||
        private string GetText(ITextChannel ch, string key, params object[] rep)
 | 
			
		||||
            => _strings.GetText(key, ch.GuildId, "Games".ToLowerInvariant(), rep);
 | 
			
		||||
 | 
			
		||||
        private async Task PotentialFlowerGeneration(SocketMessage imsg)
 | 
			
		||||
        private Task PotentialFlowerGeneration(SocketMessage imsg)
 | 
			
		||||
        {
 | 
			
		||||
            await Task.Yield();
 | 
			
		||||
            var msg = imsg as SocketUserMessage;
 | 
			
		||||
            if (msg == null || msg.Author.IsBot)
 | 
			
		||||
                return;
 | 
			
		||||
                return Task.CompletedTask;
 | 
			
		||||
 | 
			
		||||
            var channel = imsg.Channel as ITextChannel;
 | 
			
		||||
            if (channel == null)
 | 
			
		||||
                return;
 | 
			
		||||
                return Task.CompletedTask;
 | 
			
		||||
 | 
			
		||||
            if (!GenerationChannels.Contains(channel.Id))
 | 
			
		||||
                return;
 | 
			
		||||
                return Task.CompletedTask;
 | 
			
		||||
 | 
			
		||||
            var _ = Task.Run(async () =>
 | 
			
		||||
            {
 | 
			
		||||
@@ -159,7 +158,7 @@ namespace NadekoBot.Services.Games
 | 
			
		||||
                    LogManager.GetCurrentClassLogger().Warn(ex);
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
            return;
 | 
			
		||||
            return Task.CompletedTask;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -39,9 +39,8 @@ namespace NadekoBot.Services.Searches
 | 
			
		||||
            _log = LogManager.GetCurrentClassLogger();
 | 
			
		||||
 | 
			
		||||
            //translate commands
 | 
			
		||||
            _client.MessageReceived += async (msg) =>
 | 
			
		||||
            _client.MessageReceived += (msg) =>
 | 
			
		||||
            {
 | 
			
		||||
                await Task.Yield();
 | 
			
		||||
                var _ = Task.Run(async () =>
 | 
			
		||||
                {
 | 
			
		||||
                    try
 | 
			
		||||
@@ -70,6 +69,7 @@ namespace NadekoBot.Services.Searches
 | 
			
		||||
                    }
 | 
			
		||||
                    catch { }
 | 
			
		||||
                });
 | 
			
		||||
                return Task.CompletedTask;
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            //pokemon commands
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user