c#


Cant Create Keyboard with NetTelegramBotApi in C#


i want to create a keyboard in telegram bot with c#, but i cant,
when i add the keyboards show me the error.
nuget pakage is : Install-Package NetTelegramBotApi
this is a my own code.
namespace TelegramBotConsole
{
class Program
{
// Keyboards
public static ReplyKeyboardMarkup MainMenu;
// Telegram Bot Token.
private static string BotToken="Bot_Api";
static void Main(string[] args)
{
// Add The Keuboards
MainMenu = new ReplyKeyboardMarkup
{
Keyboard = new[] { new[] { "Amuzeshha" }, new[] { "Rahnama", "About" } }
};
// Running The Bot.
Task.Run(() => RunBot());
// Read The Log of Bot.
Console.ReadLine();
}
// Create Bot.
public static async Task RunBot()
{
var Bot = new TelegramBot(BotToken);
var Me = await Bot.MakeRequestAsync(new GetMe());
// Geting The Infromation of Bot.
Console.WriteLine("Username Is : {0}", Me.Username);
Console.WriteLine("My ID Is : {0}", Me.Id);
Console.WriteLine("My Name Is : {0}", Me.FirstName);
long offset = 0;
while (true)
{
var updates = await Bot.MakeRequestAsync(new GetUpdates() { Offset = offset });
foreach (var update in updates)
{
offset = update.UpdateId + 1;
var text = update.Message.Text;
if (text == "/start")
{
var Req = new SendMessage(update.Message.Chat.Id, "You Should Send Picture") { ReplyMarkup = MainMenu };
await Bot.MakeRequestAsync(Req);
continue;
}
if(update.Message.Photo == null)
{
var Req = new SendMessage(update.Message.Chat.Id, "Please Send A Picture") { ReplyMarkup = MainMenu };
await Bot.MakeRequestAsync(Req);
continue;
}
else
{
var Req = new SendMessage(update.Message.Chat.Id, "Thanks") { ReplyMarkup = MainMenu};
await Bot.MakeRequestAsync(Req);
continue;
}
}
}
}
}
this code does not working.
MainMenu = new ReplyKeyboardMarkup
{
Keyboard = new[] { new[] { "Amuzeshha" }, new[] { "Rahnama", "About" } }
};
where is the problem?
and this a screen shot of error.

Related Links

Alter Auto-Property Behavior using Custom Attribute
EF query using exists throws outofmemory exception
Is it possible to call a SOAP Service from WebAPI Service?
Update typed dataset doesn't affect database [duplicate]
How can I map a derived class having a collection of entities with Entity Framework
StructureMap with FluentValidation
Can't specify C compiler on CMake 3.7.2
How to mock an EF6 context and/or the underlying database when the values to be tested reside in the database?
What is the idea of Xamarin's cross-platform app vs. native app development? [closed]
Unable to receive events from server in ServiceStack
Can I combine multiple [ServiceKnownType] attributes into one?
Is there any difference between Body.Write and returning of a string?
LINQ to SQL not storing unicode
sed command gives incorrect output when run as a System.Diagnostics.Process
selenium XPATH to identify td inside table
Exists some other advantages using Select instead foreach C# [closed]

Categories

HOME
ftp
ide
mobile
gap-system
mifare
cryengine
esxi
aggregate-functions
jquery-select2
android-webview
osx-yosemite
unreal-engine4
xmlhttprequest
opendaylight
jquery-easyui
pushbullet
wai-aria
waterfall
expressionengine
android-cursorloader
angular2-changedetection
paper-trail-gem
ios-autolayout
ports
zimbra
tunnel
ponylang
flex3
android-databinding
client-server
matrix-multiplication
var
motion
mybatis-generator
julia-jump
fisheye
head
jenkins-2
hierarchical-clustering
remap
g77
ear
richtext
sqlproj
hdr
archiva
alchemy
bluetooth-lowenergy-4.2
dday
askbot
google-finance-api
github-for-mac
random-sample
adempiere
tooltwist
transparentproxy
ultraedit
quickfixn
pysvn
illegalargumentexception
growl
dirname
windows-search
fscanf
complete
mencoder
infomaker
ia-32
mandelbrot
stringstream
asp.net-4.0
mosix
wordbreaker
tasklist
correctness
systrace
digg
n2
lgpl
google-local-search
linq-to-mysql
time-management
httpbrowsercapabilities
software-update

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App