pylav.storage.models.player package#

Submodules#

pylav.storage.models.player.config module#

class pylav.storage.models.player.config.PlayerConfig(*args: 'Any', **kwargs: 'Any')[source]#

Bases: CachedModel

async add_to_dj_roles(role)[source]#

Add disc jockey roles to the player

async add_to_dj_users(user)[source]#

Add a user to the disc jockey users of the player

bot#
async bulk_add_dj_roles(*roles)[source]#

Add disc jockey roles to the player.

Parameters:

roles (discord.Role) – The roles to add

async bulk_add_dj_users(*users)[source]#

Add disc jockey users to the player

async bulk_remove_dj_roles(*roles)[source]#

Remove disc jockey roles from the player.

Parameters:

roles (discord.Role) – The roles to add.

async bulk_remove_dj_users(*users)[source]#

Remove disc jockey users from the player.

Parameters:

users (discord.Member) – The users to add

async classmethod create_global(bot)[source]#

Create the player in the database

async delete()[source]#

Delete the player from the database

async dj_roles_reset()[source]#

Reset the disc jockey roles of the player

async dj_users_reset()[source]#

Reset the disc jockey users of the player

async exists()[source]#

Check if the player exists in the database

async fetch_all()[source]#

Get all players from the database

async fetch_alone_dc()[source]#

Fetch the alone dc of the player

async fetch_alone_pause()[source]#

Fetch the alone pause of the player

async fetch_auto_play()[source]#

Fetch the auto play of the player

async fetch_auto_play_playlist_id()[source]#

Fetch the auto play playlist ID of the player

async fetch_auto_shuffle()[source]#

Fetch the auto shuffle of the player

async fetch_dj_roles()[source]#

Fetch the disc jockey roles of the player

async fetch_dj_users()[source]#

Fetch the disc jockey users of the player

async fetch_effects()[source]#

Fetch the effects of the player

async fetch_empty_queue_dc()[source]#

Fetch the empty queue dc of the player

async fetch_extras()[source]#

Fetch the extras of the player

async fetch_forced_channel_id()[source]#

Fetch the forced channel ID of the player

async fetch_max_volume()[source]#

Fetch the max volume of the player from the db

async fetch_notify_channel_id()[source]#

Fetch the notify channel ID of the player

async fetch_repeat_current()[source]#

Fetch the repeat current of the player

async fetch_repeat_queue()[source]#

Fetch the repeat queue of the player

async fetch_self_deaf()[source]#

Fetch the self deaf of the player

async fetch_shuffle()[source]#

Fetch the shuffle of the player

async fetch_text_channel_id()[source]#

Fetch the text channel ID of the player

async fetch_volume()[source]#

Fetch the volume of the player from the db

get_cache_key()[source]#
id#
async is_dj(user, *, additional_role_ids=None, additional_user_ids=None)[source]#

Check if a user is a disc jockey.

Parameters:
  • user (discord.Member) – The user to check.

  • additional_role_ids (list) – The additional disc jockey role ids to check.

  • additional_user_ids (list) – The additional disc jockey user ids to check.

Returns:

Whether the user is a disc jockey.

Return type:

bool

async remove_from_dj_roles(role)[source]#

Remove disc jockey roles from the player

async remove_from_dj_users(user)[source]#

Remove a user from the disc jockey users of the player

async update_alone_dc(alone_dc)[source]#

Update the alone dc of the player

async update_alone_pause(alone_pause)[source]#

Update the alone pause of the player

async update_auto_play(auto_play)[source]#

Update the auto play of the player

async update_auto_play_playlist_id(auto_play_playlist_id)[source]#

Update the auto play playlist ID of the player

async update_auto_shuffle(auto_shuffle)[source]#

Update the auto shuffle of the player

async update_effects(effects)[source]#

Update the effects of the player

async update_empty_queue_dc(empty_queue_dc)[source]#

Update the empty queue dc of the player

async update_extras(extras)[source]#

Update the extras of the player

async update_forced_channel_id(forced_channel_id)[source]#

Update the forced channel ID of the player

async update_max_volume(max_volume)[source]#

Update the max volume of the player in the db

async update_notify_channel_id(notify_channel_id)[source]#

Update the notify channel ID of the player

async update_repeat_current(repeat_current)[source]#

Update the repeat current of the player

async update_repeat_queue(repeat_queue)[source]#

Update the repeat queue of the player

async update_self_deaf(self_deaf)[source]#

Update the self deaf of the player

async update_shuffle(shuffle)[source]#

Update the shuffle of the player

async update_text_channel_id(text_channel_id)[source]#

Update the text channel ID of the player

async update_volume(volume)[source]#

Update the volume of the player in the db

pylav.storage.models.player.state module#

class pylav.storage.models.player.state.PlayerState(id, bot, channel_id, volume, position, auto_play_playlist_id, text_channel_id, notify_channel_id, forced_channel_id, paused, repeat_current, repeat_queue, shuffle, auto_shuffle, auto_play, playing, effect_enabled, self_deaf, current, queue, history, effects, extras, pk=None)[source]#

Bases: CachedModel

A class to represent the state of a player in the database

auto_play#
auto_play_playlist_id#
auto_shuffle#
bot#
channel_id#
current#
async delete()[source]#

Delete the player state from the database

effect_enabled#
effects#
extras#
forced_channel_id#
async classmethod get(bot_id, guild_id)[source]#

Get the player state from the database.

Parameters:
  • bot_id (int) – The bot ID.

  • guild_id (int) – The guild ID.

Returns:

The player state if found, otherwise None.

Return type:

PlayerState | None

get_cache_key()[source]#

Get the cache key for the player state.

history#
id#
notify_channel_id#
paused#
pk = None#
playing#
position#
queue#
repeat_current#
repeat_queue#
async save()[source]#

Save the player state to the database

self_deaf#
shuffle#
text_channel_id#
volume#

Module contents#