def __init__(self, module, source): super().__init__(module, source) self.math_help = ( f'Usage: math <python code>, this command allows for usage of a restricted subset of ' f'Python {sys.version_info[0]}.{sys.version_info[1]}') self.command_math = util_bot.bot.add_command( 'math', cooldown=util_bot.CommandCooldown(5, 0, 0, True))(self.command_math) self._latex_channels = [] self.command_render_latex = util_bot.bot.add_command( 'latex', cooldown=util_bot.CommandCooldown(5, 0, 0, True))(self.command_render_latex) self.command_latex_light_mode = util_bot.bot.add_command( 'latexlight', cooldown=util_bot.CommandCooldown(5, 0, 0, True))( self.command_latex_light_mode) self.command_render_latex.limit_to_channels = self._latex_channels plugin_help.create_topic('math', self.math_help, section=plugin_help.SECTION_COMMANDS, links=['plot', 'dankeval']) plugin_help.create_topic( 'latex', 'Usage: latex <latex source>. This command renders LaTeX source to a png.', section=plugin_help.SECTION_COMMANDS) self.latex_enabled_setting = plugin_manager.Setting( self, 'math.latex_enabled', default_value=False, scope=plugin_manager.SettingScope.PER_CHANNEL, write_defaults=True, help_='Enabled LaTeX support for this channel', on_load=self._latex_enabled_setting_on_load) self.latex_prefers_light_mode_setting = plugin_manager.Setting( self, 'math.prefers_light_mode', default_value=[], scope=plugin_manager.SettingScope.GLOBAL, help_='List of users who prefer light mode for their LaTeX renders.' )
def __init__(self, module, source): super().__init__(module, source) self.c_replay = main.bot.add_command('replay')(self.c_replay) plugin_help.add_manual_help_using_command( 'Create a link to the VOD.' 'Usage: replay [channel:STR] [time:TIME_DELTA]')(self.c_replay) plugin_help.create_topic('replay usage', 'replay [channel:STR] [time:TIME_DELTA]', section=plugin_help.SECTION_ARGS) plugin_help.create_topic( 'replay channel', 'Channel to create the replay from. Must be live.', section=plugin_help.SECTION_ARGS, links=[ 'replay channel:str' 'replay channel: str' 'replay channel:STR' 'replay channel: STR' ]) plugin_help.create_topic('replay time', 'Time to go back in the VOD.', section=plugin_help.SECTION_ARGS, links=[ 'replay time:time_delta' 'replay time: time_delta' 'replay time:TIME_DELTA' 'replay time: TIME_DELTA' ])
def __init__(self, module, source): super().__init__(module, source) self.c_replay = main.bot.add_command('replay')(self.c_replay) self.c_clip = main.bot.add_command( 'quick_clip', available_in_whispers=False, cooldown=main.CommandCooldown(30, 10, 2), )(self.c_clip) self.c_clip.aliases = ['qc'] plugin_help.add_manual_help_using_command( 'Create a link to the VOD. ' 'Usage: replay [channel:STR] [time:TIME_DELTA]')(self.c_replay) plugin_help.add_manual_help_using_command( 'Creates a clip quickly, usage: quick_clip', aliases=[ 'qc', ])(self.c_clip) plugin_help.create_topic( 'replay channel', 'Channel to create the replay from. Must be live.', section=plugin_help.SECTION_ARGS, links=[ 'replay channel:str', 'replay channel: str', 'replay channel:STR', 'replay channel: STR', ]) plugin_help.create_topic('replay time', 'Time to go back in the VOD.', section=plugin_help.SECTION_ARGS, links=[ 'replay time:time_delta', 'replay time: time_delta', 'replay time:TIME_DELTA', 'replay time: TIME_DELTA', ])
def __init__(self, module, source): super().__init__(module, source) self.MailboxGame = mailbox_game.get(main.Base) self.game_enabled_setting = plugin_manager.Setting( self, 'mailbox_game.enabled', default_value=False, scope=plugin_manager.SettingScope.PER_CHANNEL, write_defaults=True, on_load=self._load_from_settings, help_= 'Toggles whether or not the mailbox guessing game is enabled in the channel.' ) self.after_game_timeout_length = plugin_manager.Setting( self, 'mailbox_game.timeout_after', default_value=-1, scope=plugin_manager.SettingScope.PER_CHANNEL, write_defaults=True, help_= 'Sets how big is the timeout for guessing after the mail minigame has stopped accepting guesses.' ) self.after_game_timeout_message = plugin_manager.Setting( self, 'mailbox_game.timeout_message', default_value= 'Your guess was late. To prevent spam you have been timed out.', scope=plugin_manager.SettingScope.PER_CHANNEL, write_defaults=True, help_= 'Sets the timeout message for timeouts after the mail minigame has stopped accepting guesses.' ) self.default_no_game_timeout_reason = plugin_manager.Setting( self, 'mailbox_game.no_game_timeout_message', default_value= 'There is no mail minigame running. Please don\'t spam.', scope=plugin_manager.SettingScope.PER_CHANNEL, write_defaults=True, help_= 'Sets the timeout message for semi-manual timeouts. See help for "mailgame timeout"' ) self.mailbox_games = {} self.command_mailbox = main.bot.add_command( 'mailbox', limit_to_channels=[], available_in_whispers=False, required_permissions=['mailbox.manage'], enable_local_bypass=True)(self.command_mailbox) self.command_mailbox.aliases.append('mailgame') self.command_delete_guesses_after_stop = main.bot.add_command( '[plugin_mailboxgame:remove_guesses_after_stop]', available_in_whispers=False, cooldown=main.CommandCooldown(0, 0, 0, True) # no cooldowns, )(self.command_delete_guesses_after_stop) self.command_delete_guesses_after_stop.limit_to_channels = [] self.command_delete_guesses_after_stop.matcher_function = self._delete_guesses_matcher main.reloadables['mailbox_channels'] = self._reload_channels plugin_help.create_topic( 'mailbox', 'Manage the mailbox game. Subcommands: mailbox start, ' 'mailbox stop, mailbox draw, mailbox cancel.', section=plugin_help.SECTION_COMMANDS, links=['mailgame']) plugin_help.create_topic( 'mailbox stop', 'Stop accepting new guesses into the minigame. This subcommand takes no arguments.', section=plugin_help.SECTION_ARGS, links=['mailgame stop']) plugin_help.create_topic( 'mailbox draw', 'Draw winner(s) of the minigame. Syntax: mailbox draw NN NN NN, ' 'where NN is a number, numbers need to be separated by spaces, ' 'they don\'t need leading zeros', section=plugin_help.SECTION_ARGS, links=['mailgame draw']) plugin_help.create_topic( 'mailbox start', 'Start the mailbox minigame. Possible arguments are guesses, ' 'find_best, winners. Help for these is at "mailbox start ARGUMENT_NAME"', section=plugin_help.SECTION_ARGS, links=['mailgame start']) plugin_help.create_topic( 'mailbox cancel', 'Cancels the ongoing mailbox minigame. This subcommand takes no arguments.', section=plugin_help.SECTION_ARGS, links=['mailgame cancel']) plugin_help.create_topic( 'mailbox timeout', 'Sets up manual timeouts for guesses. This subcommand takes one optional argument: ' 'the timeout reason, a multi-word string.', section=plugin_help.SECTION_ARGS, links=['mailgame timeout']) plugin_help.create_topic( 'mailbox start guesses', 'How many guesses should people have. Use guesses:NUMBER to change. Default: 1.', section=plugin_help.SECTION_ARGS, links=['mailgame start guesses']) plugin_help.create_topic( 'mailbox start find_best', 'Should the best matches be shown. If false only shows full matches. ' 'Use -find_best to disable that behaviour. Default: true', section=plugin_help.SECTION_ARGS, links=['mailgame start find_best']) plugin_help.create_topic( 'mailbox start winners', 'Highest amount of names shown when drawing winner(s). Full natches are always shown. ' 'Use winners:NUMBER to change this number. Default: 3', section=plugin_help.SECTION_ARGS, links=['mailgame start winners']) plugin_help.create_topic( 'mailbox start punish_more', 'Punish users for guessing more than they are allowed to. ' 'This will make the users guesses worth zero points. ' 'Use -punish_more to disable this. If disabled the first guess will be used. ' 'Duplicating the same guess will never cause disqualification. ' 'Default: true', section=plugin_help.SECTION_ARGS, links=['mailgame start punish_more'])
def __init__(self, module, source): super().__init__(module, source) self.c_nuke = main.bot.add_command('nuke', required_permissions=['util.nuke'], enable_local_bypass=True)( self.c_nuke) self.c_nuke_url = main.bot.add_command( 'nuke_url', required_permissions=['util.nuke'], enable_local_bypass=True)(self.c_nuke) self.max_nuke = 30 plugin_help.create_topic( 'nuke', 'Timeout or ban in bulk, searches by message. ' 'Usage: nuke regex:REGEX [+perma] timeout:TIME search:TIME [+dry-run] [+force]', section=plugin_help.SECTION_COMMANDS) plugin_help.create_topic('nuke regex', 'Find message by this key.', section=plugin_help.SECTION_ARGS) plugin_help.create_topic('nuke perma', 'Ban users permanently USE THIS WITH CAUTION', section=plugin_help.SECTION_ARGS) plugin_help.create_topic('nuke timeout', 'Amount of time to timeout the users for.', section=plugin_help.SECTION_ARGS) plugin_help.create_topic('nuke search', 'How much of the message history to search', section=plugin_help.SECTION_ARGS) plugin_help.create_topic( 'nuke dry-run', 'Don\'t perform any actions just return the results.', section=plugin_help.SECTION_ARGS) plugin_help.create_topic( 'nuke force', f'Ban or timeout more than {self.max_nuke} users.', section=plugin_help.SECTION_ARGS) plugin_help.create_topic( 'nuke_url', 'Timeout or ban in bulk, uses provided url.' 'Usage: nuke_url url:URL [+perma] [+force] timeout:TIME [+dry-run]', section=plugin_help.SECTION_COMMANDS) plugin_help.create_topic( 'nuke_url url', 'Download this and use this as a list of users to punish.', section=plugin_help.SECTION_ARGS) plugin_help.create_topic('nuke_url perma', 'Ban users permanently USE THIS WITH CAUTION', section=plugin_help.SECTION_ARGS) plugin_help.create_topic('nuke_url timeout', 'Amount of time to timeout the users for.', section=plugin_help.SECTION_ARGS) plugin_help.create_topic('nuke_url search', 'How much of the message history to search', section=plugin_help.SECTION_ARGS) plugin_help.create_topic( 'nuke_url dry-run', 'Don\'t perform any actions just return the results.', section=plugin_help.SECTION_ARGS) plugin_help.create_topic( 'nuke_url force', f'Ban or timeout more than {self.max_nuke} users.', section=plugin_help.SECTION_ARGS)
def __init__(self, module, source): super().__init__(module, source) self.kill_switches = {} # region commands self.c_nuke = main.bot.add_command('nuke', required_permissions=['util.nuke'], enable_local_bypass=True, available_in_whispers=False)( self.c_nuke) self.c_nuke_url = main.bot.add_command( 'nuke_url', required_permissions=['util.nuke_url'], enable_local_bypass=True, available_in_whispers=False)(self.c_nuke_url) self.c_unnuke = main.bot.add_command( 'unnuke', required_permissions=['util.unnuke'], enable_local_bypass=True, available_in_whispers=False)(self.c_unnuke) self.c_stop_nuke = main.bot.add_command( 'stop_nuke', required_permissions=['util.nuke'], enable_local_bypass=True, available_in_whispers=False)(self.c_stop_nuke) # endregion # region help plugin_help.create_topic( 'nuke', 'Timeout or ban in bulk, searches by message. ' 'Usage: nuke regex:REGEX [+perma] timeout:TIME search:TIME [+dry-run] [+force]', section=plugin_help.SECTION_COMMANDS) plugin_help.create_topic('nuke regex', 'Find message by this key.', section=plugin_help.SECTION_ARGS) plugin_help.create_topic('nuke perma', 'Ban users permanently USE THIS WITH CAUTION', section=plugin_help.SECTION_ARGS) plugin_help.create_topic('nuke timeout', 'Amount of time to timeout the users for.', section=plugin_help.SECTION_ARGS) plugin_help.create_topic('nuke search', 'How much of the message history to search', section=plugin_help.SECTION_ARGS) plugin_help.create_topic( 'nuke dry-run', 'Don\'t perform any actions just return the results.', section=plugin_help.SECTION_ARGS) plugin_help.create_topic( 'nuke force', f'Ban or timeout more than "nuke.max_safe" users.', section=plugin_help.SECTION_ARGS) plugin_help.create_topic( 'nuke_url', 'Timeout or ban in bulk, uses provided url.' 'Usage: nuke_url url:URL [+perma] [+force] timeout:TIME [+dry-run]', section=plugin_help.SECTION_COMMANDS) plugin_help.create_topic( 'nuke_url url', 'Download this and use this as a list of users to punish.', section=plugin_help.SECTION_ARGS) plugin_help.create_topic('nuke_url perma', 'Ban users permanently USE THIS WITH CAUTION', section=plugin_help.SECTION_ARGS) plugin_help.create_topic('nuke_url timeout', 'Amount of time to timeout the users for.', section=plugin_help.SECTION_ARGS) plugin_help.create_topic( 'nuke_url dry-run', 'Don\'t perform any actions just return the results.', section=plugin_help.SECTION_ARGS) plugin_help.create_topic( 'nuke_url force', f'Ban or timeout more than "nuke.max_safe" users.', section=plugin_help.SECTION_ARGS) plugin_help.create_topic( 'unnuke', 'Unyimeout or unban in bulk, uses provided url.' 'Usage: unnuke url:URL [+perma] [+dry-run]', section=plugin_help.SECTION_COMMANDS) plugin_help.create_topic( 'unnuke url', 'Download this and use this as a list of users to revert.', section=plugin_help.SECTION_ARGS) plugin_help.create_topic('unnuke perma', 'Use /unban instead of /untimeout', section=plugin_help.SECTION_ARGS) plugin_help.create_topic( 'unnuke dry-run', 'Don\'t perform any actions just return the results.', section=plugin_help.SECTION_ARGS) # endregion # region settings self.max_nuke_setting = plugin_manager.Setting( self, 'nuke.max_safe', default_value=15, scope=plugin_manager.SettingScope.GLOBAL, write_defaults=True) self.max_connections_setting = plugin_manager.Setting( self, 'nuke.max_connections', default_value=12, scope=plugin_manager.SettingScope.GLOBAL, write_defaults=True) # region self.connections = [] self.tasks = []
def __init__(self, module, source): super().__init__(module, source) self.timeout_setting = plugin_manager.Setting( self, 'cancer.waytoodank_timeout', default_value=1.2, scope=plugin_manager.SettingScope.GLOBAL, write_defaults=True) self.status_every_frames_setting = plugin_manager.Setting( self, 'cancer.status_every_frames', default_value=10, scope=plugin_manager.SettingScope.GLOBAL, write_defaults=True) self.time_before_status_setting = plugin_manager.Setting( self, 'cancer.time_before_status', default_value=5, scope=plugin_manager.SettingScope.GLOBAL, write_defaults=True) self._sneeze = (-1, None) self.storage = main.PluginStorage(self, main.bot.storage) main.bot.handlers['chat_msg'].append(self.chan_msg_handler) self.random_ping_setting = plugin_manager.Setting( self, 'cancer.random_pings', default_value=['{my pings run out}'], scope=plugin_manager.SettingScope.GLOBAL, write_defaults=True) self.pyramid_enabled_setting = plugin_manager.Setting( self, 'cancer.pyramid_enabled', default_value=False, scope=plugin_manager.SettingScope.PER_CHANNEL, write_defaults=True) self.cookie_optin_setting = plugin_manager.Setting( self, 'cancer.cookie_optin', default_value=[], scope=plugin_manager.SettingScope.GLOBAL, write_defaults=True) # register commands self.command_pyramid = main.bot.add_command( 'mb.pyramid', required_permissions=['cancer.pyramid'], enable_local_bypass=True)(self.c_pyramid) plugin_help.add_manual_help_using_command( 'Make a pyramid out of an emote or text', None)(self.command_pyramid) self.command_braillefy = main.bot.add_command( 'braillefy', enable_local_bypass=True, required_permissions=['cancer.braille'])(self.c_braillefy) plugin_help.add_manual_help_using_command( 'Convert an image into braille.', None)(self.command_braillefy) # arguments. plugin_help.create_topic('braillefy url', 'URL pointing to image you want to convert.', section=plugin_help.SECTION_ARGS) plugin_help.create_topic('braillefy reverse', 'Should the output braille be reversed.', section=plugin_help.SECTION_ARGS) plugin_help.create_topic( 'braillefy sensitivity', 'Per-channel sensitivity of the converter. r(ed), g(reen), b(lue), a(lpha)', section=plugin_help.SECTION_ARGS, links=[ 'braillefy sensitivity_r', 'braillefy sensitivity_g', 'braillefy sensitivity_b', 'braillefy sensitivity_a' ]) plugin_help.create_topic( 'braillefy size', 'Size of the image. Defaults: max_x = 60, pad_y = 60, ' 'size_percent=[undefined]. max_x, pad_y are in pixels.', section=plugin_help.SECTION_ARGS, links=[ 'braillefy size_percent', 'braillefy max_x', 'braillefy pad_y', ]) self.c_cookie_optin = main.bot.add_command('cookie')( self.c_cookie_optin) plugin_help.add_manual_help_using_command( 'Add yourself to the list of people who will be reminded to eat ' 'cookies', None)(self.c_cookie_optin) main.bot.schedule_repeated_event(0.1, 1, self.waytoodank_timer, (), {}) plugin_help.create_topic( 'plugin_cancer', 'Plugin dedicated to things that shouldn\'t be done ' '(responding to messages other than commands, spamming).', section=plugin_help.SECTION_MISC, links=['plugin_cancer.py', 'cancer']) warnings.simplefilter('error', Image.DecompressionBombWarning)
def __init__(self, module, source): super().__init__(module, source) warnings.simplefilter('error', Image.DecompressionBombWarning) self._sneeze_cooldown = time.time() self.storage = main.PluginStorage(self, main.bot.storage) # region Settings self.timeout_setting = plugin_manager.Setting( self, 'cancer.waytoodank_timeout', default_value=1.2, scope=plugin_manager.SettingScope.GLOBAL, write_defaults=True ) self.random_ping_setting = plugin_manager.Setting( self, 'cancer.random_pings', default_value=['{my pings run out}'], scope=plugin_manager.SettingScope.GLOBAL, write_defaults=True ) self.pyramid_enabled_setting = plugin_manager.Setting( self, 'cancer.pyramid_enabled', default_value=False, scope=plugin_manager.SettingScope.PER_CHANNEL, write_defaults=True, help_='Toggles if the mb.pyramid command is enabled in the channel.' ) self.cookie_optin_setting = plugin_manager.Setting( self, 'cancer.cookie_optin', default_value=[], scope=plugin_manager.SettingScope.GLOBAL, write_defaults=True ) self.status_every_frames_setting = plugin_manager.Setting( self, 'cancer.status_every_frames', default_value=10, scope=plugin_manager.SettingScope.GLOBAL, write_defaults=True ) self.time_before_status_setting = plugin_manager.Setting( self, 'cancer.time_before_status', default_value=5, scope=plugin_manager.SettingScope.GLOBAL, write_defaults=True ) # endregion # region Register commands self.c_cookie_optin = main.bot.add_command( 'cookie', cooldown=main.CommandCooldown(10, 5, 0) )(self.c_cookie_optin) self.command_pyramid = main.bot.add_command( 'mb.pyramid', required_permissions=['cancer.pyramid'], enable_local_bypass=True, cooldown=main.CommandCooldown(30, 30, 0) )(self.c_pyramid) self.command_braillefy = main.bot.add_command( 'braillefy', enable_local_bypass=True, required_permissions=['cancer.braille'], cooldown=main.CommandCooldown(15, 0, 0) )(self.c_braillefy) self.command_braillefy.aliases = ['ascii'] # region Help plugin_help.create_topic('braillefy url', 'URL pointing to image you want to convert.', section=plugin_help.SECTION_ARGS, links=[ 'ascii url' ]) plugin_help.create_topic('braillefy emote', 'Emote name (current channel or Twitch emote assumed) or ' '#CHANNEL_NAME:EMOTE_NAME to use an emote from another channel.', section=plugin_help.SECTION_ARGS) plugin_help.create_topic('braillefy sensitivity', 'Per-channel sensitivity of the converter. r(ed), g(reen), b(lue), a(lpha). ' 'Usage: sensitivity_(r, g, b or a):NUMBER', section=plugin_help.SECTION_ARGS, links=[ 'braillefy sensitivity_r', 'braillefy sensitivity_g', 'braillefy sensitivity_b', 'braillefy sensitivity_a', 'ascii sensitivity_r', 'ascii sensitivity_g', 'ascii sensitivity_b', 'ascii sensitivity_a', ]) plugin_help.create_topic('braillefy reverse', 'Should the output braille be reversed. ' 'Usage: +reverse', section=plugin_help.SECTION_ARGS) plugin_help.create_topic('braillefy size', 'Size of the image. Defaults: max_x = 60, pad_y = 60, ' 'size_percent=[undefined]. max_x, pad_y are in pixels. ' 'If resize option is set to False (-resize) no resizing will be done. ' 'Usages: size_percent:NUMBER, max_x:NUMBER, pad_y:NUMBER', section=plugin_help.SECTION_ARGS, links=[ 'braillefy size_percent', 'braillefy max_x', 'braillefy pad_y', 'braillefy resize', 'ascii size_percent', 'ascii max_x', 'ascii pad_y', 'ascii resize', ]) plugin_help.create_topic('braillefy hastebin', 'Should the ascii be put into a hastebin?' 'Usage: +hastebin', section=plugin_help.SECTION_ARGS, links=[ 'ascii hastebin' ]) plugin_help.create_topic('braillefy sobel', 'Should a edge detection filter be applied before creating the ascii? ' 'See Wikipedia:Sobel. Usage: braillefy (...) +sobel') plugin_help.create_topic('plugin_cancer', 'Plugin dedicated to things that shouldn\'t be done ' '(responding to messages other than commands, spamming).', section=plugin_help.SECTION_MISC, links=[ 'plugin_cancer.py', 'cancer' ]) plugin_help.add_manual_help_using_command('Add yourself to the list of people who will be reminded to eat ' 'cookies. Usage: cookie', None)(self.c_cookie_optin) plugin_help.add_manual_help_using_command('Make a pyramid out of an emote or text. ' 'Usage: pyramid <size> <text...>', None)(self.command_pyramid) plugin_help.add_manual_help_using_command( 'Convert an image into braille. ' 'Usage: braillefy (url:URL|emote:EMOTE) [sensitivity_(r|g|b|a):float] ' '[size_percent:float] [max_x:int] [pad_y:int] [+reverse] [+hastebin] [+sobel] [-resize]', None )(self.command_braillefy)