async def search(self, client: Client, channel: Channel, args: str, author: Member, **_: Dict[str, Any]) -> None: """`!search {query}` Search for cards, using a scryfall-style query.""" await client.send_typing(channel) how_many, cardnames = fetcher.search_scryfall(args) cbn = oracle.cards_by_name() cards = [cbn[name] for name in cardnames if cbn.get(name) is not None] await post_cards(client, cards, channel, author, more_results_link(args, how_many))
async def scryfall(self, bot, channel, args, author): #mything """`!scryfall {query}` search scryfall for the query.""" too_many, cards = fetcher.search_scryfall(args) additional_text = 'There are too many cards, only a few are shown.\n' if too_many else '' if len(cards) > 10: additional_text += '<http://scryfall.com/search/?q=' + fetcher.internal.escape(args) + '>' await bot.post_cards(cards, channel, author, additional_text)
async def scryfall(self, bot, channel, args, author): """`!scryfall {query}` Search for cards using Scryfall.""" await bot.client.send_typing(channel) how_many, cardnames = fetcher.search_scryfall(args) cbn = oracle.cards_by_name() cards = [ cbn.get(name) for name in cardnames if cbn.get(name) is not None ] await bot.post_cards(cards, channel, author, more_results_link(args, how_many))
def complex_search(query: str) -> List[Card]: if query == '': return [] _, cardnames = fetcher.search_scryfall(query) cbn = oracle.cards_by_name() return [cbn[name] for name in cardnames if cbn.get(name) is not None]
def rotation(interestingness: Optional[str] = None) -> str: rotation_query = request.args.get('rq') _, cardnames = fetcher.search_scryfall( rotation_query, exhaustive=True) if rotation_query else (None, None) view = Rotation(interestingness, rotation_query, cardnames) return view.page()