def setup(self): self._module_data = self.get_module_data() if not 'attachments' in self._module_data: self._module_data['attachments'] = {} self.register_admin_command(ModuleAdminCommand( 'attach', self._attach_sub, usage = f'{self.module_name} attach <!command/none> <tier>', description = 'Run !<command> when a user subs to the channel. Set to "none" to remove. Tier is optional.', )) self.register_admin_command(ModuleAdminCommand( 'attach_gift', self._attach_gift, usage = f'{self.module_name} attach_gift !<command> <tier>', description = 'Run !<command> when a user gifts a sub to the channel. Set to "none" to remove. Tier is optional.', )) self.register_admin_command(ModuleAdminCommand( 'list', self._list, usage = f'{self.module_name} list', description = 'List sub attachments', )) self.event_listen(EVT_SUBSCRIPTION, self.subscription)
def setup(self): self._channel_point_data = self.get_module_data() if not 'attachments' in self._channel_point_data: self._channel_point_data['attachments'] = {} self.register_admin_command( ModuleAdminCommand( 'attach', self._attach_reward, usage=f'{self.module_name} attach', description='Attach a reward redemption to a command', )) self.register_admin_command( ModuleAdminCommand( 'list', self._list_rewards, usage=f'{self.module_name} list', description='List all configured rewards', )) self.register_admin_command( ModuleAdminCommand( 'delete', self._delete_reward, usage=f'{self.module_name} delete', description='Delete a reward redemption', )) self.event_listen(EVT_POINT_REDEMPTION, self.points_redeemed)
def setup(self): self._shoutout_data = self.get_module_data() self.register_admin_command(ModuleAdminCommand( 'command', self.set_command, usage = f'{self.module_name} command !<command>', description = 'Set chat command for shoutouts', )) self.register_admin_command(ModuleAdminCommand( 'message', self.set_message, usage = f'{self.module_name} message <message>', description = 'Set chat message for shoutouts. Avilable variables: {streamer}, {game}, {url}', )) self.register_admin_command(ModuleAdminCommand( 'account', self.set_response_account, usage = f'{self.module_name} account', description = 'Set the account to use for shoutouts', )) self.event_listen(EVT_CHATCOMMAND, self.command)
def setup(self): self._module_data = self.get_module_data() if not 'commands' in self._module_data: self._module_data['commands'] = {} self.register_admin_command( ModuleAdminCommand( 'add', self._add_random_command, usage= f'{self.module_name} add !<newcommand> !<option1> !<option2>...', description= 'Add a new command that will execute another command at random' )) self.register_admin_command( ModuleAdminCommand('delete', self._delete_random_command, usage=f'{self.module_name} delete !<command>', description='Delete command !<command>')) self.register_admin_command( ModuleAdminCommand('list', self._list_commands, usage=f'{self.module_name} list', description='List all random commands')) self.event_listen(EVT_CHATCOMMAND, self.command)
def setup(self): self.register_admin_command( ModuleAdminCommand( 'toggle', self.toggle_module, usage=f'{self.module_name} toggle <module name>', description='Enable or disable module')) self.register_admin_command( ModuleAdminCommand('list', self.list_modules, usage=f'{self.module_name} list', description='List all modules'))
def setup(self): self._module_data = self.get_module_data() if not 'attachments' in self._module_data: self._module_data['attachments'] = {} self.register_admin_command(ModuleAdminCommand( 'attach_raid', self._attach_raid, usage = f'{self.module_name} attach_raid <!command/none>', description = 'Run !<command> when a user raids the channel. Set to "none" to remove', )) self.register_admin_command(ModuleAdminCommand( 'attach_host', self._attach_host, usage = f'{self.module_name} attach_host <!command/none>', description = 'Run !<command> when a user hosts the channel. Set to "none" to remove', )) self.event_listen(EVT_RAID, self.raid) self.event_listen(EVT_HOST, self.host)
def setup(self): self._commands = self.get_module_data() if not os.path.isdir(self.media_directory): os.makedirs(self.media_directory) if not 'commands' in self._commands: self._commands['commands'] = {} self.register_admin_command( ModuleAdminCommand( 'add', self._add_command, usage=f'{self.module_name} add <!command> <soundfile.mp3>', description='Add sound command')) self.register_admin_command( ModuleAdminCommand('list', self._list_commands, usage=f'{self.module_name} list', description='List sound commands')) self.register_admin_command( ModuleAdminCommand('details', self._command_details, usage=f'{self.module_name} details !<command>', description='Details for !<command>')) self.register_admin_command( ModuleAdminCommand('delete', self._delete_command, usage=f'{self.module_name} delete <!command>', description='Delete a sound command')) self.register_admin_command( ModuleAdminCommand('audio_device', self._select_audio_device, usage=f'{self.module_name} audio_device', description='Set the sound device for sounds')) self.register_admin_command( ModuleAdminCommand( 'volume', self._set_volume, usage=f'{self.module_name} volume <!command> <volume>', description='Set volume for sound in %. Default is 100.')) self.register_admin_command( ModuleAdminCommand( 'dir', self._show_directory, usage=f'{self.module_name} dir', description='Show media directory for audio files')) self.event_listen(EVT_CHATCOMMAND, self.command)
def setup(self): self._module_data = self.get_module_data() if not 'commands' in self._module_data: self._module_data['commands'] = {} self.register_admin_command( ModuleAdminCommand( 'new', self._new_alias, usage=f'{self.module_name} new !<alias>', description='Register !<alias> as a new alias', )) self.register_admin_command( ModuleAdminCommand( 'add', self._add_alias_command, usage=f'{self.module_name} add !<alias>', description= 'Add a command for !<alias>. !<alias> must be registered using new.', )) self.register_admin_command( ModuleAdminCommand( 'list', self._list_alias, usage=f'{self.module_name} list', description='List all aliases', )) self.register_admin_command( ModuleAdminCommand( 'delete', self._delete_alias, usage=f'{self.module_name} delete !<alias>', description='Delete one or all entries for !<alias>', )) self.event_listen(EVT_CHATCOMMAND, self.command)
def setup(self): self._module_data = self.get_module_data() if not 'attachments' in self._module_data: self._module_data['attachments'] = {} self.register_admin_command(ModuleAdminCommand( 'attach', self._attach_bits, usage = f'{self.module_name} attach <!command/none>', description = 'Run !<command> when a user cheers bits in the channel. Set to "none" to remove', )) self.event_listen(EVT_BITS, self.bits)
def setup(self): self._rotator_data = self.get_module_data() self._last_time = time.time() self._message_count = 0 self._message_index = 0 self.prompt_ident = None self.register_admin_command( ModuleAdminCommand( 'add', self.add_message, usage=f'{self.module_name} add <message>', description='Add a message for the rotator', )) self.register_admin_command( ModuleAdminCommand( 'pause', self.pause_message, usage=f'{self.module_name} pause', description='Pause or resume a specific rotator message', )) self.register_admin_command( ModuleAdminCommand( 'delete', self.delete_message, usage=f'{self.module_name} delete', description='Delete an existing message in the rotator', )) self.register_admin_command( ModuleAdminCommand( 'list', self.list_messages, usage=f'{self.module_name} list', description='List messages to rotate', )) self.register_admin_command( ModuleAdminCommand( 'time', self.set_time_threshold, usage=f'{self.module_name} time <minutes>', description='Set time threshold between sending messages', )) self.register_admin_command( ModuleAdminCommand( 'messagecount', self.set_message_threshold, usage=f'{self.module_name} messagecount <messages>', description= 'Set how many chat messages must occur bettween events', )) self.event_listen(EVT_TIMER, self.timer) self.event_listen(EVT_CHATMESSAGE, self.chat_message)
def setup(self): self._permission_data = self.get_module_data() if not 'commands' in self._permission_data: self._permission_data['commands'] = {} self.register_admin_command( ModuleAdminCommand( 'set', self._set_permission, usage= f'{self.module_name} set !<command> <all/vip/mod/broadcaster>', description= 'Set the permssion for !<command> to all, mod only, or broadcaster only' )) self.register_admin_command( ModuleAdminCommand('list', self._list_permissions, usage=f'{self.module_name} list', description='List all permissions')) self.register_admin_command( ModuleAdminCommand( 'delete', self._delete_permission, usage=f'{self.module_name} delete !<command>', description='Delete permissions for !<command>')) self.register_admin_command( ModuleAdminCommand( 'default', self._set_default_permission, usage=f'{self.module_name} default <all/vip/mod/broadcaster>', description= 'Set default permission for all comamnds to all, mod only, or broadcaster only' ))
def setup(self): ## Do not allow timers greater than 25 hours self.max_timer_len = 25 * 60 self._timer_data = self.get_module_data() ## Create empty list of timers if this is the first ## time the module has been loaded if not 'timers' in self._timer_data: self._timer_data['timers'] = [] self.register_admin_command( ModuleAdminCommand('list', self._list_timers, usage=f'{self.module_name} list', description='List all active timers')) self.register_admin_command( ModuleAdminCommand('clear', self._clear_timers, usage=f'{self.module_name} clear', description='Clear all timers')) self.event_listen(EVT_CHATCOMMAND, self.command) self.event_listen(EVT_TIMER, self.timer_check)
def setup(self): self._cooldown_data = self.get_module_data() if not 'commands' in self._cooldown_data: self._cooldown_data['commands'] = {} if not 'runtimes' in self._cooldown_data: self._cooldown_data['runtimes'] = {} self.register_admin_command(ModuleAdminCommand( 'list', self._list_cooldowns, usage = f'{self.module_name} list', description = 'List cooldowns' )) self.register_admin_command(ModuleAdminCommand( 'default_cooldown', self._set_default_cooldown, usage = f'{self.module_name} default_cooldown <time>', description = 'Set the default cooldown for all commands in seconds' )) self.register_admin_command(ModuleAdminCommand( 'set', self._set_cooldown, usage = f'{self.module_name} set !<command> <global> <user> <queue>', description = 'Set the global and user cooldowns for !<command> in seconds. <queue> can be yes/no. Defaults to yes.' )) self.register_admin_command(ModuleAdminCommand( 'notifications', self._set_notifications, usage = f'{self.module_name} notifications <on/off>', description = 'Enable or disable cooldown notifications in Twitch chat' )) self.register_admin_command(ModuleAdminCommand( 'notification_override', self._notification_override, usage = f'{self.module_name} notification_override <!command> <on/off/inherit>', description = 'Enable or disable cooldown notification for a specific command' )) self.register_admin_command(ModuleAdminCommand( 'delete', self._delete_cooldown, usage = f'{self.module_name} delete !<command>', description = 'Delete cooldowns for !<command>' )) self.event_listen(EVT_CHATCOMMAND, self.command)
def setup(self): self.login_thread = None self.login_thread_queue = Queue() self.prompt_ident = None ## Define commands self.register_admin_command( ModuleAdminCommand('add', self.add_account, usage=f'{self.module_name} add', description='Add a new Twtich account.')) self.register_admin_command( ModuleAdminCommand('list', self.list_accounts, usage=f'{self.module_name} list', description='List all accounts.')) self.register_admin_command( ModuleAdminCommand( 'refresh', self.refresh_accounts, usage=f'{self.module_name} refresh', description='Update all accounts using Twitch API')) self.register_admin_command( ModuleAdminCommand( 'default', self.set_default, usage=f'{self.module_name} default', description='Set the default account to send chat messages')) self.register_admin_command( ModuleAdminCommand('broadcaster', self.set_broadcaster, usage=f'{self.module_name} broadcaster', description='Set the broadcaster account')) self.register_admin_command( ModuleAdminCommand('delete', self.remove_account, usage=f'{self.module_name} delete', description='Delete an account.'))
def setup(self): if not os.path.isdir(self.media_directory): os.makedirs(self.media_directory) self._sound_data = self.get_module_data() self._sound_command = self._sound_data.get('sound_command', 'hi') self._stream_online = False if not 'user_sounds' in self._sound_data.keys(): self._sound_data['user_sounds'] = {} self._last_alert = 0 self.register_admin_command( ModuleAdminCommand( 'command', self._set_command, usage=f'{self.module_name} command !<command>', description= 'Set command for users to play their welcome message & sound')) self.register_admin_command( ModuleAdminCommand( 'sound', self._add_entrance_sound, usage=f'{self.module_name} sound <twitch_user> <sound.mp3>', description= 'Add entrance sound for <twitch_user> set <sound.mp3> to "none" to clear' )) self.register_admin_command( ModuleAdminCommand( 'volume', self._set_volume, usage=f'{self.module_name} volume <twitch_user> <volume>', description= 'Set volume for entrance sound in %. Default is 100.')) self.register_admin_command( ModuleAdminCommand( 'message', self._add_entrance_message, usage=f'{self.module_name} message <twitch_user> <message>', description= 'Add entrance message for <twitch_user>. Set <message> to "none" to clear' )) self.register_admin_command( ModuleAdminCommand( 'remove', self._remove_entrance_sound, usage=f'{self.module_name} remove <twitch_user>', description= 'Remove entrance sound and message for <twitch_user>')) self.register_admin_command( ModuleAdminCommand('list', self._list_entrance_sounds, usage=f'{self.module_name} list', description='List entrance sounds')) self.register_admin_command( ModuleAdminCommand('dir', self._show_directory, usage=f'{self.module_name} dir', description='Show directory for audio files')) self.register_admin_command( ModuleAdminCommand( 'audio_device', self._set_entrance_audio_device, usage=f'{self.module_name} audio_device', description='Set the audio device to use for entrance sounds')) self.register_admin_command( ModuleAdminCommand( 'alert_audio_device', self._set_alert_audio_device, usage=f'{self.module_name} alert_audio_device', description='Set the audio device to use for entrance alerts')) self.register_admin_command( ModuleAdminCommand( 'alert_sound', self._set_alert_sound, usage=f'{self.module_name} alert_sound <soundfile>', description= 'Set the sound file for entrance alerts. Set <soundfile> to "none" to clear.' )) self.register_admin_command( ModuleAdminCommand( 'test', self._test_welcome, usage=f'{self.module_name} test <user>', description='Test the welcome event for <user> if one is set.') ) self.event_listen(EVT_FIRST_MESSAGE, self.send_first_message_command) self.event_listen(EVT_CHATCOMMAND, self.command) self.event_listen(EVT_STREAM_STATUS, self.status_change)
def setup(self): self._obs_data = self.get_module_data() self.obs_queue = Queue() self.obs_thread = None if not 'commands' in self._obs_data: self._obs_data['commands'] = {} self._call_id = 0 self._ws = None self.register_admin_command(ModuleAdminCommand( 'host', self._set_host, usage = f'{self.module_name} host <host>', description = 'Sets host for obs websocket. Default is localhost', )) self.register_admin_command(ModuleAdminCommand( 'port', self._set_port, usage = f'{self.module_name} port <port>', description = 'Sets port for obs websocket. Default is 4444', )) self.register_admin_command(ModuleAdminCommand( 'password', self._set_password, usage = f'{self.module_name} password <password>', description = 'Sets password for obs websocket. Set to none to clear password.', )) self.register_admin_command(ModuleAdminCommand( 'list', self._list_obs_commands, usage = f'{self.module_name} list', description = 'List all obs commands' )) self.register_admin_command(ModuleAdminCommand( 'details', self._command_details, usage = f'{self.module_name} details !<command>', description = 'Show details of !<command>' )) self.register_admin_command(ModuleAdminCommand( 'add_timed_source', self._add_timed_source, usage = f'{self.module_name} add_timed_source !<command>', description = 'Adds a command to show a source for a set period of time.', )) self.register_admin_command(ModuleAdminCommand( 'hide_timed_source', self._hide_timed_source, usage = f'{self.module_name} hide_timed_source !<command>', description = 'Adds a command to hide a source for a set period of time.', )) self.register_admin_command(ModuleAdminCommand( 'add_timed_filter', self._add_timed_filter, usage = f'{self.module_name} add_timed_filter !<command> <source>', description = 'Adds a command to show a filter for <source> for a set period of time.', )) self.register_admin_command(ModuleAdminCommand( 'hide_timed_filter', self._hide_timed_filter, usage = f'{self.module_name} hide_timed_filter !<command> <source>', description = 'Adds a command to hide a filter for <source> for a set period of time.', )) self.register_admin_command(ModuleAdminCommand( 'add_scene_change', self._add_scene_change, usage = f'{self.module_name} add_scene_change !<command> <scene> <source_scene>...', description = 'Adds a command to change to <scene>. Will only function if you are currently on <source> scene if specified. Can list multiple source scenes.', )) self.register_admin_command(ModuleAdminCommand( 'delete', self._delete_command, usage = f'{self.module_name} delete !<command>', description = 'Delete <!command>', )) self.event_listen(EVT_CHATCOMMAND, self.command) self.restart_obs_thread()
def setup(self): ## Commands are saved in the database self._commands = self.get_module_data() self._static_commands = { 'addcommand': self._add_command, 'appendcommand': self._append_command, 'deletecommand': self._delete_command, #'c': self._list_commands, } self.register_admin_command( ModuleAdminCommand( 'add', self._add_command_admin, usage=f'{self.module_name} add !<command> <response>', description='Add a basic command.')) self.register_admin_command( ModuleAdminCommand( 'append', self._append_command_admin, usage=f'{self.module_name} append !<command> <response>', description='Append a response to an existing command')) self.register_admin_command( ModuleAdminCommand('delete', self._delete_command_admin, usage=f'{self.module_name} delete !<command>', description='Delete a command')) self.register_admin_command( ModuleAdminCommand('toggle', self._toggle_command, usage=f'{self.module_name} toggle !<command>', description='Enable or disable !<command>')) self.register_admin_command( ModuleAdminCommand('list', self.list_commands, usage=f'{self.module_name} list', description='List all basic commands')) self.register_admin_command( ModuleAdminCommand('details', self.command_details, usage=f'{self.module_name} details !<command>', description='Show details of !<command>')) self.register_admin_command( ModuleAdminCommand( 'command_account', self.command_account, usage=f'{self.module_name} command_account !<command>', description='Change the response account for !<command>')) self.register_admin_command( ModuleAdminCommand('counters', self.list_counters, usage=f'{self.module_name} counters', description='List all counters')) self.register_admin_command( ModuleAdminCommand( 'set_counter', self._set_counter, usage=f'{self.module_name} set_counter <counter_name> <value>', description='Set value of a counter')) self.event_listen(EVT_CHATCOMMAND, self.command)
def setup(self): self._module_data = self.get_module_data() self._raffles_active = False if not 'raffles' in self._module_data: self._module_data['raffles'] = {} if not 'active_raffles' in self._module_data: self._module_data['active_raffles'] = [] if not 'last_raffle' in self._module_data: self._module_data['last_raffle'] = {} if len(self._module_data.get('active_raffles', [])) > 0: self._raffles_active = True self.register_admin_command( ModuleAdminCommand('new', self._new_raffle, usage=f'{self.module_name} new <name>', description='Create a new raffle')) self.register_admin_command( ModuleAdminCommand('stop', self._stop_active_raffle, usage=f'{self.module_name} stop <raffle_name>', description='Stop a running raffle')) self.register_admin_command( ModuleAdminCommand('list', self._list_raffles, usage=f'{self.module_name} list', description='Lists all raffles')) self.register_admin_command( ModuleAdminCommand( 'time', self._set_time, usage=f'{self.module_name} time <raffle_name> <time>', description='Set how long <raffle_name> lasts in <time> seconds' )) self.register_admin_command( ModuleAdminCommand( 'command', self._set_command, usage=f'{self.module_name} time <raffle_name> !<command>', description= 'Set the comamnd to join <raffle_name>. Defaults to !join')) self.register_admin_command( ModuleAdminCommand( 'interval', self._set_interval, usage=f'{self.module_name} interval <raffle_name> <interval>', description= 'Sets the interval of messages to be posted in chat during an active raffle to <interval> seconds' )) self.register_admin_command( ModuleAdminCommand( 'prize', self._set_prize, usage=f'{self.module_name} prize <raffle_name> <prize>', description='Set the prize for <raffle_name> to <prize>')) self.register_admin_command( ModuleAdminCommand( 'winners', self._set_winners, usage=f'{self.module_name} winners <raffle_name> <winners>', description= 'Sets the number of winners of <raffle_name> to <winners>')) self.register_admin_command( ModuleAdminCommand( 'confirm', self._set_confirm, usage=f'{self.module_name} confirm <raffle_name> <on/off>', description= 'Turn confirmation messsage on or off when joining a raffle.')) self.event_listen(EVT_CHATCOMMAND, self.command) self.event_listen(EVT_TIMER, self.timer)