discord_lfg.stats
Manages stats logging.
DATA = pl.DataFrame()
module-attribute
#
DATA_SCHEMA = {'command_name': pl.String, 'date_finished': pl.Date, 'finished_state': pl.String, 'activity_name': pl.String, 'listed_as': pl.String, 'creator_notes': pl.String, 'creator_id': pl.Int64, 'extra_info': pl.List(pl.String), 'role_names': pl.List(pl.String), 'user_ids': pl.List(pl.Int64), 'user_display_names': pl.List(pl.String)}
module-attribute
#
logger = logging.getLogger(__name__)
module-attribute
#
HistoricCommandNameSelect(command_names)
#
Bases: Select
Select from command names.
Initialisation.
Source code in src\discord_lfg\stats.py
callback(interaction)
async
#
Does the thing.
Source code in src\discord_lfg\stats.py
HistoricGroupDateSelect(start_date)
#
Bases: Select
Select from dates.
Initialisation.
Source code in src\discord_lfg\stats.py
callback(interaction)
async
#
Does the thing.
Source code in src\discord_lfg\stats.py
HistoricGroupViewer(interaction, user_id_str='0', moderator_role_name='')
#
Bases: View
View historic groups.
Initialisation.
Source code in src\discord_lfg\stats.py
command_selected = command_options[0]
instance-attribute
#
command_selector = HistoricCommandNameSelect(command_options)
instance-attribute
#
date_selected = start_date
instance-attribute
#
date_selector = HistoricGroupDateSelect(start_date)
instance-attribute
#
message = None
instance-attribute
#
user_data = DATA.filter(pl.col('user_ids').list.contains(user_id))
instance-attribute
#
next(interaction, button)
async
#
Shows the chronologically next group.
Source code in src\discord_lfg\stats.py
on_timeout()
async
#
Do stuff when timeout occurs.
previous(interaction, button)
async
#
Shows the chronologically previous group.
Source code in src\discord_lfg\stats.py
retain_options()
#
Sets currently selected options as new defaults so these are retained through updates.
Source code in src\discord_lfg\stats.py
show_groups(interaction, button)
async
#
Show groups to the user.
Source code in src\discord_lfg\stats.py
HistoricStatsDateSelect()
#
Bases: Select
Select from dates.
Initialisation.
Source code in src\discord_lfg\stats.py
durations = {'Today': (today, today), 'Last 7 days': (today - timedelta(days=7), today), 'Last 28 days': (today - timedelta(days=28), today), 'This month': (today.replace(day=1), today), 'Last 6 months (180 days)': (today - timedelta(days=180), today), 'All time': (today - timedelta(days=9999), today)}
instance-attribute
#
callback(interaction)
async
#
Does the thing.
Source code in src\discord_lfg\stats.py
HistoricStatsFinishTypeSelect()
#
Bases: Select
Select which users to remove.
Initialisation.
Source code in src\discord_lfg\stats.py
callback(interaction)
async
#
Does the thing.
Source code in src\discord_lfg\stats.py
HistoricStatsViewer()
#
Bases: View
View historic stats.
Initialisation.
Source code in src\discord_lfg\stats.py
command_selected = command_options[0]
instance-attribute
#
command_selector = HistoricCommandNameSelect(command_options)
instance-attribute
#
date_end = self.date_start
instance-attribute
#
date_selector = HistoricStatsDateSelect()
instance-attribute
#
date_start = datetime_now_utc().date()
instance-attribute
#
finish_type_selector = HistoricStatsFinishTypeSelect()
instance-attribute
#
finish_types = ['complete']
instance-attribute
#
message = None
instance-attribute
#
stats_data = DATA.clone()
instance-attribute
#
on_timeout()
async
#
Do stuff when timeout occurs.
retain_options()
#
Sets currently selected options as new defaults so these are retained through updates.
Source code in src\discord_lfg\stats.py
show_stats(interaction, button)
async
#
Show groups to the user.
Source code in src\discord_lfg\stats.py
get_data(data_path)
#
Gets the existing data ready to append to (for warm-starting the bot).
Source code in src\discord_lfg\stats.py
historic_group(group_data)
#
Creates a string representing the historic group appropriate for display to a user.
Source code in src\discord_lfg\stats.py
historic_group_embed(group_data)
#
Generates a historic group embed.
Source code in src\discord_lfg\stats.py
record_group(command_name, date_finished, finished_state, activity_name, listed_as, creator_notes, creator_id, extra_info, role_names, user_ids, user_display_names)
#
Records a finished group into the data table.