def setup(new_adapter):
    global adapter
    adapter = new_adapter

    adapter.add_handler(CommandHandler('probe', on_probe_command, command_description='Allows the user to get status for a given probe.')
                        .add_argument('probe_id', nargs='*', help='Probe ID'))
    adapter.add_handler(CommandHandler('probe_alias', on_probe_alias_command, command_description='Allows the user to set an alias for a given probe.')
                        .add_argument('--remove', help='Remove alias', action='store_true')
                        .add_argument('--alias', help='Set an alias (e.g. Santiago)')
                        .add_argument('--probe_id', help='Probe ID (e.g. 11816)'))
Esempio n. 2
0
 def setup_handlers(self, adapter):
     self.bot = adapter.bot
     self.add_handler(
         CommandHandler(
             'pelota',
             self.on_pelota_command,
             command_description='Dominican Republic Baseball Standings'))
     self.add_handler(
         CommandHandler(
             'pizarra',
             self.on_pizarra_command,
             command_description='Dominican Republic Baseball Dashboard'))
Esempio n. 3
0
 def setup_handlers(self, adapter):
     log.info("Setting up handlers for Grammar plugin")
     self.add_handler(
         CommandHandler('grammar',
                        self.on_grammar_command,
                        command_description=
                        'Checks the grammar on the text being replied to.'))
Esempio n. 4
0
 def setup_handlers(self, adapter):
     log.info("Setting up handlers for RemindMe plugin")
     self.add_handler(
         CommandHandler(
             'remindme',
             self.on_remindme_command,
             command_description='Reminds you of a message in the future.').
         add_argument('when', nargs='*', help='Relative or absolute date'))
Esempio n. 5
0
 def setup_handlers(self, adapter):
     self.bot = adapter.bot
     self.add_handler(
         CommandHandler(
             'cine',
             self.on_cine_command,
             command_description=
             'Allows the user to check which movies are now available in the movie theather.'
         ))
Esempio n. 6
0
 def setup_handlers(self, adapter):
     self.bot = adapter.bot
     self.add_handler(
         CommandHandler(
             'rae',
             self.on_rae_command,
             command_description=
             'Buscar definiciones en la Real Academia Española.'))
     self.add_handler(CallbackQueryHandler('rae:', self.on_button),
                      priority=1)
Esempio n. 7
0
 def setup_handlers(self, adapter):
     # TODO: Add --show-images argument
     self.add_handler(
         CommandHandler(
             'wa',
             self.on_query,
             command_description=
             'Allows the user to query WolframAlpha knowledge engine.').
         add_argument('--verbose',
                      help='Get a more detailed response',
                      action='store_true').add_argument(
                          'query', nargs='*', help='Query (e.g. 2+2)'))
Esempio n. 8
0
 def setup_handlers(self, adapter):
     self.add_handler(
         CommandHandler(
             'greeting',
             self.on_greeting_command,
             command_description=
             'Allows the user to set the greeting on a group chat.').
         add_argument('--remove',
                      help='Remove greeting',
                      action='store_true'))
     self.add_handler(
         MessageHandler([CommonFilters.status_update.left_chat_member],
                        self.on_left_chat_member))
     self.add_handler(
         MessageHandler([CommonFilters.status_update.new_chat_members],
                        self.on_new_chat_members))
Esempio n. 9
0
    def setup_handlers(self, adapter):
        log.info("Setting up handlers for Topic plugin")
        self.add_handler(CommandHandler('topic', self.on_topic_command, command_description='Allows the user to control the topic on the chat title.'))
                         # .add_argument('--set', help='Set the topic', action='store_true')
                         # .add_argument('--unset', help='Unset the topic', action='store_true')
                         # .add_argument('--pop', help='Pop the subtopic off the end', action='store_true')
                         # .add_argument('--push', help='Push a subtopic onto the end', action='store_true')
                         # .add_argument('--shift', help='Shift the subtopic from the beginning', action='store_true')
                         # .add_argument('--unshift', help='Prepend a subtopic to the beginning', action='store_true')
                         # .add_argument('--fix', help='Fix chat title', action='store_true'))

        # Revert chat topic & subtopics if it is changed by someone else
        self.add_handler(MessageHandler([CommonFilters.status_update.new_chat_title], self.on_new_chat_title))
        # Delete Topic if bot leaves the chat
        self.add_handler(MessageHandler([CommonFilters.status_update.left_chat_member], self.on_left_chat_member))
        # Handle button presses
        self.add_handler(CallbackQueryHandler('{}:'.format(self.name), self.on_button), priority=1)
Esempio n. 10
0
def setup(new_adapter):
    global adapter
    adapter = new_adapter

    adapter.add_handler(
        CommandHandler(
            'ud',
            on_ud_command,
            command_description=
            'Allows the user to find terms or phrases on Urban Dictionary.').
        add_argument('--n', help='Number of results',
                     default='1').add_argument(
                         '--no-examples',
                         help='No examples',
                         action='store_true').add_argument(
                             '--verbose',
                             help='Increase verbosity',
                             action='store_true').add_argument(
                                 'terms', nargs='*', help='Terms or phrase'))
Esempio n. 11
0
 def setup_handlers(self, adapter):
     self.add_handler(
         CommandHandler('spotify',
                        self.on_spotify_command,
                        command_description='Allows the user to '
                        'search for songs on '
                        'Spotify.')
         #  .add_argument('--artists', help='Search for artists', action='store_true')
         #  .add_argument('--albums', help='Search for albums', action='store_true')
         #  .add_argument('--playlists', help='Search for playlists', action='store_true')
         # .add_argument('--skip', help='Results to skip', default='0')
         .add_argument('--count', help='Number of results',
                       default='1').add_argument('terms',
                                                 nargs='*',
                                                 help='Search terms'))
     self.add_handler(
         MessageHandler(CommonFilters.entity(MessageEntity.URL),
                        self.on_url))
     self.add_handler(CallbackQueryHandler('spotify:fetch-preview',
                                           self.on_button),
                      priority=1)
 def setup_handlers(self, adapter):
     self.bot = adapter.bot
     pattern_types = ', '.join([x[0] for x in PATTERN_TYPES])
     self.add_handler(
         CommandHandler(
             'reply',
             self.on_reply_command,
             command_description='Allows the user to add or remove replies.'
         ).add_argument('--remove',
                        help='Remove reply',
                        action='store_true').add_argument(
                            '--new-pattern', help='New words or pattern').
         add_argument(
             '--type',
             help='Pattern type (e.g. {})'.format(pattern_types),
             default='exact').add_argument(
                 '--mode',
                 help='Parse mode (e.g. Markdown, HTML)',
                 default='Markdown').add_argument(
                     'pattern',
                     nargs='*',
                     help='Words or pattern that trigger this reply'))
     self.add_handler(MessageHandler([CommonFilters.text], self.on_text),
                      priority=90)
Esempio n. 13
0
 def setup_handlers(self, adapter):
     self.bot = adapter.bot
     self.add_handler(CommandHandler('cine', self.on_cine_command, command_description='Allow to see what movies are now playing'))
Esempio n. 14
0
 def setup_handlers(self, adapter):
     self.add_handler(
         CommandHandler(
             'anime',
             self.on_anime,
             command_description='Searches for anime torrents on Nyaa.si'))
Esempio n. 15
0
 def setup_handlers(self, adapter):
     self.add_handler(
         CommandHandler(
             'gas',
             self.on_gas,
             command_description='Fetch gas prices from micm.gob.do'))