How to use the errbot.botcmd function in errbot

To help you get started, we’ve selected a few errbot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github errbotio / errbot / tests / borken_plugin / broken.py View on Github external
    @botcmd
    def hello(self, msg, args):
        """ this command says hello """
        return 'Hello World !'
github errbotio / errbot / tests / base_backend_tests.py View on Github external
    @botcmd
    def return_args_as_str(self, mess, args):
        return "".join(args)
github errbotio / errbot / tests / dyna_plugin / dyna.py View on Github external
    @botcmd
    def remove_saw(self, msg, args):
        self.destroy_dynamic_plugin('saw')
        return 'removed'
github errbotio / errbot / tests / base_backend_tests.py View on Github external
    @botcmd(template='args_as_md')
    def yield_args_as_md(self, mess, args):
        for arg in args:
            yield {'args': [arg]}
github errbotio / errbot / errbot / core_plugins / chatRoom.py View on Github external
    @botcmd(split_args_with=ShlexArgParser())
    def room_join(self, message, args):
        """
        Join (creating it first if needed) a chatroom.

        Usage:
        !room join  []

        Examples (XMPP):
        !room join example-room@chat.server.tld
        !room join example-room@chat.server.tld super-secret-password

        Examples (IRC):
        !room join #example-room
        !room join #example-room super-secret-password
        !room join #example-room "password with spaces"
        """
github errbotio / errbot / errbot / errBot.py View on Github external
    @botcmd(admin_only=True)
    def blacklist(self, mess, args):
        """Blacklist a plugin so that it will not be loaded automatically during bot startup"""
        if args not in self.get_all_plugin_names():
            return ("{} isn't a valid plugin name. The current plugins are:\n"
                    "{}".format(args, self.formatted_plugin_list(active_only=False)))
        return self.blacklist_plugin(args)
github errbotio / errbot / errbot / errBot.py View on Github external
    @botcmd(admin_only=True)
    def load(self, mess, args):
        """load a plugin"""
        args = args.strip()
        if not args:
            return ("Please tell me which of the following plugins to reload:\n"
                    "{}".format(self.formatted_plugin_list(active_only=False)))
        if args not in self.get_all_plugin_names():
            return ("{} isn't a valid plugin name. The current plugins are:\n"
                    "{}".format(args, self.formatted_plugin_list(active_only=False)))
        if args in self.get_all_active_plugin_names():
            return "{} is already loaded".format(args)

        self.reload_plugin_by_name(args)
        r = self.activate_plugin(args)
        return r
github errbotio / errbot / errbot / core_plugins / chatRoom.py View on Github external
    @botcmd(split_args_with=SeparatorArgParser())
    def room_leave(self, message, args):
        """
        Leave a chatroom.

        Usage:
        !room leave 

        Examples (XMPP):
        !room leave example-room@chat.server.tld

        Examples (IRC):
        !room leave #example-room
        """
        if len(args) < 1:
            return 'Please tell me which chatroom to leave.'
        self.query_room(args[0]).leave()
github errbotio / errbot / errbot / core_plugins / textcmds.py View on Github external
    @botcmd
    def asadmin(self, msg, _):
        """
           This puts you in a 1-1 chat with the bot.
        """
        self._bot.user = self.build_identifier(self.bot_config.BOT_ADMINS[0])
        return f'You are now an admin: {self._bot.user}.'
github errbotio / errbot / errbot / core_plugins / chatRoom.py View on Github external
    @botcmd(split_args_with=SeparatorArgParser())
    def room_invite(self, message, args):
        """
        Invite one or more people into a chatroom.

        Usage:
        !room invite   [, ..]

        Examples (XMPP):
        !room invite room@conference.server.tld bob@server.tld

        Examples (IRC):
        !room invite #example-room bob
        """
        if len(args) < 2:
            return "Please tell me which person(s) to invite into which room."
        self.query_room(args[0]).invite(*args[1:])