@@ -1299,6 +1299,32 @@ func (c *Client) AnswerCallbackQuery(callbackQueryID string, opts ...sendOption)
1299
1299
return c .doRequest ("answerCallbackQuery" , req , & success )
1300
1300
}
1301
1301
1302
+ // BotCommand represents a bot command.
1303
+ type BotCommand struct {
1304
+ Command string `json:"command"` // Text of the command, 1-32 characters. Can contain only lowercase English letters, digits and underscores.
1305
+ Description string `json:"description"` // Description of the command, 3-256 characters.
1306
+ }
1307
+
1308
+ /*
1309
+ GetMyCommands get the current list of bot commands.
1310
+ */
1311
+ func (c * Client ) GetMyCommands () (* []BotCommand , error ) {
1312
+ botCommands := & []BotCommand {}
1313
+ err := c .doRequest ("getMyCommands" , url.Values {}, botCommands )
1314
+ return botCommands , err
1315
+ }
1316
+
1317
+ /*
1318
+ SetMyCommands set the list of bot commands.
1319
+ */
1320
+ func (c * Client ) SetMyCommands (commands []BotCommand ) error {
1321
+ req := url.Values {}
1322
+ cmd , _ := json .Marshal (commands )
1323
+ req .Set ("commands" , string (cmd ))
1324
+ var set bool
1325
+ return c .doRequest ("setMyCommands" , url.Values {}, set )
1326
+ }
1327
+
1302
1328
/*
1303
1329
EditMessageText edit text and game messages sent by the bot. Available options:
1304
1330
- OptParseModeHTML
@@ -1461,11 +1487,12 @@ func (c *Client) SendSticker(chatID, fileID string, opts ...sendOption) (*Messag
1461
1487
1462
1488
// StickerSet represents sticker set
1463
1489
type StickerSet struct {
1464
- Name string `json:"name"`
1465
- Title string `json:"title"`
1466
- IsAnimated bool `json:"is_animated"`
1467
- ContainsMasks bool `json:"contains_masks"`
1468
- Stickers []Sticker `json:"stickers"`
1490
+ Name string `json:"name"`
1491
+ Title string `json:"title"`
1492
+ IsAnimated bool `json:"is_animated"`
1493
+ ContainsMasks bool `json:"contains_masks"`
1494
+ Stickers []Sticker `json:"stickers"`
1495
+ Thumb * PhotoSize `json:"thumb"`
1469
1496
}
1470
1497
1471
1498
/*
@@ -1501,12 +1528,16 @@ var (
1501
1528
v .Set ("mask_position" , string (p ))
1502
1529
}
1503
1530
}
1531
+ OptAnimatedSticker = func (v url.Values ) {
1532
+ v .Set ("tgs_sticker" , "true" )
1533
+ }
1504
1534
)
1505
1535
1506
1536
/*
1507
1537
CreateNewStickerSetFile creates new sticker set with sticker file. Available options:
1508
1538
- OptContainsMasks
1509
1539
- OptMaskPosition(pos *MaskPosition)
1540
+ - OptAnimatedSticker
1510
1541
*/
1511
1542
func (c * Client ) CreateNewStickerSetFile (userID int , name , title , stickerFilename , emojis string , opts ... sendOption ) error {
1512
1543
req := url.Values {}
@@ -1517,8 +1548,15 @@ func (c *Client) CreateNewStickerSetFile(userID int, name, title, stickerFilenam
1517
1548
for _ , opt := range opts {
1518
1549
opt (req )
1519
1550
}
1551
+ stickerFile := inputFile {name : stickerFilename }
1552
+ if len (req .Get ("tgs_sticker" )) > 0 {
1553
+ stickerFile .field = "tgs_sticker"
1554
+ req .Del ("tgs_sticker" )
1555
+ } else {
1556
+ stickerFile .field = "png_sticker"
1557
+ }
1520
1558
var created bool
1521
- return c .doRequestWithFiles ("createNewStickerSet" , req , & created , inputFile { field : "png_sticker" , name : stickerFilename } )
1559
+ return c .doRequestWithFiles ("createNewStickerSet" , req , & created , stickerFile )
1522
1560
}
1523
1561
1524
1562
/*
@@ -1543,6 +1581,7 @@ func (c *Client) CreateNewStickerSet(userID int, name, title, fileID, emojis str
1543
1581
/*
1544
1582
AddStickerToSetFile add a new sticker file to a set created by the bot. Available options:
1545
1583
- OptMaskPosition(pos *MaskPosition)
1584
+ - OptAnimatedSticker
1546
1585
*/
1547
1586
func (c * Client ) AddStickerToSetFile (userID int , name , filename , emojis string , opts ... sendOption ) error {
1548
1587
req := url.Values {}
@@ -1552,8 +1591,15 @@ func (c *Client) AddStickerToSetFile(userID int, name, filename, emojis string,
1552
1591
for _ , opt := range opts {
1553
1592
opt (req )
1554
1593
}
1594
+ stickerFile := inputFile {name : filename }
1595
+ if len (req .Get ("tgs_sticker" )) > 0 {
1596
+ stickerFile .field = "tgs_sticker"
1597
+ req .Del ("tgs_sticker" )
1598
+ } else {
1599
+ stickerFile .field = "png_sticker"
1600
+ }
1555
1601
var added bool
1556
- return c .doRequestWithFiles ("addStickerToSet" , req , & added , inputFile { field : "png_sticker" , name : filename } )
1602
+ return c .doRequestWithFiles ("addStickerToSet" , req , & added , stickerFile )
1557
1603
}
1558
1604
1559
1605
/*
@@ -1594,6 +1640,29 @@ func (c *Client) DeleteStickerFromSet(fileID string) error {
1594
1640
return c .doRequest ("deleteStickerFromSet" , req , & deleted )
1595
1641
}
1596
1642
1643
+ /*
1644
+ SetStickerSetThumb sets the thumbnail of a sticker set with a previously uploaded file.
1645
+ */
1646
+ func (c * Client ) SetStickerSetThumb (userID int , name , thumb string ) error {
1647
+ req := url.Values {}
1648
+ req .Set ("user_id" , fmt .Sprint (userID ))
1649
+ req .Set ("name" , name )
1650
+ req .Set ("thumb" , thumb )
1651
+ var set bool
1652
+ return c .doRequest ("setStickerSetThumb" , req , & set )
1653
+ }
1654
+
1655
+ /*
1656
+ SetStickerSetThumbFile sets the thumbnail of a sticker set with thumbnail file.
1657
+ */
1658
+ func (c * Client ) SetStickerSetThumbFile (userID int , name , thumbnailFilename string ) error {
1659
+ req := url.Values {}
1660
+ req .Set ("user_id" , fmt .Sprint (userID ))
1661
+ req .Set ("name" , name )
1662
+ var set bool
1663
+ return c .doRequestWithFiles ("setStickerSetThumb" , req , & set , inputFile {field : "thumb" , name : thumbnailFilename })
1664
+ }
1665
+
1597
1666
// InputMessageContent content of a message to be sent as a result of an inline query
1598
1667
type InputMessageContent interface {
1599
1668
inputMessageContent ()
@@ -2410,6 +2479,29 @@ func (c *Client) SendPoll(chatID string, question string, options []string, opts
2410
2479
return msg , err
2411
2480
}
2412
2481
2482
+ /*
2483
+ SendDice sends native telegram dice. Available Options:
2484
+ - OptDisableNotification
2485
+ - OptReplyToMessageID(id int)
2486
+ - OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
2487
+ - OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
2488
+ - OptReplyKeyboardRemove
2489
+ - OptReplyKeyboardRemoveSelective
2490
+ - OptForceReply
2491
+ - OptForceReplySelective
2492
+ */
2493
+ func (c * Client ) SendDice (chatID string , emoji string , opts ... sendOption ) (* Dice , error ) {
2494
+ req := url.Values {}
2495
+ req .Set ("chat_id" , chatID )
2496
+ req .Set ("emoji" , emoji )
2497
+ for _ , opt := range opts {
2498
+ opt (req )
2499
+ }
2500
+ dice := & Dice {}
2501
+ err := c .doRequest ("sendDice" , req , dice )
2502
+ return dice , err
2503
+ }
2504
+
2413
2505
/*
2414
2506
StopPoll stops poll. Available Options:
2415
2507
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
0 commit comments