コード例 #1
0
 private async Task <int> SendMessage(BotClientWrapper botClient, long chatId, SelectOptionTelegramMessage message, bool notify)
 {
     return(await botClient.SendTextMessageAsync(
                chatId,
                message.Text,
                disableWebPagePreview : message.DisableWebPagePreview,
                disableNotification : !notify,
                replyMarkup : new InlineKeyboardMarkup(
                    message.Options.Select(o => new InlineKeyboardButton {
         Text = o.Value, CallbackData = o.Key
     })
                    .Select((b, idx) => new KeyValuePair <int, InlineKeyboardButton>(idx, b))
                    .GroupBy(kvp => kvp.Key, kvp => kvp.Value)
                    .Select(g => g.AsEnumerable())
                    )
                ));
 }
コード例 #2
0
 private async Task <int> SendMessage(BotClientWrapper botClient, long chatId, TextTelegramMessage message, bool notify)
 {
     return(await botClient.SendTextMessageAsync(chatId, message.Text, disableWebPagePreview : message.DisableWebPagePreview, disableNotification : !notify));
 }
コード例 #3
0
 private async Task <int> SendMessage(BotClientWrapper botClient, long chatId, RequestLocationTelegramMessage message, bool notify)
 {
     return(await botClient.SendTextMessageAsync(chatId, message.Text, disableWebPagePreview : message.DisableWebPagePreview, disableNotification : !notify, replyMarkup : new ReplyKeyboardMarkup(KeyboardButton.WithRequestLocation(message.RequestLocation))));
 }
コード例 #4
0
 public async Task <int> SendMessage(BotClientWrapper botClient, long chatId, string message, bool notify)
 {
     return(await botClient.SendTextMessageAsync(chatId, message, !notify));
 }