Beispiel #1
0
    def load_internal_commands(self, **options):
        if len(self.internal_commands) > 0:
            return self.internal_commands

        self.internal_commands = {}

        self.internal_commands['quit'] = Command.pajbot_command(self.bot, 'quit',
                level=1000,
                command='quit',
                description='Shut down the bot, this will most definitely restart it if set up properly')

        self.internal_commands['1quit'] = self.internal_commands['quit']
        self.internal_commands['ceaseallactionscurrentlybeingacteduponwiththecodeandiapologizeforbeingawhitecisgenderedmaleinthepatriarchy'] = self.internal_commands['quit']

        self.internal_commands['twitterfollow'] = Command.dispatch_command('twitter_follow',
                level=1000,
                description='Start listening for tweets for the given user',
                examples=[
                    CommandExample(None, 'Default usage',
                        chat='user:!twitterfollow forsensc2\n'
                        'bot>user:Now following ForsenSC2',
                        description='Follow ForsenSC2 on twitter so new tweets are output in chat.').parse(),
                    ])

        self.internal_commands['twitterunfollow'] = Command.dispatch_command('twitter_unfollow',
                level=1000,
                description='Stop listening for tweets for the given user',
                examples=[
                    CommandExample(None, 'Default usage',
                        chat='user:!twitterunfollow forsensc2\n'
                        'bot>user:No longer following ForsenSC2',
                        description='Stop automatically printing tweets from ForsenSC2').parse(),
                    ])

        self.internal_commands['add'] = Command.multiaction_command(
                level=100,
                delay_all=0,
                delay_user=0,
                default=None,
                command='add',
                commands={
                    'command': Command.dispatch_command('add_command',
                        level=500,
                        description='Add a command!',
                        examples=[
                            CommandExample(None, 'Create a normal command',
                                chat='user:!add command test Kappa 123\n'
                                'bot>user:Added your command (ID: 7)',
                                description='This creates a normal command with the trigger !test which outputs Kappa 123 to chat').parse(),
                            CommandExample(None, 'Create a command that responds with a whisper',
                                chat='user:!add command test Kappa 123 --whisper\n'
                                'bot>user:Added your command (ID: 7)',
                                description='This creates a command with the trigger !test which responds with Kappa 123 as a whisper to the user who called the command').parse(),
                            ]),
                    'win': Command.dispatch_command('add_win',
                        level=500,
                        description='Add a win to something!'),
                    'funccommand': Command.dispatch_command('add_funccommand',
                        level=2000,
                        description='Add a command that uses a command'),
                    'alias': Command.dispatch_command('add_alias',
                        level=500,
                        description='Adds an alias to an already existing command',
                        examples=[
                            CommandExample(None, 'Add an alias to a command',
                                chat='user:!add alias test alsotest\n'
                                'bot>user:Successfully added the aliases alsotest to test',
                                description='Adds the alias !alsotest to the existing command !test').parse(),
                            CommandExample(None, 'Add multiple aliases to a command',
                                chat='user:!add alias test alsotest newtest test123\n'
                                'bot>user:Successfully added the aliases alsotest, newtest, test123 to test',
                                description='Adds the aliases !alsotest, !newtest, and !test123 to the existing command !test').parse(),
                            ]),

                    })
        self.internal_commands['edit'] = Command.multiaction_command(
                level=100,
                delay_all=0,
                delay_user=0,
                default=None,
                command='edit',
                commands={
                    'command': Command.dispatch_command('edit_command',
                        level=500,
                        description='Edit an already-existing command',
                        examples=[
                            CommandExample(None, 'Change the response',
                                chat='user:!edit command test This is the new response!\n'
                                'bot>user:Updated the command (ID: 29)',
                                description='Changes the text response for the command !test to "This is the new response!"').parse(),
                            CommandExample(None, 'Change the Global Cooldown',
                                chat='user:!edit command test --cd 10\n'
                                'bot>user:Updated the command (ID: 29)',
                                description='Changes the global cooldown for the command !test to 10 seconds').parse(),
                            CommandExample(None, 'Change the User-specific Cooldown',
                                chat='user:!edit command test --usercd 30\n'
                                'bot>user:Updated the command (ID: 29)',
                                description='Changes the user-specific cooldown for the command !test to 30 seconds').parse(),
                            CommandExample(None, 'Change the Level for a command',
                                chat='user:!edit command test --level 500\n'
                                'bot>user:Updated the command (ID: 29)',
                                description='Changes the command level for !test to level 500').parse(),
                            CommandExample(None, 'Change the Cost for a command',
                                chat='user:!edit command $test1 --cost 50\n'
                                'bot>user:Updated the command (ID: 27)',
                                description='Changes the command cost for !$test1 to 50 points, you should always use a $ for a command that cost points.').parse(),
                            CommandExample(None, 'Change a command to Moderator only',
                                chat='user:!edit command test --modonly\n'
                                'bot>user:Updated the command (ID: 29)',
                                description='This command can only be used for user with level 100 and Moderator status or user over level 500').parse(),
                            CommandExample(None, 'Remove Moderator only from a command',
                                chat='user:!edit command test --no-modonly\n'
                                'bot>user:Updated the command (ID: 29)',
                                description='This command can be used for normal users again.').parse(),
                            ]),
                    'funccommand': Command.dispatch_command('edit_funccommand',
                        level=2000,
                        description='Add a command that uses a command'),
                    })
        self.internal_commands['remove'] = Command.multiaction_command(
                level=100,
                delay_all=0,
                delay_user=0,
                default=None,
                command='remove',
                commands={
                    'command': Command.dispatch_command('remove_command',
                        level=500,
                        description='Remove a command!',
                        examples=[
                            CommandExample(None, 'Remove a command',
                                chat='user:!remove command Keepo123\n'
                                'bot>user:Successfully removed command with id 27',
                                description='Removes a command with the trigger !Keepo123').parse(),
                            CommandExample(None, 'Remove a command with the given ID.',
                                chat='user:!remove command 28\n'
                                'bot>user:Successfully removed command with id 28',
                                description='Removes a command with id 28').parse(),
                            ]),
                    'win': Command.dispatch_command('remove_win',
                        level=500,
                        description='Remove a win to something!'),
                    'alias': Command.dispatch_command('remove_alias',
                        level=500,
                        description='Removes an alias to an already existing command',
                        examples=[
                            CommandExample(None, 'Remove two aliases',
                                chat='user:!remove alias KeepoKeepo Keepo2Keepo\n'
                                'bot>user:Successfully removed 2 aliases.',
                                description='Removes KeepoKeepo and Keepo2Keepo as aliases').parse(),
                            ]),
                    })
        self.internal_commands['rem'] = self.internal_commands['remove']
        self.internal_commands['del'] = self.internal_commands['remove']
        self.internal_commands['delete'] = self.internal_commands['remove']
        self.internal_commands['eval'] = Command.dispatch_command('eval',
                level=2000,
                description='Run a raw python command. Debug mode only')

        return self.internal_commands
Beispiel #2
0
    def load_internal_commands(self):
        if self.internal_commands:
            return self.internal_commands

        self.internal_commands = {}

        self.internal_commands["quit"] = Command.pajbot_command(
            self.bot,
            "quit",
            level=2000,
            command="quit",
            description=
            "Shut down the bot, this will most definitely restart it if set up properly",
        )
        self.internal_commands["twitterfollow"] = Command.dispatch_command(
            "twitter_follow",
            level=1000,
            description="Start listening for tweets for the given user",
            examples=[
                CommandExample(
                    None,
                    "Default usage",
                    chat="user:!twitterfollow forsensc2\n"
                    "bot>user:Now following ForsenSC2",
                    description=
                    "Follow ForsenSC2 on twitter so new tweets are output in chat.",
                ).parse()
            ],
        )
        self.internal_commands["twitterunfollow"] = Command.dispatch_command(
            "twitter_unfollow",
            level=1000,
            description="Stop listening for tweets for the given user",
            examples=[
                CommandExample(
                    None,
                    "Default usage",
                    chat="user:!twitterunfollow forsensc2\n"
                    "bot>user:No longer following ForsenSC2",
                    description=
                    "Stop automatically printing tweets from ForsenSC2",
                ).parse()
            ],
        )
        self.internal_commands["add"] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command="add",
            commands={
                "command":
                Command.dispatch_command(
                    "add_command",
                    level=500,
                    description="Add a command!",
                    examples=[
                        CommandExample(
                            None,
                            "Create a normal command",
                            chat="user:!add command test Kappa 123\n"
                            "bot>user:Added your command (ID: 7)",
                            description=
                            "This creates a normal command with the trigger !test which outputs Kappa 123 to chat",
                        ).parse(),
                        CommandExample(
                            None,
                            "Create a command that responds with a whisper",
                            chat="user:!add command test Kappa 123 --whisper\n"
                            "bot>user:Added your command (ID: 7)",
                            description=
                            "This creates a command with the trigger !test which responds with Kappa 123 as a whisper to the user who called the command",
                        ).parse(),
                    ],
                ),
                "win":
                Command.dispatch_command(
                    "add_win",
                    level=500,
                    description="Add a win to something!"),
                "funccommand":
                Command.dispatch_command(
                    "add_funccommand",
                    level=2000,
                    description="Add a command that uses a command"),
                "alias":
                Command.dispatch_command(
                    "add_alias",
                    level=500,
                    description="Adds an alias to an already existing command",
                    examples=[
                        CommandExample(
                            None,
                            "Add an alias to a command",
                            chat="user:!add alias test alsotest\n"
                            "bot>user:Successfully added the aliases alsotest to test",
                            description=
                            "Adds the alias !alsotest to the existing command !test",
                        ).parse(),
                        CommandExample(
                            None,
                            "Add multiple aliases to a command",
                            chat=
                            "user:!add alias test alsotest newtest test123\n"
                            "bot>user:Successfully added the aliases alsotest, newtest, test123 to test",
                            description=
                            "Adds the aliases !alsotest, !newtest, and !test123 to the existing command !test",
                        ).parse(),
                    ],
                ),
            },
        )
        self.internal_commands["edit"] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command="edit",
            commands={
                "command":
                Command.dispatch_command(
                    "edit_command",
                    level=500,
                    description="Edit an already-existing command",
                    examples=[
                        CommandExample(
                            None,
                            "Change the response",
                            chat=
                            "user:!edit command test This is the new response!\n"
                            "bot>user:Updated the command (ID: 29)",
                            description=
                            'Changes the text response for the command !test to "This is the new response!"',
                        ).parse(),
                        CommandExample(
                            None,
                            "Change the Global Cooldown",
                            chat="user:!edit command test --cd 10\n"
                            "bot>user:Updated the command (ID: 29)",
                            description=
                            "Changes the global cooldown for the command !test to 10 seconds",
                        ).parse(),
                        CommandExample(
                            None,
                            "Change the User-specific Cooldown",
                            chat="user:!edit command test --usercd 30\n"
                            "bot>user:Updated the command (ID: 29)",
                            description=
                            "Changes the user-specific cooldown for the command !test to 30 seconds",
                        ).parse(),
                        CommandExample(
                            None,
                            "Change the Level for a command",
                            chat="user:!edit command test --level 500\n"
                            "bot>user:Updated the command (ID: 29)",
                            description=
                            "Changes the command level for !test to level 500",
                        ).parse(),
                        CommandExample(
                            None,
                            "Change the Cost for a command",
                            chat="user:!edit command $test1 --cost 50\n"
                            "bot>user:Updated the command (ID: 27)",
                            description=
                            "Changes the command cost for !$test1 to 50 points, you should always use a $ for a command that cost points.",
                        ).parse(),
                        CommandExample(
                            None,
                            "Change a command to Moderator only",
                            chat="user:!edit command test --modonly\n"
                            "bot>user:Updated the command (ID: 29)",
                            description=
                            "This command can only be used for user with level 100 and Moderator status or user over level 500",
                        ).parse(),
                        CommandExample(
                            None,
                            "Remove Moderator only from a command",
                            chat="user:!edit command test --no-modonly\n"
                            "bot>user:Updated the command (ID: 29)",
                            description=
                            "This command can be used for normal users again.",
                        ).parse(),
                    ],
                ),
                "funccommand":
                Command.dispatch_command(
                    "edit_funccommand",
                    level=2000,
                    description="Add a command that uses a command"),
            },
        )
        self.internal_commands["remove"] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command="remove",
            commands={
                "command":
                Command.dispatch_command(
                    "remove_command",
                    level=500,
                    description="Remove a command!",
                    examples=[
                        CommandExample(
                            None,
                            "Remove a command",
                            chat="user:!remove command Keepo123\n"
                            "bot>user:Successfully removed command with id 27",
                            description=
                            "Removes a command with the trigger !Keepo123",
                        ).parse(),
                        CommandExample(
                            None,
                            "Remove a command with the given ID.",
                            chat="user:!remove command 28\n"
                            "bot>user:Successfully removed command with id 28",
                            description="Removes a command with id 28",
                        ).parse(),
                    ],
                ),
                "win":
                Command.dispatch_command(
                    "remove_win",
                    level=500,
                    description="Remove a win to something!"),
                "alias":
                Command.dispatch_command(
                    "remove_alias",
                    level=500,
                    description=
                    "Removes an alias to an already existing command",
                    examples=[
                        CommandExample(
                            None,
                            "Remove two aliases",
                            chat="user:!remove alias KeepoKeepo Keepo2Keepo\n"
                            "bot>user:Successfully removed 2 aliases.",
                            description=
                            "Removes KeepoKeepo and Keepo2Keepo as aliases",
                        ).parse()
                    ],
                ),
            },
        )
        self.internal_commands["rem"] = self.internal_commands["remove"]
        self.internal_commands["del"] = self.internal_commands["remove"]
        self.internal_commands["delete"] = self.internal_commands["remove"]
        self.internal_commands["eval"] = Command.dispatch_command(
            "eval",
            level=2000,
            description="Run a raw python command. Debug mode only")

        return self.internal_commands
Beispiel #3
0
    def load_internal_commands(self, **options):
        if len(self.internal_commands) > 0:
            return self.internal_commands

        self.internal_commands = {}

        self.internal_commands["quit"] = Command.pajbot_command(
            self.bot,
            "quit",
            level=1000,
            command="quit",
            description="Shut down the bot, this will most definitely restart it if set up properly",
        )

        self.internal_commands[
            "ceaseallactionscurrentlybeingacteduponwiththecodeandiapologizeforbeingawhitecisgenderedmaleinthepatriarchy"
        ] = self.internal_commands["quit"]

        self.internal_commands["twitterfollow"] = Command.dispatch_command(
            "twitter_follow",
            level=1000,
            description="Start listening for tweets for the given user",
            examples=[
                CommandExample(
                    None,
                    "Default usage",
                    chat="user:!twitterfollow forsensc2\n" "bot>user:Now following ForsenSC2",
                    description="Follow ForsenSC2 on twitter so new tweets are output in chat.",
                ).parse()
            ],
        )

        self.internal_commands["twitterunfollow"] = Command.dispatch_command(
            "twitter_unfollow",
            level=1000,
            description="Stop listening for tweets for the given user",
            examples=[
                CommandExample(
                    None,
                    "Default usage",
                    chat="user:!twitterunfollow forsensc2\n" "bot>user:No longer following ForsenSC2",
                    description="Stop automatically printing tweets from ForsenSC2",
                ).parse()
            ],
        )

        self.internal_commands["add"] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command="add",
            commands={
                "command": Command.dispatch_command(
                    "add_command",
                    level=500,
                    description="Add a command!",
                    examples=[
                        CommandExample(
                            None,
                            "Create a normal command",
                            chat="user:!add command test Kappa 123\n" "bot>user:Added your command (ID: 7)",
                            description="This creates a normal command with the trigger !test which outputs Kappa 123 to chat",
                        ).parse(),
                        CommandExample(
                            None,
                            "Create a command that responds with a whisper",
                            chat="user:!add command test Kappa 123 --whisper\n" "bot>user:Added your command (ID: 7)",
                            description="This creates a command with the trigger !test which responds with Kappa 123 as a whisper to the user who called the command",
                        ).parse(),
                    ],
                ),
                "win": Command.dispatch_command("add_win", level=500, description="Add a win to something!"),
                "funccommand": Command.dispatch_command(
                    "add_funccommand", level=2000, description="Add a command that uses a command"
                ),
                "alias": Command.dispatch_command(
                    "add_alias",
                    level=500,
                    description="Adds an alias to an already existing command",
                    examples=[
                        CommandExample(
                            None,
                            "Add an alias to a command",
                            chat="user:!add alias test alsotest\n"
                            "bot>user:Successfully added the aliases alsotest to test",
                            description="Adds the alias !alsotest to the existing command !test",
                        ).parse(),
                        CommandExample(
                            None,
                            "Add multiple aliases to a command",
                            chat="user:!add alias test alsotest newtest test123\n"
                            "bot>user:Successfully added the aliases alsotest, newtest, test123 to test",
                            description="Adds the aliases !alsotest, !newtest, and !test123 to the existing command !test",
                        ).parse(),
                    ],
                ),
            },
        )
        self.internal_commands["edit"] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command="edit",
            commands={
                "command": Command.dispatch_command(
                    "edit_command",
                    level=500,
                    description="Edit an already-existing command",
                    examples=[
                        CommandExample(
                            None,
                            "Change the response",
                            chat="user:!edit command test This is the new response!\n"
                            "bot>user:Updated the command (ID: 29)",
                            description='Changes the text response for the command !test to "This is the new response!"',
                        ).parse(),
                        CommandExample(
                            None,
                            "Change the Global Cooldown",
                            chat="user:!edit command test --cd 10\n" "bot>user:Updated the command (ID: 29)",
                            description="Changes the global cooldown for the command !test to 10 seconds",
                        ).parse(),
                        CommandExample(
                            None,
                            "Change the User-specific Cooldown",
                            chat="user:!edit command test --usercd 30\n" "bot>user:Updated the command (ID: 29)",
                            description="Changes the user-specific cooldown for the command !test to 30 seconds",
                        ).parse(),
                        CommandExample(
                            None,
                            "Change the Level for a command",
                            chat="user:!edit command test --level 500\n" "bot>user:Updated the command (ID: 29)",
                            description="Changes the command level for !test to level 500",
                        ).parse(),
                        CommandExample(
                            None,
                            "Change the Cost for a command",
                            chat="user:!edit command $test1 --cost 50\n" "bot>user:Updated the command (ID: 27)",
                            description="Changes the command cost for !$test1 to 50 points, you should always use a $ for a command that cost points.",
                        ).parse(),
                        CommandExample(
                            None,
                            "Change a command to Moderator only",
                            chat="user:!edit command test --modonly\n" "bot>user:Updated the command (ID: 29)",
                            description="This command can only be used for user with level 100 and Moderator status or user over level 500",
                        ).parse(),
                        CommandExample(
                            None,
                            "Remove Moderator only from a command",
                            chat="user:!edit command test --no-modonly\n" "bot>user:Updated the command (ID: 29)",
                            description="This command can be used for normal users again.",
                        ).parse(),
                    ],
                ),
                "funccommand": Command.dispatch_command(
                    "edit_funccommand", level=2000, description="Add a command that uses a command"
                ),
            },
        )
        self.internal_commands["remove"] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command="remove",
            commands={
                "command": Command.dispatch_command(
                    "remove_command",
                    level=500,
                    description="Remove a command!",
                    examples=[
                        CommandExample(
                            None,
                            "Remove a command",
                            chat="user:!remove command Keepo123\n" "bot>user:Successfully removed command with id 27",
                            description="Removes a command with the trigger !Keepo123",
                        ).parse(),
                        CommandExample(
                            None,
                            "Remove a command with the given ID.",
                            chat="user:!remove command 28\n" "bot>user:Successfully removed command with id 28",
                            description="Removes a command with id 28",
                        ).parse(),
                    ],
                ),
                "win": Command.dispatch_command("remove_win", level=500, description="Remove a win to something!"),
                "alias": Command.dispatch_command(
                    "remove_alias",
                    level=500,
                    description="Removes an alias to an already existing command",
                    examples=[
                        CommandExample(
                            None,
                            "Remove two aliases",
                            chat="user:!remove alias KeepoKeepo Keepo2Keepo\n"
                            "bot>user:Successfully removed 2 aliases.",
                            description="Removes KeepoKeepo and Keepo2Keepo as aliases",
                        ).parse()
                    ],
                ),
            },
        )
        self.internal_commands["rem"] = self.internal_commands["remove"]
        self.internal_commands["del"] = self.internal_commands["remove"]
        self.internal_commands["delete"] = self.internal_commands["remove"]
        self.internal_commands["eval"] = Command.dispatch_command(
            "eval", level=2000, description="Run a raw python command. Debug mode only"
        )

        return self.internal_commands