Compare commits
45
Commits
f61ad83e11
...
v4.2.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
48a91dca3d | ||
|
|
5eb637a3a8 | ||
|
|
f722eb1a83 | ||
|
|
7759bbc648 | ||
|
|
65de7baeda | ||
|
|
e243404480 | ||
|
|
f735e6d846 | ||
|
|
9fbaf7bcf6 | ||
|
|
1959e11e5c | ||
|
|
c25d354fc0 | ||
|
|
e5d90a71d9 | ||
|
|
785a4eff46 | ||
|
|
627112b114 | ||
|
|
9b3bd9d02c | ||
|
|
2c56c614f3 | ||
|
|
3ccaa7004e | ||
|
|
289113661f | ||
|
|
74ce22dd26 | ||
|
|
170ce1cbfb | ||
|
|
e1b761e848 | ||
|
|
68592a7df8 | ||
|
|
b28938f66a | ||
|
|
adab97f505 | ||
|
|
edf51aac2d | ||
|
|
dbc6474fc3 | ||
|
|
ed68c4174f | ||
|
|
3abbff13d5 | ||
|
|
304b089113 | ||
|
|
29a163ec46 | ||
|
|
76fbba739f | ||
|
|
7204e882f1 | ||
|
|
a8d775ca09 | ||
|
|
983b9b6f34 | ||
|
|
84c910b19c | ||
|
|
1fcb25193d | ||
|
|
f52b2fe49f | ||
|
|
24a9fa998a | ||
|
|
4785271ebb | ||
|
|
f9d765ad92 | ||
|
|
50868988c0 | ||
|
|
81ae867a43 | ||
|
|
2649ceb6bb | ||
|
|
6e02bc877f | ||
|
|
63db4c1dd2 | ||
|
|
8604ba2547 |
Vendored
+2
-2
@@ -10,8 +10,8 @@
|
|||||||
"ondelete"
|
"ondelete"
|
||||||
],
|
],
|
||||||
"python.analysis.diagnosticSeverityOverrides": {
|
"python.analysis.diagnosticSeverityOverrides": {
|
||||||
"reportOptionalMemberAccess": false,
|
"reportOptionalMemberAccess": "warning",
|
||||||
"reportArgumentType": "information",
|
"reportArgumentType": "information",
|
||||||
"reportAttributeAccessIssue": "warning"
|
"reportAttributeAccessIssue": "warning"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
FROM python:3.12.3-slim
|
FROM python:3.12.3-slim
|
||||||
|
|
||||||
# install uv
|
# install uv
|
||||||
COPY --from=ghcr.io/astral-sh/uv:0.6.2 /uv /uvx /bin/
|
COPY --from=ghcr.io/astral-sh/uv:0.6.5 /uv /uvx /bin/
|
||||||
|
|
||||||
RUN apt-get update && apt-get -y upgrade && apt-get -y install sqlite3
|
RUN apt-get update && apt-get -y upgrade && apt-get -y install sqlite3
|
||||||
|
|
||||||
|
|||||||
@@ -2,14 +2,15 @@
|
|||||||
|
|
||||||
from nextcord.ext import commands
|
from nextcord.ext import commands
|
||||||
|
|
||||||
from .create import CreateCog
|
from cogs.commands.create import CreateCog
|
||||||
from .delete import DeleteCog
|
from cogs.commands.delete import DeleteCog
|
||||||
from .help import HelpCog
|
from cogs.commands.get import GetCog
|
||||||
from .refresh import RefreshCog
|
from cogs.commands.help import HelpCog
|
||||||
from .set import SetCog
|
from cogs.commands.refresh import RefreshCog
|
||||||
from .submission import SubmissionCog
|
from cogs.commands.set import SetCog
|
||||||
from .update import UpdateCog
|
from cogs.commands.submission import SubmissionCog
|
||||||
from .view import ViewCog
|
from cogs.commands.update import UpdateCog
|
||||||
|
from cogs.commands.view import ViewCog
|
||||||
|
|
||||||
|
|
||||||
# This function will be called when this extension is loaded.
|
# This function will be called when this extension is loaded.
|
||||||
@@ -18,6 +19,7 @@ def setup(bot: commands.Bot) -> None:
|
|||||||
"""Adds all command classes to bot."""
|
"""Adds all command classes to bot."""
|
||||||
bot.add_cog(CreateCog(bot))
|
bot.add_cog(CreateCog(bot))
|
||||||
bot.add_cog(DeleteCog())
|
bot.add_cog(DeleteCog())
|
||||||
|
bot.add_cog(GetCog())
|
||||||
bot.add_cog(HelpCog())
|
bot.add_cog(HelpCog())
|
||||||
bot.add_cog(RefreshCog(bot))
|
bot.add_cog(RefreshCog(bot))
|
||||||
bot.add_cog(SetCog())
|
bot.add_cog(SetCog())
|
||||||
|
|||||||
@@ -0,0 +1,199 @@
|
|||||||
|
"""Get command hierarchy."""
|
||||||
|
|
||||||
|
import nextcord
|
||||||
|
from nextcord.ext import commands
|
||||||
|
from sqlmodel import Session, col, select
|
||||||
|
|
||||||
|
from database.db import engine
|
||||||
|
from database.models import Category, CategoryGroup
|
||||||
|
from utilities.utils import autofill_categories, autofill_groups
|
||||||
|
|
||||||
|
|
||||||
|
class GetCog(commands.Cog, name="Get command."):
|
||||||
|
"""Class holds commands for setting variables in guild's database."""
|
||||||
|
|
||||||
|
def __init__(self) -> None:
|
||||||
|
"""Default constructor for SetCog class. Does nothing."""
|
||||||
|
|
||||||
|
@nextcord.slash_command(default_member_permissions=nextcord.Permissions(administrator=True))
|
||||||
|
async def get(self, interaction: nextcord.Interaction) -> None:
|
||||||
|
"""Parent slash command for getting. Never called."""
|
||||||
|
|
||||||
|
@get.subcommand(description="Commands for getting category information.")
|
||||||
|
async def category(self, interaction: nextcord.Interaction) -> None:
|
||||||
|
"""Parent slash subcommand for getting category information. Never called."""
|
||||||
|
|
||||||
|
@category.subcommand(description="Get whether a category is sorted in ascending or descending order.")
|
||||||
|
async def is_ascending(
|
||||||
|
self,
|
||||||
|
interaction: nextcord.Interaction,
|
||||||
|
group_id: str = nextcord.SlashOption(name="group", description="Group that Category is in.", required=True),
|
||||||
|
category_id: str = nextcord.SlashOption(
|
||||||
|
name="category", description="Category to information from.", required=True
|
||||||
|
),
|
||||||
|
) -> None:
|
||||||
|
"""
|
||||||
|
Command to view how a category is sorted.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
interaction (nextcord.Interaction): Interaction that invoked the command.
|
||||||
|
group_id (str): String representation of Group id get information from. Is SlashOption.
|
||||||
|
category_id (str): String representation of Category id to get information from. Is SlashOption.
|
||||||
|
"""
|
||||||
|
stmt = (
|
||||||
|
select(Category).where(col(Category.group_id) == int(group_id)).where(col(Category.id) == int(category_id))
|
||||||
|
)
|
||||||
|
|
||||||
|
with Session(engine) as session:
|
||||||
|
if (category := session.scalar(stmt)) is None:
|
||||||
|
await interaction.response.send_message("Group or Category was not found.", ephemeral=True)
|
||||||
|
return
|
||||||
|
|
||||||
|
await interaction.response.send_message(
|
||||||
|
f"**{category.name}** is sorted in **{'ascending' if category.is_ascending else 'descending'}** order.",
|
||||||
|
ephemeral=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
@category.subcommand(description="Get whether a category required validation.")
|
||||||
|
async def is_validated(
|
||||||
|
self,
|
||||||
|
interaction: nextcord.Interaction,
|
||||||
|
group_id: str = nextcord.SlashOption(name="group", description="Group that Category is in.", required=True),
|
||||||
|
category_id: str = nextcord.SlashOption(
|
||||||
|
name="category", description="Category to information from.", required=True
|
||||||
|
),
|
||||||
|
) -> None:
|
||||||
|
"""
|
||||||
|
Command to view if a category required photo validation.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
interaction (nextcord.Interaction): Interaction that invoked the command.
|
||||||
|
group_id (str): String representation of Group id get information from. Is SlashOption.
|
||||||
|
category_id (str): String representation of Category id to get information from. Is SlashOption.
|
||||||
|
"""
|
||||||
|
stmt = (
|
||||||
|
select(Category).where(col(Category.group_id) == int(group_id)).where(col(Category.id) == int(category_id))
|
||||||
|
)
|
||||||
|
|
||||||
|
with Session(engine) as session:
|
||||||
|
if (category := session.scalar(stmt)) is None:
|
||||||
|
await interaction.response.send_message("Group or Category was not found.", ephemeral=True)
|
||||||
|
return
|
||||||
|
|
||||||
|
await interaction.response.send_message(
|
||||||
|
f"{category.name} does {'not ' if not category.is_validated else ''} require validation.",
|
||||||
|
ephemeral=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
@category.subcommand(description="Get the size for a category.")
|
||||||
|
async def size(
|
||||||
|
self,
|
||||||
|
interaction: nextcord.Interaction,
|
||||||
|
group_id: str = nextcord.SlashOption(name="group", description="Group that Category is in.", required=True),
|
||||||
|
category_id: str = nextcord.SlashOption(name="category", description="Category to get size of.", required=True),
|
||||||
|
) -> None:
|
||||||
|
"""
|
||||||
|
Command to view a category's size.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
interaction (nextcord.Interaction): Interaction that invoked the command.
|
||||||
|
group_id (str): String representation of Group id get information from. Is SlashOption.
|
||||||
|
category_id (str): String representation of Category id to get information from. Is SlashOption.
|
||||||
|
"""
|
||||||
|
stmt = (
|
||||||
|
select(Category).where(col(Category.group_id) == int(group_id)).where(col(Category.id) == int(category_id))
|
||||||
|
)
|
||||||
|
|
||||||
|
with Session(engine) as session:
|
||||||
|
if (category := session.scalar(stmt)) is None:
|
||||||
|
await interaction.response.send_message("Group or Category was not found.", ephemeral=True)
|
||||||
|
return
|
||||||
|
|
||||||
|
await interaction.response.send_message(
|
||||||
|
f"**{category.name}** has a size of **{category.size}**.", ephemeral=True
|
||||||
|
)
|
||||||
|
|
||||||
|
@get.subcommand(description="Commands for getting group information.")
|
||||||
|
async def group(self, interaction: nextcord.Interaction) -> None:
|
||||||
|
"""Parent slash subcommand for getting group information. Never called."""
|
||||||
|
|
||||||
|
@group.subcommand(description="Get the pad length of a group.")
|
||||||
|
async def pad_length(
|
||||||
|
self,
|
||||||
|
interaction: nextcord.Interaction,
|
||||||
|
group_id: str = nextcord.SlashOption(name="group", description="Group to get pad length of.", required=True),
|
||||||
|
) -> None:
|
||||||
|
"""
|
||||||
|
Command to view a group's pad length.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
interaction (nextcord.Interaction): Interaction that invoked the command.
|
||||||
|
group_id (str): String representation of Group id get information from. Is SlashOption.
|
||||||
|
"""
|
||||||
|
stmt = select(CategoryGroup).where(col(CategoryGroup.id) == int(group_id))
|
||||||
|
|
||||||
|
with Session(engine) as session:
|
||||||
|
if (group := session.scalar(stmt)) is None:
|
||||||
|
await interaction.response.send_message("Group was not found.", ephemeral=True)
|
||||||
|
return
|
||||||
|
|
||||||
|
await interaction.response.send_message(
|
||||||
|
f"**{group.name}** has a pad length of **{group.pad_length}**.", ephemeral=True
|
||||||
|
)
|
||||||
|
|
||||||
|
@group.subcommand(description="Get the username length of a group.")
|
||||||
|
async def username_length(
|
||||||
|
self,
|
||||||
|
interaction: nextcord.Interaction,
|
||||||
|
group_id: str = nextcord.SlashOption(
|
||||||
|
name="group", description="Group to get username length of.", required=True
|
||||||
|
),
|
||||||
|
) -> None:
|
||||||
|
"""
|
||||||
|
Command to view a group's username length.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
interaction (nextcord.Interaction): Interaction that invoked the command.
|
||||||
|
group_id (str): String representation of Group id get information from. Is SlashOption.
|
||||||
|
"""
|
||||||
|
stmt = select(CategoryGroup).where(col(CategoryGroup.id) == int(group_id))
|
||||||
|
|
||||||
|
with Session(engine) as session:
|
||||||
|
if (group := session.scalar(stmt)) is None:
|
||||||
|
await interaction.response.send_message("Group was not found.", ephemeral=True)
|
||||||
|
return
|
||||||
|
|
||||||
|
await interaction.response.send_message(
|
||||||
|
f"**{group.name}** has a username length of **{group.username_length}**.", ephemeral=True
|
||||||
|
)
|
||||||
|
|
||||||
|
@is_ascending.on_autocomplete("category_id")
|
||||||
|
@is_validated.on_autocomplete("category_id")
|
||||||
|
@size.on_autocomplete("category_id")
|
||||||
|
async def category_autocomplete(self, interaction: nextcord.Interaction, category_id: str, group_id: str) -> None:
|
||||||
|
"""
|
||||||
|
Autocomplete function for category names.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
interaction (nextcord.Interaction): Interaction that invoked the command.
|
||||||
|
category_id (str): String to be autocompleted with Category name.
|
||||||
|
group_id (str): Group to find Category from.
|
||||||
|
"""
|
||||||
|
await interaction.response.send_autocomplete(
|
||||||
|
autofill_categories(interaction.guild_id, int(group_id), category_id)
|
||||||
|
)
|
||||||
|
|
||||||
|
@is_ascending.on_autocomplete("group_id")
|
||||||
|
@is_validated.on_autocomplete("group_id")
|
||||||
|
@pad_length.on_autocomplete("group_id")
|
||||||
|
@size.on_autocomplete("group_id")
|
||||||
|
@username_length.on_autocomplete("group_id")
|
||||||
|
async def group_autocomplete(self, interaction: nextcord.Interaction, group_id: str) -> None:
|
||||||
|
"""
|
||||||
|
Sends results from autofill_groups back to group_output_channel for autocompletion of group_id.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
interaction (nextcord.Interaction): Interaction with command.
|
||||||
|
group_id (str): String to run autocompletion against.
|
||||||
|
"""
|
||||||
|
await interaction.response.send_autocomplete(autofill_groups(interaction.guild_id, group_id))
|
||||||
+165
-42
@@ -22,7 +22,7 @@ class SetCog(commands.Cog, name="Set command."):
|
|||||||
async def set(self, interaction: nextcord.Interaction) -> None:
|
async def set(self, interaction: nextcord.Interaction) -> None:
|
||||||
"""Parent slash command for setting settings. Never called."""
|
"""Parent slash command for setting settings. Never called."""
|
||||||
|
|
||||||
@set.subcommand("Commands for editing a category.")
|
@set.subcommand(description="Commands for editing a category.")
|
||||||
async def category(self, interaction: nextcord.Interaction) -> None:
|
async def category(self, interaction: nextcord.Interaction) -> None:
|
||||||
"""Parent slash subcommand for setting category settings. Never called."""
|
"""Parent slash subcommand for setting category settings. Never called."""
|
||||||
|
|
||||||
@@ -30,9 +30,7 @@ class SetCog(commands.Cog, name="Set command."):
|
|||||||
async def category_size(
|
async def category_size(
|
||||||
self,
|
self,
|
||||||
interaction: nextcord.Interaction,
|
interaction: nextcord.Interaction,
|
||||||
group_id: str = nextcord.SlashOption(
|
group_id: str = nextcord.SlashOption(name="group", description="Group that Category is in.", required=True),
|
||||||
name="group", description="Category Group that Category is in.", required=True
|
|
||||||
),
|
|
||||||
category_id: str = nextcord.SlashOption(
|
category_id: str = nextcord.SlashOption(
|
||||||
name="category", description="Category to update size of.", required=True
|
name="category", description="Category to update size of.", required=True
|
||||||
),
|
),
|
||||||
@@ -47,38 +45,36 @@ class SetCog(commands.Cog, name="Set command."):
|
|||||||
category_id (str): String representation of Category id to register channel to. Is SlashOption.
|
category_id (str): String representation of Category id to register channel to. Is SlashOption.
|
||||||
size (int): Size to set. Is SlashOption.
|
size (int): Size to set. Is SlashOption.
|
||||||
"""
|
"""
|
||||||
stmt = select(Category).where(col(CategoryGroup.id == group_id)).where(col(Category.id) == int(category_id))
|
stmt = (
|
||||||
|
select(Category).where(col(Category.group_id) == int(group_id)).where(col(Category.id) == int(category_id))
|
||||||
|
)
|
||||||
|
|
||||||
with Session(engine) as session:
|
with Session(engine) as session:
|
||||||
category = session.scalar(stmt)
|
if (category := session.scalar(stmt)) is None:
|
||||||
if category is None:
|
|
||||||
await interaction.response.send_message("Category or Group was not found.", ephemeral=True)
|
await interaction.response.send_message("Category or Group was not found.", ephemeral=True)
|
||||||
return
|
return
|
||||||
category.size = size
|
category.size = size
|
||||||
# session.add(category) test if this is needed. SQLAlchemy can do the update without adding.
|
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|
||||||
# Use the relationship to get group category is in.
|
# Use the relationship to get group category is in.
|
||||||
group = category.category_group
|
if (group := category.category_group) is None:
|
||||||
if group is None:
|
agon_logger.warning(f"{category.name}:{category.id} group relationship was None.")
|
||||||
agon_logger.error(f"{category.name}:{category.id} group relationship was None.")
|
|
||||||
|
|
||||||
stmt = select(CategoryGroup).where(col(CategoryGroup.id) == group_id)
|
stmt = select(CategoryGroup).where(col(CategoryGroup.id) == group_id)
|
||||||
group = session.scalar(stmt)
|
if (group := session.scalar(stmt)) is None:
|
||||||
if group is None:
|
|
||||||
await interaction.response.send_message("Group was not found.", ephemeral=True)
|
await interaction.response.send_message("Group was not found.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
await send_highscore_message(session, interaction.guild, group)
|
await send_highscore_message(session, interaction.guild, group)
|
||||||
await interaction.response.send_message(f"{category.name} size has been updated to {size}.", ephemeral=True)
|
await interaction.response.send_message(
|
||||||
|
f"**{category.name}** size has been updated to **{size}**.", ephemeral=True
|
||||||
|
)
|
||||||
|
|
||||||
@category.subcommand(description="Update the is_ascending value for a category.")
|
@category.subcommand(description="Update the is_ascending value for a category.")
|
||||||
async def is_ascending(
|
async def is_ascending(
|
||||||
self,
|
self,
|
||||||
interaction: nextcord.Interaction,
|
interaction: nextcord.Interaction,
|
||||||
group_id: str = nextcord.SlashOption(
|
group_id: str = nextcord.SlashOption(name="group", description="Group that Category is in.", required=True),
|
||||||
name="group", description="Category Group that Category is in.", required=True
|
|
||||||
),
|
|
||||||
category_id: str = nextcord.SlashOption(
|
category_id: str = nextcord.SlashOption(
|
||||||
name="category", description="Category to update is_ascending of.", required=True
|
name="category", description="Category to update is_ascending of.", required=True
|
||||||
),
|
),
|
||||||
@@ -95,37 +91,145 @@ class SetCog(commands.Cog, name="Set command."):
|
|||||||
category_id (str): String representation of Category id to register channel to. Is SlashOption.
|
category_id (str): String representation of Category id to register channel to. Is SlashOption.
|
||||||
ascending (bool): Boolean to set. Determines whether scores are sorted ascending or not. Is SlashOption.
|
ascending (bool): Boolean to set. Determines whether scores are sorted ascending or not. Is SlashOption.
|
||||||
"""
|
"""
|
||||||
stmt = select(Category).where(col(CategoryGroup.id == group_id)).where(col(Category.id) == int(category_id))
|
stmt = (
|
||||||
|
select(Category).where(col(Category.group_id) == int(group_id)).where(col(Category.id) == int(category_id))
|
||||||
|
)
|
||||||
|
|
||||||
with Session(engine) as session:
|
with Session(engine) as session:
|
||||||
category = session.scalar(stmt)
|
if (category := session.scalar(stmt)) is None:
|
||||||
if category is None:
|
|
||||||
await interaction.response.send_message("Category or Group was not found.", ephemeral=True)
|
await interaction.response.send_message("Category or Group was not found.", ephemeral=True)
|
||||||
return
|
return
|
||||||
category.is_ascending = ascending
|
category.is_ascending = ascending
|
||||||
# session.add(category) test if this is needed. SQLAlchemy can do the update without adding.
|
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|
||||||
# Use the relationship to get group category is in.
|
# Use the relationship to get group category is in.
|
||||||
group = category.category_group
|
if (group := category.category_group) is None:
|
||||||
if group is None:
|
agon_logger.warning(f"{category.name}:{category.id} group relationship was None.")
|
||||||
agon_logger.error(f"{category.name}:{category.id} group relationship was None.")
|
|
||||||
|
|
||||||
stmt = select(CategoryGroup).where(col(CategoryGroup.id) == group_id)
|
stmt = select(CategoryGroup).where(col(CategoryGroup.id) == group_id)
|
||||||
group = session.scalar(stmt)
|
if (group := session.scalar(stmt)) is None:
|
||||||
if group is None:
|
|
||||||
await interaction.response.send_message("Group was not found.", ephemeral=True)
|
await interaction.response.send_message("Group was not found.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
await send_highscore_message(session, interaction.guild, group)
|
await send_highscore_message(session, interaction.guild, group)
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
f"{category.name} is_ascending has been updated to {ascending}.", ephemeral=True
|
f"**{category.name}** is_ascending has been updated to **{ascending}**.", ephemeral=True
|
||||||
|
)
|
||||||
|
|
||||||
|
@category.subcommand(description="Update the is_validated value for a category.")
|
||||||
|
async def is_validated(
|
||||||
|
self,
|
||||||
|
interaction: nextcord.Interaction,
|
||||||
|
group_id: str = nextcord.SlashOption(name="group", description="Group that Category is in.", required=True),
|
||||||
|
category_id: str = nextcord.SlashOption(
|
||||||
|
name="category", description="Category to update is_ascending of.", required=True
|
||||||
|
),
|
||||||
|
validated: bool = nextcord.SlashOption( # noqa: FBT001
|
||||||
|
description="Whether the scores need to be validated.", required=True
|
||||||
|
),
|
||||||
|
) -> None:
|
||||||
|
"""
|
||||||
|
Command to update a category's is_validated boolean.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
interaction (nextcord.Interaction): Interaction that invoked the command.
|
||||||
|
group_id (str): String representation of Group id to register channel to. Is SlashOption.
|
||||||
|
category_id (str): String representation of Category id to register channel to. Is SlashOption.
|
||||||
|
validated (bool): Boolean to set. Determines whether scores are validated or not. Is SlashOption.
|
||||||
|
"""
|
||||||
|
stmt = (
|
||||||
|
select(Category).where(col(Category.group_id) == int(group_id)).where(col(Category.id) == int(category_id))
|
||||||
|
)
|
||||||
|
|
||||||
|
with Session(engine) as session:
|
||||||
|
if (category := session.scalar(stmt)) is None:
|
||||||
|
await interaction.response.send_message("Category or Group was not found.", ephemeral=True)
|
||||||
|
return
|
||||||
|
category.is_validated = validated
|
||||||
|
session.commit()
|
||||||
|
|
||||||
|
await interaction.response.send_message(
|
||||||
|
f"**{category.name}** is_validated has been updated to **{validated}**.", ephemeral=True
|
||||||
|
)
|
||||||
|
|
||||||
|
@category.subcommand(name="name", description="Change the name of a category.")
|
||||||
|
async def category_name(
|
||||||
|
self,
|
||||||
|
interaction: nextcord.Interaction,
|
||||||
|
group_id: str = nextcord.SlashOption(name="group", description="Group that Category is in.", required=True),
|
||||||
|
category_id: str = nextcord.SlashOption(
|
||||||
|
name="category", description="Category to update the name of.", required=True
|
||||||
|
),
|
||||||
|
name: str = nextcord.SlashOption(description="Name to update to.", required=True, min_length=1, max_length=30),
|
||||||
|
) -> None:
|
||||||
|
"""
|
||||||
|
Command to update a category's name.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
interaction (nextcord.Interaction): Interaction that invoked the command.
|
||||||
|
group_id (str): String representation of Group id to register channel to. Is SlashOption.
|
||||||
|
category_id (str): String representation of Category id to register channel to. Is SlashOption.
|
||||||
|
name (str): The name to update the category's name to. Is SlashOption.
|
||||||
|
"""
|
||||||
|
stmt = (
|
||||||
|
select(Category).where(col(Category.group_id) == int(group_id)).where(col(Category.id) == int(category_id))
|
||||||
|
)
|
||||||
|
|
||||||
|
with Session(engine) as session:
|
||||||
|
if (category := session.scalar(stmt)) is None:
|
||||||
|
await interaction.response.send_message("Category or Group was not found.", ephemeral=True)
|
||||||
|
return
|
||||||
|
old_name = category.name
|
||||||
|
category.name = name
|
||||||
|
session.commit()
|
||||||
|
|
||||||
|
# Use the relationship to get group category is in.
|
||||||
|
if (group := category.category_group) is None:
|
||||||
|
agon_logger.warning(f"{category.name}:{category.id} group relationship was None.")
|
||||||
|
|
||||||
|
stmt = select(CategoryGroup).where(col(CategoryGroup.id) == group_id)
|
||||||
|
if (group := session.scalar(stmt)) is None:
|
||||||
|
await interaction.response.send_message("Group was not found.", ephemeral=True)
|
||||||
|
return
|
||||||
|
|
||||||
|
await send_highscore_message(session, interaction.guild, group)
|
||||||
|
await interaction.response.send_message(
|
||||||
|
f"**{old_name}** has been updated to **{category.name}**.", ephemeral=True
|
||||||
)
|
)
|
||||||
|
|
||||||
@set.subcommand(description="Commands for editing a group.")
|
@set.subcommand(description="Commands for editing a group.")
|
||||||
async def group(self, interaction: nextcord.Interaction) -> None:
|
async def group(self, interaction: nextcord.Interaction) -> None:
|
||||||
"""Parent slash subcommand for setting group settings. Never called."""
|
"""Parent slash subcommand for setting group settings. Never called."""
|
||||||
|
|
||||||
|
@group.subcommand(name="name", description="Change the name of a Group.")
|
||||||
|
async def group_name(
|
||||||
|
self,
|
||||||
|
interaction: nextcord.Interaction,
|
||||||
|
group_id: str = nextcord.SlashOption(name="group", description="Group that Category is in.", required=True),
|
||||||
|
name: str = nextcord.SlashOption(description="Name to update to.", required=True, min_length=1, max_length=50),
|
||||||
|
) -> None:
|
||||||
|
"""
|
||||||
|
Command to update a group's name.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
interaction (nextcord.Interaction): Interaction that invoked the command.
|
||||||
|
group_id (str): String representation of Group id to register channel to. Is SlashOption.
|
||||||
|
name (str): The name to update the group's name to. Is SlashOption.
|
||||||
|
"""
|
||||||
|
stmt = select(CategoryGroup).where(col(CategoryGroup.id) == int(group_id))
|
||||||
|
|
||||||
|
with Session(engine) as session:
|
||||||
|
if (group := session.scalar(stmt)) is None:
|
||||||
|
await interaction.response.send_message("Group was not found.", ephemeral=True)
|
||||||
|
return
|
||||||
|
old_name = group.name
|
||||||
|
group.name = name
|
||||||
|
# session.add(group) test if this is needed. SQLAlchemy can do the update without adding.
|
||||||
|
session.commit()
|
||||||
|
|
||||||
|
await send_highscore_message(session, interaction.guild, group)
|
||||||
|
await interaction.response.send_message(f"**{old_name}** has been updated to **{group.name}**.", ephemeral=True)
|
||||||
|
|
||||||
@group.subcommand(description="Registers the channel for a Group's messages.")
|
@group.subcommand(description="Registers the channel for a Group's messages.")
|
||||||
async def output_channel(
|
async def output_channel(
|
||||||
self,
|
self,
|
||||||
@@ -155,9 +259,14 @@ class SetCog(commands.Cog, name="Set command."):
|
|||||||
.where(col(CategoryGroup.guild_id) == interaction.guild_id)
|
.where(col(CategoryGroup.guild_id) == interaction.guild_id)
|
||||||
.where(col(CategoryGroup.id) == int(group_id))
|
.where(col(CategoryGroup.id) == int(group_id))
|
||||||
)
|
)
|
||||||
group = session.scalar(stmt)
|
if (group := session.scalar(stmt)) is None:
|
||||||
group.ChannelId = channel_id
|
await interaction.response.send_message("Group or Category was not found.", ephemeral=True)
|
||||||
|
return
|
||||||
|
group.channel_id = channel_id
|
||||||
session.commit()
|
session.commit()
|
||||||
|
# TODO(imcompiling): delete the message and call send_highscore_message to send a new one. Bug needs fixed
|
||||||
|
# first.
|
||||||
|
# 082
|
||||||
await interaction.send(f"Registered <#{channel_id}>.", ephemeral=True)
|
await interaction.send(f"Registered <#{channel_id}>.", ephemeral=True)
|
||||||
|
|
||||||
@group.subcommand(
|
@group.subcommand(
|
||||||
@@ -189,14 +298,14 @@ class SetCog(commands.Cog, name="Set command."):
|
|||||||
.where(col(CategoryGroup.guild_id) == interaction.guild_id)
|
.where(col(CategoryGroup.guild_id) == interaction.guild_id)
|
||||||
.where(col(CategoryGroup.id) == int(group_id))
|
.where(col(CategoryGroup.id) == int(group_id))
|
||||||
)
|
)
|
||||||
group = session.scalar(stmt)
|
if (group := session.scalar(stmt)) is None:
|
||||||
if group is None:
|
|
||||||
await interaction.response.send_message("Group was not found.", ephemeral=True)
|
await interaction.response.send_message("Group was not found.", ephemeral=True)
|
||||||
return
|
return
|
||||||
group.PadLength = length
|
|
||||||
|
group.pad_length = length
|
||||||
session.commit()
|
session.commit()
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
f"Category pad length set to {length} for {group.name}", ephemeral=True
|
f"Category pad length set to **{length}** for **{group.name}**.", ephemeral=True
|
||||||
)
|
)
|
||||||
await send_highscore_message(session, interaction.guild, group)
|
await send_highscore_message(session, interaction.guild, group)
|
||||||
|
|
||||||
@@ -225,7 +334,9 @@ class SetCog(commands.Cog, name="Set command."):
|
|||||||
|
|
||||||
with Session(engine) as session:
|
with Session(engine) as session:
|
||||||
stmt = select(Guild).where(col(Guild.id) == interaction.guild_id)
|
stmt = select(Guild).where(col(Guild.id) == interaction.guild_id)
|
||||||
guild = session.scalar(stmt)
|
if (guild := session.scalar(stmt)) is None:
|
||||||
|
await interaction.response.send_message("Guild was not found.", ephemeral=True)
|
||||||
|
return
|
||||||
guild.submission_channel = channel_id
|
guild.submission_channel = channel_id
|
||||||
session.commit()
|
session.commit()
|
||||||
await interaction.send(f"Registered <#{channel_id}>.", ephemeral=True)
|
await interaction.send(f"Registered <#{channel_id}>.", ephemeral=True)
|
||||||
@@ -255,10 +366,15 @@ class SetCog(commands.Cog, name="Set command."):
|
|||||||
.where(col(CategoryGroup.guild_id) == interaction.guild_id)
|
.where(col(CategoryGroup.guild_id) == interaction.guild_id)
|
||||||
.where(col(CategoryGroup.id) == int(group_id))
|
.where(col(CategoryGroup.id) == int(group_id))
|
||||||
)
|
)
|
||||||
group = session.scalar(stmt)
|
if (group := session.scalar(stmt)) is None:
|
||||||
group.UsernameLength = length
|
await interaction.response.send_message("Group or Category was not found.", ephemeral=True)
|
||||||
|
return
|
||||||
|
|
||||||
|
group.username_length = length
|
||||||
session.commit()
|
session.commit()
|
||||||
await interaction.response.send_message(f"Username length set to {length}.", ephemeral=True)
|
await interaction.response.send_message(
|
||||||
|
f"Username length for **{group.name}** set to **{length}**.", ephemeral=True
|
||||||
|
)
|
||||||
|
|
||||||
@set.subcommand(description="Registers the channel for verification messages.")
|
@set.subcommand(description="Registers the channel for verification messages.")
|
||||||
async def verify_channel(
|
async def verify_channel(
|
||||||
@@ -283,13 +399,17 @@ class SetCog(commands.Cog, name="Set command."):
|
|||||||
|
|
||||||
with Session(engine) as session:
|
with Session(engine) as session:
|
||||||
stmt = select(Guild).where(col(Guild.id) == interaction.guild_id)
|
stmt = select(Guild).where(col(Guild.id) == interaction.guild_id)
|
||||||
guild = session.scalar(stmt)
|
if (guild := session.scalar(stmt)) is None:
|
||||||
guild.VerificationChannel = channel_id
|
await interaction.response.send_message("Guild was not found.", ephemeral=True)
|
||||||
|
return
|
||||||
|
guild.verification_channel = channel_id
|
||||||
session.commit()
|
session.commit()
|
||||||
await interaction.send(f"Registered <#{channel_id}>.", ephemeral=True)
|
await interaction.send(f"Registered <#{channel_id}>.", ephemeral=True)
|
||||||
|
|
||||||
|
@category_name.on_autocomplete("category_id")
|
||||||
@category_size.on_autocomplete("category_id")
|
@category_size.on_autocomplete("category_id")
|
||||||
@is_ascending.on_autocomplete("category_id")
|
@is_ascending.on_autocomplete("category_id")
|
||||||
|
@is_validated.on_autocomplete("category_id")
|
||||||
async def category_autocomplete(self, interaction: nextcord.Interaction, category_id: str, group_id: str) -> None:
|
async def category_autocomplete(self, interaction: nextcord.Interaction, category_id: str, group_id: str) -> None:
|
||||||
"""
|
"""
|
||||||
Autocomplete function for category names.
|
Autocomplete function for category names.
|
||||||
@@ -303,9 +423,12 @@ class SetCog(commands.Cog, name="Set command."):
|
|||||||
autofill_categories(interaction.guild_id, int(group_id), category_id)
|
autofill_categories(interaction.guild_id, int(group_id), category_id)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@category_name.on_autocomplete("group_id")
|
||||||
@category_size.on_autocomplete("group_id")
|
@category_size.on_autocomplete("group_id")
|
||||||
@output_channel.on_autocomplete("group_id")
|
@group_name.on_autocomplete("group_id")
|
||||||
@is_ascending.on_autocomplete("group_id")
|
@is_ascending.on_autocomplete("group_id")
|
||||||
|
@is_validated.on_autocomplete("group_id")
|
||||||
|
@output_channel.on_autocomplete("group_id")
|
||||||
@pad_length.on_autocomplete("group_id")
|
@pad_length.on_autocomplete("group_id")
|
||||||
@username_length.on_autocomplete("group_id")
|
@username_length.on_autocomplete("group_id")
|
||||||
async def group_autocomplete(self, interaction: nextcord.Interaction, group_id: str) -> None:
|
async def group_autocomplete(self, interaction: nextcord.Interaction, group_id: str) -> None:
|
||||||
|
|||||||
@@ -64,10 +64,7 @@ class SubmissionCog(commands.Cog):
|
|||||||
.where(col(Category.group_id) == int(group_id))
|
.where(col(Category.group_id) == int(group_id))
|
||||||
.where(col(Category.id) == int(category_id))
|
.where(col(Category.id) == int(category_id))
|
||||||
)
|
)
|
||||||
|
if (category := session.scalar(stmt)) is None:
|
||||||
category: Category | None = session.scalar(stmt)
|
|
||||||
|
|
||||||
if category is None:
|
|
||||||
await interaction.response.send_message("Category not found.", ephemeral=True)
|
await interaction.response.send_message("Category not found.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -79,10 +76,13 @@ class SubmissionCog(commands.Cog):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# check with regex if score is in correct format
|
# check with regex if score is in correct format
|
||||||
verified_score = await self.verify_score(interaction, score, is_time_record=category.is_time_record)
|
|
||||||
|
|
||||||
# check if verify_score was successful. It replies with corrections required itself.
|
# check if verify_score was successful. It replies with corrections required itself.
|
||||||
if verified_score is None:
|
if (
|
||||||
|
verified_score := await self.verify_score(interaction, score, is_time_record=category.is_time_record)
|
||||||
|
) is None:
|
||||||
|
# This response message will be filled out better once command is split up to
|
||||||
|
# know which type it expects...
|
||||||
|
await interaction.response.send_message("Format was incorrect.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
# Create submission verification request or submit score if verification not needed.
|
# Create submission verification request or submit score if verification not needed.
|
||||||
@@ -92,16 +92,13 @@ class SubmissionCog(commands.Cog):
|
|||||||
return
|
return
|
||||||
|
|
||||||
stmt = select(col(Guild.verification_channel)).where(col(Guild.id) == interaction.guild_id)
|
stmt = select(col(Guild.verification_channel)).where(col(Guild.id) == interaction.guild_id)
|
||||||
verification_channel_id: int | None = session.scalar(stmt)
|
|
||||||
|
|
||||||
if verification_channel_id is None:
|
if (verification_channel_id := session.scalar(stmt)) is None:
|
||||||
error_response = "No verification channel was registered. Contact server admins."
|
error_response = "No verification channel was registered. Contact server admins."
|
||||||
await interaction.response.send_message(error_response, ephemeral=True)
|
await interaction.response.send_message(error_response, ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
channel = interaction.guild.get_channel(verification_channel_id)
|
if (channel := interaction.guild.get_channel(verification_channel_id)) is None:
|
||||||
|
|
||||||
if channel is None:
|
|
||||||
error_response = "Registered Verification channel does not exist. Contact server admins."
|
error_response = "Registered Verification channel does not exist. Contact server admins."
|
||||||
await interaction.response.send_message(error_response, ephemeral=True)
|
await interaction.response.send_message(error_response, ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -26,10 +26,9 @@ class GuildListener(commands.Cog, name="Guild Listener"):
|
|||||||
"""
|
"""
|
||||||
with Session(engine) as session:
|
with Session(engine) as session:
|
||||||
stmt = select(Guild).where(col(Guild.id == guild.id))
|
stmt = select(Guild).where(col(Guild.id == guild.id))
|
||||||
guild_data = session.scalar(stmt)
|
|
||||||
|
|
||||||
# just in case check if the guild already exists
|
# just in case check if the guild already exists
|
||||||
if guild_data is None:
|
if (guild_data := session.scalar(stmt)) is None:
|
||||||
new_guild = Guild(id=guild.id, name=guild.name)
|
new_guild = Guild(id=guild.id, name=guild.name)
|
||||||
session.add(new_guild)
|
session.add(new_guild)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class GuildData(commands.Cog, name="Guild Data"):
|
|||||||
with Session(engine) as session:
|
with Session(engine) as session:
|
||||||
for guild in self.bot.guilds:
|
for guild in self.bot.guilds:
|
||||||
# update given guild name for guild id
|
# update given guild name for guild id
|
||||||
stmt = select(Guild).where(col(Guild.id == guild.id))
|
stmt = select(Guild).where(col(Guild.id) == guild.id)
|
||||||
guild_data = session.scalar(stmt)
|
guild_data = session.scalar(stmt)
|
||||||
|
|
||||||
# just in case checking if the guild doesn't exist.
|
# just in case checking if the guild doesn't exist.
|
||||||
@@ -39,6 +39,6 @@ class GuildData(commands.Cog, name="Guild Data"):
|
|||||||
new_guild = Guild(id=guild.id, name=guild.name)
|
new_guild = Guild(id=guild.id, name=guild.name)
|
||||||
session.add(new_guild)
|
session.add(new_guild)
|
||||||
else:
|
else:
|
||||||
guild_data.GuildName = guild.name
|
guild_data.name = guild.name
|
||||||
|
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|||||||
@@ -39,9 +39,7 @@ class VerificationView(nextcord.ui.View):
|
|||||||
.where(col(Submission.message_id) == interaction.message.id)
|
.where(col(Submission.message_id) == interaction.message.id)
|
||||||
)
|
)
|
||||||
|
|
||||||
submission = session.scalar(stmt)
|
if (submission := session.scalar(stmt)) is None:
|
||||||
|
|
||||||
if submission is None:
|
|
||||||
await interaction.response.send_message("Could not find submission data in database.", ephemeral=True)
|
await interaction.response.send_message("Could not find submission data in database.", ephemeral=True)
|
||||||
await interaction.message.delete()
|
await interaction.message.delete()
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -2,13 +2,16 @@
|
|||||||
|
|
||||||
from sqlmodel import SQLModel, create_engine
|
from sqlmodel import SQLModel, create_engine
|
||||||
from utilities import config
|
from utilities import config
|
||||||
|
from utilities.logger import agon_logger
|
||||||
|
|
||||||
from . import models # noqa: F401 - Need this import for creating the models.
|
from . import models # noqa: F401 - Need this import for creating the models.
|
||||||
|
|
||||||
if config.ENVIRONMENT == "prod":
|
if config.ENVIRONMENT == "prod":
|
||||||
url = f"mysql+pymysql://{config.SQL_USER}:{config.SQL_PASS}@{config.SQL_HOST}/{config.SQL_DB}"
|
url = f"mysql+pymysql://{config.SQL_USER}:{config.SQL_PASS}@{config.SQL_HOST}/{config.SQL_DB}"
|
||||||
|
agon_logger.info("Connected to prod database.")
|
||||||
else:
|
else:
|
||||||
url = "sqlite:///database.db"
|
url = "sqlite:///database.db"
|
||||||
|
agon_logger.info("Connected to local dev database.")
|
||||||
engine = create_engine(url)
|
engine = create_engine(url)
|
||||||
|
|
||||||
# Don't need to create all when connected to prod.
|
# Don't need to create all when connected to prod.
|
||||||
|
|||||||
+16
-8
@@ -10,6 +10,7 @@ from sqlmodel import col
|
|||||||
|
|
||||||
from database.db import engine
|
from database.db import engine
|
||||||
from database.models import Category, CategoryGroup, Guild, Score
|
from database.models import Category, CategoryGroup, Guild, Score
|
||||||
|
from main import agon_logger
|
||||||
|
|
||||||
MAX_LINE_LENGTH = 142
|
MAX_LINE_LENGTH = 142
|
||||||
|
|
||||||
@@ -64,7 +65,7 @@ def autofill_groups(guild_id: int, group_begin: str) -> "dict[str, str]":
|
|||||||
"""
|
"""
|
||||||
with Session(engine) as session:
|
with Session(engine) as session:
|
||||||
# Select all groups in guild.
|
# Select all groups in guild.
|
||||||
stmt = select(CategoryGroup).wherecol((CategoryGroup.guild_id) == guild_id)
|
stmt = select(CategoryGroup).where(col(CategoryGroup.guild_id) == guild_id)
|
||||||
|
|
||||||
# dict has to have key values of same type for discord.
|
# dict has to have key values of same type for discord.
|
||||||
group_dict: dict[str, str] = {group.name: str(group.id) for group in session.scalars(stmt)}
|
group_dict: dict[str, str] = {group.name: str(group.id) for group in session.scalars(stmt)}
|
||||||
@@ -275,6 +276,8 @@ def format_highscore_message(session: Session, group: CategoryGroup) -> str:
|
|||||||
return ret_string + "```"
|
return ret_string + "```"
|
||||||
|
|
||||||
|
|
||||||
|
# TODO(imcompiling): rework into two functions to remove the boolean and reduce function arguments.
|
||||||
|
# 084
|
||||||
def format_score_string(
|
def format_score_string(
|
||||||
username: str,
|
username: str,
|
||||||
score: float,
|
score: float,
|
||||||
@@ -327,7 +330,7 @@ def get_time_str(time_in: float) -> str:
|
|||||||
return time.strftime(f"%-M:%S.{milliseconds}", time.gmtime(time_in))
|
return time.strftime(f"%-M:%S.{milliseconds}", time.gmtime(time_in))
|
||||||
|
|
||||||
|
|
||||||
async def send_highscore_message(session: Session, guild: nextcord.Guild, group: CategoryGroup) -> nextcord.Message:
|
async def send_highscore_message(session: Session, guild: nextcord.Guild, group: CategoryGroup) -> None:
|
||||||
"""
|
"""
|
||||||
Function takes care of checking if a message exists for a group.
|
Function takes care of checking if a message exists for a group.
|
||||||
|
|
||||||
@@ -337,23 +340,28 @@ async def send_highscore_message(session: Session, guild: nextcord.Guild, group:
|
|||||||
session (Session): The sqlalchemy session being used for this function call.
|
session (Session): The sqlalchemy session being used for this function call.
|
||||||
guild (nextcord.Guild): the nextcord.Guild object requesting this message.
|
guild (nextcord.Guild): the nextcord.Guild object requesting this message.
|
||||||
group (CategoryGroup): group to post to the message.
|
group (CategoryGroup): group to post to the message.
|
||||||
|
|
||||||
Returns:
|
|
||||||
nextcord.Message: Message object that was posted with group contents.
|
|
||||||
"""
|
"""
|
||||||
highscore_string = format_highscore_message(session, group)
|
highscore_string = format_highscore_message(session, group)
|
||||||
channel = guild.get_channel(group.channel_id)
|
channel = guild.get_channel(group.channel_id)
|
||||||
|
|
||||||
|
if not isinstance(channel, nextcord.TextChannel):
|
||||||
|
agon_logger.error(
|
||||||
|
"Channel id %s in guild %s is does not correspond to a TextChannel.", channel.id, channel.guild.id
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
if group.message_id is None:
|
if group.message_id is None:
|
||||||
# message doesn't exist.
|
# message doesn't exist.
|
||||||
message: nextcord.Message = await channel.send(highscore_string)
|
message: nextcord.Message = await channel.send(highscore_string)
|
||||||
group.MessageId = message.id
|
group.message_id = message.id
|
||||||
session.commit()
|
session.commit()
|
||||||
else:
|
else:
|
||||||
|
# TODO(imcompiling): check what happens when message is deleted.
|
||||||
|
# https://gitea.cheezers.org/imcompiling/agon/issues/83
|
||||||
message: nextcord.Message = await channel.fetch_message(group.message_id)
|
message: nextcord.Message = await channel.fetch_message(group.message_id)
|
||||||
await message.edit(content=highscore_string)
|
await message.edit(content=highscore_string)
|
||||||
|
|
||||||
return message
|
return
|
||||||
|
|
||||||
|
|
||||||
async def submit_score(
|
async def submit_score(
|
||||||
@@ -390,7 +398,7 @@ async def submit_score(
|
|||||||
existing_score = session.scalar(stmt)
|
existing_score = session.scalar(stmt)
|
||||||
|
|
||||||
if existing_score:
|
if existing_score:
|
||||||
existing_score.Score = score_f
|
existing_score.score = score_f
|
||||||
else:
|
else:
|
||||||
score_obj = Score(username=username, score=score_f, category_id=category_id)
|
score_obj = Score(username=username, score=score_f, category_id=category_id)
|
||||||
session.add(score_obj)
|
session.add(score_obj)
|
||||||
|
|||||||
Reference in New Issue
Block a user