键盘按钮电报bot C#

时间:2020-01-16 20:13:50

标签: c# bots telegram

我有webhook电报bot,但是InlineKeyboardMarkup不起作用。 它显示了一个键盘,但是按钮什么也没做。

代码: 1.键盘

    public static InlineKeyboardMarkup rkm = new InlineKeyboardMarkup(new[]
        {
                    // first row
                    new []
                    {
                        InlineKeyboardButton.WithCallbackData("Login As Admin", "callbackLoginAsAdmin"),
                        InlineKeyboardButton.WithCallbackData("Check regestration", "callbackCheck"),


                    },
                    // second row
                    new []
                    {
                        InlineKeyboardButton.WithCallbackData("help", "callbackHelp"),
                        InlineKeyboardButton.WithCallbackData("RandomSticker", "callbackRandomSticker"),
                    }
        });
  1. 更新

    public async Task<OkResult> Update(Update update) 
    {
    
    
        if (update.Message.Date >= Bot.StartTime && update.Type == UpdateType.Message)
        {
         ... 
    
        }
    
        else if (update.CallbackQuery != null )
        {
            var client = await Bot.Get();
            var Callback = update.CallbackQuery;
            //await client.AnswerCallbackQueryAsync(Callback.Id, "works", true);
            await client.SendTextMessageAsync("chat id", "works");
        }
    
    
    
    
        return Ok();
    }
    

    } }

如果要按下任何按钮,我只是想发送“作品”。

0 个答案:

没有答案