yazdmich

Untitled

Sep 27th, 2016
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1. # pythonexample.py
  2.  
  3. import znc
  4. from twilio.rest import TwilioRestClient
  5.  
  6.  
  7. class account(object): pass
  8. account.sid = '<account sid>'
  9. account.auth = '<auth token>'
  10.  
  11. client  = TwilioRestClient(account.sid, account.auth)
  12.  
  13. class pythonexample(znc.Module):
  14.     description = "Example python3 module for ZNC"
  15.  
  16.     def OnChanMsg(self, nick, channel, message):
  17.         if '<your nick>' in message.s.lower():
  18.             client.messages.create(
  19.                     to="<your cell number>",
  20.                     from_="<twilio outbound number>",
  21.                     body="{0} said {1} on {2}".format(nick.GetNick(), message.s, channel.GetName())
  22.                     )
  23.         return znc.CONTINUE
Advertisement
Add Comment
Please, Sign In to add comment