@@ -3,7 +3,7 @@ from tables import hasKey, `[]`
3
3
import types, keyboard
4
4
5
5
proc sendMessage * (b: TeleBot , chatId: int64 , text: string , parseMode = " " , entities: seq [MessageEntity ] = @ [],
6
- disableWebPagePreview = false , disableNotification = false , replyToMessageId = 0 ,
6
+ disableWebPagePreview = false , disableNotification = false , protectContent = false , replyToMessageId = 0 ,
7
7
allowSendingWithoutReply = false , replyMarkup: KeyboardMarkup = nil ): Future [Message ] {.async .} =
8
8
var data = newMultipartData ()
9
9
@@ -19,6 +19,8 @@ proc sendMessage*(b: TeleBot, chatId: int64, text: string, parseMode = "", entit
19
19
data[" disable_web_page_preview" ] = " true"
20
20
if disableNotification:
21
21
data[" disable_notification" ] = " true"
22
+ if protectContent:
23
+ data[" protect_content" ] = " true"
22
24
if replyToMessageId != 0 :
23
25
data[" reply_to_message_id" ] = $ replyToMessageId
24
26
if allowSendingWithoutReply:
@@ -30,7 +32,7 @@ proc sendMessage*(b: TeleBot, chatId: int64, text: string, parseMode = "", entit
30
32
result = getMessage (res)
31
33
32
34
proc sendPhoto * (b: TeleBot , chatId: int64 , photo: string , caption = " " , parseMode = " " ,
33
- captionEntities: seq [MessageEntity ] = @ [], disableNotification = false , replyToMessageId = 0 ,
35
+ captionEntities: seq [MessageEntity ] = @ [], disableNotification = false , protectContent = false , replyToMessageId = 0 ,
34
36
allowSendingWithoutReply = false ,replyMarkup: KeyboardMarkup = nil ): Future [Message ] {.async .} =
35
37
var data = newMultipartData ()
36
38
@@ -46,6 +48,8 @@ proc sendPhoto*(b: TeleBot, chatId: int64, photo: string, caption = "", parseMod
46
48
data[" caption_entities" ] = json
47
49
if disableNotification:
48
50
data[" disable_notification" ] = " true"
51
+ if protectContent:
52
+ data[" protect_content" ] = " true"
49
53
if replyToMessageId != 0 :
50
54
data[" reply_to_message_id" ] = $ replyToMessageId
51
55
if allowSendingWithoutReply:
@@ -57,7 +61,7 @@ proc sendPhoto*(b: TeleBot, chatId: int64, photo: string, caption = "", parseMod
57
61
result = getMessage (res)
58
62
59
63
proc sendAudio * (b: TeleBot , chatId: int64 , audio: string , caption = " " , parseMode = " " , captionEntities: seq [MessageEntity ] = @ [],
60
- duration = 0 , performer = " " , title = " " , thumb = " " , disableNotification = false , replyToMessageId = 0 ,
64
+ duration = 0 , performer = " " , title = " " , thumb = " " , disableNotification = false , protectContent = false , replyToMessageId = 0 ,
61
65
allowSendingWithoutReply = false , replyMarkup: KeyboardMarkup = nil ): Future [Message ] {.async .} =
62
66
var data = newMultipartData ()
63
67
@@ -81,6 +85,8 @@ proc sendAudio*(b: TeleBot, chatId: int64, audio: string, caption = "", parseMod
81
85
data.addData (" thumb" , thumb, true )
82
86
if disableNotification:
83
87
data[" disable_notification" ] = " true"
88
+ if protectContent:
89
+ data[" protect_content" ] = " true"
84
90
if replyToMessageId != 0 :
85
91
data[" reply_to_message_id" ] = $ replyToMessageId
86
92
if allowSendingWithoutReply:
@@ -93,7 +99,7 @@ proc sendAudio*(b: TeleBot, chatId: int64, audio: string, caption = "", parseMod
93
99
94
100
proc sendDocument * (b: TeleBot , chatId: int64 , document: string , thumb = " " , caption = " " ,
95
101
disableContentTypeDetection = false , parseMode = " " , captionEntities: seq [MessageEntity ] = @ [], disableNotification = false ,
96
- replyToMessageId = 0 , allowSendingWithoutReply = false , replyMarkup: KeyboardMarkup = nil ): Future [Message ] {.async .} =
102
+ protectContent = false , replyToMessageId = 0 , allowSendingWithoutReply = false , replyMarkup: KeyboardMarkup = nil ): Future [Message ] {.async .} =
97
103
var data = newMultipartData ()
98
104
99
105
data[" chat_id" ] = $ chatId
@@ -112,6 +118,8 @@ proc sendDocument*(b: TeleBot, chatId: int64, document: string, thumb = "", capt
112
118
data[" caption_entities" ] = json
113
119
if disableNotification:
114
120
data[" disable_notification" ] = " true"
121
+ if protectContent:
122
+ data[" protect_content" ] = " true"
115
123
if replyToMessageId != 0 :
116
124
data[" reply_to_message_id" ] = $ replyToMessageId
117
125
if allowSendingWithoutReply:
@@ -122,14 +130,16 @@ proc sendDocument*(b: TeleBot, chatId: int64, document: string, thumb = "", capt
122
130
let res = await makeRequest (b, procName, data)
123
131
result = getMessage (res)
124
132
125
- proc sendSticker * (b: TeleBot , chatId: int64 , sticker: string , disableNotification = false , replyToMessageId = 0 ,
133
+ proc sendSticker * (b: TeleBot , chatId: int64 , sticker: string , disableNotification = false , protectContent = false , replyToMessageId = 0 ,
126
134
allowSendingWithoutReply = false , replyMarkup: KeyboardMarkup = nil ): Future [Message ] {.async .} =
127
135
var data = newMultipartData ()
128
136
129
137
data[" chat_id" ] = $ chatId
130
138
data.addData (" sticker" , sticker, true )
131
139
if disableNotification:
132
140
data[" disable_notification" ] = " true"
141
+ if protectContent:
142
+ data[" protect_content" ] = " true"
133
143
if replyToMessageId != 0 :
134
144
data[" reply_to_message_id" ] = $ replyToMessageId
135
145
if allowSendingWithoutReply:
@@ -142,7 +152,7 @@ proc sendSticker*(b: TeleBot, chatId: int64, sticker: string, disableNotificatio
142
152
143
153
proc sendVideo * (b: TeleBot , chatId: int64 , video: string , duration = 0 , width = 0 , height = 0 , thumb = " " , caption = " " ,
144
154
parseMode = " " , captionEntities: seq [MessageEntity ] = @ [], supportsStreaming = false , disableNotification = false ,
145
- replyToMessageId = 0 , allowSendingWithoutReply = false , replyMarkup: KeyboardMarkup = nil ): Future [Message ] {.async .} =
155
+ protectContent = false , replyToMessageId = 0 , allowSendingWithoutReply = false , replyMarkup: KeyboardMarkup = nil ): Future [Message ] {.async .} =
146
156
var data = newMultipartData ()
147
157
148
158
data[" chat_id" ] = $ chatId
@@ -167,6 +177,8 @@ proc sendVideo*(b: TeleBot, chatId: int64, video: string, duration = 0, width =
167
177
data[" supports_streaming" ] = " true"
168
178
if disableNotification:
169
179
data[" disable_notification" ] = " true"
180
+ if protectContent:
181
+ data[" protect_content" ] = " true"
170
182
if replyToMessageId != 0 :
171
183
data[" reply_to_message_id" ] = $ replyToMessageId
172
184
if allowSendingWithoutReply:
@@ -178,7 +190,7 @@ proc sendVideo*(b: TeleBot, chatId: int64, video: string, duration = 0, width =
178
190
result = getMessage (res)
179
191
180
192
proc sendVoice * (b: TeleBot , chatId: int64 , voice: string , caption = " " , parseMode = " " , captionEntities: seq [MessageEntity ] = @ [],
181
- duration = 0 , disableNotification = false , replyToMessageId = 0 ,
193
+ duration = 0 , disableNotification = false , protectContent = false , replyToMessageId = 0 ,
182
194
allowSendingWithoutReply = false , replyMarkup: KeyboardMarkup = nil ): Future [Message ] {.async .} =
183
195
var data = newMultipartData ()
184
196
@@ -196,6 +208,8 @@ proc sendVoice*(b: TeleBot, chatId: int64, voice: string, caption = "", parseMod
196
208
data[" duration" ] = $ duration
197
209
if disableNotification:
198
210
data[" disable_notification" ] = " true"
211
+ if protectContent:
212
+ data[" protect_content" ] = " true"
199
213
if replyToMessageId != 0 :
200
214
data[" reply_to_message_id" ] = $ replyToMessageId
201
215
if allowSendingWithoutReply:
@@ -207,7 +221,7 @@ proc sendVoice*(b: TeleBot, chatId: int64, voice: string, caption = "", parseMod
207
221
result = getMessage (res)
208
222
209
223
proc sendVideoNote * (b: TeleBot , chatId: int64 , videoNote: string , duration = 0 , length = 0 , thumb = " " ,
210
- disableNotification = false , replyToMessageId = 0 ,
224
+ disableNotification = false , protectContent = false , replyToMessageId = 0 ,
211
225
allowSendingWithoutReply = false , replyMarkup: KeyboardMarkup = nil ): Future [Message ] {.async .} =
212
226
var data = newMultipartData ()
213
227
@@ -221,6 +235,8 @@ proc sendVideoNote*(b: TeleBot, chatId: int64, videoNote: string, duration = 0,
221
235
data.addData (" thumb" , thumb, true )
222
236
if disableNotification:
223
237
data[" disable_notification" ] = " true"
238
+ if protectContent:
239
+ data[" protect_content" ] = " true"
224
240
if replyToMessageId != 0 :
225
241
data[" reply_to_message_id" ] = $ replyToMessageId
226
242
if allowSendingWithoutReply:
@@ -232,7 +248,7 @@ proc sendVideoNote*(b: TeleBot, chatId: int64, videoNote: string, duration = 0,
232
248
result = getMessage (res)
233
249
234
250
proc sendLocation * (b: TeleBot , chatId: int64 , latitude: float , longitude: float , livePeriod = 0 ,
235
- heading = 0 , proximityAlertRadius = 0 , disableNotification = false ,
251
+ heading = 0 , proximityAlertRadius = 0 , disableNotification = false , protectContent = false ,
236
252
replyToMessageId = 0 , allowSendingWithoutReply = false , replyMarkup: KeyboardMarkup = nil ): Future [Message ] {.async .} =
237
253
var data = newMultipartData ()
238
254
@@ -247,6 +263,8 @@ proc sendLocation*(b: TeleBot, chatId: int64, latitude: float, longitude: float,
247
263
data[" proximity_alert_radius" ] = $ proximityAlertRadius
248
264
if disableNotification:
249
265
data[" disable_notification" ] = " true"
266
+ if protectContent:
267
+ data[" protect_content" ] = " true"
250
268
if replyToMessageId != 0 :
251
269
data[" reply_to_message_id" ] = $ replyToMessageId
252
270
if allowSendingWithoutReply:
@@ -258,7 +276,7 @@ proc sendLocation*(b: TeleBot, chatId: int64, latitude: float, longitude: float,
258
276
result = getMessage (res)
259
277
260
278
proc sendVenue * (b: TeleBot , chatId: int64 , latitude: float , longitude: float , address: string , foursquareId = " " , foursquareType = " " ,
261
- googlePlaceId = " " , googlePlaceType = " " , disableNotification = false , replyToMessageId = 0 ,
279
+ googlePlaceId = " " , googlePlaceType = " " , disableNotification = false , protectContent = false , replyToMessageId = 0 ,
262
280
allowSendingWithoutReply = false , replyMarkup: KeyboardMarkup = nil ): Future [Message ] {.async .} =
263
281
var data = newMultipartData ()
264
282
@@ -277,6 +295,8 @@ proc sendVenue*(b: TeleBot, chatId: int64, latitude: float, longitude: float, ad
277
295
data[" google_place_type" ] = googlePlaceType
278
296
if disableNotification:
279
297
data[" disable_notification" ] = " true"
298
+ if protectContent:
299
+ data[" protect_content" ] = " true"
280
300
if replyToMessageId != 0 :
281
301
data[" reply_to_message_id" ] = $ replyToMessageId
282
302
if allowSendingWithoutReply:
@@ -288,7 +308,7 @@ proc sendVenue*(b: TeleBot, chatId: int64, latitude: float, longitude: float, ad
288
308
result = getMessage (res)
289
309
290
310
proc sendContact * (b: TeleBot , chatId: int64 , phoneNumber: string , firstName: string , lastName = " " , vcard = " " ,
291
- disableNotification = false , replyToMessageId = 0 ,
311
+ disableNotification = false , protectContent = false , replyToMessageId = 0 ,
292
312
allowSendingWithoutReply = false , replyMarkup: KeyboardMarkup = nil ): Future [Message ] {.async .} =
293
313
var data = newMultipartData ()
294
314
@@ -301,6 +321,8 @@ proc sendContact*(b: TeleBot, chatId: int64, phoneNumber: string, firstName: str
301
321
data[" vcard" ] = vcard
302
322
if disableNotification:
303
323
data[" disable_notification" ] = " true"
324
+ if protectContent:
325
+ data[" protect_content" ] = " true"
304
326
if replyToMessageId != 0 :
305
327
data[" reply_to_message_id" ] = $ replyToMessageId
306
328
if allowSendingWithoutReply:
@@ -315,8 +337,8 @@ proc sendInvoice*(b: TeleBot, chatId: int64, title: string, description: string,
315
337
prices: seq [LabeledPrice ], maxTipAmount = 0 , suggestedTipAmounts: seq [int ] = @ [], startParameter = " " ,
316
338
providerData = " " , photoUrl = " " , photoSize = 0 , photoWidth = 0 , photoHeight = 0 ,
317
339
needName = false , needPhoneNumber = false , needEmail = false , needShippingAddress = false , sendPhoneNumberToProvider = false ,
318
- sendEmailToProvider = false , isFlexible = false ,
319
- disableNotification = false , replyToMessageId = 0 , allowSendingWithoutReply = false , replyMarkup: KeyboardMarkup = nil ): Future [Message ] {.async .} =
340
+ sendEmailToProvider = false , isFlexible = false , disableNotification = false , protectContent = false , replyToMessageId = 0 ,
341
+ allowSendingWithoutReply = false , replyMarkup: KeyboardMarkup = nil ): Future [Message ] {.async .} =
320
342
var data = newMultipartData ()
321
343
322
344
data[" chat_id" ] = $ chatId
@@ -362,6 +384,8 @@ proc sendInvoice*(b: TeleBot, chatId: int64, title: string, description: string,
362
384
data[" is_flexible" ] = " true"
363
385
if disableNotification:
364
386
data[" disable_notification" ] = " true"
387
+ if protectContent:
388
+ data[" protect_content" ] = " true"
365
389
if replyToMessageId != 0 :
366
390
data[" reply_to_message_id" ] = $ replyToMessageId
367
391
if allowSendingWithoutReply:
@@ -373,7 +397,8 @@ proc sendInvoice*(b: TeleBot, chatId: int64, title: string, description: string,
373
397
result = getMessage (res)
374
398
375
399
proc sendAnimation * (b: TeleBot , chatId: int64 , animation: string , duration = 0 , width = 0 , height = 0 , thumb = " " ,
376
- caption = " " , parseMode = " " , captionEntities: seq [MessageEntity ] = @ [], disableNotification = false , replyToMessageId = 0 ,
400
+ caption = " " , parseMode = " " , captionEntities: seq [MessageEntity ] = @ [], disableNotification = false ,
401
+ protectContent = false , replyToMessageId = 0 ,
377
402
allowSendingWithoutReply = false , replyMarkup: KeyboardMarkup = nil ): Future [Message ] {.async .} =
378
403
var data = newMultipartData ()
379
404
@@ -397,6 +422,8 @@ proc sendAnimation*(b: TeleBot, chatId: int64, animation: string, duration = 0,
397
422
data[" caption_entities" ] = json
398
423
if disableNotification:
399
424
data[" disable_notification" ] = " true"
425
+ if protectContent:
426
+ data[" protect_content" ] = " true"
400
427
if replyToMessageId != 0 :
401
428
data[" reply_to_message_id" ] = $ replyToMessageId
402
429
if allowSendingWithoutReply:
@@ -410,7 +437,7 @@ proc sendAnimation*(b: TeleBot, chatId: int64, animation: string, duration = 0,
410
437
proc sendPoll * (b: TeleBot , chatId: int64 , question: string , options: seq [string ], isAnonymous = false , kind = " " ,
411
438
allowsMultipleAnswers = false , correctOptionId = 0 , explanation = " " , explanationParseMode = " " ,
412
439
explanationEntities: seq [MessageEntity ] = @ [], openPeriod = 0 , closeDate = 0 , isClosed = false , disableNotification = false ,
413
- replyToMessageId = 0 , allowSendingWithoutReply = false , replyMarkup: KeyboardMarkup = nil ): Future [Message ] {.async .} =
440
+ protectContent = false , replyToMessageId = 0 , allowSendingWithoutReply = false , replyMarkup: KeyboardMarkup = nil ): Future [Message ] {.async .} =
414
441
var data = newMultipartData ()
415
442
416
443
data[" chat_id" ] = $ chatId
@@ -442,6 +469,8 @@ proc sendPoll*(b: TeleBot, chatId: int64, question: string, options: seq[string]
442
469
data[" is_closed" ] = " true"
443
470
if disableNotification:
444
471
data[" disable_notification" ] = " true"
472
+ if protectContent:
473
+ data[" protect_content" ] = " true"
445
474
if replyToMessageId != 0 :
446
475
data[" reply_to_message_id" ] = $ replyToMessageId
447
476
if allowSendingWithoutReply:
@@ -452,7 +481,7 @@ proc sendPoll*(b: TeleBot, chatId: int64, question: string, options: seq[string]
452
481
let res = await makeRequest (b, procName, data)
453
482
result = getMessage (res)
454
483
455
- proc sendDice * (b: TeleBot , chatId: int64 , emoji = " " , disableNotification = false , replyToMessageId = 0 ,
484
+ proc sendDice * (b: TeleBot , chatId: int64 , emoji = " " , disableNotification = false , protectContent = false , replyToMessageId = 0 ,
456
485
allowSendingWithoutReply = false , replyMarkup: KeyboardMarkup = nil ): Future [Message ] {.async .} =
457
486
var data = newMultipartData ()
458
487
@@ -461,6 +490,8 @@ proc sendDice*(b: TeleBot, chatId: int64, emoji = "", disableNotification = fals
461
490
data[" emoji" ] = emoji
462
491
if disableNotification:
463
492
data[" disable_notification" ] = " true"
493
+ if protectContent:
494
+ data[" protect_content" ] = " true"
464
495
if replyToMessageId != 0 :
465
496
data[" reply_to_message_id" ] = $ replyToMessageId
466
497
if allowSendingWithoutReply:
@@ -484,7 +515,7 @@ proc close*(b: TeleBot): Future[bool] {.async.} =
484
515
let res = await makeRequest (b, procName)
485
516
result = unmarshal (res, bool )
486
517
487
- proc forwardMessage * (b: TeleBot , chatId, fromChatId: string , messageId: int , disableNotification = false ): Future [Message ] {.async .} =
518
+ proc forwardMessage * (b: TeleBot , chatId, fromChatId: string , messageId: int , disableNotification = false , protectContent = false ): Future [Message ] {.async .} =
488
519
var data = newMultipartData ()
489
520
490
521
data[" chat_id" ] = chatId
@@ -493,12 +524,13 @@ proc forwardMessage*(b: TeleBot, chatId, fromChatId: string, messageId: int, dis
493
524
494
525
if disableNotification:
495
526
data[" disable_notification" ] = " true"
496
-
527
+ if protectContent:
528
+ data[" protect_content" ] = " true"
497
529
let res = await makeRequest (b, procName, data)
498
530
result = getMessage (res)
499
531
500
532
proc copyMessage * (b: TeleBot , chatId, fromChatId: string , messageId: int , caption = " " , parseMode = " " ,
501
- captionEntities: seq [MessageEntity ] = @ [], disableNotification = false ,
533
+ captionEntities: seq [MessageEntity ] = @ [], disableNotification = false , protectContent = false ,
502
534
replyToMessageId = 0 , allowSendingWithoutReply = false , replyMarkup: KeyboardMarkup = nil ): Future [MessageId ] {.async .} =
503
535
var data = newMultipartData ()
504
536
@@ -515,6 +547,8 @@ proc copyMessage*(b: TeleBot, chatId, fromChatId: string, messageId: int, captio
515
547
data[" caption_entities" ] = json
516
548
if disableNotification:
517
549
data[" disable_notification" ] = " true"
550
+ if protectContent:
551
+ data[" protect_content" ] = " true"
518
552
if replyToMessageId != 0 :
519
553
data[" reply_to_message_id" ] = $ replyToMessageId
520
554
if allowSendingWithoutReply:
0 commit comments