Skip to content

Commit

Permalink
Bot API 6.7
Browse files Browse the repository at this point in the history
  • Loading branch information
ba0f3 committed Apr 22, 2023
1 parent 45b376f commit 816fcd5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
8 changes: 6 additions & 2 deletions src/telebot/private/api.nim
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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.}

Expand All @@ -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.}

Expand Down
21 changes: 19 additions & 2 deletions src/telebot/private/types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ type
chatId*: int64

WriteAccessAllowed* = object of TelegramObject
webAppName*: Option[string]

VoiceChatScheduled* = object of TelegramObject
startDate*: int
Expand Down Expand Up @@ -304,6 +305,7 @@ type
webApp*: Option[WebAppInfo]
switchInlineQuery*: Option[string]
switchInlineQueryCurrentChat*: Option[string]
switchInlineQueryChosenChat*: Option[SwitchInlineQueryChosenChat]
callbackGame*: Option[CallbackGame]
pay*: Option[bool]

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -565,6 +575,7 @@ type
oldChatMember*: ChatMember
newChatMember*: ChatMember
inviteLink*: Option[ChatInviteLink]
viaChatFolderInviteLink*: Option[bool]

ChatJoinRequest* = object of TelegramObject
chat*: Chat
Expand Down Expand Up @@ -759,7 +770,6 @@ type
sendEmailToProvider*: Option[bool]
isFlexible*: Option[bool]


InlineQueryResult* = object of TelegramObject
kind*: string
id*: string
Expand Down Expand Up @@ -914,14 +924,18 @@ type
chatType: Option[string]
location*: Option[Location]


ChosenInlineResult* = object of TelegramObject
resultId*: string
fromUser*: User
location*: Option[Location]
inlineMessageId*: Option[string]
query*: string

InlineQueryResultsButton* = ref object of TelegramObject
text*: string
webApp*: Option[WebAppInfo]
startParameter*: Option[string]

#------------------
# Input Media
#------------------
Expand Down Expand Up @@ -1059,6 +1073,9 @@ type
userId*: int
]#

BotName* = object of TelegramObject
name*: string

BotDescription* = object of TelegramObject
description*: string

Expand Down
2 changes: 1 addition & 1 deletion telebot.nimble
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "2023.04.13"
version = "2023.04.22"
author = "Huy Doan"
description = "Async Telegram Bot API Client"
license = "MIT"
Expand Down

0 comments on commit 816fcd5

Please sign in to comment.