Added SMS related functions.

This commit is contained in:
Adrian Gallagher
2015-03-04 00:02:09 +11:00
parent 2977664da6
commit 1159065514

View File

@@ -13,6 +13,27 @@ const (
SMSGLOBAL_API_URL = "http://www.smsglobal.com/http-api.php"
)
func SMSSendToAll(message string) {
for _, contact := range bot.config.SMSContacts {
if contact.Enabled {
err := SMSNotify(contact.Number, message)
if err != nil {
log.Println(err)
}
}
}
}
func SMSGetNumberByName(name string) (string) {
for _, contact := range bot.config.SMSContacts {
if contact.Name == name {
return contact.Number
}
}
return ""
}
func SMSNotify(to, message string) (error) {
values := url.Values{}
values.Set("action", "sendsms")