Skip to content

Commit

Permalink
BotAPI 6.9
Browse files Browse the repository at this point in the history
  • Loading branch information
ba0f3 committed Sep 25, 2023
1 parent fd5a19b commit 75c29da
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/telebot/private/api.nim
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ proc unbanChatMember*(b: TeleBot, chatId: ChatId, userId: int, onlyIfBanned = fa
proc restrictChatMember*(b: TeleBot, chatId: ChatId, userId: int, permissions: ChatPermissions, useIndependentChatPermissions = false, untilDate = 0): Future[bool] {.api, async.}

proc promoteChatMember*(b: TeleBot, chatId: ChatId, userId: int, isAnonymous = false, canManageChat = false, canChangeInfo = false,
canPostMessages = false, canEditMessages = false, canDeleteMessages = false, canManageVideoChats = false,
canPostMessages = false, canEditMessages = false, canDeleteMessages = false,
canPostStories = false, canEditStories = false, canDeleteStories = false, canManageVideoChats = false,
canInviteUsers = false, canRestrictMembers = false, canPinMessages = false, canPromoteMembers = false,
canManageTopics = false): Future[bool] {.api, async.}

Expand Down
9 changes: 9 additions & 0 deletions src/telebot/private/types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,9 @@ type
chatId*: int64

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

VoiceChatScheduled* = object of TelegramObject
startDate*: int
Expand Down Expand Up @@ -513,6 +515,9 @@ type
canpostMessages*: Option[bool]
canEditMessages*: Option[bool]
canPinMessages*: Option[bool]
canPostStories*: Option[bool]
canEditStories*: Option[bool]
canDeleteStories*: Option[bool]
canManageTopics*: Option[bool]

ChatMember* = object of TelegramObject
Expand Down Expand Up @@ -560,7 +565,11 @@ type
canInviteUsers*: Option[bool]
canPostMessages*: Option[bool]
canEditMessages*: Option[bool]
canPostStories*: Option[bool]
canEditStories*: Option[bool]
canDeleteStories*: Option[bool]
canPinMessages*: Option[bool]
customTitle*: Option[string]
ChatMemberMember* = object of ChatMember
Expand Down
20 changes: 20 additions & 0 deletions src/telebot/webapp.nim
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ type
POPUP_CLOSED = "popupClosed"
QR_TEXT_RECEIVED = "qrTextReceived"
CLIPBOARD_TEXT_RECEIVED = "clipboardTextReceived"
WRITE_ACCESS_REQUESTED = "writeAccessRequested"
CONTACT_REQUESTED = "contactRequested"

WebAppInitData* = object
query_id*: string
Expand All @@ -30,6 +32,8 @@ type
username*: string
language_code*: string
isPremium*: bool
addedToAttachmentMenu*: bool
allowsWriteToPm*: bool
photo_url*: string

WebAppChat* {.importc, nodecl.} = object
Expand All @@ -53,6 +57,8 @@ type

HapticFeedback* {.importc, nodecl.} = object

CloudStorage* {.importc, nodecl.} = object

ThemeParams* {.importc, nodecl.} = object
bg_color*: string
text_color*: string
Expand Down Expand Up @@ -92,6 +98,8 @@ type
BackButton*: BackButton
MainButton*: MainButton
HapticFeedback*: HapticFeedback
CloudStorage*: CloudStorage


TelegramObj* {.importc, nodecl.} = object of RootObj
WebApp*: WebApp
Expand Down Expand Up @@ -121,6 +129,8 @@ proc showAlert*(w: WebApp, message: string, callback: EventHandler = nil) {.impo
proc showScanQrPopup*(w: WebApp, params: ScanQrPopupParams, callbback: EventHandler) {.importc, nodecl.}
proc closeScanQrPopup*(w: WebApp) {.importc, nodecl.}
proc readTextFromClipboard*(w: WebApp, callbback: EventHandler) {.importc, nodecl.}
proc requestWriteAccess*(w: WebApp, callback: EventHandler) {.importc, nodecl.}
proc requestContact*(w: WebApp, callback: EventHandler) {.importc, nodecl.}
proc showConfirm*(w: WebApp, message: string, callback: EventHandler = nil) {.importc, nodecl.}
proc ready*(w: WebApp): bool {.importc, nodecl.}
proc expand*(w: WebApp) {.importc, nodecl.}
Expand Down Expand Up @@ -155,3 +165,13 @@ proc impactOccurred*(h: HapticFeedback, style: string): HapticFeedback {.importc
proc notificationOccurred*(h: HapticFeedback, kind: string): HapticFeedback {.importc, nodecl.}
proc selectionChanged*(h: HapticFeedback): HapticFeedback {.importc, nodecl.}

#--------
# CloudStorage
#--------
proc setItem*(c: CloudStorage, key: string, value: string, callback: EventHandler) {.importc, nodecl.}
proc getItem*(c: CloudStorage, key: string, callback: EventHandler) {.importc, nodecl.}
proc getItems*(c: CloudStorage, keys: seq[string], callback: EventHandler) {.importc, nodecl.}
proc removeItem*(c: CloudStorage, key: string, callback: EventHandler) {.importc, nodecl.}
proc removeItems*(c: CloudStorage, keys: seq[string], callback: EventHandler) {.importc, nodecl.}
proc getKeys*(c: CloudStorage, callback: EventHandler) {.importc, nodecl.}

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

0 comments on commit 75c29da

Please sign in to comment.