Skip to content

Commit

Permalink
Bot API 5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Huy Doan committed Dec 7, 2021
1 parent e32207a commit da0d71c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/telebot/private/api.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,22 @@ proc setChatAdministratorCustomTitle*(b: TeleBot, chatId: string, userId: int, c
let res = await makeRequest(b, procName, data)
result = res.toBool

proc banChatSenderChat*(b: TeleBot, chatId: string, senderChatId: int, untilDate = 0): Future[bool] {.async.} =
var data = newMultipartData()
data["chat_id"] = chatId
data["sender_chat_id"] = $senderChatId
if untilDate > 0:
data["until_date"] = $untilDate
let res = await makeRequest(b, procName, data)
result = res.toBool

proc unbanChatSenderChat*(b: TeleBot, chatId: string, senderChatId: int): Future[bool] {.async.} =
var data = newMultipartData()
data["chat_id"] = chatId
data["sender_chat_id"] = $senderChatId
let res = await makeRequest(b, procName, data)
result = res.toBool

proc getUpdates*(b: TeleBot, offset, limit = 0, timeout = 50, allowedUpdates: seq[string] = @[]): Future[JsonNode] {.async.} =
var data = newMultipartData()

Expand Down
12 changes: 12 additions & 0 deletions src/telebot/private/types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,19 @@ type
firstName*: Option[string]
lastName*: Option[string]
photo*: Option[ChatPhoto]
bio*: Option[string]
hasPrivateForwards*: Option[bool]
description*: Option[string]
inviteLink*: Option[string]
pinnedMessage*: Option[ref Message]
permissions*: Option[ChatPermissions]
slowModeDelay*: Option[int]
messageAutoDeleteTime*: Option[int]
hasProtectedContent*: Option[bool]
stickerSetName*: Option[string]
canSetStickerSet*: Option[bool]
linkedChatId*: Option[int]
location*: Option[ChatLocation]

PhotoSize* = object of TelegramObject
fileId*: string
Expand Down Expand Up @@ -315,9 +321,11 @@ type
forwardSignature*: Option[string]
forwardSenderName*: Option[string]
forwardDate*: Option[int]
isAutomaticForward*: Option[bool]
replyToMessage*: Option[ref Message]
viaBot*: Option[User]
editDate*: Option[int]
hasProtectedContent*: Option[bool]
mediaGroupId*: Option[string]
authorSignature*: Option[string]
text*: Option[string]
Expand Down Expand Up @@ -473,6 +481,10 @@ type
canInviteUsers*: Option[bool]
canPinMessages*: Option[bool]

ChatLocation* = object of TelegramObject
location*: Location
address*: string

BotCommand* = object of TelegramObject
command*: string
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 = "1.0.11"
version = "1.0.12"
author = "Huy Doan"
description = "Async Telegram Bot API Client"
license = "MIT"
Expand Down

0 comments on commit da0d71c

Please sign in to comment.