Esempio n. 1
0
        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 });
            }
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 public static async Task <User> getMe(TelegramService service)
 {
     return(await service.PostRequestAsync <User>("getMe", null));
 }
Esempio n. 4
0
 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 });
 }
Esempio n. 5
0
 public static async Task sendMessage(TelegramService service, string message, long chatId)
 {
     await service.PostRequestAsync <object>("sendMessage", new MessageSend { chat_id = chatId, text = message });
 }