TelegramBots / Telegram.Bot

.NET Client for Telegram Bot API
https://telegrambots.github.io/book
MIT License
3.22k stars 690 forks source link

SendPhoto is not working #3

Closed NaderSetarei closed 9 years ago

NaderSetarei commented 9 years ago

{"Required property 'result' not found in JSON. Path '', line 1, position 148."}

MrRoundRobin commented 9 years ago

Cann you give me more details? Parameters? Code snippet?

NaderSetarei commented 9 years ago

var myPhoto= File.ReadAllBytes("I:\TelegramFolder\zoroofchiPhoto.jpg"); await zoroofchiBot.SendPhoto(update.Message.Chat.Id, myPhoto, "zoroofchi");

NaderSetarei commented 9 years ago

MrRoundRobin :-) ?

MrRoundRobin commented 9 years ago

Found the underlining error. Need to figure out how to deal with it ;)

NaderSetarei commented 9 years ago

thanx MrRoundRobin

MrRoundRobin commented 9 years ago

the file to be send needs a file name. i can't get the file name from byte[] so i decided to use a wrapper object:

var stream = new FileStream(@"c:\xy.png", FileMode.Open);
var fileToSend = new FileToSend("Test.png", stream);

await Bot.SendPhoto(update.Message.Chat.Id, fileToSend, update.Message.Text);
NaderSetarei commented 9 years ago

oh thanx yay its a good wraper MrRoundRobin :-)

MrRoundRobin commented 9 years ago

Maybe i'll add byte[] getter/setters later

AminSarkar commented 5 years ago

hi.how can i sned a photo by uri ? can anyone help me ?

MihaZupan commented 5 years ago

Don't comment on unrelated 3 year old issues! Read the documentation and see examples https://telegrambots.github.io/book/3/files/upload.html#uploading-by-url If you read the Readme you'll find more help resources.

Developer-313 commented 4 years ago

Hi there, I have this problem to and i even used this code: FileToSend fts = new FileToSend("test.png", stream); bot.SendPhoto(123456789,fts); bot no change. any idea what to do?

tuscen commented 4 years ago

@Developer-313 Hello, please, read messages above. This is a long closed issue for an unsupported version of the library.

Developer-313 commented 4 years ago

@tuscen I have read them and did anything to fix this problem but no benefit

tuscen commented 4 years ago

@Developer-313 You're using version that's long unsupported. Please, upgrade. If there's a bug in the old version it won't be fixed.

Developer-313 commented 4 years ago

@tuscen I am using the latest version 15.

tuscen commented 4 years ago

@Developer-313 Then, please, fill a new bug report with as much information as you can find.

Developer-313 commented 4 years ago

@tuscen how to do that?

tuscen commented 4 years ago

@Developer-313 Open a new issue, it's already contains a template. https://help.github.com/en/github/managing-your-work-on-github/creating-an-issue