Last active
August 20, 2016 10:59
-
-
Save cygnetix/7bda68cc059a7896fc667d925f126178 to your computer and use it in GitHub Desktop.
Pushover Command for ErrBot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Core] | |
| Name = Pushover | |
| Module = err-pushover | |
| [Python] | |
| Version=2+ | |
| [Documentation] | |
| Description = Sends commands to mobile phones using the pushover.net API |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pushover |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment