@@ -831,7 +831,7 @@ type RemoveWebhookConfig struct {
831831}
832832
833833func (config RemoveWebhookConfig ) method () string {
834- return "setWebhook "
834+ return "deleteWebhook "
835835}
836836
837837func (config RemoveWebhookConfig ) params () (Params , error ) {
@@ -878,12 +878,9 @@ func (config InlineConfig) params() (Params, error) {
878878 params .AddNonEmpty ("next_offset" , config .NextOffset )
879879 params .AddNonEmpty ("switch_pm_text" , config .SwitchPMText )
880880 params .AddNonEmpty ("switch_pm_parameter" , config .SwitchPMParameter )
881+ err := params .AddInterface ("results" , config .Results )
881882
882- if err := params .AddInterface ("results" , config .Results ); err != nil {
883- return params , err
884- }
885-
886- return params , nil
883+ return params , err
887884}
888885
889886// CallbackConfig contains information on making a CallbackQuery response.
@@ -975,12 +972,10 @@ func (config RestrictChatMemberConfig) params() (Params, error) {
975972 params .AddFirstValid ("chat_id" , config .ChatID , config .SuperGroupUsername , config .ChannelUsername )
976973 params .AddNonZero ("user_id" , config .UserID )
977974
978- if err := params .AddInterface ("permissions" , config .Permissions ); err != nil {
979- return params , err
980- }
975+ err := params .AddInterface ("permissions" , config .Permissions )
981976 params .AddNonZero64 ("until_date" , config .UntilDate )
982977
983- return params , nil
978+ return params , err
984979}
985980
986981// PromoteChatMemberConfig contains fields to promote members of chat
@@ -1200,10 +1195,7 @@ func (config InvoiceConfig) params() (Params, error) {
12001195 params ["start_parameter" ] = config .StartParameter
12011196 params ["currency" ] = config .Currency
12021197
1203- if err = params .AddInterface ("prices" , config .Prices ); err != nil {
1204- return params , err
1205- }
1206-
1198+ err = params .AddInterface ("prices" , config .Prices )
12071199 params .AddNonEmpty ("provider_data" , config .ProviderData )
12081200 params .AddNonEmpty ("photo_url" , config .PhotoURL )
12091201 params .AddNonZero ("photo_size" , config .PhotoSize )
@@ -1217,7 +1209,7 @@ func (config InvoiceConfig) params() (Params, error) {
12171209 params .AddBool ("send_phone_number_to_provider" , config .SendPhoneNumberToProvider )
12181210 params .AddBool ("send_email_to_provider" , config .SendEmailToProvider )
12191211
1220- return params , nil
1212+ return params , err
12211213}
12221214
12231215func (config InvoiceConfig ) method () string {
@@ -1232,13 +1224,42 @@ type ShippingConfig struct {
12321224 ErrorMessage string
12331225}
12341226
1227+ func (config ShippingConfig ) method () string {
1228+ return "answerShippingQuery"
1229+ }
1230+
1231+ func (config ShippingConfig ) params () (Params , error ) {
1232+ params := make (Params )
1233+
1234+ params ["shipping_query_id" ] = config .ShippingQueryID
1235+ params .AddBool ("ok" , config .OK )
1236+ err := params .AddInterface ("shipping_options" , config .ShippingOptions )
1237+ params .AddNonEmpty ("error_message" , config .ErrorMessage )
1238+
1239+ return params , err
1240+ }
1241+
12351242// PreCheckoutConfig conatins information for answerPreCheckoutQuery request.
12361243type PreCheckoutConfig struct {
12371244 PreCheckoutQueryID string // required
12381245 OK bool // required
12391246 ErrorMessage string
12401247}
12411248
1249+ func (config PreCheckoutConfig ) method () string {
1250+ return "answerPreCheckoutQuery"
1251+ }
1252+
1253+ func (config PreCheckoutConfig ) params () (Params , error ) {
1254+ params := make (Params )
1255+
1256+ params ["pre_checkout_query_id" ] = config .PreCheckoutQueryID
1257+ params .AddBool ("ok" , config .OK )
1258+ params .AddNonEmpty ("error_message" , config .ErrorMessage )
1259+
1260+ return params , nil
1261+ }
1262+
12421263// DeleteMessageConfig contains information of a message in a chat to delete.
12431264type DeleteMessageConfig struct {
12441265 ChannelUsername string
@@ -1678,30 +1699,6 @@ func (config MediaGroupConfig) params() (Params, error) {
16781699 return params , nil
16791700}
16801701
1681- // DiceConfig allows you to send a random dice roll to Telegram.
1682- //
1683- // Emoji may be one of the following: 🎲 (1-6), 🎯 (1-6), 🏀 (1-5).
1684- type DiceConfig struct {
1685- BaseChat
1686-
1687- Emoji string
1688- }
1689-
1690- func (config DiceConfig ) method () string {
1691- return "sendDice"
1692- }
1693-
1694- func (config DiceConfig ) params () (Params , error ) {
1695- params , err := config .BaseChat .params ()
1696- if err != nil {
1697- return params , err
1698- }
1699-
1700- params .AddNonEmpty ("emoji" , config .Emoji )
1701-
1702- return params , err
1703- }
1704-
17051702// GetMyCommandsConfig gets a list of the currently registered commands.
17061703type GetMyCommandsConfig struct {}
17071704
@@ -1710,7 +1707,7 @@ func (config GetMyCommandsConfig) method() string {
17101707}
17111708
17121709func (config GetMyCommandsConfig ) params () (Params , error ) {
1713- return make ( Params ) , nil
1710+ return nil , nil
17141711}
17151712
17161713// SetMyCommandsConfig sets a list of commands the bot understands.
@@ -1729,3 +1726,28 @@ func (config SetMyCommandsConfig) params() (Params, error) {
17291726
17301727 return params , err
17311728}
1729+
1730+ // DiceConfig contains information about a sendDice request.
1731+ type DiceConfig struct {
1732+ BaseChat
1733+ // Emoji on which the dice throw animation is based.
1734+ // Currently, must be one of “🎲”, “🎯”, or “🏀”.
1735+ // Dice can have values 1-6 for “🎲” and “🎯”, and values 1-5 for “🏀”.
1736+ // Defaults to “🎲”
1737+ Emoji string
1738+ }
1739+
1740+ func (config DiceConfig ) method () string {
1741+ return "sendDice"
1742+ }
1743+
1744+ func (config DiceConfig ) params () (Params , error ) {
1745+ params , err := config .BaseChat .params ()
1746+ if err != nil {
1747+ return params , err
1748+ }
1749+
1750+ params .AddNonEmpty ("emoji" , config .Emoji )
1751+
1752+ return params , err
1753+ }
0 commit comments