Fill out docstrings.

This commit is contained in:
alwayscompiling
2022-11-24 17:05:45 -05:00
parent 8a2108fc14
commit 9ebbca2557
3 changed files with 33 additions and 31 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ class Guild:
Args:
guild_id (int): Discord Guild id of new Guild
"""
self._category_pad_length: int = 25
self._category_pad_length: int = 26
self._guild_id: int = guild_id
self._highscore_channel_id: int = 0
self._submission_channel_id: int = 0
+31 -29
View File
@@ -2,14 +2,16 @@
Commands for managing the tables/categories/scores for a Guild.
"""
from typing import Optional
import nextcord
from nextcord.ext import commands
from highscores import highscores_data # pylint: disable=import-error
from utilities.utils import ( # pylint: disable=import-error
autofill_categories,
autofill_users,
autofill_tables,
autofill_users,
send_highscore_message,
)
@@ -82,7 +84,7 @@ class DataManagementCog(commands.Cog, name="Table Management"):
message is user was removed from that table.
Args:
interaction (nextcord.Interaction): Interaction that invoked the command
interaction (nextcord.Interaction): Interaction that invoked the command.
username (str): User to remove from highscores
"""
guild = highscores_data.get_guild(interaction.guild_id)
@@ -116,14 +118,15 @@ class DataManagementCog(commands.Cog, name="Table Management"):
user_name: str = nextcord.SlashOption(description="User to delete.", required=True),
):
"""
_summary_
Removes a user from a category. Uses autofill functions to fill out table_name, category_name, and user_name.
Args:
interaction (nextcord.Interaction): _description_
table_name (str, optional): _description_. Defaults to nextcord.SlashOption(description="", required=True).
category_name (str, optional): _description_. Defaults to nextcord.SlashOption(description="", required=True).
user_name (str, optional): _description_. Defaults to nextcord.SlashOption(description="", required=True).
interaction (nextcord.Interaction): Interaction that invoked the command.
table_name (str): Table to remove user from. Is SlashOption.
category_name (str): Category to remove user from. Is SlashOption.
user_name (str): The user to remove. Is SlashOption.
"""
# TODO ensure input params are valid
@user.subcommand(description="Deletes a user's scores from entire table.")
async def from_table(
@@ -133,37 +136,36 @@ class DataManagementCog(commands.Cog, name="Table Management"):
user_name: str = nextcord.SlashOption(description="User to delete.", required=True),
):
"""
_summary_
Removes user from a table. Uses autofill functions to fill out table_name and user_name.
Args:
interaction (nextcord.Interaction): _description_
table_name (str, optional): _description_. Defaults to nextcord.SlashOption(description="Table to delete user from.", required=True).
user_name (str, optional): _description_. Defaults to nextcord.SlashOption(description="User to delete.", required=True).
interaction (nextcord.Interaction): Interaction that invoked the command.
table_name (str): Table to remove user from. Is SlashOption.
user_name (str): The user to remove. Is SlashOption.
"""
# TODO ensure params are valid
@from_category.on_autocomplete("table_name")
@from_table.on_autocomplete("table_name")
async def from_category_autocomplete_table(self, interaction: nextcord.Interaction, table_name: str):
async def autocomplete_table(self, interaction: nextcord.Interaction, table_name: str):
"""
_summary_
Autocomplete function for table names.
Args:
interaction (nextcord.Interaction): _description_
table_name (str): _description_
interaction (nextcord.Interaction): Interaction that invoked the command.
table_name (str): String to be autocompleted with Table name.
"""
await interaction.response.send_autocomplete(autofill_tables(interaction.guild_id, table_name))
@from_category.on_autocomplete("category_name")
async def from_category_autocomplete_category(
self, interaction: nextcord.Interaction, category_name: str, table_name: str
):
async def autocomplete_category(self, interaction: nextcord.Interaction, category_name: str, table_name: str):
"""
_summary_
Autocomplete function for category names.
Args:
interaction (nextcord.Interaction): _description_
category_name (str): _description_
table_name (str): _description_
interaction (nextcord.Interaction): Interaction that invoked the command.
category_name (str): String to be autocompleted with Category name.
table_name (str): Table to find Category from.
"""
await interaction.response.send_autocomplete(
autofill_categories(interaction.guild_id, table_name, category_name)
@@ -171,17 +173,17 @@ class DataManagementCog(commands.Cog, name="Table Management"):
@from_category.on_autocomplete("user_name")
@from_table.on_autocomplete("user_name")
async def from_category_autocomplete_user(
self, interaction: nextcord.Interaction, user_name: str, table_name: str, category_name: str = None
async def autocomplete_user(
self, interaction: nextcord.Interaction, user_name: str, table_name: str, category_name: Optional[str]
):
"""
_summary_
Autocomplete functions for user names.
Args:
interaction (nextcord.Interaction): _description_
user_name (str): _description_
table_name (str): _description_
category_name (str): _description_
interaction (nextcord.Interaction): Interaction that invoked the command.
user_name (str): String to be autocompleted with User name.
table_name (str): Table to find category from.
category_name (Optional[str]): Category to find User from, can be None.
"""
await interaction.response.send_autocomplete(
autofill_users(interaction.guild_id, table_name, category_name, user_name)
+1 -1
View File
@@ -131,7 +131,7 @@ class MessageManagementCog(commands.Cog, name="Message Management"):
Args:
interaction (nextcord.Interaction): Interaction with command.
table (str): String to run autocomplete compared to.
table_name (str): String to run autocomplete compared to.
"""
await interaction.response.send_autocomplete(autofill_tables(interaction.guild_id, table_name))