async def set_default_coin(self, ctx, coin_name):
        await pretty_print(
            ctx,
            f"Are you sure you want to set {coin_name} as default coin?",
            caption="Give 👍 reaction to confirm",
            title="Warning",
            color=WARNING_COLOR,
        )

        def check(reaction, user):
            return user == ctx.message.author and str(reaction.emoji) == "👍"

        try:
            await self.bot.wait_for("reaction_add", timeout=30.0, check=check)
        except asyncio.TimeoutError:
            await pretty_print(ctx,
                               "Set default coin timed out 👎",
                               title="Timeout",
                               color=ERROR_COLOR)
        else:
            data.add_default_coin(ctx.guild.id, coin_name)
            await pretty_print(
                ctx,
                f"{coin_name} is now the default coin 👍",
                title="Set",
                color=GREEN_COLOR,
            )
Beispiel #2
0
async def add_mapping(mapping: CoinMapping, guildId: str):
    data.add_default_coin(guildId, mapping.coinKind)
    coinKind = data.get_default_coin(guildId)
    if not coinKind:
        raise HTTPException(status_code=404, detail="Coin not found")
    return {"guildId": guildId, "coinKind": coinKind}