Skip to content

Instantly share code, notes, and snippets.

@cygnetix
Last active August 20, 2016 10:59
Show Gist options
  • Save cygnetix/7bda68cc059a7896fc667d925f126178 to your computer and use it in GitHub Desktop.
Save cygnetix/7bda68cc059a7896fc667d925f126178 to your computer and use it in GitHub Desktop.
Pushover Command for ErrBot
[Core]
Name = Pushover
Module = err-pushover
[Python]
Version=2+
[Documentation]
Description = Sends commands to mobile phones using the pushover.net API
from errbot import BotPlugin, arg_botcmd
from pushover import init, Client
pushover_applicaton = '<<application key>>'
pushover_client_user1 = '<<device 1>>'
pushover_client_user2 = '<<device 2>>'
class ErrPushover(BotPlugin):
"""Sends push notifications using the pushover.net API
Examples:
!pushover user1 \"Can you jump in to the #ops chatroom?\"
"""
@arg_botcmd('message', type=str)
@arg_botcmd('name', type=str)
def pushover(self, msg, name=None, message=None):
"""!pushover bowen \"test message\""""
if name == 'user1':
client = pushover_client_user1
elif name == 'user2':
client = pushover_client_user2
else:
return "I'm sorry, but I don't know who %s is." % (name)
init(pushover_applicaton)
client = Client(client).send_message(message, title="ErrBot")
return "Message sent."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment