protected override async Task HandlerLogicImpl(UpdateHandlerArgs args) { StringBuilder b = new StringBuilder(); b.AppendLine("<code>Parsed Tokens</code>"); for (int i = 0; i < args.MessageArgs.CommandTokens.Count; i++) { b.AppendLine($"<code>[{i}] </code>{args.MessageArgs.CommandTokens[i]}"); } await args.BotClient.SendTextMessageAsync( args.MessageArgs.Message.Chat.Id, b.ToString(), parseMode : ParseMode.Html); }
protected override async Task HandlerLogicImpl(UpdateHandlerArgs args) { // Thanks to HandlesUpdateType we already know the Update is of type Message Message m = args.MessageArgs.Message; // We only process text-messages if (m.Type == MessageType.Text) { if (args.MessageArgs.CommandTokens[0].ToLower().Equals("/start")) { await args.BotClient.SendTextMessageAsync( m.Chat.Id, "Hello Telegram World" ); // Make sure to mark Update as handled to hide it from successive handlers args.Handled = true; } } }