|
|
@ -28,6 +28,7 @@ type paymentHolder struct { |
|
|
|
Payment stellar1.PaymentDetailsLocal `json:"notification"` |
|
|
|
Payment stellar1.PaymentDetailsLocal `json:"notification"` |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Handlers holds pointers to handlers that you want to implement inside the bot type
|
|
|
|
type Handlers struct { |
|
|
|
type Handlers struct { |
|
|
|
ChatHandler *func(chat1.MsgSummary) |
|
|
|
ChatHandler *func(chat1.MsgSummary) |
|
|
|
ConversationHandler *func(chat1.ConvSummary) |
|
|
|
ConversationHandler *func(chat1.ConvSummary) |
|
|
@ -35,6 +36,7 @@ type Handlers struct { |
|
|
|
ErrorHandler *func(error) |
|
|
|
ErrorHandler *func(error) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SubscriptionChannels are passed to GetNewMessages to return data through channels
|
|
|
|
type SubscriptionChannels struct { |
|
|
|
type SubscriptionChannels struct { |
|
|
|
chat chan chat1.MsgSummary |
|
|
|
chat chan chat1.MsgSummary |
|
|
|
conversation chan chat1.ConvSummary |
|
|
|
conversation chan chat1.ConvSummary |
|
|
@ -48,19 +50,23 @@ type Error struct { |
|
|
|
Message string `json:"message"` |
|
|
|
Message string `json:"message"` |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ExplodingLifetime holds a time duration for ephemeral messages
|
|
|
|
type ExplodingLifetime struct { |
|
|
|
type ExplodingLifetime struct { |
|
|
|
time.Duration |
|
|
|
time.Duration |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// UnmarshalJSON unpacks exploding lifetimes from JSON
|
|
|
|
func (d *ExplodingLifetime) UnmarshalJSON(b []byte) (err error) { |
|
|
|
func (d *ExplodingLifetime) UnmarshalJSON(b []byte) (err error) { |
|
|
|
d.Duration, err = time.ParseDuration(strings.Trim(string(b), `"`)) |
|
|
|
d.Duration, err = time.ParseDuration(strings.Trim(string(b), `"`)) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// MarshalJSON packs exploding lifetimes to JSON
|
|
|
|
func (d *ExplodingLifetime) MarshalJSON() (b []byte, err error) { |
|
|
|
func (d *ExplodingLifetime) MarshalJSON() (b []byte, err error) { |
|
|
|
return []byte(fmt.Sprintf(`"%s"`, d.String())), nil |
|
|
|
return []byte(fmt.Sprintf(`"%s"`, d.String())), nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SendMessageBody holds the body string for all send and reply methods
|
|
|
|
type SendMessageBody struct { |
|
|
|
type SendMessageBody struct { |
|
|
|
Body string |
|
|
|
Body string |
|
|
|
} |
|
|
|
} |
|
|
|