public static async Task sendMessageWithReplyOptions(TelegramService service, string message, long chatId, List <string> replyOptions) { var keyboardReply = generateKeyboard(replyOptions); if (keyboardReply != null) { await service.PostRequestAsync <object>("sendMessage", new MessageSendWithKeyboard { chat_id = chatId, text = message, reply_markup = keyboardReply }); } else { await service.PostRequestAsync <object>("sendMessage", new MessageSend { chat_id = chatId, text = message }); } }
public static async Task <List <Result> > getUpdates(TelegramService service, int updateId) { var result = await service.PostRequestAsync <UpdateResult>("getUpdates", new GetUpdates { offset = updateId }); if (result == null || result.result == null) { throw new System.Exception("GetUpdates returned null"); } return(result.result); }
public static async Task <User> getMe(TelegramService service) { return(await service.PostRequestAsync <User>("getMe", null)); }
public static async Task sendImageWithReplyOptions(TelegramService service, string imageUrl, long chatId, List <string> replyOptions) { var keyboardReply = generateKeyboard(replyOptions); await service.PostRequestAsync <object>("sendPhoto", new PhotoSendWithKeyboard { chat_id = chatId, photo = imageUrl, reply_markup = keyboardReply }); }
public static async Task sendMessage(TelegramService service, string message, long chatId) { await service.PostRequestAsync <object>("sendMessage", new MessageSend { chat_id = chatId, text = message }); }