0

I want to create a Button that when Click on button user go to the group telegram. but cann`t

using NetTelegramBotApi; // last verion

class Program
    {
        private static string Token = "......";
       // private static InlineKeyboardMarkup Menu1;
    }


  public static async Task RunBot()
        {


 // var keyboardInlineMenu = new InlineKeyboardButton[20][];

.....
.....
....
....

if (text == "/start")
  {


// keyboardInlineMenu  = new InlineKeyboardButton () {


InlineKeyboardButton[][] buttons = new InlineKeyboardButton[2][];
buttons[0][0] = new InlineKeyboardButton(){Text = " Go to group  ", Url = "https://api.telegram.org/......" CallbackData = "Some Callback Data"};
InlineKeyboardMarkup inlineKeyboardMarkup = new InlineKeyboardMarkup() { InlineKeyboard = buttons  };

Error (in line buttons[0][0] )

Object reference not set to an instance of an object.

RedArmy
  • 315
  • 1
  • 6
  • 16

1 Answers1

2
 var newMsg = new SendMessage(update.Message.Chat.Id, "msg")
                            {
                                ReplyMarkup = new InlineKeyboardMarkup()
                                    {
                                        InlineKeyboard = new[] 
        {
            new[] { new InlineKeyboardButton{Text="A",Url = "http://www.A.com/"}, new InlineKeyboardButton(){Text="B",Url = "http://www.B.com/"} }

        }
                                    }
                            };

                            await bot.MakeRequestAsync(newMsg);
                            continue;
cyrus2500
  • 428
  • 4
  • 15