Build fixes
This commit is contained in:
@@ -19,20 +19,20 @@ type MessageSender struct {
|
|||||||
Config config.TwiloConfig
|
Config config.TwiloConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MessageSender) Send(msg message.Message, number contact.Contact, time *time.Time) (*TwilioResult, error) {
|
func (m *MessageSender) Send(msg message.Message, number contact.Contact, sendTime *time.Time) (*TwilioResult, error) {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
client := twilio.NewRestClientWithParams(twilio.ClientParams{
|
client := twilio.NewRestClientWithParams(twilio.ClientParams{
|
||||||
Username: Config.AccountSID,
|
Username: m.Config.AccountSID,
|
||||||
Password: Config.AuthToken,
|
Password: m.Config.AuthToken,
|
||||||
})
|
})
|
||||||
|
|
||||||
params := &twilioApi.CreateMessageParams{}
|
params := &twilioApi.CreateMessageParams{}
|
||||||
params.SetTo(number.PhoneNumber)
|
params.SetTo(number.PhoneNumber)
|
||||||
params.SetFrom(Config.Number)
|
params.SetFrom(m.Config.Number)
|
||||||
params.SetBody(message.Content)
|
params.SetBody(msg.Content)
|
||||||
if time != nil {
|
if sendTime != nil {
|
||||||
if time > now {
|
if sendTime.After(now) {
|
||||||
params.SetSendAt(*time)
|
params.SetSendAt(*sendTime)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user