async def random(self, client: Client, channel: TextChannel, args: str, **_: Dict[str, Any]) -> None: """`!random` Request a random PD legal card. `!random X` Request X random PD legal cards.""" number = 1 additional_text = '' if len(args) > 0: try: number = int(args) if number > 10: additional_text = "{number}? Tsk. Here's ten.".format( number=number) number = 10 except ValueError: pass cards = [ oracle.cards_by_name()[name] for name in random.sample(oracle.legal_cards(), number) ] await post_cards(client, cards, channel, None, additional_text)
def info_emoji(c: Card, verbose: bool = False, show_legality: bool = True, no_rotation_hype: bool = False) -> str: s = '' rot_emoji = '' if show_legality: legal = c.name in oracle.legal_cards() if legal: s += ':white_check_mark:' else: s += ':no_entry_sign:' if rotation.in_rotation() and not no_rotation_hype: rot_emoji = get_future_legality(c, legal) s += rot_emoji if not legal and verbose and not rot_emoji: s += ' (not legal in PD)' if c.bugs: s += ':beetle:' return s
async def update(self, client: Client, channel: Channel, **_: Dict[str, Any]) -> None: """Forces an update to legal cards and bugs.""" oracle.legal_cards(force=True) multiverse.update_bugged_cards() await client.send_message(channel, 'Reloaded legal cards and bugs.')
async def update(self, bot, channel): """Forces an update to legal cards and bugs.""" oracle.legal_cards(force=True) multiverse.update_bugged_cards() await bot.client.send_message(channel, 'Reloaded legal cards and bugs.')
def test_legality_list() -> None: legal_cards = oracle.legal_cards() assert len(legal_cards) > 0