From 1159065514da32131c8bbab0da986c4192f900a0 Mon Sep 17 00:00:00 2001 From: Adrian Gallagher Date: Wed, 4 Mar 2015 00:02:09 +1100 Subject: [PATCH] Added SMS related functions. --- smsglobal.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/smsglobal.go b/smsglobal.go index 4c0ff6bf..00c84dd9 100644 --- a/smsglobal.go +++ b/smsglobal.go @@ -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")