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_en table. Use the untranslated parameter to show cards from the cards table (Japanese/untranslated).

Aliases: ti

Syntax:

!!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 untranslated cards table. Defaults to False (shows English translation from cards_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

Permissions

Author: Everyone (subject to channel/guild command restrictions)

Bot: View Channel, Send Messages (plus Connect/Speak for voice commands)

async tcg_info_jp(ctx, card_number: str)

Fetches and displays information about a specific Love Live TCG card in Japanese (untranslated).

Aliases: ti_jp

Syntax:

!!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

Permissions

Author: Everyone (subject to channel/guild command restrictions)

Bot: View Channel, Send Messages (plus Connect/Speak for voice commands)

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 Japanese cards row

  • member / energy — card type filter

  • live — live cards; following words = song name (partial match)

  • pack / booster — following words = booster pack name (partial match)

Permissions

Author: Everyone (subject to channel/guild command restrictions)

Bot: View Channel, Send Messages (plus Connect/Speak for voice commands)

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.

Permissions

Author: Everyone (subject to channel/guild command restrictions)

Bot: View Channel, Send Messages (plus Connect/Speak for voice commands)

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_en table. Use the untranslated parameter to show cards from the cards table (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.

Permissions

Author: Everyone (subject to channel/guild command restrictions)

Bot: View Channel, Send Messages (plus Connect/Speak for voice commands)

Syntax:

/tcg random

Search TCG cards and show image previews with clickable card IDs.

Filters always use English cards_en columns (same as /tcg random). When untranslated is True, matched cards are shown from the cards table.

Permissions

Author: Everyone (subject to channel/guild command restrictions)

Bot: View Channel, Send Messages (plus Connect/Speak for voice commands)

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_*.json scrape file (newer files override the same card_number) and imports the combined set into the cards table. Missing cards_en rows are created automatically so /tcg search can find new expansions. Run !!tcgimport_app_dual after lltcgweb sync when English skill text should match the web app.

When using the force parameter, it will also clean up any extra cards in the database that are not present in the merged JSON set.

Aliases: tcgimport

Syntax:

!!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 (llradmin check).

Returns:

Status messages indicating the import progress and results.

Return type:

discord.Message

Permissions

Author: LLR Admin (server owner / bot owner)

Bot: View Channel, Send Messages (plus Connect/Speak for voice commands)

async tcg_yell_icon_patch(ctx)

Update blade_hearts (inside hearts JSON) and special_heart for Live cards from committed tcg_yell_icon_patch.json (official cardlist yell icons).

Does not delete cards or change other fields. Safe to re-run.

Aliases: tcgyellicons, tcgyellpatch

Example: !!tcgyellicons

Permissions

Author: LLR Admin (server owner / bot owner)

Bot: View Channel, Send Messages (plus Connect/Speak for voice commands)

async list_json_files(ctx)

List all available JSON files matching the all_cards_*.json pattern.

Displays up to 10 files sorted by modification time (newest first), showing the filename, modification date, and file size.

Syntax:

!!list_json_files

Example:

!!list_json_files

Attention

This command requires admin permissions (llradmin check).

Returns:

A message listing available JSON files with their metadata.

Return type:

discord.Message

Permissions

Author: LLR Admin (server owner / bot owner)

Bot: View Channel, Send Messages (plus Connect/Speak for voice commands)

async export_card_numbers(ctx)

Export all card numbers from the database to existing_cards.json for the scraper to use.

This command exports all card numbers from the cards table 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: tcgexport

Syntax:

!!export_card_numbers
!!tcgexport

Example:

!!tcgexport

Attention

This command requires admin permissions (llradmin check).

Returns:

Status messages indicating the export progress and Git operations.

Return type:

discord.Message

Permissions

Author: LLR Admin (server owner / bot owner)

Bot: View Channel, Send Messages (plus Connect/Speak for voice commands)

async import_english_cards(ctx, force: str = None)

Import English card translations from all_cards_en_*.json files into the cards_en table.

This command imports translated card data from the newest all_cards_en_*.json file created by cardtranslate_json.py. Use the force parameter to update existing cards.

Aliases: tcgimport_en

Syntax:

!!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 (llradmin check).

Returns:

Status messages indicating the import progress and results.

Return type:

discord.Message

Permissions

Author: LLR Admin (server owner / bot owner)

Bot: View Channel, Send Messages (plus Connect/Speak for voice commands)

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.py in lltcgweb from cards.json. Existing cards_en rows get app English metadata replaced (name, skill text, booster pack, series, units, card type). New rows are inserted using non-translated columns from the cards table.

Aliases: tcgimport_app_en

Syntax:

!!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 (llradmin check).

Returns:

Status messages indicating the import progress and results.

Return type:

discord.Message

Permissions

Author: LLR Admin (server owner / bot owner)

Bot: View Channel, Send Messages (plus Connect/Speak for voice commands)

async import_app_dual_skills(ctx, en_filename: str = None, jp_filename: str = None)

Import English cards_en and Japanese cards.special_info from paired exports produced by python sync_discord_card_skills.py --write-only in lltcgweb.

With no filenames, uses the newest tcg_cards_en_app_*.json and the matching tcg_cards_jp_skill_patch_<same timestamp>.json (or newest JP patch).

Aliases: tcgimport_app_dual, import_app_dual_cards

Syntax:

!!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 (llradmin check).

Returns:

Status messages indicating the import progress and results.

Return type:

discord.Message

Permissions

Author: LLR Admin (server owner / bot owner)

Bot: View Channel, Send Messages (plus Connect/Speak for voice commands)

async tcg_en_export(ctx)

Export (backup) the cards_en table to a JSON file.

Writes cards_en_export_<timestamp>.json in the bot working directory. Restore with !!tcg_en_restore / !!tcg_en_import.

Aliases: tcg_en_backup

Syntax:

!!tcg_en_export
!!tcg_en_backup

Example:

!!tcg_en_backup

Attention

This command requires admin permissions (llradmin check).

Returns:

A confirmation message with the exported filename and card count.

Return type:

discord.Message

Permissions

Author: LLR Admin (server owner / bot owner)

Bot: View Channel, Send Messages (plus Connect/Speak for voice commands)

async tcg_en_import(ctx, filename: str = None)

Restore cards_en from a backup JSON file (typically from !!tcg_en_backup).

If no filename is provided, uses the newest cards_en_export_*.json file. Warning: Deletes all existing cards_en rows before importing.

Aliases: tcg_en_restore

Syntax:

!!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 (llradmin check).

Returns:

A confirmation message with the import results.

Return type:

discord.Message

Permissions

Author: LLR Admin (server owner / bot owner)

Bot: View Channel, Send Messages (plus Connect/Speak for voice commands)

async tcg_stats(ctx)

Show how many cards are indexed in the cards table.

Syntax:

!!tcgstats

Example:

!!tcgstats

Attention

This command requires admin permissions (llradmin check).

Returns:

The total number of indexed TCG cards in the database.

Return type:

discord.Message

Permissions

Author: LLR Admin (server owner / bot owner)

Bot: View Channel, Send Messages (plus Connect/Speak for voice commands)

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) and cards_en (English) tables, useful for debugging and verifying data consistency.

Syntax:

!!tcg_debug_types

Example:

!!tcg_debug_types

Attention

This command requires admin permissions (llradmin check).

Returns:

A message listing all card types found in both tables.

Return type:

discord.Message

Permissions

Author: LLR Admin (server owner / bot owner)

Bot: View Channel, Send Messages (plus Connect/Speak for voice commands)

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 the cards and cards_en tables.

Syntax:

!!tcg_fix_image_urls

Example:

!!tcg_fix_image_urls

Attention

This command requires admin permissions (llradmin check).

Returns:

A message listing all fixed image URLs and the total count.

Return type:

discord.Message

Permissions

Author: LLR Admin (server owner / bot owner)

Bot: View Channel, Send Messages (plus Connect/Speak for voice commands)