]>
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(needchan
=False, glevel
=lib
.MANAGER
)
32 def reply(bot
, user
, chan
, realtarget
, *args
):
33 raise NotImplementedError
35 @lib.hook(('sms','w'), needchan
=False, glevel
=lib
.OWNER
)
36 @lib.help("<number> <message>", "send an SMS")
37 def sms(bot
, user
, chan
, realtarget
, *args
):
38 number
= "+%s" % (args
[0])
39 message
= ' '.join(args
[1:])
40 client(bot
).messages
.create(body
=message
, to
=number
, from_
=bot
.parent
.cfg
.get('sms', 'mynumber'))
41 bot
.msg(user
, "Sent message to %s" % (number
))