Skip to content

Commit e1875d3

Browse files
committed
Update to API v4.8
1 parent b990fdf commit e1875d3

File tree

3 files changed

+224
-9
lines changed

3 files changed

+224
-9
lines changed

API/TelegramAPIDefinition.yml

+55-2
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ fields:
9393
- video_note: VideoNote?
9494
- caption: String?
9595
- contact: Contact?
96+
- dice: Dice?
9697
- location: Location?
9798
- venue: Venue?
9899
- poll: Poll?
@@ -207,6 +208,12 @@ fields:
207208
- user_id: Int64?
208209
- vcard: String?
209210

211+
---
212+
type: Dice
213+
fields:
214+
- emoji: String
215+
- value: Int
216+
210217
---
211218
type: Location
212219
fields:
@@ -247,6 +254,10 @@ fields:
247254
- type: PollType
248255
- allows_multiple_answers: Bool
249256
- correct_option_id: Int?
257+
- explanation: String
258+
- explanation_entities: MessageEntity[]?
259+
- open_period: Int?
260+
- close_date: Date?
250261

251262
---
252263
type: UserProfilePhotos
@@ -374,6 +385,12 @@ fields:
374385
- can_invite_users: Bool?
375386
- can_pin_messages: Bool?
376387

388+
---
389+
type: BotCommand
390+
fields:
391+
- command: String
392+
- description: String
393+
377394
---
378395
type: ResponseParameters
379396
fields:
@@ -456,6 +473,7 @@ fields:
456473
- is_animated: Bool
457474
- contains_masks: Bool
458475
- stickers: Sticker[]
476+
- thumb: PhotoSize?
459477

460478
---
461479
type: MaskPosition
@@ -1107,13 +1125,28 @@ parameters:
11071125
- options: String[]
11081126
- is_anonymous: Bool?
11091127
- type: PollType?
1128+
- allow_multiple_answers: Bool?
11101129
- correct_option_id: Int?
1130+
- explanation: String?
1131+
- explanation_parse_mode: ParseMode?
1132+
- open_period: Int?
1133+
- close_date: Date?
11111134
- is_closed: Bool?
11121135
- disable_notification: Bool?
11131136
- reply_to_message_id: Int?
11141137
- reply_markup: ReplyMarkup?
11151138
result: Message?
11161139

1140+
---
1141+
method: sendDice
1142+
parameters:
1143+
- chat_id: ChatId
1144+
- emoji: String?
1145+
- disable_notification: Bool?
1146+
- reply_to_message_id: Int?
1147+
- reply_markup: ReplyMarkup?
1148+
result: Message?
1149+
11171150
---
11181151
method: sendChatAction
11191152
parameters:
@@ -1290,6 +1323,16 @@ parameters:
12901323
- cache_time: Int?
12911324
result: Bool?
12921325

1326+
---
1327+
method: setMyCommands
1328+
parameters:
1329+
- commands: BotCommand[]
1330+
result: Bool?
1331+
1332+
---
1333+
method: getMyCommands
1334+
result: BotCommand[]?
1335+
12931336
---
12941337
method: editMessageText
12951338
parameters:
@@ -1376,7 +1419,8 @@ parameters:
13761419
- user_id: Int64
13771420
- name: String
13781421
- title: String
1379-
- png_sticker: FileInfo
1422+
- png_sticker: FileInfo?
1423+
- tgs_sticker: InputFile?
13801424
- emojis: String
13811425
- contains_masks: Bool?
13821426
- mask_position: Bool?
@@ -1387,7 +1431,8 @@ method: addStickerToSet
13871431
parameters:
13881432
- user_id: Int
13891433
- name: String
1390-
- png_sticker: FileInfo
1434+
- png_sticker: FileInfo?
1435+
- tgs_sticker: InputFile?
13911436
- emojis: String
13921437
- mask_position: MaskPosition?
13931438
result: Bool?
@@ -1405,6 +1450,14 @@ parameters:
14051450
- sticker: String
14061451
result: Bool?
14071452

1453+
---
1454+
method: setStickerSetThumb
1455+
parameters:
1456+
- name: String
1457+
- user_id: Int
1458+
- thumb: FileInfo?
1459+
result: Bool?
1460+
14081461
---
14091462
method: answerInlineQuery
14101463
parameters:

Sources/TelegramBotSDK/Generated/Methods.swift

+132-4
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,12 @@ public extension TelegramBot {
819819
options: [String],
820820
isAnonymous: Bool? = nil,
821821
type: PollType? = nil,
822+
allowMultipleAnswers: Bool? = nil,
822823
correctOptionId: Int? = nil,
824+
explanation: String? = nil,
825+
explanationParseMode: ParseMode? = nil,
826+
openPeriod: Int? = nil,
827+
closeDate: Date? = nil,
823828
isClosed: Bool? = nil,
824829
disableNotification: Bool? = nil,
825830
replyToMessageId: Int? = nil,
@@ -831,7 +836,12 @@ public extension TelegramBot {
831836
"options": options,
832837
"is_anonymous": isAnonymous,
833838
"type": type,
839+
"allow_multiple_answers": allowMultipleAnswers,
834840
"correct_option_id": correctOptionId,
841+
"explanation": explanation,
842+
"explanation_parse_mode": explanationParseMode,
843+
"open_period": openPeriod,
844+
"close_date": closeDate,
835845
"is_closed": isClosed,
836846
"disable_notification": disableNotification,
837847
"reply_to_message_id": replyToMessageId,
@@ -844,7 +854,12 @@ public extension TelegramBot {
844854
options: [String],
845855
isAnonymous: Bool? = nil,
846856
type: PollType? = nil,
857+
allowMultipleAnswers: Bool? = nil,
847858
correctOptionId: Int? = nil,
859+
explanation: String? = nil,
860+
explanationParseMode: ParseMode? = nil,
861+
openPeriod: Int? = nil,
862+
closeDate: Date? = nil,
848863
isClosed: Bool? = nil,
849864
disableNotification: Bool? = nil,
850865
replyToMessageId: Int? = nil,
@@ -858,10 +873,50 @@ public extension TelegramBot {
858873
"options": options,
859874
"is_anonymous": isAnonymous,
860875
"type": type,
876+
"allow_multiple_answers": allowMultipleAnswers,
861877
"correct_option_id": correctOptionId,
878+
"explanation": explanation,
879+
"explanation_parse_mode": explanationParseMode,
880+
"open_period": openPeriod,
881+
"close_date": closeDate,
862882
"is_closed": isClosed,
863883
"disable_notification": disableNotification,
864884
"reply_to_message_id": replyToMessageId,
885+
"reply_markup": replyMarkup],
886+
queue: queue, completion: completion)
887+
}
888+
typealias SendDiceCompletion = (_ result: Message?, _ error: DataTaskError?) -> ()
889+
890+
@discardableResult
891+
func sendDiceSync(
892+
chatId: ChatId,
893+
emoji: String? = nil,
894+
disableNotification: Bool? = nil,
895+
replyToMessageId: Int? = nil,
896+
replyMarkup: ReplyMarkup? = nil,
897+
_ parameters: [String: Encodable?] = [:]) -> Message? {
898+
return requestSync("sendDice", defaultParameters["sendDice"], parameters, [
899+
"chat_id": chatId,
900+
"emoji": emoji,
901+
"disable_notification": disableNotification,
902+
"reply_to_message_id": replyToMessageId,
903+
"reply_markup": replyMarkup])
904+
}
905+
906+
func sendDiceAsync(
907+
chatId: ChatId,
908+
emoji: String? = nil,
909+
disableNotification: Bool? = nil,
910+
replyToMessageId: Int? = nil,
911+
replyMarkup: ReplyMarkup? = nil,
912+
_ parameters: [String: Encodable?] = [:],
913+
queue: DispatchQueue = .main,
914+
completion: SendDiceCompletion? = nil) {
915+
return requestAsync("sendDice", defaultParameters["sendDice"], parameters, [
916+
"chat_id": chatId,
917+
"emoji": emoji,
918+
"disable_notification": disableNotification,
919+
"reply_to_message_id": replyToMessageId,
865920
"reply_markup": replyMarkup],
866921
queue: queue, completion: completion)
867922
}
@@ -1441,6 +1496,44 @@ public extension TelegramBot {
14411496
"cache_time": cacheTime],
14421497
queue: queue, completion: completion)
14431498
}
1499+
typealias SetMyCommandsCompletion = (_ result: Bool?, _ error: DataTaskError?) -> ()
1500+
1501+
@discardableResult
1502+
func setMyCommandsSync(
1503+
commands: [BotCommand],
1504+
_ parameters: [String: Encodable?] = [:]) -> Bool? {
1505+
return requestSync("setMyCommands", defaultParameters["setMyCommands"], parameters, [
1506+
"commands": commands])
1507+
}
1508+
1509+
func setMyCommandsAsync(
1510+
commands: [BotCommand],
1511+
_ parameters: [String: Encodable?] = [:],
1512+
queue: DispatchQueue = .main,
1513+
completion: SetMyCommandsCompletion? = nil) {
1514+
return requestAsync("setMyCommands", defaultParameters["setMyCommands"], parameters, [
1515+
"commands": commands],
1516+
queue: queue, completion: completion)
1517+
}
1518+
typealias GetMyCommandsCompletion = (_ result: [BotCommand]?, _ error: DataTaskError?) -> ()
1519+
1520+
@discardableResult
1521+
func getMyCommandsSync(
1522+
1523+
_ parameters: [String: Encodable?] = [:]) -> [BotCommand]? {
1524+
return requestSync("getMyCommands", defaultParameters["getMyCommands"], parameters, [
1525+
:])
1526+
}
1527+
1528+
func getMyCommandsAsync(
1529+
1530+
_ parameters: [String: Encodable?] = [:],
1531+
queue: DispatchQueue = .main,
1532+
completion: GetMyCommandsCompletion? = nil) {
1533+
return requestAsync("getMyCommands", defaultParameters["getMyCommands"], parameters, [
1534+
:],
1535+
queue: queue, completion: completion)
1536+
}
14441537
typealias EditMessageTextCompletion = (_ result: MessageOrBool?, _ error: DataTaskError?) -> ()
14451538

14461539
@discardableResult
@@ -1723,7 +1816,8 @@ public extension TelegramBot {
17231816
userId: Int64,
17241817
name: String,
17251818
title: String,
1726-
pngSticker: FileInfo,
1819+
pngSticker: FileInfo? = nil,
1820+
tgsSticker: InputFile? = nil,
17271821
emojis: String,
17281822
containsMasks: Bool? = nil,
17291823
maskPosition: Bool? = nil,
@@ -1733,6 +1827,7 @@ public extension TelegramBot {
17331827
"name": name,
17341828
"title": title,
17351829
"png_sticker": pngSticker,
1830+
"tgs_sticker": tgsSticker,
17361831
"emojis": emojis,
17371832
"contains_masks": containsMasks,
17381833
"mask_position": maskPosition])
@@ -1742,7 +1837,8 @@ public extension TelegramBot {
17421837
userId: Int64,
17431838
name: String,
17441839
title: String,
1745-
pngSticker: FileInfo,
1840+
pngSticker: FileInfo? = nil,
1841+
tgsSticker: InputFile? = nil,
17461842
emojis: String,
17471843
containsMasks: Bool? = nil,
17481844
maskPosition: Bool? = nil,
@@ -1754,6 +1850,7 @@ public extension TelegramBot {
17541850
"name": name,
17551851
"title": title,
17561852
"png_sticker": pngSticker,
1853+
"tgs_sticker": tgsSticker,
17571854
"emojis": emojis,
17581855
"contains_masks": containsMasks,
17591856
"mask_position": maskPosition],
@@ -1765,22 +1862,25 @@ public extension TelegramBot {
17651862
func addStickerToSetSync(
17661863
userId: Int,
17671864
name: String,
1768-
pngSticker: FileInfo,
1865+
pngSticker: FileInfo? = nil,
1866+
tgsSticker: InputFile? = nil,
17691867
emojis: String,
17701868
maskPosition: MaskPosition? = nil,
17711869
_ parameters: [String: Encodable?] = [:]) -> Bool? {
17721870
return requestSync("addStickerToSet", defaultParameters["addStickerToSet"], parameters, [
17731871
"user_id": userId,
17741872
"name": name,
17751873
"png_sticker": pngSticker,
1874+
"tgs_sticker": tgsSticker,
17761875
"emojis": emojis,
17771876
"mask_position": maskPosition])
17781877
}
17791878

17801879
func addStickerToSetAsync(
17811880
userId: Int,
17821881
name: String,
1783-
pngSticker: FileInfo,
1882+
pngSticker: FileInfo? = nil,
1883+
tgsSticker: InputFile? = nil,
17841884
emojis: String,
17851885
maskPosition: MaskPosition? = nil,
17861886
_ parameters: [String: Encodable?] = [:],
@@ -1790,6 +1890,7 @@ public extension TelegramBot {
17901890
"user_id": userId,
17911891
"name": name,
17921892
"png_sticker": pngSticker,
1893+
"tgs_sticker": tgsSticker,
17931894
"emojis": emojis,
17941895
"mask_position": maskPosition],
17951896
queue: queue, completion: completion)
@@ -1836,6 +1937,33 @@ public extension TelegramBot {
18361937
"sticker": sticker],
18371938
queue: queue, completion: completion)
18381939
}
1940+
typealias SetStickerSetThumbCompletion = (_ result: Bool?, _ error: DataTaskError?) -> ()
1941+
1942+
@discardableResult
1943+
func setStickerSetThumbSync(
1944+
name: String,
1945+
userId: Int,
1946+
thumb: FileInfo? = nil,
1947+
_ parameters: [String: Encodable?] = [:]) -> Bool? {
1948+
return requestSync("setStickerSetThumb", defaultParameters["setStickerSetThumb"], parameters, [
1949+
"name": name,
1950+
"user_id": userId,
1951+
"thumb": thumb])
1952+
}
1953+
1954+
func setStickerSetThumbAsync(
1955+
name: String,
1956+
userId: Int,
1957+
thumb: FileInfo? = nil,
1958+
_ parameters: [String: Encodable?] = [:],
1959+
queue: DispatchQueue = .main,
1960+
completion: SetStickerSetThumbCompletion? = nil) {
1961+
return requestAsync("setStickerSetThumb", defaultParameters["setStickerSetThumb"], parameters, [
1962+
"name": name,
1963+
"user_id": userId,
1964+
"thumb": thumb],
1965+
queue: queue, completion: completion)
1966+
}
18391967
typealias AnswerInlineQueryCompletion = (_ result: Bool?, _ error: DataTaskError?) -> ()
18401968

18411969
@discardableResult

0 commit comments

Comments
 (0)