chore: sync project files

This commit is contained in:
richjohnrambo
2026-08-11 10:29:38 +08:00
parent c9d6a6767f
commit 5aa7733515
310 changed files with 3323 additions and 36 deletions
+39
View File
@@ -0,0 +1,39 @@
package tel
import (
"encoding/json"
"github.com/twilio/twilio-go"
twapi "github.com/twilio/twilio-go/rest/api/v2010"
)
type twilioConfig struct {
AccountSid string `json:"account_sid"`
AuthToken string `json:"auth_token"`
}
var twilioClient *twilio.RestClient
func twilioInit(jsonconf json.RawMessage) error {
var conf twilioConfig
if err := json.Unmarshal(jsonconf, &conf); err != nil {
return err
}
twilioClient = twilio.NewRestClientWithParams(twilio.ClientParams{
Username: conf.AccountSid,
Password: conf.AuthToken,
})
return nil
}
func twilioSend(from, to, body string) error {
_, err := twilioClient.Api.CreateMessage(&twapi.CreateMessageParams{
From: &from,
To: &to,
Body: &body,
})
return err
}
View File