I am working on a bot with new feature of Telegram bot API called InlineQuery, i implement all types in C# and now can get the query returned from Telegram to my bot, when i try to answer the query i post below Json to Telegram answerInlineQuery method but i get this error :
"Bad request: Can't parse json encoded inline query results: [Error]: can't parse number"
{"inline_query_id":"515050766530700016","results":[{"type":"photo","photo_url":"http://weknowyourdreams.com/images/car/car-05.jpg","photo_width":0,"photo_height":0,"description":"wrdqw","caption":"wer","id":"46156165165","title":"123","message_text":"123","parse_mode":"Markdown","thumb_url":"http://weknowyourdreams.com/images/car/car-05.jpg","disable_web_page_preview":false}],"cache_time":300,"is_personal":false,"next_offset":"0"}
This is my structure of AnswerInlineQuery according to this documentation : https://core.telegram.org/bots/api#answerinlinequery
public class AnswerInlineQuery
{
public string InlineQueryId { get; set; }
public List<InlineQueryResult> Results { get; set; }
public int CacheTime { get; set; }
public bool IsPersonal { get; set; }
public string NextOffset { get; set; }
}
and "InlineQueryResult" :
public class InlineQueryResult
{
public string Id { get; set; }
public string Title { get; set; }
public string MessageText { get; set; }
public string ParseMode { get; set; }
public string ThumbUrl { get; set; }
public bool DisableWebPagePreview { get; set; }
}
and "InlineQueryResultPhoto" :
public class InlineQueryResultPhoto : InlineQueryResult
{
public string Type => "photo";
public string PhotoUrl { get; set; }
public int PhotoWidth { get; set; }
public int PhotoHeight { get; set; }
public string Description { get; set; }
public string Caption { get; set; }
}
I try to pass empty results like this :
Bot.AnswerInlineQuery(new AnswerInlineQuery
{
InlineQueryId = inlinequery.Id,
Results = new List<InlineQueryResult>(),
IsPersonal = false,
CacheTime = 300,
NextOffset = "0"
});
But again i get same error, it seems the problem is not in "results" !
I don't know which number it means and tryout the Json with many different data but i can't fix it, is my structure of Json wrong ? any idea ?
Thanks .
answerInlineQueryandInlineQueryResultPhoto, and how you are serializing to JSON? - dbc