Exemple #1
0
    def load_commands(self, **options):
        cmd_reload_bttv_emotes = self.reload_cmd(
            self.bot.emote_manager.bttv_emote_manager if self.
            bot else BTTVEmoteManager)
        cmd_reload_ffz_emotes = self.reload_cmd(
            self.bot.emote_manager.ffz_emote_manager if self.
            bot else FFZEmoteManager)
        cmd_reload_twitch_emotes = self.reload_cmd(
            self.bot.emote_manager.twitch_emote_manager if self.
            bot else TwitchEmoteManager)
        cmd_print_bttv_emotes = self.print_cmd(
            self.bot.emote_manager.bttv_emote_manager
            if self.bot else BTTVEmoteManager, "forsenPls gachiGASM")
        cmd_print_ffz_emotes = self.print_cmd(
            self.bot.emote_manager.ffz_emote_manager
            if self.bot else FFZEmoteManager, "FeelsOkayMan Kapp LULW")

        # The ' ' is there to make things look good in the
        # web interface.
        if self.settings["enable_bttvemotes"]:
            self.commands["bttvemotes"] = Command.multiaction_command(
                delay_all=self.settings["global_cd"],
                delay_user=self.settings["user_cd"],
                level=self.settings["level"],
                default=" ",
                fallback=" ",
                command="bttvemotes",
                commands={
                    "reload": cmd_reload_bttv_emotes,
                    " ": cmd_print_bttv_emotes
                },
            )

        if self.settings["enable_ffzemotes"]:
            self.commands["ffzemotes"] = Command.multiaction_command(
                delay_all=self.settings["global_cd"],
                delay_user=self.settings["user_cd"],
                level=self.settings["level"],
                default=" ",
                fallback=" ",
                command="ffzemotes",
                commands={
                    "reload": cmd_reload_ffz_emotes,
                    " ": cmd_print_ffz_emotes
                },
            )

        if self.settings["enable_subemotes"]:
            self.commands["subemotes"] = Command.multiaction_command(
                delay_all=self.settings["global_cd"],
                delay_user=self.settings["user_cd"],
                level=self.settings["level"],
                default=" ",
                fallback=" ",
                command="subemotes",
                commands={
                    "reload": cmd_reload_twitch_emotes,
                    " ": self.print_twitch_cmd()
                },
            )
Exemple #2
0
    def load_commands(self, **options):
        self.commands['add'] = Command.multiaction_command(
                level=100,
                delay_all=0,
                delay_user=0,
                default=None,
                command='add',
                commands={
                    'banphrase': Command.raw_command(self.add_banphrase,
                        level=500,
                        description='Add a banphrase!',
                        examples=[
                            CommandExample(None, 'Create a banphrase',
                                chat='user:!add banphrase testman123\n'
                                'bot>user:Inserted your banphrase (ID: 83)',
                                description='This creates a banphrase with the default settings. Whenever a non-moderator types testman123 in chat they will be timed out for 300 seconds and notified through a whisper that they said something they shouldn\'t have said').parse(),
                            CommandExample(None, 'Create a banphrase that permabans people',
                                chat='user:!add banphrase testman123 --perma\n'
                                'bot>user:Inserted your banphrase (ID: 83)',
                                description='This creates a banphrase that permabans the user who types testman123 in chat. The user will be notified through a whisper that they said something they shouldn\'t have said').parse(),
                            CommandExample(None, 'Create a banphrase that permabans people without a notification',
                                chat='user:!add banphrase testman123 --perma --no-notify\n'
                                'bot>user:Inserted your banphrase (ID: 83)',
                                description='This creates a banphrase that permabans the user who types testman123 in chat').parse(),
                            CommandExample(None, 'Change the default timeout length for a banphrase',
                                chat='user:!add banphrase testman123 --time 123\n'
                                'bot>user:Updated the given banphrase (ID: 83) with (time, extra_args)',
                                description='Changes the default timeout length to a custom time of 123 seconds').parse(),
                            CommandExample(None, 'Make it so a banphrase cannot be triggered by subs',
                                chat='user:!add banphrase testman123 --subimmunity\n'
                                'bot>user:Updated the given banphrase (ID: 83) with (sub_immunity)',
                                description='Changes a command so that the banphrase can only be triggered by people who are not subscribed to the channel.').parse(),
                            ]),
                        }
                )

        self.commands['remove'] = Command.multiaction_command(
                level=100,
                delay_all=0,
                delay_user=0,
                default=None,
                command='remove',
                commands={
                    'banphrase': Command.raw_command(self.remove_banphrase,
                        level=500,
                        description='Remove a banphrase!',
                        examples=[
                            CommandExample(None, 'Remove a banphrase',
                                chat='user:!remove banphrase KeepoKeepo\n'
                                'bot>user:Successfully removed banphrase with id 33',
                                description='Removes a banphrase with the trigger KeepoKeepo.').parse(),
                            CommandExample(None, 'Remove a banphrase with the given ID.',
                                chat='user:!remove banphrase 25\n'
                                'bot>user:Successfully removed banphrase with id 25',
                                description='Removes a banphrase with id 25').parse(),
                            ]),
                    }
                )
Exemple #3
0
    def load_commands(self, **options):
        cmd_reload_bttv_emotes = self.reload_cmd(
            self.bot.emote_manager.bttv_emote_manager if self.
            bot else BTTVEmoteManager)
        cmd_reload_ffz_emotes = self.reload_cmd(
            self.bot.emote_manager.ffz_emote_manager if self.
            bot else FFZEmoteManager)
        cmd_reload_twitch_emotes = self.reload_cmd(
            self.bot.emote_manager.twitch_emote_manager if self.
            bot else TwitchEmoteManager)
        cmd_print_bttv_emotes = self.print_cmd(
            self.bot.emote_manager.bttv_emote_manager
            if self.bot else BTTVEmoteManager, "TriKool gachiBASS")
        cmd_print_ffz_emotes = self.print_cmd(
            self.bot.emote_manager.ffz_emote_manager
            if self.bot else FFZEmoteManager, "FeelsOkayMan Krappa LULW")

        # The ' ' is there to make things look good in the
        # web interface.
        self.commands["bttvemotes"] = Command.multiaction_command(
            level=100,
            default=" ",
            fallback=" ",
            command="bttvemotes",
            commands={
                "reload": cmd_reload_bttv_emotes,
                " ": cmd_print_bttv_emotes
            },
        )

        self.commands["ffzemotes"] = Command.multiaction_command(
            level=100,
            default=" ",
            fallback=" ",
            command="ffzemotes",
            commands={
                "reload": cmd_reload_ffz_emotes,
                " ": cmd_print_ffz_emotes
            },
        )

        self.commands["subemotes"] = Command.multiaction_command(
            level=100,
            default=" ",
            fallback=" ",
            command="subemotes",
            commands={
                "reload": cmd_reload_twitch_emotes,
                " ": self.print_twitch_cmd()
            },
        )
Exemple #4
0
 def load_commands(self, **rest):
     self.commands["hsbet"] = Command.multiaction_command(
         level=100,
         default="bet",
         fallback="bet",
         delay_all=0,
         delay_user=0,
         can_execute_with_whisper=True,
         commands={
             "bet":
             Command.raw_command(self.command_bet,
                                 delay_all=0,
                                 delay_user=10,
                                 can_execute_with_whisper=True),
             "open":
             Command.raw_command(self.command_open,
                                 level=500,
                                 delay_all=0,
                                 delay_user=0,
                                 can_execute_with_whisper=True),
             "close":
             Command.raw_command(self.command_close,
                                 level=500,
                                 delay_all=0,
                                 delay_user=0,
                                 can_execute_with_whisper=True),
             "stats":
             Command.raw_command(self.command_stats,
                                 level=100,
                                 delay_all=0,
                                 delay_user=10,
                                 can_execute_with_whisper=True),
         },
     )
Exemple #5
0
 def load_commands(self, **options):
     self.commands['hsbet'] = Command.multiaction_command(
         level=100,
         default='bet',
         fallback='bet',
         delay_all=0,
         delay_user=0,
         can_execute_with_whisper=True,
         commands={
             'bet':
             Command.raw_command(
                 self.command_bet,
                 delay_all=0,
                 delay_user=10,
                 can_execute_with_whisper=True,
             ),
             'open':
             Command.raw_command(
                 self.command_open,
                 level=500,
                 delay_all=0,
                 delay_user=0,
                 can_execute_with_whisper=True,
             ),
             'close':
             Command.raw_command(
                 self.command_close,
                 level=500,
                 delay_all=0,
                 delay_user=0,
                 can_execute_with_whisper=True,
             ),
         })
Exemple #6
0
    def load_commands(self, **options):
        get_cmd = Command.raw_command(self.get_bttv_emotes,
                level=100,
                delay_all=3,
                delay_user=6,
                examples=[
                    CommandExample(None, 'Show all active bttv emotes for this channel.',
                        chat='user: !bttvemotes\n'
                        'bot: Active BTTV Emotes in chat: forsenPls gachiGASM',
                        description='').parse(),
                    ])

        reload_cmd = Command.raw_command(self.reload_bttv_emotes,
                level=500,
                delay_all=10,
                delay_user=20,
                examples=[
                    CommandExample(None, 'Reload all active bttv emotes for this channel.',
                        chat='user: !bttvemotes reload\n'
                        'bot>user: Reloading bttv emotes...',
                        description='').parse(),
                    ])

        # The ' ' is there to make things look good in the
        # web interface.
        self.commands['bttvemotes'] = Command.multiaction_command(
                level=100,
                default=' ',
                fallback=' ',
                command='bttvemotes',
                commands={
                    'reload': reload_cmd,
                    ' ': get_cmd,
                    }
                )
Exemple #7
0
    def load_commands(self, **options):
        self.commands["trivia"] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            can_execute_with_whisper=True,
            commands={
                "start":
                Command.raw_command(self.command_start,
                                    level=100,
                                    delay_all=0,
                                    delay_user=60,
                                    can_execute_with_whisper=True),
                "stop":
                Command.raw_command(self.command_stop,
                                    level=420,
                                    delay_all=0,
                                    delay_user=0,
                                    can_execute_with_whisper=True),
                "skip":
                Command.raw_command(self.command_skip,
                                    level=420,
                                    delay_all=0,
                                    delay_user=0,
                                    can_execute_with_whisper=True),
            },
        )

        self.commands["leakanswers"] = Command.raw_command(
            self.command_leak,
            level=500,
            description="Log the answers to stdout")
Exemple #8
0
 def load_commands(self, **options):
     self.commands['debug'] = Command.multiaction_command(
         level=250,
         delay_all=0,
         delay_user=0,
         default=None,
         commands={
             'command':
             Command.raw_command(
                 self.debug_command,
                 level=250,
                 description='Debug a command',
                 examples=[
                     CommandExample(
                         None,
                         'Debug a command',
                         chat='user:!debug command ping\n'
                         'bot>user: id=210, level=100, type=message, cost=0, cd_all=10, cd_user=30, mod_only=False, response=Snusbot has been online for $(tb:bot_uptime)',
                         description='').parse(),
                 ]),
             'user':
             Command.raw_command(
                 self.debug_user,
                 level=250,
                 description='Debug a user',
                 examples=[
                     CommandExample(
                         None,
                         'Debug a user',
                         chat='user:!debug user snusbot\n'
                         'bot>user: id=123, level=100, num_lines=45, points=225,  last_seen=2016-04-05 17:56:23 CEST, last_active=2016-04-05 17:56:07 CEST, ignored=False, banned=False, tokens=0',
                         description='').parse(),
                 ]),
         })
Exemple #9
0
 def load_commands(self, **options):
     self.commands['hsbet'] = Command.multiaction_command(
             level=100,
             default='bet',
             fallback='bet',
             delay_all=0,
             delay_user=0,
             can_execute_with_whisper=True,
             commands={
                 'bet': Command.raw_command(
                     self.command_bet,
                     delay_all=0,
                     delay_user=10,
                     can_execute_with_whisper=True,
                     ),
                 'open': Command.raw_command(
                     self.command_open,
                     level=500,
                     delay_all=0,
                     delay_user=0,
                     can_execute_with_whisper=True,
                     ),
                 'close': Command.raw_command(
                     self.command_close,
                     level=500,
                     delay_all=0,
                     delay_user=0,
                     can_execute_with_whisper=True,
                     ),
                 })
Exemple #10
0
 def load_commands(self, **options):
     self.commands["trivia"] = Command.multiaction_command(
         level=100,
         delay_all=0,
         delay_user=0,
         can_execute_with_whisper=True,
         commands={
             "start":
             Command.raw_command(self.command_start,
                                 level=420,
                                 delay_all=0,
                                 delay_user=10,
                                 can_execute_with_whisper=True),
             "stop":
             Command.raw_command(self.command_stop,
                                 level=420,
                                 delay_all=0,
                                 delay_user=0,
                                 can_execute_with_whisper=True),
             "skip":
             Command.raw_command(self.command_skip,
                                 level=420,
                                 delay_all=0,
                                 delay_user=0,
                                 can_execute_with_whisper=True),
         },
     )
Exemple #11
0
 def load_commands(self, **options):
     self.commands["debug"] = Command.multiaction_command(
         level=100,
         delay_all=0,
         delay_user=0,
         default=None,
         commands={
             "command":
             Command.raw_command(
                 self.debug_command,
                 level=250,
                 description="Debug a command",
                 examples=[
                     CommandExample(
                         None,
                         "Debug a command",
                         chat="user:!debug command ping\n"
                         "bot>user: id=210, level=100, type=message, cost=0, cd_all=10, cd_user=30, mod_only=False, response=Snusbot has been online for $(tb:bot_uptime)",
                         description="",
                     ).parse()
                 ],
             ),
             "user":
             Command.raw_command(
                 self.debug_user,
                 level=250,
                 description="Debug a user",
                 examples=[
                     CommandExample(
                         None,
                         "Debug a user",
                         chat="user:!debug user snusbot\n"
                         "bot>user: id=123, level=100, num_lines=45, points=225,  last_seen=2016-04-05 17:56:23 CEST, last_active=2016-04-05 17:56:07 CEST, ignored=False, banned=False, tokens=0",
                         description="",
                     ).parse()
                 ],
             ),
             "tags":
             Command.raw_command(
                 self.debug_tags,
                 level=100,
                 delay_all=0,
                 delay_user=5,
                 description="Debug tags for a user",
                 examples=[
                     CommandExample(
                         None,
                         "Debug tags for a user",
                         chat="user:!debug tags pajbot\n"
                         "bot>user: pajbot has the following tags: pajlada_sub until 2016-04-28",
                         description="",
                     ).parse()
                 ],
             ),
         },
     )
Exemple #12
0
    def load_commands(self, **options):
        get_cmd = Command.raw_command(
            self.get_ffz_emotes,
            level=420,
            delay_all=15,
            delay_user=60,
            examples=[
                CommandExample(
                    None,
                    "Show all active ffz emotes for this channel.",
                    chat="user: !ffzemotes\n"
                    "bot: Active FFZ Emotes in chat: forsenPls gachiGASM",
                    description="",
                ).parse()
            ],
        )

        reload_cmd = Command.raw_command(
            self.reload_ffz_emotes,
            level=500,
            delay_all=10,
            delay_user=20,
            examples=[
                CommandExample(
                    None,
                    "Reload all active ffz emotes for this channel.",
                    chat="user: !ffzemotes reload\n"
                    "bot>user: Reloading ffz emotes...",
                    description="",
                ).parse()
            ],
        )

        # The ' ' is there to make things look good in the
        # web interface.
        self.commands["ffzemotes"] = Command.multiaction_command(
            level=100,
            default=" ",
            fallback=" ",
            command="ffzemotes",
            commands={
                "reload": reload_cmd,
                " ": get_cmd
            })
Exemple #13
0
 def load_commands(self, **options):
     self.commands["reload"] = Command.multiaction_command(
         command="reload",
         commands={
             "vips": Command.raw_command(
                 self.update_vip_cmd,
                 delay_all=120,
                 delay_user=120,
                 level=1000,
                 examples=[
                     CommandExample(
                         None,
                         "Reload who is a Twitch channel VIP",
                         chat="user:!reload vips\nbot>user: Reloading list of VIPs...",
                     ).parse()
                 ],
             )
         },
     )
Exemple #14
0
 def load_commands(self, **options):
     self.commands["reload"] = Command.multiaction_command(
         command="reload",
         commands={
             "moderators": Command.raw_command(
                 self.update_moderators_cmd,
                 delay_all=120,
                 delay_user=120,
                 level=1000,
                 examples=[
                     CommandExample(
                         None,
                         f"Reload who is a Twitch channel moderator",
                         chat=f"user:!reload moderators\nbot>user: Reloading moderator status...",
                     ).parse()
                 ],
             )
         },
     )
Exemple #15
0
 def load_commands(self, **options):
     self.commands["reload"] = Command.multiaction_command(
         command="reload",
         commands={
             "subscribers": Command.raw_command(
                 self.update_subs_cmd,
                 delay_all=120,
                 delay_user=120,
                 level=1000,
                 examples=[
                     CommandExample(
                         None,
                         "Reload who is subscriber and who isn't",
                         chat="user:!reload subscribers\nbot>user: Reloading list of subscribers...",
                         description="",
                     ).parse()
                 ],
             )
         },
     )
Exemple #16
0
    def load_commands(self, **options):
        get_cmd = Command.raw_command(
            self.get_bttv_emotes,
            level=100,
            delay_all=3,
            delay_user=6,
            examples=[
                CommandExample(
                    None,
                    'Show all active bttv emotes for this channel.',
                    chat='user: !bttvemotes\n'
                    'bot: Active BTTV Emotes in chat: forsenPls gachiGASM',
                    description='').parse(),
            ])

        reload_cmd = Command.raw_command(
            self.reload_bttv_emotes,
            level=500,
            delay_all=10,
            delay_user=20,
            examples=[
                CommandExample(
                    None,
                    'Reload all active bttv emotes for this channel.',
                    chat='user: !bttvemotes reload\n'
                    'bot>user: Reloading bttv emotes...',
                    description='').parse(),
            ])

        # The ' ' is there to make things look good in the
        # web interface.
        self.commands['bttvemotes'] = Command.multiaction_command(
            level=100,
            default=' ',
            fallback=' ',
            command='bttvemotes',
            commands={
                'reload': reload_cmd,
                ' ': get_cmd,
            })
Exemple #17
0
 def load_commands(self, **options):
     self.commands["debug"] = Command.multiaction_command(
         level=100,
         delay_all=0,
         delay_user=0,
         default=None,
         commands={
             "command":
             Command.raw_command(
                 self.debug_command,
                 level=250,
                 description="Debug a command",
                 examples=[
                     CommandExample(
                         None,
                         "Debug a command",
                         chat="user:!debug command ping\n"
                         "bot>user: id=210, level=100, type=message, cost=0, cd_all=10, cd_user=30, mod_only=False, response=Snusbot has been online for $(tb:bot_uptime)",
                         description="",
                     ).parse()
                 ],
             ),
             "user":
             Command.raw_command(
                 self.debug_user,
                 level=250,
                 description="Debug a user",
                 examples=[
                     CommandExample(
                         None,
                         "Debug a user",
                         chat="user:!debug user admiralbulldog\n"
                         "bot>user: id=123, login=admiralbulldog, name=AdmiralBulldog, level=100, num_lines=45, points=225, tokens=0, last_seen=2016-04-05 17:56:23 CEST, last_active=2016-04-05 17:56:07 CEST, ignored=False, banned=False",
                         description="",
                     ).parse()
                 ],
             ),
         },
     )
Exemple #18
0
    def load_commands(self, **options):
        get_cmd = Command.raw_command(self.get_bttv_emotes,
                                      level=100,
                                      delay_all=3,
                                      delay_user=6)

        reload_cmd = Command.raw_command(self.reload_bttv_emotes,
                                         level=500,
                                         delay_all=10,
                                         delay_user=20)

        # The ' ' is there to make things look good in the
        # web interface.
        self.commands['bttvemotes'] = Command.multiaction_command(
            level=100,
            default=' ',
            fallback=' ',
            command='bttvemotes',
            commands={
                'reload': reload_cmd,
                ' ': get_cmd,
            })
Exemple #19
0
 def load_commands(self, **options):
     self.commands['trivia'] = Command.multiaction_command(
             level=100,
             delay_all=0,
             delay_user=0,
             can_execute_with_whisper=True,
             commands={
                 'start': Command.raw_command(
                     self.command_start,
                     level=500,
                     delay_all=0,
                     delay_user=10,
                     can_execute_with_whisper=True,
                     ),
                 'stop': Command.raw_command(
                     self.command_stop,
                     level=500,
                     delay_all=0,
                     delay_user=0,
                     can_execute_with_whisper=True,
                     ),
                 }
             )
Exemple #20
0
 def load_commands(self, **options):
     self.commands["reload"] = Command.multiaction_command(
         command="reload",
         commands={
             "chatters":
             Command.raw_command(
                 self.update_chatters_cmd,
                 delay_all=120,
                 delay_user=120,
                 level=1000,
                 examples=[
                     CommandExample(
                         None,
                         "Reload who is currently chatting",
                         chat=
                         "user:!reload chatters\nbot>user: Reloading list of chatters...",
                         description=
                         "Note: Updates only last_seen values, does not award points for watching the stream.",
                     ).parse()
                 ],
             )
         },
     )
Exemple #21
0
 def load_commands(self, **options):
     self.commands['debug'] = Command.multiaction_command(
             level=100,
             delay_all=0,
             delay_user=0,
             default=None,
             commands={
                 'command': Command.raw_command(self.debug_command,
                     level=250,
                     description='Debug a command',
                     examples=[
                         CommandExample(None, 'Debug a command',
                             chat='user:!debug command ping\n'
                             'bot>user: id=210, level=100, type=message, cost=0, cd_all=10, cd_user=30, mod_only=False, response=Snusbot has been online for $(tb:bot_uptime)',
                             description='').parse(),
                         ]),
                 'user': Command.raw_command(self.debug_user,
                     level=250,
                     description='Debug a user',
                     examples=[
                         CommandExample(None, 'Debug a user',
                             chat='user:!debug user snusbot\n'
                             'bot>user: id=123, level=100, num_lines=45, points=225,  last_seen=2016-04-05 17:56:23 CEST, last_active=2016-04-05 17:56:07 CEST, ignored=False, banned=False, tokens=0',
                             description='').parse(),
                         ]),
                 'tags': Command.raw_command(self.debug_tags,
                     level=100,
                     delay_all=0,
                     delay_user=5,
                     description='Debug tags for a user',
                     examples=[
                         CommandExample(None, 'Debug tags for a user',
                             chat='user:!debug tags pajbot\n'
                             'bot>user: pajbot have the following tags: pajlada_sub until 2016-04-28',
                             description='').parse(),
                         ])
                 })
Exemple #22
0
 def load_commands(self, **options):
     self.commands['trivia'] = Command.multiaction_command(
         level=100,
         delay_all=0,
         delay_user=0,
         can_execute_with_whisper=True,
         commands={
             'start':
             Command.raw_command(
                 self.command_start,
                 level=500,
                 delay_all=0,
                 delay_user=10,
                 can_execute_with_whisper=True,
             ),
             'stop':
             Command.raw_command(
                 self.command_stop,
                 level=500,
                 delay_all=0,
                 delay_user=0,
                 can_execute_with_whisper=True,
             ),
         })
Exemple #23
0
    def load_commands(self, **options):
        self.commands["add"] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command="add",
            commands={
                "banphrase": Command.raw_command(
                    self.add_banphrase,
                    level=500,
                    description="Add a banphrase!",
                    delay_all=0,
                    delay_user=0,
                    examples=[
                        CommandExample(
                            None,
                            "Create a banphrase",
                            chat="user:!add banphrase testman123\n" "bot>user:Inserted your banphrase (ID: 83)",
                            description="This creates a banphrase with the default settings. Whenever a non-moderator types testman123 in chat they will be timed out for 300 seconds and notified through a whisper that they said something they shouldn't have said",
                        ).parse(),
                        CommandExample(
                            None,
                            "Create a banphrase that permabans people",
                            chat="user:!add banphrase testman123 --perma\n" "bot>user:Inserted your banphrase (ID: 83)",
                            description="This creates a banphrase that permabans the user who types testman123 in chat. The user will be notified through a whisper that they said something they shouldn't have said",
                        ).parse(),
                        CommandExample(
                            None,
                            "Create a banphrase that permabans people without a notification",
                            chat="user:!add banphrase testman123 --perma --no-notify\n"
                            "bot>user:Inserted your banphrase (ID: 83)",
                            description="This creates a banphrase that permabans the user who types testman123 in chat",
                        ).parse(),
                        CommandExample(
                            None,
                            "Change the default timeout length for a banphrase",
                            chat="user:!add banphrase testman123 --time 123\n"
                            "bot>user:Updated the given banphrase (ID: 83) with (time, extra_args)",
                            description="Changes the default timeout length to a custom time of 123 seconds",
                        ).parse(),
                        CommandExample(
                            None,
                            "Make it so a banphrase cannot be triggered by subs",
                            chat="user:!add banphrase testman123 --subimmunity\n"
                            "bot>user:Updated the given banphrase (ID: 83) with (sub_immunity)",
                            description="Changes a command so that the banphrase can only be triggered by people who are not subscribed to the channel.",
                        ).parse(),
                    ],
                )
            },
        )

        self.commands["remove"] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command="remove",
            commands={
                "banphrase": Command.raw_command(
                    self.remove_banphrase,
                    level=500,
                    delay_all=0,
                    delay_user=0,
                    description="Remove a banphrase!",
                    examples=[
                        CommandExample(
                            None,
                            "Remove a banphrase",
                            chat="user:!remove banphrase KeepoKeepo\n"
                            "bot>user:Successfully removed banphrase with id 33",
                            description="Removes a banphrase with the trigger KeepoKeepo.",
                        ).parse(),
                        CommandExample(
                            None,
                            "Remove a banphrase with the given ID.",
                            chat="user:!remove banphrase 25\n" "bot>user:Successfully removed banphrase with id 25",
                            description="Removes a banphrase with id 25",
                        ).parse(),
                    ],
                )
            },
        )
Exemple #24
0
    def load_commands(self, **options):
        self.commands["add"] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command="add",
            commands={
                "link":
                Command.multiaction_command(
                    level=500,
                    delay_all=0,
                    delay_user=0,
                    default=None,
                    commands={
                        "blacklist":
                        Command.raw_command(
                            self.add_link_blacklist,
                            level=500,
                            delay_all=0,
                            delay_user=0,
                            description="Blacklist a link",
                            examples=[
                                CommandExample(
                                    None,
                                    "Add a link to the blacklist for a shallow search",
                                    chat=
                                    "user:!add link blacklist --shallow scamlink.lonk/\n"
                                    "bot>user:Successfully added your links",
                                    description=
                                    "Added the link scamlink.lonk/ to the blacklist for a shallow search",
                                ).parse(),
                                CommandExample(
                                    None,
                                    "Add a link to the blacklist for a deep search",
                                    chat=
                                    "user:!add link blacklist --deep scamlink.lonk/\n"
                                    "bot>user:Successfully added your links",
                                    description=
                                    "Added the link scamlink.lonk/ to the blacklist for a deep search",
                                ).parse(),
                            ],
                        ),
                        "whitelist":
                        Command.raw_command(
                            self.add_link_whitelist,
                            level=500,
                            delay_all=0,
                            delay_user=0,
                            description="Whitelist a link",
                            examples=[
                                CommandExample(
                                    None,
                                    "Add a link to the whitelist",
                                    chat=
                                    "user:!add link whitelink safelink.lonk/\n"
                                    "bot>user:Successfully added your links",
                                    description=
                                    "Added the link safelink.lonk/ to the whitelist",
                                ).parse()
                            ],
                        ),
                    },
                )
            },
        )

        self.commands["remove"] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command="remove",
            commands={
                "link":
                Command.multiaction_command(
                    level=500,
                    delay_all=0,
                    delay_user=0,
                    default=None,
                    commands={
                        "blacklist":
                        Command.raw_command(
                            self.remove_link_blacklist,
                            level=500,
                            delay_all=0,
                            delay_user=0,
                            description="Remove a link from the blacklist.",
                            examples=[
                                CommandExample(
                                    None,
                                    "Remove a link from the blacklist.",
                                    chat="user:!remove link blacklist 20\n"
                                    "bot>user:Successfully removed blacklisted link with id 20",
                                    description=
                                    "Remove a link from the blacklist with an ID",
                                ).parse()
                            ],
                        ),
                        "whitelist":
                        Command.raw_command(
                            self.remove_link_whitelist,
                            level=500,
                            delay_all=0,
                            delay_user=0,
                            description="Remove a link from the whitelist.",
                            examples=[
                                CommandExample(
                                    None,
                                    "Remove a link from the whitelist.",
                                    chat="user:!remove link whitelist 12\n"
                                    "bot>user:Successfully removed blacklisted link with id 12",
                                    description=
                                    "Remove a link from the whitelist with an ID",
                                ).parse()
                            ],
                        ),
                    },
                )
            },
        )
Exemple #25
0
    def load_commands(self, **options):
        self.commands['setdeck'] = Command.raw_command(
            self.set_deck,
            level=420,
            delay_all=0,
            delay_user=0,
            description='Sets the deck that is currently playing.',
            examples=[
                CommandExample(
                    None,
                    'Add a new deck',
                    chat='user:!set deck http://i.imgur.com/rInqJv0.png\n'
                    'bot>user:This deck is a new deck. Its ID is 32',
                    description=
                    'This is the output if you set a deck which hasn\'t been set before.'
                ).parse(),
                CommandExample(
                    None,
                    'Set a pre-existing deck',
                    chat='user:!set deck http://i.imgur.com/rInqJv0.png\n'
                    'bot>user:Updated an already-existing deck. Its ID is 32',
                    description=
                    'This is the output if you set a deck which was added previously.'
                ).parse(),
            ])
        self.commands['set'] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command='set',
            commands={'deck': self.commands['setdeck']})

        self.commands['update'] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command='update',
            commands={
                'deck':
                Command.raw_command(
                    self.update_deck,
                    level=420,
                    description='Updates an already-existing deck.',
                    examples=[
                        CommandExample(
                            None,
                            'Set the name and class of the current deck',
                            chat=
                            'user:!update deck --name Midrange Secret --class paladin\n'
                            'bot>user:Updated deck with ID 32. Updated name, class'
                        ).parse(),
                        CommandExample(
                            None,
                            'Updates the link of the current deck',
                            chat=
                            'user:!update deck --link http://i.imgur.com/QEVwrVV.png\n'
                            'bot>user:Updated deck with ID 32. Updated link',
                            description=
                            'Changes the link of the current deck. This could be used if you want to reupload the screenshot to imgur or something.'
                        ).parse(),
                        CommandExample(
                            None,
                            'Set the name and class of an old deck',
                            chat=
                            'user:!update deck --id 12 --name Aggro --class hunter\n'
                            'bot>user:Updated deck with ID 12. Updated name, class',
                            description=
                            'Updates the name and class of an old deck. Useful for whenever you need to clean up old decks.'
                        ).parse(),
                    ]),
            })

        self.commands['remove'] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command='remove',
            commands={
                'deck':
                Command.raw_command(
                    self.remove_deck,
                    level=420,
                    description='Removes a deck with the given ID.',
                    examples=[
                        CommandExample(
                            None,
                            'Remove a deck by ID',
                            chat='user:!remove deck 123\n'
                            'bot>user:Successfully removed the deck.',
                            description='The ID in this case is 123').parse(),
                        CommandExample(
                            None,
                            'Remove a deck by URL',
                            chat=
                            'user:!remove deck http://i.imgur.com/rInqJv0.png\n'
                            'bot>user:Successfully removed the deck.',
                            description=
                            'The URL in this case is http://i.imgur.com/rInqJv0.png'
                        ).parse(),
                    ]),
            })
Exemple #26
0
    def load_commands(self, **options):
        self.commands["predict"] = Command.multiaction_command(
            level=100,
            default="vote",
            fallback="vote",
            delay_all=0,
            delay_user=0,
            commands={
                "vote":
                Command.raw_command(
                    self.predict,
                    delay_all=0,
                    delay_user=10,
                    sub_only=self.settings["sub_only"],
                    can_execute_with_whisper=True,
                    description="Predict how many wins will occur in the " +
                    self.settings["challenge_name"] + " challenge",
                ),
                "new":
                Command.raw_command(
                    self.new_predict,
                    delay_all=10,
                    delay_user=10,
                    description="Starts a new " +
                    self.settings["challenge_name"] + " run",
                    level=750,
                ),
                "end":
                Command.raw_command(
                    self.end_predict,
                    delay_all=10,
                    delay_user=10,
                    description="Ends a " + self.settings["challenge_name"] +
                    " run",
                    level=750,
                ),
                "close":
                Command.raw_command(
                    self.close_predict,
                    delay_all=10,
                    delay_user=10,
                    description="Close submissions to the latest " +
                    self.settings["challenge_name"] + " run",
                    level=750,
                ),
            },
        )

        # XXX: DEPRECATED, WILL BE REMOVED
        self.commands["newpredict"] = Command.raw_command(
            self.new_predict_depr,
            delay_all=10,
            delay_user=10,
            description="Starts a new " + self.settings["challenge_name"] +
            " run",
            level=750,
        )
        self.commands["endpredict"] = Command.raw_command(
            self.end_predict_depr,
            delay_all=10,
            delay_user=10,
            description="Ends a " + self.settings["challenge_name"] + " run",
            level=750,
        )
        self.commands["closepredict"] = Command.raw_command(
            self.close_predict_depr,
            delay_all=10,
            delay_user=10,
            description="Close submissions to the latest " +
            self.settings["challenge_name"] + " run",
            level=750,
        )

        mini_command = self.settings["mini_command"].lower().replace(
            "!", "").replace(" ", "")
        if len(mini_command) > 0:
            self.commands[mini_command] = Command.multiaction_command(
                level=100,
                default="vote",
                fallback="vote",
                delay_all=0,
                delay_user=0,
                commands={
                    "vote":
                    Command.raw_command(
                        self.mini_predict,
                        delay_all=0,
                        delay_user=10,
                        sub_only=self.settings["sub_only"],
                        can_execute_with_whisper=True,
                        description="Predict how many wins will occur in the "
                        + self.settings["challenge_name"] + " challenge",
                    ),
                    "new":
                    Command.raw_command(
                        self.mini_new_predict,
                        delay_all=10,
                        delay_user=10,
                        description="Starts a new " +
                        self.settings["challenge_name"] + " run",
                        level=750,
                    ),
                    "end":
                    Command.raw_command(
                        self.mini_end_predict,
                        delay_all=10,
                        delay_user=10,
                        description="Ends a " +
                        self.settings["challenge_name"] + " run",
                        level=750,
                    ),
                    "close":
                    Command.raw_command(
                        self.mini_close_predict,
                        delay_all=10,
                        delay_user=10,
                        description="Close submissions to the latest " +
                        self.settings["challenge_name"] + " run",
                        level=750,
                    ),
                },
            )
Exemple #27
0
    def load_commands(self, **options):
        self.commands['add'] = Command.multiaction_command(
                level=100,
                delay_all=0,
                delay_user=0,
                default=None,
                command='add',
                commands={
                    'link': Command.multiaction_command(
                        level=500,
                        delay_all=0,
                        delay_user=0,
                        default=None,
                        commands={
                            'blacklist': Command.raw_command(self.add_link_blacklist,
                                level=500,
                                description='Blacklist a link',
                                examples=[
                                    CommandExample(None, 'Add a link to the blacklist for shallow search',
                                        chat='user:!add link blacklist 0 scamlink.lonk/\n'
                                        'bot>user:Successfully added your links',
                                        description='Added the link scamlink.lonk/ to the blacklist for a shallow search').parse(),
                                    CommandExample(None, 'Add a link to the blacklist for deep search',
                                        chat='user:!add link blacklist 1 scamlink.lonk/\n'
                                        'bot>user:Successfully added your links',
                                        description='Added the link scamlink.lonk/ to the blacklist for a deep search').parse(),
                                    ]),
                            'whitelist': Command.raw_command(self.add_link_whitelist,
                                level=500,
                                description='Whitelist a link',
                                examples=[
                                    CommandExample(None, 'Add a link to the whitelist',
                                        chat='user:!add link whitelink safelink.lonk/\n'
                                        'bot>user:Successfully added your links',
                                        description='Added the link safelink.lonk/ to the whitelist').parse(),
                                    ]),
                            }
                        )
                    }
                )

        self.commands['remove'] = Command.multiaction_command(
                level=100,
                delay_all=0,
                delay_user=0,
                default=None,
                command='remove',
                commands={
                    'link': Command.multiaction_command(
                        level=500,
                        delay_all=0,
                        delay_user=0,
                        default=None,
                        commands={
                            'blacklist': Command.raw_command(self.remove_link_blacklist,
                                level=500,
                                description='Unblacklist a link',
                                examples=[
                                    CommandExample(None, 'Remove a blacklist link',
                                        chat='user:!remove link blacklist scamtwitch.scam\n'
                                        'bot>user:Successfully removed your links',
                                        description='Removes scamtwitch.scam as a blacklisted link').parse(),
                                    ]),
                            'whitelist': Command.raw_command(self.remove_link_whitelist,
                                level=500,
                                description='Unwhitelist a link',
                                examples=[
                                    CommandExample(None, 'Remove a whitelist link',
                                        chat='user:!remove link whitelist twitch.safe\n'
                                        'bot>user:Successfully removed your links',
                                        description='Removes twitch.safe as a whitelisted link').parse(),
                                    ]),
                            }
                        ),
                    }
                )
Exemple #28
0
    def load_commands(self, **options):
        commands = {
            "link":
            Command.raw_command(
                self.cmd_link,
                level=100,
                delay_all=self.settings["global_cd"],
                delay_user=self.settings["user_cd"],
                description="Get link to your dubtrack",
                examples=[
                    CommandExample(
                        None,
                        "Ask bot for dubtrack link",
                        chat="user:!dubtrack link\n"
                        "bot:Request your songs at https://dubtrack.fm/join/troydota",
                    ).parse()
                ],
            ),
            "song":
            Command.raw_command(
                self.cmd_song,
                level=100,
                delay_all=self.settings["global_cd"],
                delay_user=self.settings["user_cd"],
                description="Get current song",
                examples=[
                    CommandExample(
                        None,
                        "Ask bot for current song (youtube)",
                        chat="user:!dubtrack song\n"
                        "bot:Current song: NOMA - Brain Power, link: https://youtu.be/9R8aSKwTEMg requested by FabPotato69",
                    ).parse(),
                    CommandExample(
                        None,
                        "Ask bot for current song (soundcloud)",
                        chat="user:!dubtrack song\n"
                        "bot:Current song: This is Bondage, link: https://soundcloud.com/razq35/nightlife requested by karylul",
                    ).parse(),
                    CommandExample(
                        None,
                        "Ask bot for current song (nothing playing)",
                        chat="user:!dubtrack song\n"
                        "bot:There's no song playing right now FeelsBadMan",
                    ).parse(),
                ],
            ),
            "previous":
            Command.raw_command(
                self.cmd_previous_song,
                level=100,
                delay_all=self.settings["global_cd"],
                delay_user=self.settings["user_cd"],
                description="Get previous song",
                examples=[
                    CommandExample(
                        None,
                        "Ask bot for current song (youtube)",
                        chat="user:!dubtrack song\n"
                        "bot:Current song: NOMA - Brain Power, link: https://youtu.be/9R8aSKwTEMg requested by FabPotato69",
                    ).parse(),
                    CommandExample(
                        None,
                        "Ask bot for current song (soundcloud)",
                        chat="user:!dubtrack song\n"
                        "bot:Current song: This is Bondage, link: https://soundcloud.com/razq35/nightlife requested by karylul",
                    ).parse(),
                    CommandExample(
                        None,
                        "Ask bot for current song (nothing playing)",
                        chat="user:!dubtrack song\n"
                        "bot:There's no song playing right now FeelsBadMan",
                    ).parse(),
                ],
            ),
        }

        # alias :p
        commands["lastsong"] = commands["previous"]

        if self.settings["if_short_alias"]:
            commands["l"] = commands["link"]
            commands["s"] = commands["song"]

        self.commands["dubtrack"] = Command.multiaction_command(
            level=100,
            default="link",  # If the user does not input any argument
            fallback="link",  # If the user inputs an invalid argument
            command="dubtrack",
            commands=commands,
        )

        if self.settings["if_dt_alias"]:
            self.commands["dt"] = self.commands["dubtrack"]

        if self.settings["if_song_alias"]:
            self.commands["song"] = commands["song"]

        if self.settings["if_previoussong_alias"]:
            self.commands["previoussong"] = commands["previous"]

        if self.settings["if_lastsong_alias"]:
            self.commands["lastsong"] = commands["previous"]
Exemple #29
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
Exemple #30
0
 def load_commands(self, **options):
     self.commands["bingo"] = Command.multiaction_command(
         level=500,
         default=None,
         command="bingo",
         commands={
             "start":
             Command.raw_command(
                 self.bingo_start,
                 level=500,
                 delay_all=15,
                 delay_user=15,
                 description=
                 "Start an emote bingo with specified emote sets",
                 examples=[
                     CommandExample(
                         None,
                         "Emote bingo for default points",
                         chat="user:!bingo start bttv\n"
                         "bot: A bingo has started! Guess the right target to win 100 points! "
                         "Only one target per message! Select from Channel BTTV Emotes!",
                         description="",
                     ).parse(),
                     CommandExample(
                         None,
                         "Emote bingo for 222 points",
                         chat="user:!bingo start bttv 222\n"
                         "bot: A bingo has started! Guess the right target to win 222 points! "
                         "Only one target per message! Select from Channel BTTV Emotes!",
                         description="",
                     ).parse(),
                 ],
             ),
             "cancel":
             Command.raw_command(
                 self.bingo_cancel,
                 level=500,
                 delay_all=15,
                 delay_user=15,
                 description="Cancel a running bingo",
                 examples=[
                     CommandExample(
                         None,
                         "Cancel a bingo",
                         chat="user:!bingo cancel\n"
                         "bot: Bingo cancelled by pajlada FeelsBadMan",
                         description="",
                     ).parse()
                 ],
             ),
             "help":
             Command.raw_command(
                 self.bingo_help_random,
                 level=500,
                 delay_all=15,
                 delay_user=15,
                 description=
                 "The bot will help the chat with a random letter from the bingo target",
                 examples=[
                     CommandExample(
                         None,
                         "Get a random letter from the bingo target",
                         chat="user:!bingo help\n"
                         "bot: A bingo for 100 points is still running. You should maybe use a a a a a for the target",
                         description="",
                     ).parse()
                 ],
             ),
             "cheat":
             Command.raw_command(
                 self.bingo_help_first,
                 level=500,
                 delay_all=15,
                 delay_user=15,
                 description=
                 "The bot will help the chat with the first letter from the bingo target",
                 examples=[
                     CommandExample(
                         None,
                         "Get the first letter from the bingo target",
                         chat="user:!bingo cheat\n"
                         "bot: A bingo for 100 points is still running. You should use W W W W W as the first letter for the target",
                         description="",
                     ).parse()
                 ],
             ),
         },
     )
Exemple #31
0
 def load_commands(self, **options):
     self.commands['bingo'] = Command.multiaction_command(
             level=500,
             default=None,
             command='bingo',
             commands={
                 'emotes': Command.raw_command(self.bingo_emotes,
                     level=500,
                     delay_all=15,
                     delay_user=15,
                     description='Start an emote bingo with BTTV and TWITCH global emotes',
                     examples=[
                         CommandExample(None, 'Emote bingo for 100 points',
                             chat='user:!bingo emotes\n'
                             'bot: A bingo has started! Guess the right target to win 100 points! Only one target per message! ',
                             description='').parse(),
                         CommandExample(None, 'Emote bingo for 222 points',
                             chat='user:!bingo emotes 222\n'
                             'bot: A bingo has started! Guess the right target to win 222 points! Only one target per message! ',
                             description='').parse(),
                         ]),
                 'bttv': Command.raw_command(self.bingo_bttv,
                     level=500,
                     delay_all=15,
                     delay_user=15,
                     description='Start an emote bingo with BTTV global emotes',
                     examples=[
                         CommandExample(None, 'Emote bingo for 100 points',
                             chat='user:!bingo bttv\n'
                             'bot: A bingo has started! Guess the right target to win 100 points! Only one target per message! Use BTTV global emotes. ',
                             description='').parse(),
                         CommandExample(None, 'Emote bingo for 222 points',
                             chat='user:!bingo bttv 222\n'
                             'bot: A bingo has started! Guess the right target to win 222 points! Only one target per message! Use BTTV global emotes. ',
                             description='').parse(),
                         ]),
                 'twitch': Command.raw_command(self.bingo_twitch,
                     level=500,
                     delay_all=15,
                     delay_user=15,
                     description='Start an emote bingo with TWITCH global emotes',
                     examples=[
                         CommandExample(None, 'Emote bingo for 100 points',
                             chat='user:!bingo twitch\n'
                             'bot: A bingo has started! Guess the right target to win 100 points! Only one target per message! Use TWITCH global emotes. ',
                             description='').parse(),
                         CommandExample(None, 'Emote bingo for 222 points',
                             chat='user:!bingo twitch 222\n'
                             'bot: A bingo has started! Guess the right target to win 222 points! Only one target per message! Use TWITCH global emotes. ',
                             description='').parse(),
                         ]),
                 'cancel': Command.raw_command(self.bingo_cancel,
                     level=500,
                     delay_all=15,
                     delay_user=15,
                     description='Cancel a running bingo',
                     examples=[
                         CommandExample(None, 'Cancel a bingo',
                             chat='user:!bingo cancel\n'
                             'bot: Bingo cancelled by pajlada FeelsBadMan',
                             description='').parse(),
                         ]),
                 'help': Command.raw_command(self.bingo_help_random,
                     level=500,
                     delay_all=15,
                     delay_user=15,
                     description='The bot will help the chat with a random letter from the bingo target',
                     examples=[
                         CommandExample(None, 'Get a random letter from the bingo target',
                             chat='user:!bingo help\n'
                             'bot: A bingo for 100 points is still running. You should maybe use a a a a a for the target',
                             description='').parse(),
                         ]),
                 'cheat': Command.raw_command(self.bingo_help_first,
                     level=500,
                     delay_all=15,
                     delay_user=15,
                     description='The bot will help the chat with the first letter from the bingo target',
                     examples=[
                         CommandExample(None, 'Get the first letter from the bingo target',
                             chat='user:!bingo cheat\n'
                             'bot: A bingo for 100 points is still running. You should use W W W W W as the first letter for the target',
                             description='').parse(),
                         ]),
                 })
Exemple #32
0
    def load_commands(self, **options):
        from pajbot.models.command import Command
        from pajbot.models.command import CommandExample

        self.commands["#playsound"] = Command.raw_command(
            self.play_sound,
            tokens_cost=self.settings["token_cost"],
            cost=self.settings["point_cost"],
            sub_only=self.settings["sub_only"],
            delay_all=0,
            delay_user=0,
            description="Play a sound on stream!",
            can_execute_with_whisper=self.settings["can_whisper"],
            examples=[
                CommandExample(
                    None,
                    'Play the "doot" sample',
                    chat="user:!#playsound doot\n"
                    "bot>user:Successfully played the sound doot on stream!",
                ).parse()
            ],
        )

        self.commands[
            "#playsound"].long_description = 'Playsounds can be tried out <a href="/playsounds">here</a>'

        self.commands["add"] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command="add",
            commands={
                "playsound":
                Command.raw_command(
                    self.add_playsound_command,
                    level=500,
                    delay_all=0,
                    delay_user=0,
                    description="Creates a new playsound",
                    examples=[
                        CommandExample(
                            None,
                            "Create a new playsound",
                            chat=
                            "user:!add playsound doot https://i.nuuls.com/Bb4aX.mp3\n"
                            "bot>user:Successfully created your playsound",
                            description=
                            'Creates the "doot" playsound with the given link.',
                        ).parse(),
                        CommandExample(
                            None,
                            "Create a new playsound and sets volume",
                            chat=
                            "user:!add playsound doot https://i.nuuls.com/Bb4aX.mp3 --volume 50\n"
                            "bot>user:Successfully created your playsound",
                            description=
                            'Creates the "doot" playsound with the given link and 50% volume.',
                        ).parse(),
                        CommandExample(
                            None,
                            "Create a new playsound and sets cooldown",
                            chat=
                            "user:!add playsound doot https://i.nuuls.com/Bb4aX.mp3 --cooldown 60\n"
                            "bot>user:Successfully created your playsound",
                            description=
                            'Creates the "doot" playsound with the given link and 1 minute cooldown.',
                        ).parse(),
                        CommandExample(
                            None,
                            "Create a new playsound and disable it",
                            chat=
                            "user:!add playsound doot https://i.nuuls.com/Bb4aX.mp3 --disabled\n"
                            "bot>user:Successfully created your playsound",
                            description=
                            'Creates the "doot" playsound with the given link and initially disables it.',
                        ).parse(),
                    ],
                )
            },
        )

        self.commands["edit"] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command="edit",
            commands={
                "playsound":
                Command.raw_command(
                    self.edit_playsound_command,
                    level=500,
                    delay_all=0,
                    delay_user=0,
                    description="Edits an existing playsound",
                    examples=[
                        CommandExample(
                            None,
                            "Edit an existing playsound's link",
                            chat=
                            "user:!edit playsound doot https://i.nuuls.com/Bb4aX.mp3\n"
                            "bot>user:Successfully edited your playsound",
                            description=
                            'Updates the link of the "doot" playsound.',
                        ).parse(),
                        CommandExample(
                            None,
                            "Edit an existing playsound's volume",
                            chat="user:!edit playsound doot --volume 50\n"
                            "bot>user:Successfully edited your playsound",
                            description=
                            'Updates the volume of the "doot" playsound to 50%.',
                        ).parse(),
                        CommandExample(
                            None,
                            "Edit an existing playsound's cooldown",
                            chat="user:!edit playsound doot --cooldown 60\n"
                            "bot>user:Successfully edited your playsound",
                            description=
                            'Updates the cooldown of the "doot" playsound to 1 minute.',
                        ).parse(),
                        CommandExample(
                            None,
                            "Disable an existing playsound",
                            chat="user:!edit playsound doot --disabled\n"
                            "bot>user:Successfully edited your playsound",
                            description='Disables the "doot" playsound.',
                        ).parse(),
                        CommandExample(
                            None,
                            "Enable an existing playsound",
                            chat="user:!edit playsound doot --enabled\n"
                            "bot>user:Successfully edited your playsound",
                            description='Enables the "doot" playsound.',
                        ).parse(),
                    ],
                )
            },
        )

        self.commands["remove"] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command="remove",
            commands={
                "playsound":
                Command.raw_command(
                    self.remove_playsound_command,
                    level=500,
                    delay_all=0,
                    delay_user=0,
                    description="Removes an existing playsound",
                    examples=[
                        CommandExample(
                            None,
                            "Remove an existing playsound",
                            chat="user:!remove playsound doot\n"
                            "bot>user:Successfully removed your playsound",
                            description='Removes the "doot" playsound.',
                        ).parse()
                    ],
                )
            },
        )

        self.commands["debug"] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command="debug",
            commands={
                "playsound":
                Command.raw_command(
                    self.debug_playsound_command,
                    level=250,
                    delay_all=0,
                    delay_user=0,
                    description="Prints data about a playsound",
                    examples=[
                        CommandExample(
                            None,
                            'Get information about the "doot" playsound',
                            chat="user:!debug playsound doot\n"
                            "bot>user: name=doot, link=https://i.nuuls.com/Bb4aX.mp3, volume=100, "
                            "cooldown=None, enabled=True",
                        ).parse()
                    ],
                )
            },
        )
Exemple #33
0
    def load_commands(self, **options):
        self.commands["predict"] = Command.multiaction_command(
            level=100,
            default="vote",
            fallback="vote",
            delay_all=0,
            delay_user=0,
            commands={
                "vote": Command.raw_command(
                    self.predict,
                    delay_all=0,
                    delay_user=10,
                    sub_only=self.settings["sub_only"],
                    can_execute_with_whisper=True,
                    description="Predict how many wins will occur in the "
                    + self.settings["challenge_name"]
                    + " challenge",
                ),
                "new": Command.raw_command(
                    self.new_predict,
                    delay_all=10,
                    delay_user=10,
                    description="Starts a new " + self.settings["challenge_name"] + " run",
                    level=750,
                ),
                "end": Command.raw_command(
                    self.end_predict,
                    delay_all=10,
                    delay_user=10,
                    description="Ends a " + self.settings["challenge_name"] + " run",
                    level=750,
                ),
                "close": Command.raw_command(
                    self.close_predict,
                    delay_all=10,
                    delay_user=10,
                    description="Close submissions to the latest " + self.settings["challenge_name"] + " run",
                    level=750,
                ),
            },
        )

        # XXX: DEPRECATED, WILL BE REMOVED
        self.commands["newpredict"] = Command.raw_command(
            self.new_predict_depr,
            delay_all=10,
            delay_user=10,
            description="Starts a new " + self.settings["challenge_name"] + " run",
            level=750,
        )
        self.commands["endpredict"] = Command.raw_command(
            self.end_predict_depr,
            delay_all=10,
            delay_user=10,
            description="Ends a " + self.settings["challenge_name"] + " run",
            level=750,
        )
        self.commands["closepredict"] = Command.raw_command(
            self.close_predict_depr,
            delay_all=10,
            delay_user=10,
            description="Close submissions to the latest " + self.settings["challenge_name"] + " run",
            level=750,
        )

        mini_command = self.settings["mini_command"].lower().replace("!", "").replace(" ", "")
        if len(mini_command) > 0:
            self.commands[mini_command] = Command.multiaction_command(
                level=100,
                default="vote",
                fallback="vote",
                delay_all=0,
                delay_user=0,
                commands={
                    "vote": Command.raw_command(
                        self.mini_predict,
                        delay_all=0,
                        delay_user=10,
                        sub_only=self.settings["sub_only"],
                        can_execute_with_whisper=True,
                        description="Predict how many wins will occur in the "
                        + self.settings["challenge_name"]
                        + " challenge",
                    ),
                    "new": Command.raw_command(
                        self.mini_new_predict,
                        delay_all=10,
                        delay_user=10,
                        description="Starts a new " + self.settings["challenge_name"] + " run",
                        level=750,
                    ),
                    "end": Command.raw_command(
                        self.mini_end_predict,
                        delay_all=10,
                        delay_user=10,
                        description="Ends a " + self.settings["challenge_name"] + " run",
                        level=750,
                    ),
                    "close": Command.raw_command(
                        self.mini_close_predict,
                        delay_all=10,
                        delay_user=10,
                        description="Close submissions to the latest " + self.settings["challenge_name"] + " run",
                        level=750,
                    ),
                },
            )
Exemple #34
0
    def load_commands(self, **options):
        self.commands['add'] = Command.multiaction_command(
                level=100,
                delay_all=0,
                delay_user=0,
                default=None,
                command='add',
                commands={
                    'link': Command.multiaction_command(
                        level=500,
                        delay_all=0,
                        delay_user=0,
                        default=None,
                        commands={
                            'blacklist': Command.raw_command(self.add_link_blacklist,
                                level=500,
                                delay_all=0,
                                delay_user=0,
                                description='Blacklist a link',
                                examples=[
                                    CommandExample(None, 'Add a link to the blacklist for a shallow search',
                                        chat='user:!add link blacklist --shallow scamlink.lonk/\n'
                                        'bot>user:Successfully added your links',
                                        description='Added the link scamlink.lonk/ to the blacklist for a shallow search').parse(),
                                    CommandExample(None, 'Add a link to the blacklist for a deep search',
                                        chat='user:!add link blacklist --deep scamlink.lonk/\n'
                                        'bot>user:Successfully added your links',
                                        description='Added the link scamlink.lonk/ to the blacklist for a deep search').parse(),
                                    ]),
                            'whitelist': Command.raw_command(self.add_link_whitelist,
                                level=500,
                                delay_all=0,
                                delay_user=0,
                                description='Whitelist a link',
                                examples=[
                                    CommandExample(None, 'Add a link to the whitelist',
                                        chat='user:!add link whitelink safelink.lonk/\n'
                                        'bot>user:Successfully added your links',
                                        description='Added the link safelink.lonk/ to the whitelist').parse(),
                                    ]),
                            }
                        )
                    }
                )

        self.commands['remove'] = Command.multiaction_command(
                level=100,
                delay_all=0,
                delay_user=0,
                default=None,
                command='remove',
                commands={
                    'link': Command.multiaction_command(
                        level=500,
                        delay_all=0,
                        delay_user=0,
                        default=None,
                        commands={
                            'blacklist': Command.raw_command(self.remove_link_blacklist,
                                level=500,
                                delay_all=0,
                                delay_user=0,
                                description='Remove a link from the blacklist.',
                                examples=[
                                    CommandExample(None, 'Remove a link from the blacklist.',
                                        chat='user:!remove link blacklist 20\n'
                                        'bot>user:Successfully removed blacklisted link with id 20',
                                        description='Remove a link from the blacklist with an ID').parse(),
                                    ]),
                            'whitelist': Command.raw_command(self.remove_link_whitelist,
                                level=500,
                                delay_all=0,
                                delay_user=0,
                                description='Remove a link from the whitelist.',
                                examples=[
                                    CommandExample(None, 'Remove a link from the whitelist.',
                                        chat='user:!remove link whitelist 12\n'
                                        'bot>user:Successfully removed blacklisted link with id 12',
                                        description='Remove a link from the whitelist with an ID').parse(),
                                    ]),
                            }
                        ),
                    }
                )
Exemple #35
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
Exemple #36
0
    def load_commands(self, **options):
        self.commands["setdeck"] = Command.raw_command(
            self.set_deck,
            level=420,
            delay_all=0,
            delay_user=0,
            description="Sets the deck that is currently playing.",
            examples=[
                CommandExample(
                    None,
                    "Add a new deck",
                    chat="user:!set deck http://i.imgur.com/rInqJv0.png\n"
                    "bot>user:This deck is a new deck. Its ID is 32",
                    description=
                    "This is the output if you set a deck which hasn't been set before.",
                ).parse(),
                CommandExample(
                    None,
                    "Set a pre-existing deck",
                    chat="user:!set deck http://i.imgur.com/rInqJv0.png\n"
                    "bot>user:Updated an already-existing deck. Its ID is 32",
                    description=
                    "This is the output if you set a deck which was added previously.",
                ).parse(),
            ],
        )
        self.commands["set"] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command="set",
            commands={"deck": self.commands["setdeck"]},
        )

        self.commands["update"] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command="update",
            commands={
                "deck":
                Command.raw_command(
                    self.update_deck,
                    level=420,
                    description="Updates an already-existing deck.",
                    examples=[
                        CommandExample(
                            None,
                            "Set the name and class of the current deck",
                            chat=
                            "user:!update deck --name Midrange Secret --class paladin\n"
                            "bot>user:Updated deck with ID 32. Updated name, class",
                        ).parse(),
                        CommandExample(
                            None,
                            "Updates the link of the current deck",
                            chat=
                            "user:!update deck --link http://i.imgur.com/QEVwrVV.png\n"
                            "bot>user:Updated deck with ID 32. Updated link",
                            description=
                            "Changes the link of the current deck. This could be used if you want to reupload the screenshot to imgur or something.",
                        ).parse(),
                        CommandExample(
                            None,
                            "Set the name and class of an old deck",
                            chat=
                            "user:!update deck --id 12 --name Aggro --class hunter\n"
                            "bot>user:Updated deck with ID 12. Updated name, class",
                            description=
                            "Updates the name and class of an old deck. Useful for whenever you need to clean up old decks.",
                        ).parse(),
                    ],
                )
            },
        )

        self.commands["remove"] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command="remove",
            commands={
                "deck":
                Command.raw_command(
                    self.remove_deck,
                    level=420,
                    description="Removes a deck with the given ID.",
                    examples=[
                        CommandExample(
                            None,
                            "Remove a deck by ID",
                            chat="user:!remove deck 123\n"
                            "bot>user:Successfully removed the deck.",
                            description="The ID in this case is 123",
                        ).parse(),
                        CommandExample(
                            None,
                            "Remove a deck by URL",
                            chat=
                            "user:!remove deck http://i.imgur.com/rInqJv0.png\n"
                            "bot>user:Successfully removed the deck.",
                            description=
                            "The URL in this case is http://i.imgur.com/rInqJv0.png",
                        ).parse(),
                    ],
                )
            },
        )
Exemple #37
0
    def load_commands(self, **options):
        commands = {
                'link': Command.raw_command(
                    self.link,
                    level=100,
                    delay_all=self.settings['global_cd'],
                    delay_user=self.settings['user_cd'],
                    description='Get link to your dubtrack',
                    examples=[
                        CommandExample(
                            None,
                            'Ask bot for dubtrack link',
                            chat='user:!dubtrack link\n'
                            'bot:Request your songs at https://dubtrack.fm/join/pajlada').parse(),
                        ],
                    ),
                'song': Command.raw_command(
                    self.song,
                    level=100,
                    delay_all=self.settings['global_cd'],
                    delay_user=self.settings['user_cd'],
                    description='Get current song',
                    run_in_thread=True,
                    examples=[
                        CommandExample(
                            None,
                            'Ask bot for current song (youtube)',
                            chat='user:!dubtrack song\n'
                            'bot:Current song: NOMA - Brain Power, link: https://youtu.be/9R8aSKwTEMg').parse(),
                        CommandExample(
                            None,
                            'Ask bot for current song (soundcloud)',
                            chat='user:!dubtrack song\n'
                            'bot:Current song: This is Bondage, link: https://soundcloud.com/razq35/nightlife').parse(),
                        CommandExample(
                            None,
                            'Ask bot for current song (nothing playing)',
                            chat='user:!dubtrack song\n'
                            'bot:There\'s no song playing right now FeelsBadMan').parse(),
                        ],
                    ),
                'update': Command.raw_command(
                    self.update,
                    level=500,
                    delay_all=self.settings['global_cd'],
                    delay_user=self.settings['user_cd'],
                    description='Force reloading the song and get current song',
                    run_in_thread=True,
                    ),
                }
        if self.settings['if_short_alias']:
            commands['l'] = commands['link']
            commands['s'] = commands['song']
            commands['u'] = commands['update']

        self.commands['dubtrack'] = Command.multiaction_command(
            level=100,
            default='link',  # If the user does not input any argument
            fallback='link',  # If the user inputs an invalid argument
            command='dubtrack',
            commands=commands,
            )

        if self.settings['if_dt_alias']:
            self.commands['dt'] = self.commands['dubtrack']

        if self.settings['if_song_alias']:
            self.commands['song'] = commands['song']
Exemple #38
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
Exemple #39
0
    def load_commands(self, **options):
        try:
            level_trusted_mods = 100 if self.bot.trusted_mods else 500
            mod_only_trusted_mods = True if self.bot.trusted_mods else False
        except AttributeError:
            level_trusted_mods = 500
            mod_only_trusted_mods = False

        if self.settings['allow_subs']:
            add_highlight_level = 100
            mod_only_trusted_mods = False
        else:
            add_highlight_level = level_trusted_mods

        self.commands['add'] = Command.multiaction_command(
                level=100,
                delay_all=0,
                delay_user=0,
                default=None,
                command='add',
                commands={
                    'highlight': Command.raw_command(self.add_highlight,
                        level=add_highlight_level,
                        delay_all=30 if self.settings['allow_subs'] else 0,
                        delay_user=60 if self.settings['allow_subs'] else 4,
                        mod_only=mod_only_trusted_mods,
                        sub_only=self.settings['allow_subs'],
                        description='Creates a highlight at the current timestamp',
                        examples=[
                            CommandExample(None, 'Create a highlight',
                                chat='user:!add highlight 1v5 Pentakill\n'
                                'bot>user:Successfully created your highlight',
                                description='Creates a highlight with the description 1v5 Pentakill').parse(),
                            CommandExample(None, 'Create a highlight with a different offset',
                                chat='user:!add highlight 1v5 Pentakill --offset 60\n'
                                'bot>user:Successfully created your highlight',
                                description='Creates a highlight with the description 1v5 Pentakill and an offset of 60 seconds.').parse(),
                            ]),
                        }
                )

        self.commands['edit'] = Command.multiaction_command(
                level=100,
                delay_all=0,
                delay_user=0,
                default=None,
                command='edit',
                commands={
                    'highlight': Command.raw_command(self.edit_highlight,
                        level=level_trusted_mods,
                        mod_only=mod_only_trusted_mods,
                        description='Edit the highlight with the given ID',
                        examples=[
                            CommandExample(None, 'Change the offset with the given ID.',
                                chat='user:!edit highlight --offset 180 --id 12\n'
                                'bot>user:Successfully updated your highlight (offset)',
                                description='Changes the offset to 180 seconds for the highlight ID 12').parse(),
                            CommandExample(None, 'Change the description with the given ID.',
                                chat='user:!edit highlight 1v5 Pentakill PogChamp VAC --id 12\n'
                                'bot>user:Successfully updated your highlight (description)',
                                description='Changes the description to \'1v5 Pentakill PogChamp VAC\' for highlight ID 12.').parse(),
                            CommandExample(None, 'Change the VOD link to a mirror link.',
                                chat='user:!edit highlight --id 12 --link http://www.twitch.tv/imaqtpie/v/27878606\n'  # TODO turn off autolink
                                'bot>user:Successfully updated your highlight (override_link)',
                                description='Changes the link for highlight ID 12 to http://www.twitch.tv/imaqtpie/v/27878606').parse(),
                            CommandExample(None, 'Change the mirror link back to the VOD link.',
                                chat='user:!edit highlight --id 12 --no-link\n'
                                'bot>user:Successfully updated your highlight (override_link)',
                                description='Changes the link for highlight ID 12 back to the twitch VOD link.').parse(),
                            ]),
                    }
                )

        self.commands['remove'] = Command.multiaction_command(
                level=100,
                delay_all=0,
                delay_user=0,
                default=None,
                command='remove',
                commands={
                    'highlight': Command.raw_command(self.remove_highlight,
                        level=level_trusted_mods,
                        mod_only=mod_only_trusted_mods,
                        description='Removes a highlight with the given ID.',
                        examples=[
                            CommandExample(None, 'Remove a highlight',
                                chat='user:!remove highlight 2\n'
                                'bot>user:Successfully removed highlight with ID 2.',
                                description='Removes the highlight ID 2').parse(),
                            ]),
                    }
                )
Exemple #40
0
    def load_commands(self, **options):
        self.commands['add'] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command='add',
            commands={
                'link':
                Command.multiaction_command(
                    level=500,
                    delay_all=0,
                    delay_user=0,
                    default=None,
                    commands={
                        'blacklist':
                        Command.raw_command(
                            self.add_link_blacklist,
                            level=500,
                            description='Blacklist a link',
                            examples=[
                                CommandExample(
                                    None,
                                    'Add a link to the blacklist for shallow search',
                                    chat=
                                    'user:!add link blacklist 0 scamlink.lonk/\n'
                                    'bot>user:Successfully added your links',
                                    description=
                                    'Added the link scamlink.lonk/ to the blacklist for a shallow search'
                                ).parse(),
                                CommandExample(
                                    None,
                                    'Add a link to the blacklist for deep search',
                                    chat=
                                    'user:!add link blacklist 1 scamlink.lonk/\n'
                                    'bot>user:Successfully added your links',
                                    description=
                                    'Added the link scamlink.lonk/ to the blacklist for a deep search'
                                ).parse(),
                            ]),
                        'whitelist':
                        Command.raw_command(
                            self.add_link_whitelist,
                            level=500,
                            description='Whitelist a link',
                            examples=[
                                CommandExample(
                                    None,
                                    'Add a link to the whitelist',
                                    chat=
                                    'user:!add link whitelink safelink.lonk/\n'
                                    'bot>user:Successfully added your links',
                                    description=
                                    'Added the link safelink.lonk/ to the whitelist'
                                ).parse(),
                            ]),
                    })
            })

        self.commands['remove'] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command='remove',
            commands={
                'link':
                Command.multiaction_command(
                    level=500,
                    delay_all=0,
                    delay_user=0,
                    default=None,
                    commands={
                        'blacklist':
                        Command.raw_command(
                            self.remove_link_blacklist,
                            level=500,
                            description='Unblacklist a link',
                            examples=[
                                CommandExample(
                                    None,
                                    'Remove a blacklist link',
                                    chat=
                                    'user:!remove link blacklist scamtwitch.scam\n'
                                    'bot>user:Successfully removed your links',
                                    description=
                                    'Removes scamtwitch.scam as a blacklisted link'
                                ).parse(),
                            ]),
                        'whitelist':
                        Command.raw_command(
                            self.remove_link_whitelist,
                            level=500,
                            description='Unwhitelist a link',
                            examples=[
                                CommandExample(
                                    None,
                                    'Remove a whitelist link',
                                    chat=
                                    'user:!remove link whitelist twitch.safe\n'
                                    'bot>user:Successfully removed your links',
                                    description=
                                    'Removes twitch.safe as a whitelisted link'
                                ).parse(),
                            ]),
                    }),
            })
Exemple #41
0
    def load_commands(self, **options):
        self.commands['setdeck'] = Command.raw_command(self.set_deck,
                level=420,
                delay_all=0,
                delay_user=0,
                description='Sets the deck that is currently playing.',
                examples=[
                    CommandExample(None, 'Add a new deck',
                        chat='user:!set deck http://i.imgur.com/rInqJv0.png\n'
                        'bot>user:This deck is a new deck. Its ID is 32',
                        description='This is the output if you set a deck which hasn\'t been set before.').parse(),
                    CommandExample(None, 'Set a pre-existing deck',
                        chat='user:!set deck http://i.imgur.com/rInqJv0.png\n'
                        'bot>user:Updated an already-existing deck. Its ID is 32',
                        description='This is the output if you set a deck which was added previously.').parse(),
                    ])
        self.commands['set'] = Command.multiaction_command(
                level=100,
                delay_all=0,
                delay_user=0,
                default=None,
                command='set',
                commands={
                    'deck': self.commands['setdeck']
                        })

        self.commands['update'] = Command.multiaction_command(
                level=100,
                delay_all=0,
                delay_user=0,
                default=None,
                command='update',
                commands={
                    'deck': Command.raw_command(self.update_deck,
                        level=420,
                        description='Updates an already-existing deck.',
                        examples=[
                            CommandExample(None, 'Set the name and class of the current deck',
                                chat='user:!update deck --name Midrange Secret --class paladin\n'
                                'bot>user:Updated deck with ID 32. Updated name, class').parse(),
                            CommandExample(None, 'Updates the link of the current deck',
                                chat='user:!update deck --link http://i.imgur.com/QEVwrVV.png\n'
                                'bot>user:Updated deck with ID 32. Updated link',
                                description='Changes the link of the current deck. This could be used if you want to reupload the screenshot to imgur or something.').parse(),
                            CommandExample(None, 'Set the name and class of an old deck',
                                chat='user:!update deck --id 12 --name Aggro --class hunter\n'
                                'bot>user:Updated deck with ID 12. Updated name, class',
                                description='Updates the name and class of an old deck. Useful for whenever you need to clean up old decks.').parse(),
                            ]),
                    })

        self.commands['remove'] = Command.multiaction_command(
                level=100,
                delay_all=0,
                delay_user=0,
                default=None,
                command='remove',
                commands={
                    'deck': Command.raw_command(self.remove_deck,
                        level=420,
                        description='Removes a deck with the given ID.',
                        examples=[
                            CommandExample(None, 'Remove a deck by ID',
                                chat='user:!remove deck 123\n'
                                'bot>user:Successfully removed the deck.',
                                description='The ID in this case is 123').parse(),
                            CommandExample(None, 'Remove a deck by URL',
                                chat='user:!remove deck http://i.imgur.com/rInqJv0.png\n'
                                'bot>user:Successfully removed the deck.',
                                description='The URL in this case is http://i.imgur.com/rInqJv0.png').parse(),
                            ]),
                    })
Exemple #42
0
    def load_commands(self, **options):
        self.commands['predict'] = Command.multiaction_command(
                level=100,
                default='vote',
                fallback='vote',
                delay_all=0,
                delay_user=0,
                commands={
                    'vote': Command.raw_command(self.predict,
                        delay_all=0,
                        delay_user=10,
                        sub_only=self.settings['sub_only'],
                        can_execute_with_whisper=True,
                        description='Predict how many wins will occur in the ' + self.settings['challenge_name'] + ' challenge'),
                    'new': Command.raw_command(self.new_predict,
                        delay_all=10,
                        delay_user=10,
                        description='Starts a new ' + self.settings['challenge_name'] + ' run',
                        level=750),
                    'end': Command.raw_command(self.end_predict,
                        delay_all=10,
                        delay_user=10,
                        description='Ends a ' + self.settings['challenge_name'] + ' run',
                        level=750),
                    'close': Command.raw_command(self.close_predict,
                        delay_all=10,
                        delay_user=10,
                        description='Close submissions to the latest ' + self.settings['challenge_name'] + ' run',
                        level=750),
                    }
                )

        # XXX: DEPRECATED, WILL BE REMOVED
        self.commands['newpredict'] = Command.raw_command(self.new_predict_depr,
                delay_all=10,
                delay_user=10,
                description='Starts a new ' + self.settings['challenge_name'] + ' run',
                level=750)
        self.commands['endpredict'] = Command.raw_command(self.end_predict_depr,
                delay_all=10,
                delay_user=10,
                description='Ends a ' + self.settings['challenge_name'] + ' run',
                level=750)
        self.commands['closepredict'] = Command.raw_command(self.close_predict_depr,
                delay_all=10,
                delay_user=10,
                description='Close submissions to the latest ' + self.settings['challenge_name'] + ' run',
                level=750)

        mini_command = self.settings['mini_command'].lower().replace('!', '').replace(' ', '')
        if len(mini_command) > 0:
            self.commands[mini_command] = Command.multiaction_command(
                    level=100,
                    default='vote',
                    fallback='vote',
                    delay_all=0,
                    delay_user=0,
                    commands={
                        'vote': Command.raw_command(self.mini_predict,
                            delay_all=0,
                            delay_user=10,
                            sub_only=self.settings['sub_only'],
                            can_execute_with_whisper=True,
                            description='Predict how many wins will occur in the ' + self.settings['challenge_name'] + ' challenge'),
                        'new': Command.raw_command(self.mini_new_predict,
                            delay_all=10,
                            delay_user=10,
                            description='Starts a new ' + self.settings['challenge_name'] + ' run',
                            level=750),
                        'end': Command.raw_command(self.mini_end_predict,
                            delay_all=10,
                            delay_user=10,
                            description='Ends a ' + self.settings['challenge_name'] + ' run',
                            level=750),
                        'close': Command.raw_command(self.mini_close_predict,
                            delay_all=10,
                            delay_user=10,
                            description='Close submissions to the latest ' + self.settings['challenge_name'] + ' run',
                            level=750),
                        }
                    )
Exemple #43
0
    def load_commands(self, **options):
        try:
            level_trusted_mods = 100 if self.bot.trusted_mods else 500
            mod_only_trusted_mods = True if self.bot.trusted_mods else False
        except AttributeError:
            level_trusted_mods = 500
            mod_only_trusted_mods = False

        if self.settings['allow_subs']:
            add_highlight_level = 100
            mod_only_trusted_mods = False
        else:
            add_highlight_level = level_trusted_mods

        self.commands['add'] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command='add',
            commands={
                'highlight':
                Command.raw_command(
                    self.add_highlight,
                    level=add_highlight_level,
                    delay_all=30 if self.settings['allow_subs'] else 0,
                    delay_user=60 if self.settings['allow_subs'] else 4,
                    mod_only=mod_only_trusted_mods,
                    sub_only=self.settings['allow_subs'],
                    description='Creates a highlight at the current timestamp',
                    examples=[
                        CommandExample(
                            None,
                            'Create a highlight',
                            chat='user:!add highlight 1v5 Pentakill\n'
                            'bot>user:Successfully created your highlight',
                            description=
                            'Creates a highlight with the description 1v5 Pentakill'
                        ).parse(),
                        CommandExample(
                            None,
                            'Create a highlight with a different offset',
                            chat=
                            'user:!add highlight 1v5 Pentakill --offset 60\n'
                            'bot>user:Successfully created your highlight',
                            description=
                            'Creates a highlight with the description 1v5 Pentakill and an offset of 60 seconds.'
                        ).parse(),
                    ]),
            })

        self.commands['edit'] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command='edit',
            commands={
                'highlight':
                Command.raw_command(
                    self.edit_highlight,
                    level=level_trusted_mods,
                    mod_only=mod_only_trusted_mods,
                    description='Edit the highlight with the given ID',
                    examples=[
                        CommandExample(
                            None,
                            'Change the offset with the given ID.',
                            chat='user:!edit highlight --offset 180 --id 12\n'
                            'bot>user:Successfully updated your highlight (offset)',
                            description=
                            'Changes the offset to 180 seconds for the highlight ID 12'
                        ).parse(),
                        CommandExample(
                            None,
                            'Change the description with the given ID.',
                            chat=
                            'user:!edit highlight 1v5 Pentakill PogChamp VAC --id 12\n'
                            'bot>user:Successfully updated your highlight (description)',
                            description=
                            'Changes the description to \'1v5 Pentakill PogChamp VAC\' for highlight ID 12.'
                        ).parse(),
                        CommandExample(
                            None,
                            'Change the VOD link to a mirror link.',
                            chat=
                            'user:!edit highlight --id 12 --link http://www.twitch.tv/imaqtpie/v/27878606\n'  # TODO turn off autolink
                            'bot>user:Successfully updated your highlight (override_link)',
                            description=
                            'Changes the link for highlight ID 12 to http://www.twitch.tv/imaqtpie/v/27878606'
                        ).parse(),
                        CommandExample(
                            None,
                            'Change the mirror link back to the VOD link.',
                            chat='user:!edit highlight --id 12 --no-link\n'
                            'bot>user:Successfully updated your highlight (override_link)',
                            description=
                            'Changes the link for highlight ID 12 back to the twitch VOD link.'
                        ).parse(),
                    ]),
            })

        self.commands['remove'] = Command.multiaction_command(
            level=100,
            delay_all=0,
            delay_user=0,
            default=None,
            command='remove',
            commands={
                'highlight':
                Command.raw_command(
                    self.remove_highlight,
                    level=level_trusted_mods,
                    mod_only=mod_only_trusted_mods,
                    description='Removes a highlight with the given ID.',
                    examples=[
                        CommandExample(
                            None,
                            'Remove a highlight',
                            chat='user:!remove highlight 2\n'
                            'bot>user:Successfully removed highlight with ID 2.',
                            description='Removes the highlight ID 2').parse(),
                    ]),
            })
Exemple #44
0
    def load_commands(self, **options):
        commands = {
            "link":
            Command.raw_command(
                self.link,
                level=100,
                delay_all=self.settings["global_cd"],
                delay_user=self.settings["user_cd"],
                description="Get link to your dubtrack",
                examples=[
                    CommandExample(
                        None,
                        "Ask bot for dubtrack link",
                        chat="user:!dubtrack link\n"
                        "bot:Request your songs at https://dubtrack.fm/join/pajlada",
                    ).parse()
                ],
            ),
            "song":
            Command.raw_command(
                self.song,
                level=100,
                delay_all=self.settings["global_cd"],
                delay_user=self.settings["user_cd"],
                description="Get current song",
                run_in_thread=True,
                examples=[
                    CommandExample(
                        None,
                        "Ask bot for current song (youtube)",
                        chat="user:!dubtrack song\n"
                        "bot:Current song: NOMA - Brain Power, link: https://youtu.be/9R8aSKwTEMg",
                    ).parse(),
                    CommandExample(
                        None,
                        "Ask bot for current song (soundcloud)",
                        chat="user:!dubtrack song\n"
                        "bot:Current song: This is Bondage, link: https://soundcloud.com/razq35/nightlife",
                    ).parse(),
                    CommandExample(
                        None,
                        "Ask bot for current song (nothing playing)",
                        chat="user:!dubtrack song\n"
                        "bot:There's no song playing right now FeelsBadMan",
                    ).parse(),
                ],
            ),
            "update":
            Command.raw_command(
                self.update,
                level=500,
                delay_all=self.settings["global_cd"],
                delay_user=self.settings["user_cd"],
                description="Force reloading the song and get current song",
                run_in_thread=True,
            ),
        }
        if self.settings["if_short_alias"]:
            commands["l"] = commands["link"]
            commands["s"] = commands["song"]
            commands["u"] = commands["update"]

        self.commands["dubtrack"] = Command.multiaction_command(
            level=100,
            default="link",  # If the user does not input any argument
            fallback="link",  # If the user inputs an invalid argument
            command="dubtrack",
            commands=commands,
        )

        if self.settings["if_dt_alias"]:
            self.commands["dt"] = self.commands["dubtrack"]

        if self.settings["if_song_alias"]:
            self.commands["song"] = commands["song"]