Exemple #1
0
        private static void Bot_OnMessage(object sender, MessageEventArgs e)
        {
            var message   = e.Message;
            var botHandle = (TelegramBotClient)sender;

            if ((DateTime.Now - message.Date).TotalMinutes > 1)
            {
                return;
            }

            CultureInfo.CurrentCulture = new CultureInfo(message.From.LanguageCode ?? "en-US");

            if (!string.IsNullOrWhiteSpace(message.Text))
            {
                _messageHandler.Run(botHandle, message, message.Text).FireAndForget(botHandle, message);
            }
        }