Love Live TCG Module
- class LoveLiveTCG(*args: Any, **kwargs: Any)
Bases:
Cog- async tcg_info(ctx, card_number: str, untranslated: bool = False)
Fetches and displays information about a specific Love Live TCG card.
By default, displays cards in English from the
cards_entable. Use theuntranslatedparameter to show cards from thecardstable (Japanese/untranslated).Aliases:
tiSyntax:
!!tcg_info <card_number> [untranslated] !!ti <card_number> [untranslated]
Parameters:
card_number(str): The card number to look up (e.g., “001”, “PR-001”)untranslated(bool, optional): If True, shows the card from the untranslatedcardstable. Defaults to False (shows English translation fromcards_en).
Example:
!!tcg_info 001 !!ti PR-001 !!tcg_info 001 True
- Returns:
An embedded message with card information including image, stats, and special abilities.
- Return type:
discord.Embed
- async tcg_info_jp(ctx, card_number: str)
Fetches and displays information about a specific Love Live TCG card in Japanese (untranslated).
Aliases:
ti_jpSyntax:
!!tcg_info_jp <card_number> !!ti_jp <card_number>
Parameters:
card_number(str): The card number to look up (e.g., “001”, “PR-001”)
Example:
!!tcg_info_jp 001 !!ti_jp PR-001
- Returns:
An embedded message with Japanese/untranslated card information including image, stats, and special abilities.
- Return type:
discord.Embed
- async tcg_random_prefix(ctx: Context, *, query: str = '')
Show a random Love Live TCG card matching optional filters.
Works like the idol card commands:
!!tcg kotori,!!tcg liella,!!tcg jp kotori,!!tcg live snow halation,!!tcg member kotori sr, etc. Filters can be stacked in any order.Syntax:
!!tcg !!tcg kotori !!tcg jp liella kanon !!tcg live snow halation !!tcg pack next step !!tcg member kotori rr jp
Flags / keywords:
jp/untranslated/japanese— show the Japanesecardsrowmember/energy— card type filterlive— live cards; following words = song name (partial match)pack/booster— following words = booster pack name (partial match)
- tcg = <discord.app_commands.commands.Group object>
- async tcg_info_app(interaction: Interaction, card: str, untranslated: bool | None = False)
Get information about a specific TCG card.
Syntax:
/tcg info
- async random_card(interaction: Interaction, untranslated: bool | None = False, card_type: Literal['Energy', 'Member', 'Live'] | None = None, name: str | None = None)
Fetches a random card.
By default, displays cards in English from the
cards_entable. Use theuntranslatedparameter to show cards from thecardstable (Japanese/untranslated).If untranslated is True, filters are applied to cards and the Japanese data is displayed.
If untranslated is False (default), filters are applied to cards_en and the English data is displayed.
Filters always use English values (from cards_en) for consistency, then map to the appropriate table.
Syntax:
/tcg random
- async tcg_search(interaction: Interaction, idol: str | None = None, unit: str | None = None, live: str | None = None, rarity: str | None = None, booster_pack: str | None = None, untranslated: bool | None = False)
Search TCG cards and show image previews with clickable card IDs.
Filters always use English
cards_encolumns (same as/tcg random). Whenuntranslatedis True, matched cards are shown from thecardstable.Syntax:
/tcg search
- async update_cards_from_json(ctx, force: str = None)
Update the cards database from JSON files created by llscraper.py.
This command merges every
all_cards_*.jsonscrape file (newer files override the samecard_number) and imports the combined set into thecardstable. Missingcards_enrows are created automatically so/tcg searchcan find new expansions. Run!!tcgimport_app_dualafter lltcgweb sync when English skill text should match the web app.When using the
forceparameter, it will also clean up any extra cards in the database that are not present in the merged JSON set.Aliases:
tcgimportSyntax:
!!update_cards_from_json [force] !!tcgimport [force]
Parameters:
force(str, optional): If provided (as “force”, “true”, “yes”, or “1”), updates existing cards and removes cards from the database that are not in the JSON file.
Example:
!!tcgimport !!tcgimport force
Attention
This command requires admin permissions (
llradmincheck).- Returns:
Status messages indicating the import progress and results.
- Return type:
discord.Message
- async tcg_yell_icon_patch(ctx)
Update
blade_hearts(insideheartsJSON) andspecial_heartfor Live cards from committedtcg_yell_icon_patch.json(official cardlist yell icons).Does not delete cards or change other fields. Safe to re-run.
Aliases:
tcgyellicons,tcgyellpatchExample:
!!tcgyellicons
- async list_json_files(ctx)
List all available JSON files matching the
all_cards_*.jsonpattern.Displays up to 10 files sorted by modification time (newest first), showing the filename, modification date, and file size.
Syntax:
!!list_json_filesExample:
!!list_json_filesAttention
This command requires admin permissions (
llradmincheck).- Returns:
A message listing available JSON files with their metadata.
- Return type:
discord.Message
- async export_card_numbers(ctx)
Export all card numbers from the database to
existing_cards.jsonfor the scraper to use.This command exports all card numbers from the
cardstable to a JSON file, which can be used by the scraper to determine which cards have already been processed. The file is automatically committed and pushed to GitHub.Aliases:
tcgexportSyntax:
!!export_card_numbers !!tcgexport
Example:
!!tcgexportAttention
This command requires admin permissions (
llradmincheck).- Returns:
Status messages indicating the export progress and Git operations.
- Return type:
discord.Message
- async import_english_cards(ctx, force: str = None)
Import English card translations from
all_cards_en_*.jsonfiles into thecards_entable.This command imports translated card data from the newest
all_cards_en_*.jsonfile created bycardtranslate_json.py. Use theforceparameter to update existing cards.Aliases:
tcgimport_enSyntax:
!!import_english_cards [force] !!tcgimport_en [force]
Parameters:
force(str, optional): If provided (as “force”, “true”, “yes”, or “1”), updates existing cards in addition to adding new ones.
Example:
!!tcgimport_en !!tcgimport_en force
Attention
This command requires admin permissions (
llradmincheck).- Returns:
Status messages indicating the import progress and results.
- Return type:
discord.Message
- async import_app_english_cards(ctx, filename: str = None)
Import English card names and skill text from
tcg_cards_en_app_*.json.Generated by
python export_cards_en_from_app.pyin lltcgweb fromcards.json. Existingcards_enrows get app English metadata replaced (name, skill text, booster pack, series, units, card type). New rows are inserted using non-translated columns from thecardstable.Aliases:
tcgimport_app_enSyntax:
!!import_app_english_cards [filename] !!tcgimport_app_en [filename]
Example:
!!tcgimport_app_en !!tcgimport_app_en tcg_cards_en_app_20260619_120000.json
Attention
This command requires admin permissions (
llradmincheck).- Returns:
Status messages indicating the import progress and results.
- Return type:
discord.Message
- async import_app_dual_skills(ctx, en_filename: str = None, jp_filename: str = None)
Import English
cards_enand Japanesecards.special_infofrom paired exports produced bypython sync_discord_card_skills.py --write-onlyin lltcgweb.With no filenames, uses the newest
tcg_cards_en_app_*.jsonand the matchingtcg_cards_jp_skill_patch_<same timestamp>.json(or newest JP patch).Aliases:
tcgimport_app_dual,import_app_dual_cardsSyntax:
!!import_app_dual_skills [en_filename] [jp_filename] !!tcgimport_app_dual !!tcgimport_app_dual tcg_cards_en_app_20260627_222035.json
Example:
!!tcgimport_app_dual !!tcgimport_app_dual tcg_cards_en_app_20260627_222035.json tcg_cards_jp_skill_patch_20260627_222035.json
Attention
This command requires admin permissions (
llradmincheck).- Returns:
Status messages indicating the import progress and results.
- Return type:
discord.Message
- async tcg_en_export(ctx)
Export (backup) the
cards_entable to a JSON file.Writes
cards_en_export_<timestamp>.jsonin the bot working directory. Restore with!!tcg_en_restore/!!tcg_en_import.Aliases:
tcg_en_backupSyntax:
!!tcg_en_export !!tcg_en_backup
Example:
!!tcg_en_backupAttention
This command requires admin permissions (
llradmincheck).- Returns:
A confirmation message with the exported filename and card count.
- Return type:
discord.Message
- async tcg_en_import(ctx, filename: str = None)
Restore
cards_enfrom a backup JSON file (typically from!!tcg_en_backup).If no filename is provided, uses the newest
cards_en_export_*.jsonfile. Warning: Deletes all existingcards_enrows before importing.Aliases:
tcg_en_restoreSyntax:
!!tcg_en_import [filename] !!tcg_en_restore [filename]
Parameters:
filename(str, optional): The JSON file to import from. If not provided, uses the most recently created export file.
Example:
!!tcg_en_restore !!tcg_en_restore cards_en_export_20260124_123456.json
Attention
This command requires admin permissions (
llradmincheck).- Returns:
A confirmation message with the import results.
- Return type:
discord.Message
- async tcg_stats(ctx)
Show how many cards are indexed in the
cardstable.Syntax:
!!tcgstatsExample:
!!tcgstatsAttention
This command requires admin permissions (
llradmincheck).- Returns:
The total number of indexed TCG cards in the database.
- Return type:
discord.Message
- async tcg_debug_types(ctx)
Debug command to check what card types exist in the database.
This command lists all distinct card types found in both the
cards(Japanese) andcards_en(English) tables, useful for debugging and verifying data consistency.Syntax:
!!tcg_debug_typesExample:
!!tcg_debug_typesAttention
This command requires admin permissions (
llradmincheck).- Returns:
A message listing all card types found in both tables.
- Return type:
discord.Message
- async tcg_fix_image_urls(ctx)
Fix image URLs that have underscores instead of hyphens (e.g., PR_003 -> PR-003).
This command searches for cards with incorrect image URL formatting where underscores are used instead of hyphens in card numbers (specifically patterns like
PR_###). It fixes both thecardsandcards_entables.Syntax:
!!tcg_fix_image_urlsExample:
!!tcg_fix_image_urlsAttention
This command requires admin permissions (
llradmincheck).- Returns:
A message listing all fixed image URLs and the total count.
- Return type:
discord.Message