This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Option left out by author, but would like added.

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
d
danzigrules
Voice
Posts: 17
Joined: Thu Aug 02, 2007 6:06 am

Option left out by author, but would like added.

Post by danzigrules »

Would it be possible for someone to add the !smsdel option for oper's in this script?
It is described at the end of the script.

Would be greatly appreciated.
Thanks Much

Code: Select all

#  Author: EToS
#  Date: 09/08/2005
#  Filename: sms.tcl
#  Function: Eggdrop interface to clickatell's HTTP/S SMS Gateway
#
#  Version: 1.1 *BeTA
#  History: 
#       - 09/08/2005: First Coded
#       - 16/06/2006: Added sms.dat for data handling
#                     Added !smsadd, !smsver, !smshelp
#                     tag and nick info to sms & chan work flag
#
#  Notes: Enable with .chanset #channel +sms

# packages

package require http

# vars

# script version
set smsver "1.1 *BeTA"

# work chan flags ..
setudef flag sms

# tag bottom of sms with irc nick and tagmsg ... 0=no 1=yes
set tagnick "1"
set tagname "1"
set tagmsg "********"

# datafile
set datfile "scripts/sms.dat"

# clickatell details
set user "**********"
set pass "**********"
set id "************"


# shouldnt need to edit these urls below, but can be edited if clickatell change their
# url structure, or if you wish to attempt to adapt script to another sms gateway 

set urlcreds "http://api.clickatell.com/http/getbalance?api_id=SMSID&user=SMSUSER&password=SMSPASS"
set url "http://api.clickatell.com/http/sendmsg?api_id=SMSID&user=SMSUSER&password=SMSPASS&to=NUMTOSEND&text=MSGTOSEND"


########## DO NOT EDIT BELOW UNLESS YOU KNOW TCL! ##########

# binds

namespace eval sms {
    variable pubsmsadd {!smsadd}
    variable pubbalbind {!smscreds}
    variable pubnumbind {!number}
    variable pubverbind {!smsver}
    variable pubhelpbind {!smshelp}
    variable pubbind {!sms}
    bind PUB o|o $pubsmsadd [namespace current]::smsadd 
    bind PUB o|o $pubnumbind [namespace current]::number
    bind PUB -|- $pubbalbind [namespace current]::credspublic
    bind PUB -|- $pubverbind [namespace current]::smsver
    bind PUB -|- $pubhelpbind [namespace current]::smshelp
    bind PUB -|- $pubbind [namespace current]::public
    namespace export getnames credspublic public private
}


proc sms::smsadd {nickname hostname handle channel arguments} {
    global chan datfile

    if ![channel get $channel sms] return

    set args [split $arguments]
    set data ""

    # check args are correct
    if {($arguments < 1) || ([llength $args] < 2)} {
        putquick "PRIVMSG $channel :\[\002SMS\017\] \002Format:\002 !smsadd <name> <number>"
        return 0
    }

    # check if names already added
    if {[validfeed [lindex $args 0] 1]} {
        putquick "PRIVMSG $channel :\[\002SMS\017\] \002Error:\002 User already exists!"
        return 0
    }

    # make sure no letters in sms number
    if {![ string is digit [lindex $args 1] ] } {
        putquick "PRIVMSG $channel : [lindex $args 1]"
        putquick "PRIVMSG $channel :\[\002SMS\017\] \002Error:\002 letters detected in <number> entry"
        return 0
    }

    # Complain and exit if input file does not exist
    if {![ file exists $datfile ] }  	{
        putquick "PRIVMSG $channel :\[\002SMS\017\] \002Error: \002File \"$datfile\" not found!"
        return 0
    }

    # Complain and exit if input file is not readable
    if {![ file readable $datfile ] }  	{
        putquick "PRIVMSG $channel :\[\002SMS\017\] \002Error:\002 Permission denied to read $datfile!"
        return 0
    }


   # save sms data
    if { [ catch { set fileId [open $datfile a] } err ] }  {
        putquick "PRIVMSG $channel :\[\002SMS\017\] Error:\002 $err"
        return 0
    }

    puts $fileId [lindex $args 0]:[lindex $args 1]
    close $fileId

    putquick "PRIVMSG $channel :\[\002SMS\017\] \002Added:\002 Name: [lindex $args 0] Number: [lindex $args 1]"
}


proc sms::public {nickname hostname handle channel arguments} {
    global tagnick tagname tagmsg url urlcreds user pass id
    variable token
    set args [split $arguments]

    if ![channel get $channel sms] return

    if {($arguments < 1) || ([llength $args] < 2)} {
        putquick "PRIVMSG $channel :\002Format:\002 !sms <name> <message>"
        putquick "PRIVMSG $channel :."
        putquick "PRIVMSG $channel :Available entries:"
        putquick "PRIVMSG $channel :[getnames]"
        return 0
    }

    if {![validfeed [lindex $args 0] 1]} {             
        putquick "PRIVMSG $channel :\[\002SMS\017\] \002Error:\002 please choose one of the following names: "
        putquick "PRIVMSG $channel :[getnames]"
        return 0
    }

    set nick [lindex $args 0]
    set number "0"
    set number [getnumber $nick]

    if {($nick == "") || ($number == "0")} {
        putlog "RSS: Warning: Couldn't load configuration for the \[$id\] feed."
        putquick "PRIVMSG $channel :\002Error:\002 couldnt get number for that user."
        return 0
    }

    set arguments [lreplace $args 0 0]

    #add tag and nick - if set in config above
    if {$tagnick eq "1"} {  
        set arguments "$arguments %5b $handle %2f $channel %5d"
    }
    if {$tagname eq "1"} {
        set arguments "$arguments %5b $tagmsg %5d"
    }

    # regsub some common irc chars for unicode
    regsub -all " " $arguments "%20" arguments
    regsub -all "#" $arguments "%23" arguments 
    regsub -all "&" $arguments "%26" arguments 
    regsub -all "@" $arguments "%40" arguments

    # regsub details into sms url
    set realurl $url
    regsub -all NUMTOSEND $realurl $number realurl
    regsub -all MSGTOSEND $realurl $arguments realurl
    regsub -all SMSID $realurl $id realurl
    regsub -all SMSUSER $realurl $user realurl
    regsub -all SMSPASS $realurl $pass realurl

    # regsub details into urlcreds url
    set realurlcreds $urlcreds
    regsub -all SMSID $realurlcreds $id realurlcreds
    regsub -all SMSUSER $realurlcreds $user realurlcreds
    regsub -all SMSPASS $realurlcreds $pass realurlcreds

    set token [http::geturl $realurl]
    set data_frm_url [http::data $token]

    putquick "PRIVMSG $channel :\002Sent:\002 $arguments"
    putquick "PRIVMSG $channel :\002To:\002 [lindex $args 0] ($number)"
    putquick "PRIVMSG $channel :\002Response:\002 $data_frm_url"

    set token [http::geturl $realurlcreds]
    set bal_frm_url [http::data $token]

    putquick "PRIVMSG $channel :\002Credits:\002 $bal_frm_url"
}

proc sms::number {nickname hostname handle channel arguments} {
    global chan datfile
    set args [split $arguments]

    if ![channel get $channel sms] return

    if {($arguments < 1) || ([llength $args] < 1)} {
        putquick "PRIVMSG $channel :\[\002SMS\017\] \002Format:\002 !number <name>"
        putquick "PRIVMSG $channel :."
        putquick "PRIVMSG $channel :Available entries:"
        putquick "PRIVMSG $channel :[getnames]"
        return 0
    }

    if {![validfeed [lindex $args 0] 1]} {
        putquick "PRIVMSG $channel :\[\002SMS\017\] \002Error:\002 please choose one of the following names: "
        putquick "PRIVMSG $channel :[getnames]"
        return 0
    }
    
    set nick [lindex $args 0]
    set number "0"
    set number [getnumber $nick]

    if {($nick == "") || ($number == "0")} {
        putlog "RSS: Warning: Couldn't load configuration for the \[$id\] feed."
        putquick "PRIVMSG $channel :\002Error:\002 couldnt get number for that user."
        return 0
    }

    putquick "PRIVMSG $channel :\[\002SMS\017\] \002[lindex $args 0]:\002 $number"
}


proc sms::validfeed {keyword type} {
    global datfile

    # Complain and exit if file does not exist
    if {![ file exists $datfile ] }     {
        putquick "PRIVMSG $channel :\[\002SMS\017\] \002Error: \002File \"$datfile\" not found!"
        return 0
    }

    # Complain and exit if file is not readable
    if {![ file readable $datfile ] }   {
        putquick "PRIVMSG $channel :\[\002SMS\017\] \002Error:\002 Permission denied to read $datfile!"
        return 0
    }

    # read sms data
    if { [ catch { set fileId [open $datfile r] } err ] }  {
        putquick "PRIVMSG $channel :\[\002SMS\017\] Error:\002 $err"
        return 0
    }

    set names [list]
    while {![eof $fileId]} {
        set line [gets $fileId]
        set data [split $line ":"]
        if {$data != ""} {        
            lappend names [lindex $data 0]
        }
    }
    close $fileId

    foreach id $names {
        if {[string equal -nocase $id $keyword]} {
            switch -exact -- $type {
                {1} { return 1 }
                {2} { return $id }
            }
        }
    }
    return 0
}


proc sms::getnames { } {
    global datfile

    # Complain and exit if file does not exist
    if {![ file exists $datfile ] }     {
        putquick "PRIVMSG $channel :\[\002SMS\017\] \002Error: \002File \"$datfile\" not found!"
        return 0
    }

    # Complain and exit if file is not readable
    if {![ file readable $datfile ] }   {
        putquick "PRIVMSG $channel :\[\002SMS\017\] \002Error:\002 Permission denied to read $datfile!"
        return 0
    }

    # read sms data
    if { [ catch { set fileId [open $datfile r] } err ] }  {
        putquick "PRIVMSG $channel :\[\002SMS\017\] Error:\002 $err"
        return 0
    }

    set names [list]
    while {![eof $fileId]} {
        set line [gets $fileId]
        set data [split $line ":"]
        if {$data != ""} {
            lappend names [lindex $data 0]
        }
    }
    close $fileId

    return $names
}


proc sms::getnumber {smsname} {
    global datfile
    set smsnum ""

    # read sms data
    if { [ catch { set fileId [open $datfile r] } err ] }  {
        putquick "PRIVMSG $channel :\[\002SMS\017\] Error:\002 $err"
        return 0
    }

    set names [list]
    while {![eof $fileId]} {
        set line [gets $fileId]
        set data [split $line ":"]
        if {$data != ""} {
            if {$smsname eq [lindex $data 0]} {
                set smsnum [lindex $data 1]
            }
        }
    }
    close $fileId

    return $smsnum
}


proc sms::smsver {nickname hostname handle channel arguments} {
    global smsver

    if ![channel get $channel sms] return

    putquick "PRIVMSG $channel :\[\002SMS\017\] ver. $smsver"
    putquick "PRIVMSG $channel :\002(C) 2005 EToS"
}

proc sms::credspublic {nickname hostname handle channel arguments} {
    global chan urlcreds user pass id

    if ![channel get $channel sms] return

    # regsub details into urlcreds url
    set realurlcreds $urlcreds
    regsub -all SMSID $realurlcreds $id realurlcreds
    regsub -all SMSUSER $realurlcreds $user realurlcreds
    regsub -all SMSPASS $realurlcreds $pass realurlcreds

    set token [http::geturl $realurlcreds]
    set bal_frm_url [http::data $token]

    putquick "PRIVMSG $channel :\[\002SMS\017\] \002Credits:\002 $bal_frm_url"
}

proc sms::smshelp {nickname hostname handle channel arguments} {
    global chan

    if ![channel get $channel sms] return

    putquick "PRIVMSG $channel :\[\002SMS\017\] \002CMDS HELP!:\017"
    putquick "PRIVMSG $channel : !sms <name> <message> - send a txt msg"
    putquick "PRIVMSG $channel : !number <name> - view a users number, ops only cmd"
    putquick "PRIVMSG $channel : !smscreds -  view credits on account"
    putquick "PRIVMSG $channel : !smsadd <name> <number> - ops only"
    putquick "PRIVMSG $channel : !smsdel - not implemented \(deliberately\)"
    putquick "PRIVMSG $channel : !smsver - version info"
    putquick "PRIVMSG $channel : !smshelp - err your here!"
}

putlog "Script loaded: SMS v1.1 \00302\002(C) 2005 EToS"
User avatar
ayie
Voice
Posts: 38
Joined: Thu Feb 20, 2003 3:13 am

Post by ayie »

Hello danzigrules,

Have u try this scripts ?? It is works ??

I've try this scripts but not working, i not sure what's wrong ... maybe i signup with wrong package ...

what customer type you signup ??
Clickatell Central (API)
Communicator
Messenger-Pro
Clickatell Wholesale

this what my bot reply ....

Code: Select all

<@Afro> !sms One test test
<@MySMS> Sent: test%20test%20%5b%20Afro%20%2f%20%23sms%20%5d%20%5b%20Afro%20%26%20mike-rico%20%5d
<@MySMS> To: One
<@MySMS> Response: ERR: 001, Authentication failed
<@MySMS> Credits: ERR: 001, Authentication failed
hope you can help me ......
Ay|e
Very Idiot Person In This World
http://www.labtek.biz/v2/
User avatar
ayie
Voice
Posts: 38
Joined: Thu Feb 20, 2003 3:13 am

Post by ayie »

Anyone good in coding TCL Scripts ??

I refer to original scripts made by EToS that using clickatell gateway for eggdrop sending sms.

i've made some modifications in gateway url, but it seems the gateway/scripts cannot read the dat file.

this is the code.

Code: Select all

#  Author: EToS
#  Date: 09/08/2005
#  Filename: sms.tcl
#  Function: Eggdrop interface to clickatell's HTTP/S SMS Gateway
#
#  Version: 1.1 *BeTA
#  History: 
#       - 09/08/2005: First Coded
#       - 16/06/2006: Added sms.dat for data handling
#                     Added !smsadd, !smsver, !smshelp
#                     tag and nick info to sms & chan work flag
#
#  Notes: Enable with .chanset #channel +sms

# packages

package require http

# vars

# script version
set smsver "1"

# work chan flags ..
setudef flag sms

# tag bottom of sms with irc nick and tagmsg ... 0=no 1=yes
set tagnick "1"
set tagname "1"
set tagmsg "Ayie"

# datafile
set datfile "scripts/contact.dat"

# clickatell details
set user "xxxx"
set pass "xxxx"
#set id "xxxx"


# shouldnt need to edit these urls below, but can be edited if clickatell change their
# url structure, or if you wish to attempt to adapt script to another sms gateway 

#set urlcreds "http://api.clickatell.com/http/getbalance?api_id=SMSID&user=SMSUSER&password=SMSPASS"
set url "http://smsgateway.servage.net/sms.php?customer=SMSUSER&key=SMSPASS&number=NUMTOSEND&message=MSGTOSEND"


########## DO NOT EDIT BELOW UNLESS YOU KNOW TCL! ##########

# binds

namespace eval sms {
    variable pubsmsadd {!smsadd}
    variable pubbalbind {!smscreds}
    variable pubnumbind {!number}
    variable pubverbind {!smsver}
    variable pubhelpbind {!smshelp}
    variable pubbind {!sms}
    bind PUB o|o $pubsmsadd [namespace current]::smsadd 
    bind PUB o|o $pubnumbind [namespace current]::number
    bind PUB -|- $pubbalbind [namespace current]::credspublic
    bind PUB -|- $pubverbind [namespace current]::smsver
    bind PUB -|- $pubhelpbind [namespace current]::smshelp
    bind PUB -|- $pubbind [namespace current]::public
    namespace export getnames credspublic public private
}


proc sms::smsadd {nickname hostname handle channel arguments} {
    global chan datfile

    if ![channel get $channel sms] return

    set args [split $arguments]
    set data ""

    # check args are correct
    if {($arguments < 1) || ([llength $args] < 2)} {
        putquick "PRIVMSG $channel :\[\002SMS\017\] \002Format:\002 !smsadd <name> <number>"
        return 0
    }

    # check if names already added
    if {[validfeed [lindex $args 0] 1]} {
        putquick "PRIVMSG $channel :\[\002SMS\017\] \002Error:\002 User already exists!"
        return 0
    }

    # make sure no letters in sms number
    if {![ string is digit [lindex $args 1] ] } {
        putquick "PRIVMSG $channel : [lindex $args 1]"
        putquick "PRIVMSG $channel :\[\002SMS\017\] \002Error:\002 letters detected in <number> entry"
        return 0
    }

    # Complain and exit if input file does not exist
    if {![ file exists $datfile ] }  	{
        putquick "PRIVMSG $channel :\[\002SMS\017\] \002Error: \002File \"$datfile\" not found!"
        return 0
    }

    # Complain and exit if input file is not readable
    if {![ file readable $datfile ] }  	{
        putquick "PRIVMSG $channel :\[\002SMS\017\] \002Error:\002 Permission denied to read $datfile!"
        return 0
    }


   # save sms data
    if { [ catch { set fileId [open $datfile a] } err ] }  {
        putquick "PRIVMSG $channel :\[\002SMS\017\] Error:\002 $err"
        return 0
    }

    puts $fileId [lindex $args 0]:[lindex $args 1]
    close $fileId

    putquick "PRIVMSG $channel :\[\002SMS\017\] \002Added:\002 Name: [lindex $args 0] Number: [lindex $args 1]"
}


proc sms::public {nickname hostname handle channel arguments} {
    global tagnick tagname tagmsg url urlcreds user pass id
    variable token
    set args [split $arguments]

    if ![channel get $channel sms] return

    if {($arguments < 1) || ([llength $args] < 2)} {
        putquick "PRIVMSG $channel :\002Format:\002 !sms <name> <message>"
        putquick "PRIVMSG $channel :."
        putquick "PRIVMSG $channel :Available entries:"
        putquick "PRIVMSG $channel :[getnames]"
        return 0
    }

    if {![validfeed [lindex $args 0] 1]} {             
        putquick "PRIVMSG $channel :\[\002SMS\017\] \002Error:\002 please choose one of the following names: "
        putquick "PRIVMSG $channel :[getnames]"
        return 0
    }

    set nick [lindex $args 0]
    set number "0"
    set number [getnumber $nick]

    if {($nick == "") || ($number == "0")} {
        putlog "RSS: Warning: Couldn't load configuration for the \[$id\] feed."
        putquick "PRIVMSG $channel :\002Error:\002 couldnt get number for that user."
        return 0
    }

    set arguments [lreplace $args 0 0]

    #add tag and nick - if set in config above
    if {$tagnick eq "1"} {  
        set arguments "$arguments %5b $handle %2f $channel %5d"
    }
    if {$tagname eq "1"} {
        set arguments "$arguments %5b $tagmsg %5d"
    }

    # regsub some common irc chars for unicode
    regsub -all " " $arguments "%20" arguments
    regsub -all "#" $arguments "%23" arguments 
    regsub -all "&" $arguments "%26" arguments 
    regsub -all "@" $arguments "%40" arguments

    # regsub details into sms url
    set realurl $url
    regsub -all NUMTOSEND $realurl $number realurl
    regsub -all MSGTOSEND $realurl $arguments realurl
    regsub -all SMSID $realurl $id realurl
    regsub -all SMSUSER $realurl $user realurl
    regsub -all SMSPASS $realurl $pass realurl

    # regsub details into urlcreds url
    set realurlcreds $urlcreds
    regsub -all SMSID $realurlcreds $id realurlcreds
    regsub -all SMSUSER $realurlcreds $user realurlcreds
    regsub -all SMSPASS $realurlcreds $pass realurlcreds

    set token [http::geturl $realurl]
    set data_frm_url [http::data $token]

    putquick "PRIVMSG $channel :\002Sent:\002 $arguments"
    putquick "PRIVMSG $channel :\002To:\002 [lindex $args 0] ($number)"
    putquick "PRIVMSG $channel :\002Response:\002 $data_frm_url"

    set token [http::geturl $realurlcreds]
    set bal_frm_url [http::data $token]

    putquick "PRIVMSG $channel :\002Credits:\002 $bal_frm_url"
}

proc sms::number {nickname hostname handle channel arguments} {
    global chan datfile
    set args [split $arguments]

    if ![channel get $channel sms] return

    if {($arguments < 1) || ([llength $args] < 1)} {
        putquick "PRIVMSG $channel :\[\002SMS\017\] \002Format:\002 !number <name>"
        putquick "PRIVMSG $channel :."
        putquick "PRIVMSG $channel :Available entries:"
        putquick "PRIVMSG $channel :[getnames]"
        return 0
    }

    if {![validfeed [lindex $args 0] 1]} {
        putquick "PRIVMSG $channel :\[\002SMS\017\] \002Error:\002 please choose one of the following names: "
        putquick "PRIVMSG $channel :[getnames]"
        return 0
    }
    
    set nick [lindex $args 0]
    set number "0"
    set number [getnumber $nick]

    if {($nick == "") || ($number == "0")} {
        putlog "RSS: Warning: Couldn't load configuration for the \[$id\] feed."
        putquick "PRIVMSG $channel :\002Error:\002 couldnt get number for that user."
        return 0
    }

    putquick "PRIVMSG $channel :\[\002SMS\017\] \002[lindex $args 0]:\002 $number"
}


proc sms::validfeed {keyword type} {
    global datfile

    # Complain and exit if file does not exist
    if {![ file exists $datfile ] }     {
        putquick "PRIVMSG $channel :\[\002SMS\017\] \002Error: \002File \"$datfile\" not found!"
        return 0
    }

    # Complain and exit if file is not readable
    if {![ file readable $datfile ] }   {
        putquick "PRIVMSG $channel :\[\002SMS\017\] \002Error:\002 Permission denied to read $datfile!"
        return 0
    }

    # read sms data
    if { [ catch { set fileId [open $datfile r] } err ] }  {
        putquick "PRIVMSG $channel :\[\002SMS\017\] Error:\002 $err"
        return 0
    }

    set names [list]
    while {![eof $fileId]} {
        set line [gets $fileId]
        set data [split $line ":"]
        if {$data != ""} {        
            lappend names [lindex $data 0]
        }
    }
    close $fileId

    foreach id $names {
        if {[string equal -nocase $id $keyword]} {
            switch -exact -- $type {
                {1} { return 1 }
                {2} { return $id }
            }
        }
    }
    return 0
}


proc sms::getnames { } {
    global datfile

    # Complain and exit if file does not exist
    if {![ file exists $datfile ] }     {
        putquick "PRIVMSG $channel :\[\002SMS\017\] \002Error: \002File \"$datfile\" not found!"
        return 0
    }

    # Complain and exit if file is not readable
    if {![ file readable $datfile ] }   {
        putquick "PRIVMSG $channel :\[\002SMS\017\] \002Error:\002 Permission denied to read $datfile!"
        return 0
    }

    # read sms data
    if { [ catch { set fileId [open $datfile r] } err ] }  {
        putquick "PRIVMSG $channel :\[\002SMS\017\] Error:\002 $err"
        return 0
    }

    set names [list]
    while {![eof $fileId]} {
        set line [gets $fileId]
        set data [split $line ":"]
        if {$data != ""} {
            lappend names [lindex $data 0]
        }
    }
    close $fileId

    return $names
}


proc sms::getnumber {smsname} {
    global datfile
    set smsnum ""

    # read sms data
    if { [ catch { set fileId [open $datfile r] } err ] }  {
        putquick "PRIVMSG $channel :\[\002SMS\017\] Error:\002 $err"
        return 0
    }

    set names [list]
    while {![eof $fileId]} {
        set line [gets $fileId]
        set data [split $line ":"]
        if {$data != ""} {
            if {$smsname eq [lindex $data 0]} {
                set smsnum [lindex $data 1]
            }
        }
    }
    close $fileId

    return $smsnum
}


proc sms::smsver {nickname hostname handle channel arguments} {
    global smsver

    if ![channel get $channel sms] return

    putquick "PRIVMSG $channel :\[\002SMS\017\] ver. $smsver"
    putquick "PRIVMSG $channel :\002(C) 2005 EToS"
}

proc sms::credspublic {nickname hostname handle channel arguments} {
    global chan urlcreds user pass id

    if ![channel get $channel sms] return

    # regsub details into urlcreds url
    set realurlcreds $urlcreds
    regsub -all SMSID $realurlcreds $id realurlcreds
    regsub -all SMSUSER $realurlcreds $user realurlcreds
    regsub -all SMSPASS $realurlcreds $pass realurlcreds

    set token [http::geturl $realurlcreds]
    set bal_frm_url [http::data $token]

    putquick "PRIVMSG $channel :\[\002SMS\017\] \002Credits:\002 $bal_frm_url"
}

proc sms::smshelp {nickname hostname handle channel arguments} {
    global chan

    if ![channel get $channel sms] return

    putquick "PRIVMSG $channel :\[\002SMS\017\] \002CMDS HELP!:\017"
    putquick "PRIVMSG $channel : !sms <name> <message> - send a txt msg"
    putquick "PRIVMSG $channel : !number <name> - view a users number, ops only cmd"
    putquick "PRIVMSG $channel : !smscreds -  view credits on account"
    putquick "PRIVMSG $channel : !smsadd <name> <number> - ops only"
    putquick "PRIVMSG $channel : !smsdel - not implemented \(deliberately\)"
    putquick "PRIVMSG $channel : !smsver - version info"
    putquick "PRIVMSG $channel : !smshelp - err your here!"
}

putlog "Script loaded: SMS v1.1 \00302\002(C) 2005 EToS"
and this is the sample API from Servage API PHP file.

Code: Select all

<?php


##################################################
# SAMPLE PHP CODE TO SEND SMS VIA SERVAGE API
##################################################

// Send SMS function
function sendSMS($number,$message,$concat = 1) {
	$url = 'http://smsgateway.servage.net/sms.php';
	$customer = 'YOURCUSTOMERCODE';
	$key = 'YOURKEYCODE';
	$request = $url.'?customer='.$customer.'&key='.$key.'&number='.urlencode($number).'&message='.urlencode($message).'&concat='.$concat;
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $request);
	curl_setopt($ch, CURLOPT_HEADER, 0);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	$response = curl_exec($ch);
	curl_close($ch);
	return split(',',$response);
}

// Integration in your project
$sms_api_result = sendSMS('number','text','1');

// Check if SMS was received by the API or not
if ($sms_api_result[0] == 'OK') {
	// Ok, SMS received by the API
	// Do something here...
}
else {
	// Failure, SMS was not received by the API
	// I this example we display the response to identify the error
	print_r($sms_api_result);
}


##################################################
# SAMPLE PHP CODE FOR SMS COVERAGE QUERY
##################################################

// Coverage Query function
function coverageQuery($number) {
	$ch = curl_init(); 
	curl_setopt($ch, CURLOPT_URL, 'http://smsgateway.servage.net/sms_coverage.php?number='.$number); 
	curl_setopt($ch, CURLOPT_HEADER, 0); 
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
	$data = curl_exec($ch); 
	curl_close($ch);
	if (substr($data,0,2) == 'OK') return true;
	else return false;
}


?>
almost forgot, my contact.dat file contain this info ( Ayie:44870711111) this number is Servage format.

when i try sending the msg from irc, it gave me error result.

Code: Select all

<@Me> !sms one test
<@MyBot> Sent: test%20%5b%20Ayie%20%2f%20%23sms%20%5d%20%5b%20Ayie%20%5d
<@MyBot> To: Ayie ()
<@MyBot> Response: ERROR,Missing valid recipient number;
anyone can help me tune this code ??[/code]
Ay|e
Very Idiot Person In This World
http://www.labtek.biz/v2/
d
danzigrules
Voice
Posts: 17
Joined: Thu Aug 02, 2007 6:06 am

Post by danzigrules »

Put the gateway url back to what it was as mine works fine.

I used clickatell central.

then once logged in goto manage my products, then add a connection, add HTTP/S.

Once that is all set up you should get an API ID, edit the code:

# clickatell details
set user "xxxx"
set pass "xxxx"
set id "xxxx" <---- put API ID here

save, rehash.

follow directions in script for the rest. :)
User avatar
ayie
Voice
Posts: 38
Joined: Thu Feb 20, 2003 3:13 am

Post by ayie »

Name:
IP Lock Down:
Dial Prefix:
Callback Type:
Callback Url:

what should i fill in the IP Lock Down, Callback type, call back URL ??

I've add a test connection without fill IP Lock Down and call back URL.

when i try to send sms it gave error ...

Response: ERR: 001, Authentication failed
Credits: ERR: 001, Authentication failed
Ay|e
Very Idiot Person In This World
http://www.labtek.biz/v2/
User avatar
ayie
Voice
Posts: 38
Joined: Thu Feb 20, 2003 3:13 am

Post by ayie »

Need help with this scripts.

How to make this scripts send SMS to open number ??

This scripts need to add the number in the contact list, so the bot only read number from file.
Ay|e
Very Idiot Person In This World
http://www.labtek.biz/v2/
Post Reply