Remove all references to table. Remove a dead function. Fix some code smells.
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
Contains various utlity functions for highscores bot
|
||||
"""
|
||||
|
||||
import json
|
||||
import time
|
||||
|
||||
import nextcord
|
||||
@@ -400,31 +399,3 @@ async def submit_score(
|
||||
group = session.scalar(stmt)
|
||||
|
||||
await send_highscore_message(session, interaction.guild, group)
|
||||
|
||||
|
||||
def add_preset_configuration(guild_id: int, config_str: str) -> None:
|
||||
"""
|
||||
Adds an example configuration to a Guild. Uses guild id to know which guild and
|
||||
config name to open a file in example_config.
|
||||
|
||||
Args:
|
||||
guild_id (int): Guild id to add config to
|
||||
config_str (str): Config name to add
|
||||
"""
|
||||
with Session(engine) as session:
|
||||
with open(f"example_config/{config_str}.json", encoding="utf-8") as file:
|
||||
config = json.load(file)
|
||||
|
||||
for group_name, categorys in config["tables"].items():
|
||||
group_obj = CategoryGroup(GroupName=group_name, GuildId=guild_id)
|
||||
session.add(group_obj)
|
||||
for category_name in categorys:
|
||||
cat_obj = Category(
|
||||
CategoryName=category_name,
|
||||
Size=config["table_size"],
|
||||
IsTimeRecord=config["categories"][category_name]["is_time_record"],
|
||||
IsAscending=config["categories"][category_name]["ascending"],
|
||||
)
|
||||
session.add(cat_obj)
|
||||
|
||||
session.commit()
|
||||
|
||||
Reference in New Issue
Block a user