]>
jfr.im git - erebus.git/blob - modules/sms.py
1 # Erebus IRC bot - Author: Erebus Team
2 # vim: fileencoding=utf-8
4 # This file is released into the public domain; see http://unlicense.org/
8 'author': 'Erebus Team',
9 'license': 'public domain',
17 lib
= modlib
.modlib(__name__
)
18 modstart
= lib
.modstart
22 from twilio
.rest
import TwilioRestClient
25 return TwilioRestClient(
26 bot
.parent
.cfg
.get('sms', 'account_sid'),
27 bot
.parent
.cfg
.get('sms', 'auth_token')
31 @lib.hook(('sms','w'), needchan
=False, glevel
=lib
.OWNER
)
32 @lib.help("<number> <message>", "send an SMS")
33 def sms(bot
, user
, chan
, realtarget
, *args
):
34 number
= "+%s" % (args
[0])
35 message
= ' '.join(args
[1:])
36 client(bot
).messages
.create(body
=message
, to
=number
, from_
=bot
.parent
.cfg
.get('sms', 'mynumber'))
37 bot
.msg(user
, "Sent message to %s" % (number
))