コード例 #1
0
ファイル: Methods.cs プロジェクト: Taldrin/TextAdventureGame
        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 });
            }
        }
コード例 #2
0
ファイル: Methods.cs プロジェクト: Taldrin/TextAdventureGame
        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);
        }
コード例 #3
0
ファイル: Methods.cs プロジェクト: Taldrin/TextAdventureGame
 public static async Task <User> getMe(TelegramService service)
 {
     return(await service.PostRequestAsync <User>("getMe", null));
 }
コード例 #4
0
ファイル: Methods.cs プロジェクト: Taldrin/TextAdventureGame
 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 });
 }
コード例 #5
0
ファイル: Methods.cs プロジェクト: Taldrin/TextAdventureGame
 public static async Task sendMessage(TelegramService service, string message, long chatId)
 {
     await service.PostRequestAsync <object>("sendMessage", new MessageSend { chat_id = chatId, text = message });
 }