예제 #1
0
 def load_commands(self, **options):
     # TODO: Aliases should be set in settings?
     #       This way, it can be run alongside other modules
     self.commands['rank'] = Command.raw_command(self.league_rank,
             delay_all=15,
             delay_user=30,
             description='Check streamer\'s or other players League of Legends rank in chat.',
             examples=[
                 CommandExample(None, 'Check streamer\'s rank',
                     chat='user:!rank\n'
                     'bot: The Summoner Moregain Freeman on region EUW is currently in PLATINUM IV with 62 LP 4Head',
                     description='Bot says broadcaster\'s region, League-tier, division and LP').parse(),
                 CommandExample(None, 'Check other player\'s rank on default region',
                     chat='user:!rank forsen\n'
                     'bot: The Summoner forsen on region EUW is currently in SILVER IV with 36 LP 4Head',
                     description='Bot says player\'s region, League-tier, division and LP').parse(),
                 CommandExample(None, 'Check other player\'s rank on another region',
                     chat='user:!rank imaqtpie na\n'
                     'bot: The Summoner Imaqtpie on region NA is currently in CHALLENGER I with 441 LP 4Head',
                     description='Bot says player\'s region, League-tier, division and LP. Other regions to use as arguments: euw, eune, na, oce, br, kr, las, lan, ru, tr').parse(),
                 ],
             )
     self.commands['lolrank'] = self.commands['rank']
     self.commands['ranklol'] = self.commands['rank']
     self.commands['leaguerank'] = self.commands['rank']
예제 #2
0
 def load_commands(self, **options):
     self.commands["lolrank"] = Command.raw_command(
         self.league_rank,
         delay_all=self.settings["online_global_cd"],
         delay_user=self.settings["online_user_cd"],
         description="Check streamer's or other players League of Legends rank in chat.",
         examples=[
             CommandExample(
                 None,
                 "Check streamer's rank",
                 chat="user:!lolrank\n"
                 "bot: The Summoner Moregain Freeman on region EUW1 is currently in PLATINUM IV with 62 LP 4Head",
                 description="Bot says broadcaster's region, League-tier, division and LP",
             ).parse(),
             CommandExample(
                 None,
                 "Check other player's rank on default region",
                 chat="user:!lolrank forsen\n"
                 "bot: The Summoner forsen on region EUW1 is currently in SILVER IV with 36 LP 4Head",
                 description="Bot says player's region, League-tier, division and LP",
             ).parse(),
             CommandExample(
                 None,
                 "Check other player's rank on another region",
                 chat="user:!lolrank imaqtpie na1\n"
                 "bot: The Summoner Imaqtpie on region NA1 is currently in CHALLENGER I with 441 LP 4Head",
                 description="Bot says player's region, League-tier, division and LP. Other regions to use as arguments: br1, eun1, euw1, jp1, kr, la1, la2, na1, oc1, tr1, ru",
             ).parse(),
         ],
     )
     self.commands["ranklol"] = self.commands["lolrank"]
     self.commands["leaguerank"] = self.commands["lolrank"]
예제 #3
0
 def load_commands(self, **options):
     self.commands["ab"] = Command.raw_command(
         self.ab,
         delay_all=self.settings["global_cd"],
         delay_user=self.settings["user_cd"],
         level=self.settings["level"],
         description="Inject emote inbetween each letter/word in message",
         command="ab",
         examples=[
             CommandExample(
                 None,
                 "Inject emote inbetween each letter in message",
                 chat="user:!ab Keepo KEEPO\n"
                 "bot:pajlada, Keepo K Keepo E Keepo E Keepo P Keepo O Keepo",
                 description="",
             ).parse(),
             CommandExample(
                 None,
                 "Inject emote inbetween each word in message",
                 chat="user:!ab Kreygasm NOW THATS WHAT I CALL MUSIC\n"
                 "bot:pajlada, Kreygasm NOW Kreygasm THATS Kreygasm WHAT Kreygasm I Kreygasm CALL Kreygasm MUSIC Kreygasm",
                 description="",
             ).parse(),
         ],
     )
     self.commands["abc"] = self.commands["ab"]
예제 #4
0
    def load_commands(self, **options):
        self.commands["setgame"] = Command.raw_command(
            self.update_game,
            level=500,
            description="Update the stream's game",
            examples=[
                CommandExample(
                    None,
                    'Update the game to "World of Warcraft"',
                    chat="user:!setgame World of Warcraft\n"
                    'bot>user:pajlada updated the game to "World of Warcraft"',
                ).parse()
            ],
        )

        self.commands["settitle"] = Command.raw_command(
            self.update_title,
            level=500,
            description="Update the stream's title",
            examples=[
                CommandExample(
                    None,
                    'Update the title to "Games and shit"',
                    chat="user:!settitle Games and shit\n"
                    'bot>user:pajlada updated the title to "Games and shit"',
                ).parse()
            ],
        )
예제 #5
0
    def load_commands(self, **options):
        self.commands['permaban'] = Command.raw_command(
            self.permaban_command,
            level=1000,
            description=
            'Permanently ban a user. Every time the user types in chat, he will be permanently banned again',
            examples=[
                CommandExample(
                    None,
                    'Default usage',
                    chat='user:!permaban Karl_Kons\n'
                    'bot>user:Karl_Kons has now been permabanned',
                    description='Permanently ban Karl_Kons from the chat').
                parse(),
            ])

        self.commands['unpermaban'] = Command.raw_command(
            self.unpermaban_command,
            level=1000,
            description='Remove a permanent ban from a user',
            examples=[
                CommandExample(
                    None,
                    'Default usage',
                    chat='user:!unpermaban Karl_Kons\n'
                    'bot>user:Karl_Kons is no longer permabanned',
                    description='Remove permanent ban from Karl_Kons').parse(),
            ])
예제 #6
0
 def load_commands(self, **options):
     self.commands['duel'] = Command.raw_command(self.initiate_duel,
             delay_all=0,
             delay_user=5,
             description='Initiate a duel with a user',
             examples=[
                 CommandExample(None, '0-point duel',
                     chat='user:!duel Karl_Kons\n'
                     'bot>user:You have challenged Karl_Kons for 0 points',
                     description='Duel Karl_Kons for 0 points').parse(),
                 CommandExample(None, '69-point duel',
                     chat='user:!duel Karl_Kons 69\n'
                     'bot>user:You have challenged Karl_Kons for 69 points',
                     description='Duel Karl_Kons for 69 points').parse(),
                 ],
             )
     self.commands['cancelduel'] = Command.raw_command(self.cancel_duel,
             delay_all=0,
             delay_user=10)
     self.commands['accept'] = Command.raw_command(self.accept_duel,
             delay_all=0,
             delay_user=0)
     self.commands['decline'] = Command.raw_command(self.decline_duel,
             delay_all=0,
             delay_user=0)
     self.commands['deny'] = self.commands['decline']
     self.commands['duelstatus'] = Command.raw_command(self.status_duel,
             delay_all=0,
             delay_user=5)
     self.commands['duelstats'] = Command.raw_command(self.get_duel_stats,
             delay_all=0,
             delay_user=120)
예제 #7
0
    def load_commands(self, **options):
        self.commands["permaban"] = Command.raw_command(
            self.permaban_command,
            level=1000,
            description=
            "Permanently ban a user. Every time the user types in chat, he will be permanently banned again",
            examples=[
                CommandExample(
                    None,
                    "Default usage",
                    chat="user:!permaban Karl_Kons\n"
                    "bot>user:Karl_Kons has now been permabanned",
                    description="Permanently ban Karl_Kons from the chat",
                ).parse()
            ],
        )

        self.commands["unpermaban"] = Command.raw_command(
            self.unpermaban_command,
            level=1000,
            description="Remove a permanent ban from a user",
            examples=[
                CommandExample(
                    None,
                    "Default usage",
                    chat="user:!unpermaban Karl_Kons\n"
                    "bot>user:Karl_Kons is no longer permabanned",
                    description="Remove permanent ban from Karl_Kons",
                ).parse()
            ],
        )
예제 #8
0
 def load_commands(self, **options):
     self.commands["query"] = Command.raw_command(
         self.query,
         delay_all=self.settings["global_cd"],
         delay_user=self.settings["user_cd"],
         level=self.settings["level"],
         description="Ask Wolfram Alpha a question",
         command="query",
         examples=[
             CommandExample(
                 None,
                 "Ask Wolfram Alpha how big the moon is",
                 chat="user:!query how big is the moon?\n"
                 "bot:troydota, Input interpretation: Moon | average radius ❚ Result: 1737.4 km (kilometers)",
                 description="",
             ).parse(),
             CommandExample(
                 None,
                 "Ask Wolfram Alpha what time it is, relative to the location set in the module",
                 chat="user:!query what is the time?\n"
                 "bot:troydota, Input interpretation: current time ❚ Result: 2:22:02 pm CEST | Saturday, July 13, 2019",
                 description="",
             ).parse(),
             CommandExample(
                 None,
                 "Ask Wolfram Alpha where your car is",
                 chat="user:!query where is my car\n"
                 "bot:TETYYS, Input interpretation: Where is my car (truck, ...)? ❚ Result: Not sure, but wherever you find it, that's where it is.",
                 description="",
             ).parse(),
         ],
     )
     self.commands["wolfram"] = self.commands["query"]
     self.commands["wolframquery"] = self.commands["query"]
예제 #9
0
 def load_commands(self, **options):
     self.commands[self.settings['command_name'].lower(
     ).replace('!', '').replace(' ', '')] = Command.raw_command(
         self.paid_timeout,
         cost=self.settings['cost'],
         examples=[
             CommandExample(
                 None,
                 'Timeout someone for {0} seconds'.format(
                     self.settings['timeout_length']),
                 chat='user:!{0} paja\n'
                 'bot>user: You just used {1} points to time out paja for an additional {2} seconds.'
                 .format(self.settings['command_name'],
                         self.settings['cost'],
                         self.settings['timeout_length']),
                 description='').parse(),
         ])
     if self.settings['second_command']:
         self.commands[self.settings['command_name2'].lower(
         ).replace('!', '').replace(' ', '')] = Command.raw_command(
             self.paid_timeout2,
             cost=self.settings['cost2'],
             examples=[
                 CommandExample(
                     None,
                     'Timeout someone for {0} seconds'.format(
                         self.settings['timeout_length2']),
                     chat='user:!{0} paja\n'
                     'bot>user: You just used {1} points to time out paja for an additional {2} seconds.'
                     .format(self.settings['command_name2'],
                             self.settings['cost2'],
                             self.settings['timeout_length2']),
                     description='').parse(),
             ])
예제 #10
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(),
                 ]),
         })
예제 #11
0
    def load_commands(self, **options):
        setgame_trigger = self.settings["setgame_trigger"].lower().replace("!", "").replace(" ", "")
        self.commands[setgame_trigger] = Command.raw_command(
            self.update_game,
            level=self.settings["level"],
            description="Update the stream's game",
            examples=[
                CommandExample(
                    None,
                    'Update the game to "World of Warcraft"',
                    chat=f"user:!{setgame_trigger} World of Warcraft\n"
                    'bot>user:pajlada updated the game to "World of Warcraft"',
                ).parse()
            ],
        )

        settitle_trigger = self.settings["settitle_trigger"].lower().replace("!", "").replace(" ", "")
        self.commands[settitle_trigger] = Command.raw_command(
            self.update_title,
            level=self.settings["level"],
            description="Update the stream's title",
            examples=[
                CommandExample(
                    None,
                    'Update the title to "Games and shit"',
                    chat=f"user:!{settitle_trigger} Games and shit\n"
                    'bot>user:pajlada updated the title to "Games and shit"',
                ).parse()
            ],
        )
예제 #12
0
 def load_commands(self, **options):
     if self.settings['untimeout_enable']:
         self.commands[self.settings['untimeout_command_name'].lower().replace('!', '').replace(' ', '')] = Command.raw_command(self.untimeout_source,
             cost=self.settings['untimeout_cost'],
             delay_all=0,
             delay_user=15,
             can_execute_with_whisper=True,
             description='Timed out for no apparent reason? Untimeout yourself using points!',
             examples=[
                 CommandExample(None,
                     'Untimeout yourself for {0} points'.format(self.settings['untimeout_cost']),
                     chat='user>bot:!{0}\n'
                     'bot>user: You have been unbanned.'.format(self.settings['untimeout_command_name']),
                     description='').parse(),
             ])
     if self.settings['unban_enable']:
         self.commands[self.settings['unban_command_name'].lower().replace('!', '').replace(' ', '')] = Command.raw_command(self.unban_source,
             cost=self.settings['unban_cost'],
             delay_all=0,
             delay_user=15,
             can_execute_with_whisper=True,
             description='Banned for no apparent reason? Unban yourself using points!',
             examples=[
                 CommandExample(None,
                     'Unban yourself for {0} points'.format(self.settings['unban_cost']),
                     chat='user>bot:!{0}\n'
                     'bot>user: You have been unbanned.'.format(self.settings['unban_command_name']),
                     description='').parse(),
             ])
예제 #13
0
 def load_commands(self, **options):
     self.commands['raffle'] = Command.raw_command(self.raffle,
             delay_all=0,
             delay_user=0,
             level=500,
             description='Start a raffle for points',
             examples=[
                 CommandExample(None, 'Start a raffle for 69 points',
                     chat='user:!raffle 69\n'
                     'bot:A raffle has begun for 69 points. Type !join to join the raffle! The raffle will end in in 60 seconds.',
                     description='Start a 60-second raffle for 69 points').parse(),
                 CommandExample(None, 'Start a raffle for the default value of {} points',
                     chat='user:!raffle 69 30\n'
                     'bot:A raffle has begun for 69 points. Type !join to join the raffle! The raffle will end in in 30 seconds.',
                     description='Start a 30-second raffle for 69 points').parse(),
                 ],
             )
     self.commands['join'] = Command.raw_command(self.join,
             delay_all=0,
             delay_user=5,
             description='Join a running raffle',
             examples=[
                 CommandExample(None, 'Join a running raffle',
                     chat='user:!join',
                     description='You don\'t get confirmation whether you joined the raffle or not.').parse(),
                 ],
             )
예제 #14
0
    def load_commands(self, **options):
        self.commands["ignore"] = Command.raw_command(
            self.ignore_command,
            level=1000,
            description="Ignore a user, which means he can't run any commands",
            examples=[
                CommandExample(
                    None,
                    "Default usage",
                    chat="user:!ignore Karl_Kons\n"
                    "bot>user:Now ignoring Karl_Kons",
                    description="Ignore user Karl_Kons",
                ).parse()
            ],
        )

        self.commands["unignore"] = Command.raw_command(
            self.unignore_command,
            level=1000,
            description="Unignore a user",
            examples=[
                CommandExample(
                    None,
                    "Default usage",
                    chat="user:!unignore Karl_Kons\n"
                    "bot>user:No longer ignoring Karl_Kons",
                    description="Unignore user Karl_Kons",
                ).parse()
            ],
        )
예제 #15
0
 def load_commands(self, **options):
     self.commands[self.settings["command_name"].lower(
     ).replace("!", "").replace(" ", "")] = Command.raw_command(
         self.paid_timeout,
         can_execute_with_whisper=False,
         examples=[
             CommandExample(
                 None,
                 f"Timeout someone for {self.settings['timeout_length']} seconds",
                 chat=
                 f"user:!{self.settings['command_name']} paja\nbot>user: You just used {self.settings['cost']} points to time out paja for an additional {self.settings['timeout_length']} seconds.",
                 description="",
             ).parse()
         ],
     )
     if self.settings["second_command"]:
         self.commands[self.settings["command_name2"].lower(
         ).replace("!", "").replace(" ", "")] = Command.raw_command(
             self.paid_timeout2,
             can_execute_with_whisper=False,
             examples=[
                 CommandExample(
                     None,
                     f"Timeout someone for {self.settings['timeout_length2']} seconds",
                     chat=
                     f"user:!{self.settings['command_name2']} synderen\nbot>user: You just used {self.settings['cost2']} points to time out synderen for an additional {self.settings['timeout_length2']} seconds.",
                     description="",
                 ).parse()
             ],
         )
예제 #16
0
    def load_commands(self, **options):
        self.commands["w"] = Command.raw_command(
            self.whisper,
            level=2000,
            description="Send a whisper from the bot")
        self.commands["editpoints"] = Command.raw_command(
            self.edit_points,
            level=1500,
            description="Modifies a user's points",
            examples=[
                CommandExample(
                    None,
                    "Give a user points",
                    chat="user:!editpoints pajlada 500\n"
                    "bot>user:Successfully gave pajlada 500 points.",
                    description=
                    "This creates 500 points and gives them to pajlada",
                ).parse(),
                CommandExample(
                    None,
                    "Remove points from a user",
                    chat="user:!editpoints pajlada -500\n"
                    "bot>user:Successfully removed 500 points from pajlada.",
                    description=
                    "This removes 500 points from pajlada. Users can go into negative points with this.",
                ).parse(),
            ],
        )
        self.commands["setpoints"] = Command.raw_command(
            self.set_points,
            level=1500,
            description="Sets a user's points",
            examples=[
                CommandExample(
                    None,
                    "Set a user's points",
                    chat="user:!setpoints pajlada 500\n"
                    "bot>user:Successfully set pajlada's points to 500.",
                    description="This sets pajlada's points to 500.",
                ).parse()
            ],
        )
        self.commands["level"] = Command.raw_command(
            self.level, level=1000, description="Set a users level")

        self.commands["silence"] = Command.raw_command(
            self.cmd_silence, level=500, description="Silence the bot")
        self.commands["mute"] = self.commands["silence"]

        self.commands["unsilence"] = Command.raw_command(
            self.cmd_unsilence, level=500, description="Unsilence the bot")
        self.commands["unmute"] = self.commands["unsilence"]

        self.commands["module"] = Command.raw_command(
            self.cmd_module,
            level=500,
            description="Modify module",
            delay_all=0,
            delay_user=0)
예제 #17
0
파일: debug.py 프로젝트: galoncyryll/pajbot
 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()
                 ],
             ),
         },
     )
예제 #18
0
 def load_commands(self, **options):
     self.commands['#playsound'] = Command.raw_command(
         self.play_sound,
         tokens_cost=self.settings['token_cost'],
         cost=self.settings['point_cost'],
         sub_only=True,
         description=
         'Play a sound on stream! Costs {} tokens, sub only for now.'.
         format(self.settings['token_cost']),
         can_execute_with_whisper=True,
         examples=[
             CommandExample(
                 None,
                 'Play the "cumming" sample',
                 chat='user:!#playsound cumming\n'
                 'bot>user:Successfully played your sample cumming').parse(
                 ),
             CommandExample(
                 None,
                 'Play the "fuckyou" sample',
                 chat='user:!#playsound fuckyou\n'
                 'bot>user:Successfully played your sample fuckyou').parse(
                 ),
         ],
     )
     global_script = """<script>
         function playOrStopSound(elem, audio) {
             if(elem.innerHTML=="Play") {
                 elem.innerHTML="Stop";
                 audio.play();
             } else {
                 elem.innerHTML="Play";
                 audio.pause();
                 audio.currentTime=0;
             }
         }
         </script>"""
     local_script = """<script>
         var elem{0.command}=document.getElementById('btnTogglePlay{0.command}');
         var snd{0.command} = new Audio("{0.href}");
         snd{0.command}.onended=function(){{elem{0.command}.innerHTML='Play';}};
         elem{0.command}.addEventListener("click", function(){{ playOrStopSound(elem{0.command}, snd{0.command}); }});
     </script>"""
     html_valid_samples = global_script
     for sample in Samples.all_samples:
         parsed_sample = local_script.format(sample)
         html_valid_samples += ''.join([
             '<tr><td class="command-sample{1}">!#playsound {0.command}</td><td><button id="btnTogglePlay{0.command}">Play</button>{2}</td></tr>'
             .format(sample, ' new' if sample.new else '', parsed_sample)
         ])
     self.commands[
         '#playsound'].long_description = '<h5 style="margin-top: 20px;">Valid samples</h5><table>{}</table>'.format(
             html_valid_samples)
예제 #19
0
    def load_commands(self, **options):
        self.commands['singleraffle'] = Command.raw_command(self.raffle,
                delay_all=0,
                delay_user=0,
                level=500,
                description='Start a raffle for points',
                command='raffle',
                examples=[
                    CommandExample(None, 'Start a raffle for 69 points',
                        chat='user:!raffle 69\n'
                        'bot:A raffle has begun for 69 points. Type !join to join the raffle! The raffle will end in 60 seconds.',
                        description='Start a 60-second raffle for 69 points').parse(),
                    CommandExample(None, 'Start a raffle with a different length',
                        chat='user:!raffle 69 30\n'
                        'bot:A raffle has begun for 69 points. Type !join to join the raffle! The raffle will end in 30 seconds.',
                        description='Start a 30-second raffle for 69 points').parse(),
                    ],
                )
        self.commands['sraffle'] = self.commands['singleraffle']
        self.commands['join'] = Command.raw_command(self.join,
                delay_all=0,
                delay_user=5,
                description='Join a running raffle',
                examples=[
                    CommandExample(None, 'Join a running raffle',
                        chat='user:!join',
                        description='You don\'t get confirmation whether you joined the raffle or not.').parse(),
                    ],
                )
        if self.settings['multi_enabled']:
            self.commands['multiraffle'] = Command.raw_command(self.multi_raffle,
                    delay_all=0,
                    delay_user=0,
                    level=500,
                    description='Start a multi-raffle for points',
                    command='multiraffle',
                    examples=[
                        CommandExample(None, 'Start a multi-raffle for 69 points',
                            chat='user:!multiraffle 69\n'
                            'bot:A multi-raffle has begun for 69 points. Type !join to join the raffle! The raffle will end in 60 seconds.',
                            description='Start a 60-second raffle for 69 points').parse(),
                        CommandExample(None, 'Start a multi-raffle with a different length',
                            chat='user:!multiraffle 69 30\n'
                            'bot:A multi-raffle has begun for 69 points. Type !join to join the raffle! The raffle will end in 30 seconds.',
                            description='Start a 30-second multi-raffle for 69 points').parse(),
                        ],
                    )
            self.commands['mraffle'] = self.commands['multiraffle']

        if self.settings['default_raffle_type'] == 'Multi Raffle' and self.settings['multi_enabled']:
            self.commands['raffle'] = self.commands['multiraffle']
        else:
            self.commands['raffle'] = self.commands['singleraffle']
예제 #20
0
파일: duel.py 프로젝트: sgaweda/troybot
 def load_commands(self, **options):
     self.commands["duel"] = Command.raw_command(
         self.initiate_duel,
         delay_all=self.settings["online_global_cd"],
         delay_user=self.settings["online_user_cd"],
         description="Initiate a duel with a user",
         examples=[
             CommandExample(
                 None,
                 "0-point duel",
                 chat="user:!duel Karl_Kons\n"
                 "bot>user:You have challenged Karl_Kons for 0 points",
                 description="Duel Karl_Kons for 0 points",
             ).parse(),
             CommandExample(
                 None,
                 "69-point duel",
                 chat="user:!duel Karl_Kons 69\n"
                 "bot>user:You have challenged Karl_Kons for 69 points",
                 description="Duel Karl_Kons for 69 points",
             ).parse(),
         ],
     )
     self.commands["cancelduel"] = Command.raw_command(
         self.cancel_duel,
         delay_all=0,
         delay_user=10,
         description="Cancel your duel request")
     self.commands["accept"] = Command.raw_command(
         self.accept_duel,
         delay_all=0,
         delay_user=0,
         description="Accept a duel request")
     self.commands["decline"] = Command.raw_command(
         self.decline_duel,
         delay_all=0,
         delay_user=0,
         description="Decline a duel request")
     self.commands["deny"] = self.commands["decline"]
     self.commands["duelstatus"] = Command.raw_command(
         self.status_duel,
         delay_all=0,
         delay_user=5,
         description="Current duel request info")
     self.commands["duelstats"] = Command.raw_command(
         self.get_duel_stats,
         delay_all=0,
         delay_user=120,
         description="Get your duel statistics")
예제 #21
0
    def load_commands(self, **options):
        from pajbot.models.command import Command
        from pajbot.models.command import CommandExample

        self.commands["longtimeout"] = Command.raw_command(
            self.long_timeout,
            level=500,
            description=
            "Timeout someone for a duration longer than Twitch allows",
            can_execute_with_whispers=True,
            examples=[
                CommandExample(
                    None,
                    "Timeout syndereN for three weeks",
                    chat="user:!longtimeout synderen 21\n"
                    "bot>user:Timed out syndereN for 21 days",
                ).parse()
            ],
        )

        self.commands["listtimeouts"] = Command.raw_command(
            self.list_timeouts,
            level=500,
            description="List pending timeouts",
            can_execute_with_whispers=True,
            examples=[
                CommandExample(
                    None,
                    "Get wben timeouts expire",
                    chat="user:!listtimeouts\n"
                    "bot>user:syndereN: 2019-05-12 08:31:09",
                ).parse()
            ],
        )

        self.commands["removetimeout"] = Command.raw_command(
            self.remove_timeout,
            level=500,
            description="Remove unfulfilled timeout",
            can_execute_with_whispers=True,
            examples=[
                CommandExample(
                    None,
                    "Cancel syndereN's long timeout",
                    chat="user:!removetimeout syndereN\n"
                    "bot>user:Successfully cancelled syndereN's 14 day timeout",
                ).parse()
            ],
        )
예제 #22
0
 def load_commands(self, **options):
     self.commands["clip"] = Command.raw_command(
         self.clip,
         sub_only=self.settings["subscribers_only"],
         delay_all=self.settings["global_cd"],
         delay_user=self.settings["user_cd"],
         level=self.settings["level"],
         can_execute_with_whisper=bool(
             self.settings["response_method"] == "reply"),
         command="clip",
         examples=[
             CommandExample(
                 None,
                 "Make a new clip while the stream is online",
                 chat="user:!clip\n"
                 "bot: " + self.settings["online_response"].format(
                     source="pajlada",
                     streamer=StreamHelper.get_streamer(),
                     clip=
                     "https://clips.twitch.tv/ExpensiveWonderfulClamArsonNoSexy",
                 ),
                 description="",
             ).parse()
         ],
     )
예제 #23
0
 def load_commands(self, **options):
     # TODO: Aliases should be set in settings?
     #       This way, it can be run alongside other modules
     self.commands["song"] = Command.raw_command(
         self.song,
         delay_all=self.settings["global_cd"],
         delay_user=self.settings["user_cd"],
         description="Check what that is playing on the stream",
         examples=[
             CommandExample(
                 None,
                 "Check the current song",
                 chat="user:!song\n"
                 "bot: " + self.settings["current_song"].format(
                     source="pajlada",
                     streamer=StreamHelper.get_streamer(),
                     song="Adele - Hello",
                 ),
                 description=
                 "Bot mentions the name of the song and the artist currently playing on stream",
             ).parse()
         ],
     )
     self.commands["currentsong"] = self.commands["song"]
     self.commands["nowplaying"] = self.commands["song"]
     self.commands["playing"] = self.commands["song"]
예제 #24
0
파일: bet.py 프로젝트: yustinuspr/bullbot
    def load_commands(self, **options):
        self.commands["bet"] = Command.raw_command(
            self.command_bet,
            delay_all=0,
            delay_user=0,
            can_execute_with_whisper=True,
            description="Bet points",
            examples=[
                CommandExample(
                    None,
                    "Bet 69 points on a win",
                    chat="user:!bet win 69\n" "bot>user: You have bet 69 points on this game resulting in a win.",
                    description="Bet 69 points that the streamer will win",
                ).parse()
            ],
        )

        self.commands["openbet"] = Command.raw_command(
            self.command_open, level=420, delay_all=0, delay_user=0, description="Open bets"
        )
        self.commands["restartbet"] = Command.raw_command(
            self.command_restart, level=420, delay_all=0, delay_user=0, description="Restart bets"
        )
        self.commands["closebet"] = Command.raw_command(
            self.command_close, level=420, delay_all=0, delay_user=0, description="Close bets"
        )
        self.commands["betstatus"] = Command.raw_command(
            self.command_betstatus, level=420, description="Status of bets"
        )
        self.commands["currentbets"] = Command.raw_command(self.command_stats, level=100, delay_all=0, delay_user=10)
예제 #25
0
 def load_commands(self, **options):
     self.commands["showemote"] = Command.raw_command(
         self.show_emote,
         notify_on_error=True,
         cost=self.settings["point_cost"],
         description="Show an emote on stream!",
         sub_only=self.settings["sub_only"],
         can_execute_with_whisper=self.settings["can_whisper"],
         delay_all=self.settings["cooldown_global"],
         delay_user=self.settings["cooldown_per_user"],
         examples=[
             CommandExample(
                 None,
                 "Show an emote on stream.",
                 chat="user:!showemote Keepo\n"
                 "bot>user: Successfully sent the emote Keepo to the stream!",
                 description="",
             ).parse()
         ],
     )
     self.commands["disableshowemote"] = Command.raw_command(
         self.disable_showemote,
         cost=self.settings["disable_cost"],
         description="Disables show emote",
         delay_all=self.settings["disable_cooldown"],
     )
예제 #26
0
파일: emotes.py 프로젝트: FeelsFeels/pajbot
    def print_cmd(self, manager, examples):
        def do_print(source, **rest):
            self.print_emotes(source, manager)

        if self.settings[
                f"custom_{manager.friendly_name.lower()}_response"] != "":
            bot_response = "bot: " + self.settings[
                f"custom_{manager.friendly_name.lower()}_response"].format(
                    source="pajlada", streamer=StreamHelper.get_streamer())
        else:
            bot_response = f"bot: {manager.friendly_name} emotes: {examples}"

        return Command.raw_command(
            do_print,
            level=self.settings["level"],
            delay_all=self.settings["global_cd"],
            delay_user=self.settings["user_cd"],
            examples=[
                CommandExample(
                    None,
                    f"Show all active {manager.friendly_name} emotes for this channel.",
                    chat=f"user: !{manager.friendly_name.lower()}emotes\n" +
                    bot_response,
                ).parse()
            ],
        )
예제 #27
0
 def load_commands(self, **options):
     self.commands['duel'] = Command.raw_command(
         self.initiate_duel,
         delay_all=self.settings['online_global_cd'],
         delay_user=self.settings['online_user_cd'],
         description='Initiate a duel with a user',
         examples=[
             CommandExample(
                 None,
                 '0-point duel',
                 chat='user:!duel Karl_Kons\n'
                 'bot>user:You have challenged Karl_Kons for 0 points',
                 description='Duel Karl_Kons for 0 points').parse(),
             CommandExample(
                 None,
                 '69-point duel',
                 chat='user:!duel Karl_Kons 69\n'
                 'bot>user:You have challenged Karl_Kons for 69 points',
                 description='Duel Karl_Kons for 69 points').parse(),
         ],
     )
     self.commands['cancelduel'] = Command.raw_command(
         self.cancel_duel,
         delay_all=0,
         delay_user=10,
         description='Cancel your duel request')
     self.commands['accept'] = Command.raw_command(
         self.accept_duel,
         delay_all=0,
         delay_user=0,
         description='Accept a duel request')
     self.commands['decline'] = Command.raw_command(
         self.decline_duel,
         delay_all=0,
         delay_user=0,
         description='Decline a duel request')
     self.commands['deny'] = self.commands['decline']
     self.commands['duelstatus'] = Command.raw_command(
         self.status_duel,
         delay_all=0,
         delay_user=5,
         description='Current duel request info')
     self.commands['duelstats'] = Command.raw_command(
         self.get_duel_stats,
         delay_all=0,
         delay_user=120,
         description='Get your duel statistics')
예제 #28
0
 def load_commands(self, **options):
     self.commands['multiraffle'] = Command.raw_command(self.raffle,
             delay_all=0,
             delay_user=0,
             level=500,
             description='Start a raffle for points',
             examples=[
                 CommandExample(None, 'Start a raffle for 69 points',
                     chat='user:!raffle 69\n'
                     'bot:A raffle has begun for 69 points. Type !join to join the raffle! The raffle will end in in 60 seconds.',
                     description='Start a 60-second raffle for 69 points').parse(),
                 CommandExample(None, 'Start a raffle for the default value of {} points',
                     chat='user:!raffle 69 30\n'
                     'bot:A raffle has begun for 69 points. Type !join to join the raffle! The raffle will end in in 30 seconds.',
                     description='Start a 30-second raffle for 69 points').parse(),
                 ],
             )
예제 #29
0
 def load_commands(self, **options):
     if self.settings["untimeout_enable"]:
         self.commands[self.settings["untimeout_command_name"].lower(
         ).replace("!", "").replace(" ", "")] = Command.raw_command(
             self.untimeout_source,
             cost=self.settings["untimeout_cost"],
             delay_all=0,
             delay_user=15,
             can_execute_with_whisper=True,
             description=
             "Timed out for no apparent reason? Untimeout yourself using points!",
             examples=[
                 CommandExample(
                     None,
                     "Untimeout yourself for {0} points".format(
                         self.settings["untimeout_cost"]),
                     chat="user>bot:!{0}\n"
                     "bot>user: You have been unbanned.".format(
                         self.settings["untimeout_command_name"]),
                     description="",
                 ).parse()
             ],
         )
     if self.settings["unban_enable"]:
         self.commands[self.settings["unban_command_name"].lower(
         ).replace("!", "").replace(" ", "")] = Command.raw_command(
             self.unban_source,
             cost=self.settings["unban_cost"],
             delay_all=0,
             delay_user=15,
             can_execute_with_whisper=True,
             description=
             "Banned for no apparent reason? Unban yourself using points!",
             examples=[
                 CommandExample(
                     None,
                     "Unban yourself for {0} points".format(
                         self.settings["unban_cost"]),
                     chat="user>bot:!{0}\n"
                     "bot>user: You have been unbanned.".format(
                         self.settings["unban_command_name"]),
                     description="",
                 ).parse()
             ],
         )
예제 #30
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
            })