From 816fcd54d1a41219816b6556e1d14f24b27adabc Mon Sep 17 00:00:00 2001 From: Huy Doan Date: Sat, 22 Apr 2023 11:00:01 +0700 Subject: [PATCH] Bot API 6.7 --- src/telebot/private/api.nim | 8 ++++++-- src/telebot/private/types.nim | 21 +++++++++++++++++++-- telebot.nimble | 2 +- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/telebot/private/api.nim b/src/telebot/private/api.nim index 4d90909..f377b2a 100644 --- a/src/telebot/private/api.nim +++ b/src/telebot/private/api.nim @@ -1,6 +1,7 @@ import httpclient, json, asyncdispatch, utils, strutils, options, strtabs, logging +import types from tables import hasKey, `[]` -import types, keyboard +from keyboard import `$` proc sendMessage*(b: TeleBot, chatId: ChatId, text: string, messageThreadId = 0, parseMode = "", entities: seq[MessageEntity] = @[], disableWebPagePreview = false, disableNotification = false, protectContent = false, replyToMessageId = 0, @@ -266,6 +267,9 @@ proc deleteMyCommands*(b: TeleBot, scope = COMMAND_SCOPE_DEFAULT, chatId = "", u let res = await makeRequest(b, PROC_NAME, data) result = res.getBool +proc setMyName*(b: TeleBot, name = "", languageCode = ""): Future[bool] {.api, async.} + +proc getMyName*(b: TeleBot, languageCode = ""): Future[BotName] {.api, async.} proc setMyDescription*(b: TeleBot, description = "", languageCode = ""): Future[bool] {.api, async.} @@ -287,7 +291,7 @@ proc setCustomEmojiStickerSetThumbnail*(b: TeleBot, name: string, customEmojiId proc deleteStickerSet*(b: TeleBot, name: string): Future[bool] {.api, async.} -proc answerInlineQuery*[T: InlineQueryResult](b: TeleBot, inlineQueryId: string, results: seq[T], cacheTime = 0, isPersonal = false, nextOffset = "", switchPmText = "", switchPmParameter = ""): Future[bool] {.api, async.} +proc answerInlineQuery*[T: InlineQueryResult](b: TeleBot, inlineQueryId: string, results: seq[T], cacheTime = 0, isPersonal = false, nextOffset = "", button: InlineQueryResultsButton = nil): Future[bool] {.api, async.} proc setChatAdministratorCustomTitle*(b: TeleBot, chatId: ChatId, userId: int, customTitle: string): Future[bool] {.api, async.} diff --git a/src/telebot/private/types.nim b/src/telebot/private/types.nim index 58f09b8..cb474ae 100644 --- a/src/telebot/private/types.nim +++ b/src/telebot/private/types.nim @@ -261,6 +261,7 @@ type chatId*: int64 WriteAccessAllowed* = object of TelegramObject + webAppName*: Option[string] VoiceChatScheduled* = object of TelegramObject startDate*: int @@ -304,6 +305,7 @@ type webApp*: Option[WebAppInfo] switchInlineQuery*: Option[string] switchInlineQueryCurrentChat*: Option[string] + switchInlineQueryChosenChat*: Option[SwitchInlineQueryChosenChat] callbackGame*: Option[CallbackGame] pay*: Option[bool] @@ -366,6 +368,14 @@ type user*: User score*: int + SwitchInlineQueryChosenChat* = ref object of TelegramObject + query*: Option[string] + allowUserChats*: Option[bool] + allowBotChats*: Option[bool] + allowGroupChats*: Option[bool] + allowChannelChats*: Option[bool] + + CallbackQuery* = ref object of TelegramObject id*: string fromUser*: User @@ -565,6 +575,7 @@ type oldChatMember*: ChatMember newChatMember*: ChatMember inviteLink*: Option[ChatInviteLink] + viaChatFolderInviteLink*: Option[bool] ChatJoinRequest* = object of TelegramObject chat*: Chat @@ -759,7 +770,6 @@ type sendEmailToProvider*: Option[bool] isFlexible*: Option[bool] - InlineQueryResult* = object of TelegramObject kind*: string id*: string @@ -914,7 +924,6 @@ type chatType: Option[string] location*: Option[Location] - ChosenInlineResult* = object of TelegramObject resultId*: string fromUser*: User @@ -922,6 +931,11 @@ type inlineMessageId*: Option[string] query*: string + InlineQueryResultsButton* = ref object of TelegramObject + text*: string + webApp*: Option[WebAppInfo] + startParameter*: Option[string] + #------------------ # Input Media #------------------ @@ -1059,6 +1073,9 @@ type userId*: int ]# + BotName* = object of TelegramObject + name*: string + BotDescription* = object of TelegramObject description*: string diff --git a/telebot.nimble b/telebot.nimble index d5f0fe1..48e7c6f 100644 --- a/telebot.nimble +++ b/telebot.nimble @@ -1,4 +1,4 @@ -version = "2023.04.13" +version = "2023.04.22" author = "Huy Doan" description = "Async Telegram Bot API Client" license = "MIT"