def look_for_upgrades(code, deck_mode): """ Given a ArkhamDB deckcode, returns a Discord.Embed that contains the upgrade information of that deck if any. :param deck_mode: :param code: ArkhamDB ID :return: """ deck1 = find_deck(code, deck_mode) deck2 = find_former_deck(code, deck_mode) if not deck1: return create_embed(lang.locale('deck_not_found')), False elif not deck2: return create_embed(lang.locale('upgrade_not_found')), False info = check_upgrade_rules(deck2, deck1, cards.get_all_cards()) return format_upgraded_deck(deck1, info), True
def look_for_random_player_card(query): r_cards = card_search(query, cards.get_p_cards(), use_pc_keywords) card = random.choice(r_cards) embed = resolve_search([card]) if embed: return embed, True else: create_embed(lang.locale('card_not_found')), False
def look_for_list_of_cards(query): r_cards = card_search(query, cards.get_p_cards(), use_pc_keywords) result = [(c, 1) for c in r_cards[:10]] text = ">>> " + format_list_of_cards(result, sort=False) title = f"{lang.locale('ahList_title')} {len(result)}" embed = create_embed(title, text) if r_cards: return embed, True else: create_embed(lang.locale('card_not_found')), False
def tarot_slash_options(): """ Returns the slash command options for Tarot cards. :return: """ return [ create_option(name="name", description=lang.locale('name_description'), option_type=3, required=False) ]
def look_for_tarot(query): """ Given a query, returns a embed containing a tarot card of the game. If the query is empty, returns a random tarot card. :param query: A query string. :return: """ search = tarot.search_for_tarot(query) if search: return format_tarot(search), True return create_embed(lang.locale('card_not_found')), False
def deck_slash_options(): """ Returns the slash command options for decks. :return: """ return [ create_option(name="code", description=lang.locale('deck_code_desc'), option_type=4, required=True), create_option(name="type", description=lang.locale('deck_type_desc'), option_type=3, required=False, choices=[ create_choice(name=lang.locale('public_deck'), value="decklist"), create_choice(name=lang.locale('private_deck'), value="deck"), ]), ]
def format_faq_text(card_id, back=False): faq_info = load_faq() text = f"**{lang.locale('faq_title')}**: \n" if has_faq(card_id, faq_info): card = get_faq(card_id, faq_info) if back and ('text_back' in card): text += f">>> {format_text(card['text_back'])} \n" elif 'text' in card: text += f">>> {format_text(card['text'])} \n" return text else: return lang.locale('faq_not_found')
def look_for_mythos_card(query: str): """ Given a query, a list of cards and a keyword function returns a embed containing the information of a mythos card. :param query: A query string, it can contain an (TYPE) or a ~Subtext~ :return: a Discord.Embed """ r_cards = card_search(query, cards.get_e_cards(), use_ec_keywords) embed = resolve_search(r_cards) if embed: return embed, True return create_embed(lang.locale('card_not_found'), "", {}), False
def look_for_deck(code, deck_type): """ Given a ArkhamDB deckcode, returns a Discord.Embed that contains the information of that deck. :param deck_type: :param code: ArkhamDB ID :return: """ deck = find_deck(code, deck_type) if deck: deck_info = extract_deck_info(deck, cards.get_all_cards()) embed = format_deck(deck, deck_info) return embed, True return create_embed(lang.locale('deck_not_found'), "", {}), False
def look_for_card_back(query: str): """ Given a query, a list of cards and a keyword function returns a embed containing the information of a back of a card. :param query: A query string, it can contain an (TYPE) or a ~Subtext~ :return: a Discord.Embed """ f_cards = [c for c in cards.get_all_cards() if c["double_sided"]] r_cards = card_search(query, f_cards, use_ec_keywords) embed = resolve_back_search(r_cards) if embed: return embed, True return create_embed(lang.locale('card_not_found'), "", {}), False
def timing_slash_options(): """ Returns the slash command options for Game's Framework. :return: """ return [ create_option(name="timing", description=lang.locale('timings_type_desc'), option_type=3, required=True, choices=[ create_choice(name=lang.locale('mythos_phase'), value="M"), create_choice( name=lang.locale('investigation_phase'), value="I"), create_choice(name=lang.locale('enemy_phase'), value="E"), create_choice(name=lang.locale('upkeep_phase'), value="U"), create_choice(name=lang.locale('skill_test'), value="S"), ]) ]
bot = commands.Bot(command_prefix='!SrCotorre') slash = SlashCommand(bot, sync_commands=True) @bot.event async def on_ready(): print(f'{bot.user.name} está listo! :parrot:') # await bot.change_presence(activity=discord.Game('')) await bot.change_presence(activity=discord.Activity( type=discord.ActivityType.watching, name="Buttons")) # await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name="for e/info")) # await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="ArkhamDB")) @slash.slash(name="ah", description=lang.locale('ah_description'), options=player_card_slash_options()) async def ah_s(ctx: SlashContext, name="", level="", faction="", extras="", sub="", pack=""): await ctx.defer() query = format_query_pc(name, level, faction, extras, sub, pack) embed, hidden = look_for_player_card(query) await ctx.send(embed=embed) # await cards_buttons_row(bot, ctx, embed)
def general_card_slash_options(): """ Returns the slash command options for general cards. :return: """ return [ create_option(name="name", description=lang.locale('name_description'), option_type=3, required=True), create_option(name="type", description=lang.locale('card_type_desc'), option_type=3, required=False, choices=[ create_choice(name=lang.locale('scenario'), value="S"), create_choice(name=lang.locale('act'), value="A"), create_choice(name=lang.locale('agenda'), value="P"), create_choice(name=lang.locale('treachery'), value="T"), create_choice(name=lang.locale('enemy'), value="E"), create_choice(name=lang.locale('location'), value="L"), create_choice(name=lang.locale('player_cards'), value="J"), create_choice(name=lang.locale('mythos'), value="M"), ]), create_option(name="sub", description=lang.locale('sub_description'), option_type=3, required=False), create_option(name="pack", description=lang.locale('pack_description'), option_type=3, required=False), ]
def player_card_slash_options(): """ Returns the slash command options for player cards. :return: """ return [ create_option(name="name", description=lang.locale('name_description'), option_type=3, required=False), create_option(name="level", description=lang.locale('level_description'), option_type=4, required=False), create_option(name="faction", description=lang.locale('faction_description'), option_type=3, required=False, choices=[ create_choice(name=lang.locale('guardian'), value="G"), create_choice(name=lang.locale('seeker'), value="B"), create_choice(name=lang.locale('rogue'), value="R"), create_choice(name=lang.locale('mystic'), value="M"), create_choice(name=lang.locale('survivor'), value="S"), create_choice(name=lang.locale('neutral'), value="N"), ]), create_option(name="extras", description=lang.locale('extras_description'), option_type=3, required=False, choices=[ create_choice(name=lang.locale('permanent'), value="P"), create_choice(name=lang.locale('exceptional'), value="E"), create_choice(name=lang.locale('advanced/parallel'), value="A"), create_choice(name=lang.locale('unique'), value="U"), create_choice(name=lang.locale('signature'), value="C"), ]), create_option(name="sub", description=lang.locale('sub_description'), option_type=3, required=False), create_option(name="pack", description=lang.locale('pack_description'), option_type=3, required=False) ]