Consistency of variable names.

bot-api-6.1
Syfaro 2018-10-08 18:37:18 -05:00
parent 655c3a4137
commit 1f859674f7
2 changed files with 186 additions and 186 deletions

88
bot.go
View File

@ -329,11 +329,11 @@ func (bot *BotAPI) GetUserProfilePhotos(config UserProfilePhotosConfig) (UserPro
// //
// Requires FileID. // Requires FileID.
func (bot *BotAPI) GetFile(config FileConfig) (File, error) { func (bot *BotAPI) GetFile(config FileConfig) (File, error) {
v := make(Params) params := make(Params)
v["file_id"] = config.FileID params["file_id"] = config.FileID
resp, err := bot.MakeRequest("getFile", v) resp, err := bot.MakeRequest("getFile", params)
if err != nil { if err != nil {
return File{}, err return File{}, err
} }
@ -438,11 +438,11 @@ func (bot *BotAPI) ListenForWebhook(pattern string) UpdatesChannel {
// GetChat gets information about a chat. // GetChat gets information about a chat.
func (bot *BotAPI) GetChat(config ChatConfig) (Chat, error) { func (bot *BotAPI) GetChat(config ChatConfig) (Chat, error) {
v := make(Params) params := make(Params)
v.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername) params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername)
resp, err := bot.MakeRequest("getChat", v) resp, err := bot.MakeRequest("getChat", params)
if err != nil { if err != nil {
return Chat{}, err return Chat{}, err
} }
@ -458,11 +458,11 @@ func (bot *BotAPI) GetChat(config ChatConfig) (Chat, error) {
// If none have been appointed, only the creator will be returned. // If none have been appointed, only the creator will be returned.
// Bots are not shown, even if they are an administrator. // Bots are not shown, even if they are an administrator.
func (bot *BotAPI) GetChatAdministrators(config ChatConfig) ([]ChatMember, error) { func (bot *BotAPI) GetChatAdministrators(config ChatConfig) ([]ChatMember, error) {
v := make(Params) params := make(Params)
v.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername) params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername)
resp, err := bot.MakeRequest("getChatAdministrators", v) resp, err := bot.MakeRequest("getChatAdministrators", params)
if err != nil { if err != nil {
return []ChatMember{}, err return []ChatMember{}, err
} }
@ -475,11 +475,11 @@ func (bot *BotAPI) GetChatAdministrators(config ChatConfig) ([]ChatMember, error
// GetChatMembersCount gets the number of users in a chat. // GetChatMembersCount gets the number of users in a chat.
func (bot *BotAPI) GetChatMembersCount(config ChatConfig) (int, error) { func (bot *BotAPI) GetChatMembersCount(config ChatConfig) (int, error) {
v := make(Params) params := make(Params)
v.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername) params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername)
resp, err := bot.MakeRequest("getChatMembersCount", v) resp, err := bot.MakeRequest("getChatMembersCount", params)
if err != nil { if err != nil {
return -1, err return -1, err
} }
@ -492,12 +492,12 @@ func (bot *BotAPI) GetChatMembersCount(config ChatConfig) (int, error) {
// GetChatMember gets a specific chat member. // GetChatMember gets a specific chat member.
func (bot *BotAPI) GetChatMember(config ChatConfigWithUser) (ChatMember, error) { func (bot *BotAPI) GetChatMember(config ChatConfigWithUser) (ChatMember, error) {
v := make(Params) params := make(Params)
v.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername) params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername)
v.AddNonZero("user_id", config.UserID) params.AddNonZero("user_id", config.UserID)
resp, err := bot.MakeRequest("getChatMember", v) resp, err := bot.MakeRequest("getChatMember", params)
if err != nil { if err != nil {
return ChatMember{}, err return ChatMember{}, err
} }
@ -511,12 +511,12 @@ func (bot *BotAPI) GetChatMember(config ChatConfigWithUser) (ChatMember, error)
// UnbanChatMember unbans a user from a chat. Note that this only will work // UnbanChatMember unbans a user from a chat. Note that this only will work
// in supergroups and channels, and requires the bot to be an admin. // in supergroups and channels, and requires the bot to be an admin.
func (bot *BotAPI) UnbanChatMember(config ChatMemberConfig) (APIResponse, error) { func (bot *BotAPI) UnbanChatMember(config ChatMemberConfig) (APIResponse, error) {
v := make(Params) params := make(Params)
v.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername) params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername)
v.AddNonZero("user_id", config.UserID) params.AddNonZero("user_id", config.UserID)
return bot.MakeRequest("unbanChatMember", v) return bot.MakeRequest("unbanChatMember", params)
} }
// RestrictChatMember to restrict a user in a supergroup. The bot must be an // RestrictChatMember to restrict a user in a supergroup. The bot must be an
@ -524,37 +524,37 @@ func (bot *BotAPI) UnbanChatMember(config ChatMemberConfig) (APIResponse, error)
//appropriate admin rights. Pass True for all boolean parameters to lift //appropriate admin rights. Pass True for all boolean parameters to lift
//restrictions from a user. Returns True on success. //restrictions from a user. Returns True on success.
func (bot *BotAPI) RestrictChatMember(config RestrictChatMemberConfig) (APIResponse, error) { func (bot *BotAPI) RestrictChatMember(config RestrictChatMemberConfig) (APIResponse, error) {
v := make(Params) params := make(Params)
v.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername) params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername)
v.AddNonZero("user_id", config.UserID) params.AddNonZero("user_id", config.UserID)
v.AddNonNilBool("can_send_messages", config.CanSendMessages) params.AddNonNilBool("can_send_messages", config.CanSendMessages)
v.AddNonNilBool("can_send_media_messages", config.CanSendMediaMessages) params.AddNonNilBool("can_send_media_messages", config.CanSendMediaMessages)
v.AddNonNilBool("can_send_other_messages", config.CanSendOtherMessages) params.AddNonNilBool("can_send_other_messages", config.CanSendOtherMessages)
v.AddNonNilBool("can_add_web_page_previews", config.CanAddWebPagePreviews) params.AddNonNilBool("can_add_web_page_previews", config.CanAddWebPagePreviews)
v.AddNonZero64("until_date", config.UntilDate) params.AddNonZero64("until_date", config.UntilDate)
return bot.MakeRequest("restrictChatMember", v) return bot.MakeRequest("restrictChatMember", params)
} }
// PromoteChatMember add admin rights to user // PromoteChatMember add admin rights to user
func (bot *BotAPI) PromoteChatMember(config PromoteChatMemberConfig) (APIResponse, error) { func (bot *BotAPI) PromoteChatMember(config PromoteChatMemberConfig) (APIResponse, error) {
v := make(Params) params := make(Params)
v.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername) params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername)
v.AddNonZero("user_id", config.UserID) params.AddNonZero("user_id", config.UserID)
v.AddNonNilBool("can_change_info", config.CanChangeInfo) params.AddNonNilBool("can_change_info", config.CanChangeInfo)
v.AddNonNilBool("can_post_messages", config.CanPostMessages) params.AddNonNilBool("can_post_messages", config.CanPostMessages)
v.AddNonNilBool("can_edit_messages", config.CanEditMessages) params.AddNonNilBool("can_edit_messages", config.CanEditMessages)
v.AddNonNilBool("can_delete_messages", config.CanDeleteMessages) params.AddNonNilBool("can_delete_messages", config.CanDeleteMessages)
v.AddNonNilBool("can_invite_members", config.CanInviteUsers) params.AddNonNilBool("can_invite_members", config.CanInviteUsers)
v.AddNonNilBool("can_restrict_members", config.CanRestrictMembers) params.AddNonNilBool("can_restrict_members", config.CanRestrictMembers)
v.AddNonNilBool("can_pin_messages", config.CanPinMessages) params.AddNonNilBool("can_pin_messages", config.CanPinMessages)
v.AddNonNilBool("can_promote_members", config.CanPromoteMembers) params.AddNonNilBool("can_promote_members", config.CanPromoteMembers)
return bot.MakeRequest("promoteChatMember", v) return bot.MakeRequest("promoteChatMember", params)
} }
// GetGameHighScores allows you to get the high scores for a game. // GetGameHighScores allows you to get the high scores for a game.
@ -577,11 +577,11 @@ func (bot *BotAPI) GetGameHighScores(config GetGameHighScoresConfig) ([]GameHigh
// GetInviteLink get InviteLink for a chat // GetInviteLink get InviteLink for a chat
func (bot *BotAPI) GetInviteLink(config ChatConfig) (string, error) { func (bot *BotAPI) GetInviteLink(config ChatConfig) (string, error) {
v := make(Params) params := make(Params)
v.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername) params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername)
resp, err := bot.MakeRequest("exportChatInviteLink", v) resp, err := bot.MakeRequest("exportChatInviteLink", params)
if err != nil { if err != nil {
return "", err return "", err
} }

View File

@ -69,15 +69,15 @@ type BaseChat struct {
} }
func (chat *BaseChat) params() (Params, error) { func (chat *BaseChat) params() (Params, error) {
v := make(Params) params := make(Params)
v.AddFirstValid("chat_id", chat.ChatID, chat.ChannelUsername) params.AddFirstValid("chat_id", chat.ChatID, chat.ChannelUsername)
v.AddNonZero("reply_to_message_id", chat.ReplyToMessageID) params.AddNonZero("reply_to_message_id", chat.ReplyToMessageID)
v.AddBool("disable_notification", chat.DisableNotification) params.AddBool("disable_notification", chat.DisableNotification)
err := v.AddInterface("reply_markup", chat.ReplyMarkup) err := params.AddInterface("reply_markup", chat.ReplyMarkup)
return v, err return params, err
} }
// BaseFile is a base type for all file config types. // BaseFile is a base type for all file config types.
@ -117,18 +117,18 @@ type BaseEdit struct {
} }
func (edit BaseEdit) params() (Params, error) { func (edit BaseEdit) params() (Params, error) {
v := make(Params) params := make(Params)
if edit.InlineMessageID != "" { if edit.InlineMessageID != "" {
v["inline_message_id"] = edit.InlineMessageID params["inline_message_id"] = edit.InlineMessageID
} else { } else {
v.AddFirstValid("chat_id", edit.ChatID, edit.ChannelUsername) params.AddFirstValid("chat_id", edit.ChatID, edit.ChannelUsername)
v.AddNonZero("message_id", edit.MessageID) params.AddNonZero("message_id", edit.MessageID)
} }
err := v.AddInterface("reply_markup", edit.ReplyMarkup) err := params.AddInterface("reply_markup", edit.ReplyMarkup)
return v, err return params, err
} }
// MessageConfig contains information about a SendMessage request. // MessageConfig contains information about a SendMessage request.
@ -525,20 +525,20 @@ type SetGameScoreConfig struct {
} }
func (config SetGameScoreConfig) params() (Params, error) { func (config SetGameScoreConfig) params() (Params, error) {
v := make(Params) params := make(Params)
v.AddNonZero("user_id", config.UserID) params.AddNonZero("user_id", config.UserID)
v.AddNonZero("scrore", config.Score) params.AddNonZero("scrore", config.Score)
v.AddBool("disable_edit_message", config.DisableEditMessage) params.AddBool("disable_edit_message", config.DisableEditMessage)
if config.InlineMessageID != "" { if config.InlineMessageID != "" {
v["inline_message_id"] = config.InlineMessageID params["inline_message_id"] = config.InlineMessageID
} else { } else {
v.AddFirstValid("chat_id", config.ChatID, config.ChannelUsername) params.AddFirstValid("chat_id", config.ChatID, config.ChannelUsername)
v.AddNonZero("message_id", config.MessageID) params.AddNonZero("message_id", config.MessageID)
} }
return v, nil return params, nil
} }
func (config SetGameScoreConfig) method() string { func (config SetGameScoreConfig) method() string {
@ -555,18 +555,18 @@ type GetGameHighScoresConfig struct {
} }
func (config GetGameHighScoresConfig) params() (Params, error) { func (config GetGameHighScoresConfig) params() (Params, error) {
v := make(Params) params := make(Params)
v.AddNonZero("user_id", config.UserID) params.AddNonZero("user_id", config.UserID)
if config.InlineMessageID != "" { if config.InlineMessageID != "" {
v["inline_message_id"] = config.InlineMessageID params["inline_message_id"] = config.InlineMessageID
} else { } else {
v.AddFirstValid("chat_id", config.ChatID, config.ChannelUsername) params.AddFirstValid("chat_id", config.ChatID, config.ChannelUsername)
v.AddNonZero("message_id", config.MessageID) params.AddNonZero("message_id", config.MessageID)
} }
return v, nil return params, nil
} }
func (config GetGameHighScoresConfig) method() string { func (config GetGameHighScoresConfig) method() string {
@ -774,20 +774,20 @@ func (config InlineConfig) method() string {
} }
func (config InlineConfig) params() (Params, error) { func (config InlineConfig) params() (Params, error) {
v := make(Params) params := make(Params)
v["inline_query_id"] = config.InlineQueryID params["inline_query_id"] = config.InlineQueryID
v.AddNonZero("cache_time", config.CacheTime) params.AddNonZero("cache_time", config.CacheTime)
v.AddBool("is_personal", config.IsPersonal) params.AddBool("is_personal", config.IsPersonal)
v.AddNonEmpty("next_offset", config.NextOffset) params.AddNonEmpty("next_offset", config.NextOffset)
v.AddNonEmpty("switch_pm_text", config.SwitchPMText) params.AddNonEmpty("switch_pm_text", config.SwitchPMText)
v.AddNonEmpty("switch_pm_parameter", config.SwitchPMParameter) params.AddNonEmpty("switch_pm_parameter", config.SwitchPMParameter)
if err := v.AddInterface("results", config.Results); err != nil { if err := params.AddInterface("results", config.Results); err != nil {
return v, err return params, err
} }
return v, nil return params, nil
} }
// CallbackConfig contains information on making a CallbackQuery response. // CallbackConfig contains information on making a CallbackQuery response.
@ -804,15 +804,15 @@ func (config CallbackConfig) method() string {
} }
func (config CallbackConfig) params() (Params, error) { func (config CallbackConfig) params() (Params, error) {
v := make(Params) params := make(Params)
v["callback_query_id"] = config.CallbackQueryID params["callback_query_id"] = config.CallbackQueryID
v.AddNonEmpty("text", config.Text) params.AddNonEmpty("text", config.Text)
v.AddBool("show_alert", config.ShowAlert) params.AddBool("show_alert", config.ShowAlert)
v.AddNonEmpty("url", config.URL) params.AddNonEmpty("url", config.URL)
v.AddNonZero("cache_time", config.CacheTime) params.AddNonZero("cache_time", config.CacheTime)
return v, nil return params, nil
} }
// ChatMemberConfig contains information about a user in a chat for use // ChatMemberConfig contains information about a user in a chat for use
@ -834,12 +834,12 @@ func (config UnbanChatMemberConfig) method() string {
} }
func (config UnbanChatMemberConfig) params() (Params, error) { func (config UnbanChatMemberConfig) params() (Params, error) {
v := make(Params) params := make(Params)
v.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername) params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername)
v.AddNonZero("user_id", config.UserID) params.AddNonZero("user_id", config.UserID)
return v, nil return params, nil
} }
// KickChatMemberConfig contains extra fields to kick user // KickChatMemberConfig contains extra fields to kick user
@ -853,13 +853,13 @@ func (config KickChatMemberConfig) method() string {
} }
func (config KickChatMemberConfig) params() (Params, error) { func (config KickChatMemberConfig) params() (Params, error) {
v := make(Params) params := make(Params)
v.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername) params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername)
v.AddNonZero("user_id", config.UserID) params.AddNonZero("user_id", config.UserID)
v.AddNonZero64("until_date", config.UntilDate) params.AddNonZero64("until_date", config.UntilDate)
return v, nil return params, nil
} }
// RestrictChatMemberConfig contains fields to restrict members of chat // RestrictChatMemberConfig contains fields to restrict members of chat
@ -877,18 +877,18 @@ func (config RestrictChatMemberConfig) method() string {
} }
func (config RestrictChatMemberConfig) params() (Params, error) { func (config RestrictChatMemberConfig) params() (Params, error) {
v := make(Params) params := make(Params)
v.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername) params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername)
v.AddNonZero("user_id", config.UserID) params.AddNonZero("user_id", config.UserID)
v.AddNonNilBool("can_send_messages", config.CanSendMessages) params.AddNonNilBool("can_send_messages", config.CanSendMessages)
v.AddNonNilBool("can_send_media_messages", config.CanSendMediaMessages) params.AddNonNilBool("can_send_media_messages", config.CanSendMediaMessages)
v.AddNonNilBool("can_send_other_messages", config.CanSendOtherMessages) params.AddNonNilBool("can_send_other_messages", config.CanSendOtherMessages)
v.AddNonNilBool("can_add_web_page_previews", config.CanAddWebPagePreviews) params.AddNonNilBool("can_add_web_page_previews", config.CanAddWebPagePreviews)
v.AddNonZero64("until_date", config.UntilDate) params.AddNonZero64("until_date", config.UntilDate)
return v, nil return params, nil
} }
// PromoteChatMemberConfig contains fields to promote members of chat // PromoteChatMemberConfig contains fields to promote members of chat
@ -909,21 +909,21 @@ func (config PromoteChatMemberConfig) method() string {
} }
func (config PromoteChatMemberConfig) params() (Params, error) { func (config PromoteChatMemberConfig) params() (Params, error) {
v := make(Params) params := make(Params)
v.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername) params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername)
v.AddNonZero("user_id", config.UserID) params.AddNonZero("user_id", config.UserID)
v.AddNonNilBool("can_change_info", config.CanChangeInfo) params.AddNonNilBool("can_change_info", config.CanChangeInfo)
v.AddNonNilBool("can_post_messages", config.CanPostMessages) params.AddNonNilBool("can_post_messages", config.CanPostMessages)
v.AddNonNilBool("can_edit_messages", config.CanEditMessages) params.AddNonNilBool("can_edit_messages", config.CanEditMessages)
v.AddNonNilBool("can_delete_messages", config.CanDeleteMessages) params.AddNonNilBool("can_delete_messages", config.CanDeleteMessages)
v.AddNonNilBool("can_invite_users", config.CanInviteUsers) params.AddNonNilBool("can_invite_users", config.CanInviteUsers)
v.AddNonNilBool("can_restrict_members", config.CanRestrictMembers) params.AddNonNilBool("can_restrict_members", config.CanRestrictMembers)
v.AddNonNilBool("can_pin_messages", config.CanPinMessages) params.AddNonNilBool("can_pin_messages", config.CanPinMessages)
v.AddNonNilBool("can_promote_members", config.CanPromoteMembers) params.AddNonNilBool("can_promote_members", config.CanPromoteMembers)
return v, nil return params, nil
} }
// ChatConfig contains information about getting information on a chat. // ChatConfig contains information about getting information on a chat.
@ -943,11 +943,11 @@ func (config LeaveChatConfig) method() string {
} }
func (config LeaveChatConfig) params() (Params, error) { func (config LeaveChatConfig) params() (Params, error) {
v := make(Params) params := make(Params)
v.AddFirstValid("chat_id", config.ChatID, config.ChannelUsername) params.AddFirstValid("chat_id", config.ChatID, config.ChannelUsername)
return v, nil return params, nil
} }
// ChatConfigWithUser contains information about getting information on // ChatConfigWithUser contains information about getting information on
@ -1041,12 +1041,12 @@ func (config DeleteMessageConfig) method() string {
} }
func (config DeleteMessageConfig) params() (Params, error) { func (config DeleteMessageConfig) params() (Params, error) {
v := make(Params) params := make(Params)
v.AddNonZero64("chat_id", config.ChatID) params.AddNonZero64("chat_id", config.ChatID)
v.AddNonZero("message_id", config.MessageID) params.AddNonZero("message_id", config.MessageID)
return v, nil return params, nil
} }
// PinChatMessageConfig contains information of a message in a chat to pin. // PinChatMessageConfig contains information of a message in a chat to pin.
@ -1062,13 +1062,13 @@ func (config PinChatMessageConfig) method() string {
} }
func (config PinChatMessageConfig) params() (Params, error) { func (config PinChatMessageConfig) params() (Params, error) {
v := make(Params) params := make(Params)
v.AddFirstValid("chat_id", config.ChatID, config.ChannelUsername) params.AddFirstValid("chat_id", config.ChatID, config.ChannelUsername)
v.AddNonZero("message_id", config.MessageID) params.AddNonZero("message_id", config.MessageID)
v.AddBool("disable_notification", config.DisableNotification) params.AddBool("disable_notification", config.DisableNotification)
return v, nil return params, nil
} }
// UnpinChatMessageConfig contains information of chat to unpin. // UnpinChatMessageConfig contains information of chat to unpin.
@ -1082,11 +1082,11 @@ func (config UnpinChatMessageConfig) method() string {
} }
func (config UnpinChatMessageConfig) params() (Params, error) { func (config UnpinChatMessageConfig) params() (Params, error) {
v := make(Params) params := make(Params)
v.AddFirstValid("chat_id", config.ChatID, config.ChannelUsername) params.AddFirstValid("chat_id", config.ChatID, config.ChannelUsername)
return v, nil return params, nil
} }
// SetChatPhotoConfig allows you to set a group, supergroup, or channel's photo. // SetChatPhotoConfig allows you to set a group, supergroup, or channel's photo.
@ -1121,11 +1121,11 @@ func (config DeleteChatPhotoConfig) method() string {
} }
func (config DeleteChatPhotoConfig) params() (Params, error) { func (config DeleteChatPhotoConfig) params() (Params, error) {
v := make(Params) params := make(Params)
v.AddFirstValid("chat_id", config.ChatID, config.ChannelUsername) params.AddFirstValid("chat_id", config.ChatID, config.ChannelUsername)
return v, nil return params, nil
} }
// SetChatTitleConfig allows you to set the title of something other than a private chat. // SetChatTitleConfig allows you to set the title of something other than a private chat.
@ -1141,12 +1141,12 @@ func (config SetChatTitleConfig) method() string {
} }
func (config SetChatTitleConfig) params() (Params, error) { func (config SetChatTitleConfig) params() (Params, error) {
v := make(Params) params := make(Params)
v.AddFirstValid("chat_id", config.ChatID, config.ChannelUsername) params.AddFirstValid("chat_id", config.ChatID, config.ChannelUsername)
v["title"] = config.Title params["title"] = config.Title
return v, nil return params, nil
} }
// SetChatDescriptionConfig allows you to set the description of a supergroup or channel. // SetChatDescriptionConfig allows you to set the description of a supergroup or channel.
@ -1162,12 +1162,12 @@ func (config SetChatDescriptionConfig) method() string {
} }
func (config SetChatDescriptionConfig) params() (Params, error) { func (config SetChatDescriptionConfig) params() (Params, error) {
v := make(Params) params := make(Params)
v.AddFirstValid("chat_id", config.ChatID, config.ChannelUsername) params.AddFirstValid("chat_id", config.ChatID, config.ChannelUsername)
v["description"] = config.Description params["description"] = config.Description
return v, nil return params, nil
} }
// GetStickerSetConfig allows you to get the stickers in a set. // GetStickerSetConfig allows you to get the stickers in a set.
@ -1180,11 +1180,11 @@ func (config GetStickerSetConfig) method() string {
} }
func (config GetStickerSetConfig) params() (Params, error) { func (config GetStickerSetConfig) params() (Params, error) {
v := make(Params) params := make(Params)
v["name"] = config.Name params["name"] = config.Name
return v, nil return params, nil
} }
// UploadStickerConfig allows you to upload a sticker for use in a set later. // UploadStickerConfig allows you to upload a sticker for use in a set later.
@ -1198,11 +1198,11 @@ func (config UploadStickerConfig) method() string {
} }
func (config UploadStickerConfig) params() (Params, error) { func (config UploadStickerConfig) params() (Params, error) {
v := make(Params) params := make(Params)
v.AddNonZero64("user_id", config.UserID) params.AddNonZero64("user_id", config.UserID)
return v, nil return params, nil
} }
func (config UploadStickerConfig) name() string { func (config UploadStickerConfig) name() string {
@ -1233,23 +1233,23 @@ func (config NewStickerSetConfig) method() string {
} }
func (config NewStickerSetConfig) params() (Params, error) { func (config NewStickerSetConfig) params() (Params, error) {
v := make(Params) params := make(Params)
v.AddNonZero64("user_id", config.UserID) params.AddNonZero64("user_id", config.UserID)
v["name"] = config.Name params["name"] = config.Name
v["title"] = config.Title params["title"] = config.Title
if sticker, ok := config.PNGSticker.(string); ok { if sticker, ok := config.PNGSticker.(string); ok {
v[config.name()] = sticker params[config.name()] = sticker
} }
v["emojis"] = config.Emojis params["emojis"] = config.Emojis
v.AddBool("contains_masks", config.ContainsMasks) params.AddBool("contains_masks", config.ContainsMasks)
err := v.AddInterface("mask_position", config.MaskPosition) err := params.AddInterface("mask_position", config.MaskPosition)
return v, err return params, err
} }
func (config NewStickerSetConfig) getFile() interface{} { func (config NewStickerSetConfig) getFile() interface{} {
@ -1280,19 +1280,19 @@ func (config AddStickerConfig) method() string {
} }
func (config AddStickerConfig) params() (Params, error) { func (config AddStickerConfig) params() (Params, error) {
v := make(Params) params := make(Params)
v.AddNonZero64("user_id", config.UserID) params.AddNonZero64("user_id", config.UserID)
v["name"] = config.Name params["name"] = config.Name
v["emojis"] = config.Emojis params["emojis"] = config.Emojis
if sticker, ok := config.PNGSticker.(string); ok { if sticker, ok := config.PNGSticker.(string); ok {
v[config.name()] = sticker params[config.name()] = sticker
} }
err := v.AddInterface("mask_position", config.MaskPosition) err := params.AddInterface("mask_position", config.MaskPosition)
return v, err return params, err
} }
func (config AddStickerConfig) name() string { func (config AddStickerConfig) name() string {
@ -1318,12 +1318,12 @@ func (config SetStickerPositionConfig) method() string {
} }
func (config SetStickerPositionConfig) params() (Params, error) { func (config SetStickerPositionConfig) params() (Params, error) {
v := make(Params) params := make(Params)
v["sticker"] = config.Sticker params["sticker"] = config.Sticker
v.AddNonZero("position", config.Position) params.AddNonZero("position", config.Position)
return v, nil return params, nil
} }
// DeleteStickerConfig allows you to delete a sticker from a set. // DeleteStickerConfig allows you to delete a sticker from a set.
@ -1336,11 +1336,11 @@ func (config DeleteStickerConfig) method() string {
} }
func (config DeleteStickerConfig) params() (Params, error) { func (config DeleteStickerConfig) params() (Params, error) {
v := make(Params) params := make(Params)
v["sticker"] = config.Sticker params["sticker"] = config.Sticker
return v, nil return params, nil
} }
// SetChatStickerSetConfig allows you to set the sticker set for a supergroup. // SetChatStickerSetConfig allows you to set the sticker set for a supergroup.
@ -1356,12 +1356,12 @@ func (config SetChatStickerSetConfig) method() string {
} }
func (config SetChatStickerSetConfig) params() (Params, error) { func (config SetChatStickerSetConfig) params() (Params, error) {
v := make(Params) params := make(Params)
v.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername) params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername)
v["sticker_set_name"] = config.StickerSetName params["sticker_set_name"] = config.StickerSetName
return v, nil return params, nil
} }
// DeleteChatStickerSetConfig allows you to remove a supergroup's sticker set. // DeleteChatStickerSetConfig allows you to remove a supergroup's sticker set.
@ -1375,11 +1375,11 @@ func (config DeleteChatStickerSetConfig) method() string {
} }
func (config DeleteChatStickerSetConfig) params() (Params, error) { func (config DeleteChatStickerSetConfig) params() (Params, error) {
v := make(Params) params := make(Params)
v.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername) params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername)
return v, nil return params, nil
} }
// MediaGroupConfig allows you to send a group of media. // MediaGroupConfig allows you to send a group of media.
@ -1399,14 +1399,14 @@ func (config MediaGroupConfig) method() string {
} }
func (config MediaGroupConfig) params() (Params, error) { func (config MediaGroupConfig) params() (Params, error) {
v := make(Params) params := make(Params)
v.AddFirstValid("chat_id", config.ChatID, config.ChannelUsername) params.AddFirstValid("chat_id", config.ChatID, config.ChannelUsername)
if err := v.AddInterface("media", config.Media); err != nil { if err := params.AddInterface("media", config.Media); err != nil {
return v, nil return params, nil
} }
v.AddBool("disable_notification", config.DisableNotification) params.AddBool("disable_notification", config.DisableNotification)
v.AddNonZero("reply_to_message_id", config.ReplyToMessageID) params.AddNonZero("reply_to_message_id", config.ReplyToMessageID)
return v, nil return params, nil
} }