Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify variables to "config" #800

Merged
merged 1 commit into from
Sep 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,9 +571,9 @@ func MsgOptionBroadcast() MsgOption {

// MsgOptionCompose combines multiple options into a single option.
func MsgOptionCompose(options ...MsgOption) MsgOption {
return func(c *sendConfig) error {
return func(config *sendConfig) error {
for _, opt := range options {
if err := opt(c); err != nil {
if err := opt(config); err != nil {
return err
}
}
Expand All @@ -583,30 +583,30 @@ func MsgOptionCompose(options ...MsgOption) MsgOption {

// MsgOptionParse set parse option.
func MsgOptionParse(b bool) MsgOption {
return func(c *sendConfig) error {
return func(config *sendConfig) error {
var v string
if b {
v = "full"
} else {
v = "none"
}
c.values.Set("parse", v)
config.values.Set("parse", v)
return nil
}
}

// MsgOptionIconURL sets an icon URL
func MsgOptionIconURL(iconURL string) MsgOption {
return func(c *sendConfig) error {
c.values.Set("icon_url", iconURL)
return func(config *sendConfig) error {
config.values.Set("icon_url", iconURL)
return nil
}
}

// MsgOptionIconEmoji sets an icon emoji
func MsgOptionIconEmoji(iconEmoji string) MsgOption {
return func(c *sendConfig) error {
c.values.Set("icon_emoji", iconEmoji)
return func(config *sendConfig) error {
config.values.Set("icon_emoji", iconEmoji)
return nil
}
}
Expand Down