示例#1
0
 async def bet(
     self,
     ctx,
     maximum: IntGreaterThan(1) = 6,
     tip: IntGreaterThan(0) = 6,
     money: IntFromTo(0, 100_000) = 0,
 ):
示例#2
0
    async def purchase(self,
                       ctx,
                       booster: str.lower,
                       amount: IntGreaterThan(0) = 1):
        _("""`<booster>` - The booster type to buy, can be time, luck, money or all
            `[amount]` - The amount of boosters to buy; defaults to 1

            Buy one or more booster from the store. For a detailed explanation what the boosters do, check `{prefix}help boosters`."""
          )
        if booster not in ["time", "luck", "money", "all"]:
            return await ctx.send(
                _("Please either buy `time`, `luck` or `money`."))
        price = {
            "time": 1000,
            "luck": 500,
            "money": 1000,
            "all": 2500
        }[booster] * amount
        if ctx.character_data["money"] < price:
            return await ctx.send(_("You're too poor."))
        if booster != "all":
            async with self.bot.pool.acquire() as conn:
                await conn.execute(
                    f"UPDATE profile SET {booster}_booster={booster}_booster+$1,"
                    ' "money"="money"-$2 WHERE "user"=$3;',
                    amount,
                    price,
                    ctx.author.id,
                )
                await self.bot.log_transaction(
                    ctx,
                    from_=ctx.author.id,
                    to=2,
                    subject="money",
                    data={"Amount": price},
                    conn=conn,
                )
        else:
            async with self.bot.pool.acquire() as conn:
                await conn.execute(
                    'UPDATE profile SET "time_booster"="time_booster"+$1,'
                    ' "luck_booster"="luck_booster"+$1,'
                    ' "money_booster"="money_booster"+$1, "money"="money"-$2 WHERE'
                    ' "user"=$3;',
                    amount,
                    price,
                    ctx.author.id,
                )
                await self.bot.log_transaction(
                    ctx,
                    from_=ctx.author.id,
                    to=2,
                    subject="money",
                    data={"Amount": price},
                    conn=conn,
                )
        await ctx.send(
            _("Successfully bought **{amount}x** {booster} booster(s). Use"
              " `{prefix}boosters` to view your new boosters.").format(
                  amount=amount, booster=booster, prefix=ctx.prefix))
示例#3
0
 async def set_crates(self, ctx, amount: IntGreaterThan(-1), rarity: CrateRarity):
     _("""Sets crates in a trade.""")
     if await self.bot.has_crates(ctx.author.id, amount, rarity):
         ctx.transaction["crates"][rarity] = amount
         await ctx.message.add_reaction(":blackcheck:441826948919066625")
     else:
         await ctx.send(_("You do not have enough crates."))
示例#4
0
 async def purchase(self,
                    ctx,
                    booster: str.lower,
                    amount: IntGreaterThan(0) = 1):
     _("""Buy a booster from the store.""")
     if booster not in ["time", "luck", "money", "all"]:
         return await ctx.send(
             _("Please either buy `time`, `luck` or `money`."))
     price = {
         "time": 1000,
         "luck": 500,
         "money": 1000,
         "all": 2500
     }[booster] * amount
     if ctx.character_data["money"] < price:
         return await ctx.send(_("You're too poor."))
     if booster != "all":
         await self.bot.pool.execute(
             f'UPDATE profile SET {booster}_booster={booster}_booster+$1, "money"="money"-$2 WHERE "user"=$3;',
             amount,
             price,
             ctx.author.id,
         )
     else:
         await self.bot.pool.execute(
             'UPDATE profile SET "time_booster"="time_booster"+$1, "luck_booster"="luck_booster"+$1, "money_booster"="money_booster"+$1, "money"="money"-$2 WHERE "user"=$3;',
             amount,
             price,
             ctx.author.id,
         )
     await ctx.send(
         _("Successfully bought **{amount}x** {booster} booster(s). Use `{prefix}boosters` to view your new boosters."
           ).format(amount=amount, booster=booster, prefix=ctx.prefix))
示例#5
0
 async def set_money(self, ctx, amount: IntGreaterThan(-1)):
     _("""Sets money in a trade.""")
     if await self.bot.has_money(ctx.author.id, amount):
         ctx.transaction["money"] = amount
         await ctx.message.add_reaction(":blackcheck:441826948919066625")
     else:
         await ctx.send(_("You are too poor."))
示例#6
0
 async def sell(self, ctx, itemid: int, price: IntGreaterThan(-1)):
     _(
         """Puts your item into the market. Tax for selling items is 5% of the price."""
     )
     async with self.bot.pool.acquire() as conn:
         item = await conn.fetchrow(
             "SELECT * FROM inventory i JOIN allitems ai ON (i.item=ai.id) WHERE ai.id=$1 AND ai.owner=$2;",
             itemid,
             ctx.author.id,
         )
         if not item:
             return await ctx.send(
                 _("You don't own an item with the ID: {itemid}").format(
                     itemid=itemid
                 )
             )
         if item["original_name"] or item["original_type"]:
             return await ctx.send(_("You may not sell donator-modified items."))
         if item["value"] > price:
             return await ctx.send(
                 _(
                     "Selling an item below its value is a bad idea. You can always do `{prefix}merchant {itemid}` to get more money."
                 ).format(prefix=ctx.prefix, itemid=itemid)
             )
         elif item["damage"] < 4 and item["armor"] < 4:
             return await ctx.send(
                 _(
                     "Your item is either equal to a Starter Item or worse. Noone would buy it."
                 )
             )
         if (
             builds := await self.bot.get_city_buildings(ctx.character_data["guild"])
         ) and builds["trade_building"] != 0:
             tax = 0
         else:
示例#7
0
 async def sell(self, ctx, itemid: int, price: IntGreaterThan(-1)):
     """Puts an item into the player store."""
     async with self.bot.pool.acquire() as conn:
         item = await conn.fetchrow(
             "SELECT * FROM inventory i JOIN allitems ai ON (i.item=ai.id) WHERE ai.id=$1 AND ai.owner=$2;",
             itemid,
             ctx.author.id,
         )
         if not item:
             return await ctx.send(
                 f"You don't own an item with the ID: {itemid}")
         if item["damage"] < 4 and item["armor"] < 4:
             return await ctx.send(
                 "Your item is either equal to a Starter Item or worse. Noone would buy it."
             )
         elif price > item["value"] * 1000:
             return await ctx.send(
                 f"Your price is too high. Try adjusting it to be up to `{item[6] * 1000}`."
             )
         await conn.execute(
             "DELETE FROM inventory i USING allitems ai WHERE i.item=ai.id AND ai.id=$1 AND ai.owner=$2;",
             itemid,
             ctx.author.id,
         )
         await conn.execute(
             "INSERT INTO market (item, price) VALUES ($1, $2);", itemid,
             price)
     await ctx.send(
         f"Successfully added your item to the shop! Use `{ctx.prefix}shop` to view it in the market!"
     )
示例#8
0
 async def sell(self, ctx, itemid: int, price: IntGreaterThan(-1)):
     _("""Puts your item into the market.""")
     async with self.bot.pool.acquire() as conn:
         item = await conn.fetchrow(
             "SELECT * FROM inventory i JOIN allitems ai ON (i.item=ai.id) WHERE ai.id=$1 AND ai.owner=$2;",
             itemid,
             ctx.author.id,
         )
         if not item:
             return await ctx.send(
                 _("You don't own an item with the ID: {itemid}").format(
                     itemid=itemid))
         if item["value"] > price:
             return await ctx.send(
                 _("Selling an item below its value is a bad idea. You can always do `{prefix}merchant {itemid}` to get more money."
                   ).format(prefix=ctx.prefix, itemid=itemid))
         elif item["damage"] < 4 and item["armor"] < 4:
             return await ctx.send(
                 _("Your item is either equal to a Starter Item or worse. Noone would buy it."
                   ))
         elif price > item["value"] * 1000:
             return await ctx.send(
                 _("Your price is too high. Try adjusting it to be up to `{limit}`."
                   ).format(limit=item[6] * 1000))
         await conn.execute(
             "DELETE FROM inventory i USING allitems ai WHERE i.item=ai.id AND ai.id=$1 AND ai.owner=$2;",
             itemid,
             ctx.author.id,
         )
         await conn.execute(
             "INSERT INTO market (item, price) VALUES ($1, $2);", itemid,
             price)
     await ctx.send(
         _("Successfully added your item to the shop! Use `{prefix}shop` to view it in the market!"
           ).format(prefix=ctx.prefix))
示例#9
0
    async def userfriendly(self, ctx, *date_info: IntGreaterThan(0)):
        _("""Sends today's userfriendly comic if no date info is passed. Else, it will use YYYY MM DD or DD MM YYYY depending on where the year is, with the date parts being seperated with spaces."""
          )
        if not date_info:
            date = datetime.date.today()
        else:
            if date_info[0] > 1900:  # YYYY-MM-DD
                date = datetime.date(year=date_info[0],
                                     month=date_info[1],
                                     day=date_info[2])
            elif date_info[2] > 1900:  # DD-MM-YYYY
                date = datetime.date(year=date_info[2],
                                     month=date_info[1],
                                     day=date_info[0])
            else:
                return await ctx.send(_("Unable to parse date."))
            if (date < datetime.date(year=1997, month=11, day=17)
                    or date > datetime.date.today()):
                return await ctx.send(
                    _("Userfriendly was launched on November, 17th 1997 and I also cannot check the future."
                      ))
        async with self.bot.session.get(
                f"http://ars.userfriendly.org/cartoons/?id={date.strftime('%Y%m%d')}&mode=classic"
        ) as r:
            stuff = await r.text()

        await ctx.send(embed=discord.Embed(
            color=self.bot.config.primary_colour,
            url="http://userfriendly.org",
            title=_("Taken from userfriendly.org"),
            description=str(date),
        ).set_image(url=re.compile('<img border="0" src="([^"]+)"').search(
            stuff).group(1)))
示例#10
0
 async def tradecrate(self,
                      ctx,
                      other: MemberWithCharacter,
                      amount: IntGreaterThan(0) = 1):
     _("""Trades crates to a user.""")
     if other == ctx.author:
         return await ctx.send(_("Very funny..."))
     if ctx.character_data["crates"] < amount:
         return await ctx.send(_("You don't have any crates."))
     async with self.bot.pool.acquire() as conn:
         await conn.execute(
             'UPDATE profile SET crates=crates-$1 WHERE "user"=$2;',
             amount,
             ctx.author.id,
         )
         await conn.execute(
             'UPDATE profile SET crates=crates+$1 WHERE "user"=$2;', amount,
             other.id)
     await ctx.send(
         _("Successfully gave {amount} crate(s) to {other}.").format(
             amount=amount, other=other.mention))
     await self.bot.log_transaction(ctx,
                                    from_=ctx.author,
                                    to=other,
                                    subject="crates",
                                    data=amount)
示例#11
0
 async def garfield(self, ctx, *date_info: IntGreaterThan(0)):
     _(
         """Sends today's garfield comic if no date info is passed. Else, it will use YYYY MM DD or DD MM YYYY depending on where the year is, with the date parts being seperated with spaces."""
     )
     if not date_info:
         date = datetime.date.today()
     else:
         if date_info[0] > 1900:  # YYYY-MM-DD
             date = datetime.date(
                 year=date_info[0], month=date_info[1], day=date_info[2]
             )
         elif date_info[2] > 1900:  # DD-MM-YYYY
             date = datetime.date(
                 year=date_info[2], month=date_info[1], day=date_info[0]
             )
         else:
             return await ctx.send(_("Unable to parse date."))
         if (
             date < datetime.date(year=1978, month=6, day=19)
             or date > datetime.date.today()
         ):
             return await ctx.send(
                 _(
                     "Garfield was launched on June, 19th 1978 and I also cannot check the future."
                 )
             )
     await ctx.send(
         embed=discord.Embed(color=self.bot.config.primary_colour).set_image(
             url=f"https://d1ejxu6vysztl5.cloudfront.net/comics/garfield/{date.year}/{date.strftime('%Y-%m-%d')}.gif?format=png"
         )
     )
示例#12
0
 async def tradecrate(
     self,
     ctx,
     other: MemberWithCharacter,
     amount: IntGreaterThan(0) = 1,
     rarity: str.lower = "common",
 ):
     _("""Trades crates to a user.""")
     if other == ctx.author:
         return await ctx.send(_("Very funny..."))
     if rarity not in ["common", "uncommon", "rare", "magic", "legendary"]:
         return await ctx.send(
             _("{rarity} is not a valid rarity.").format(rarity=rarity))
     if ctx.character_data[f"crates_{rarity}"] < amount:
         return await ctx.send(
             _("You don't have any crates of this rarity."))
     async with self.bot.pool.acquire() as conn:
         await conn.execute(
             f'UPDATE profile SET "crates_{rarity}"="crates_{rarity}"-$1 WHERE "user"=$2;',
             amount,
             ctx.author.id,
         )
         await conn.execute(
             f'UPDATE profile SET "crates_{rarity}"="crates_{rarity}"+$1 WHERE "user"=$2;',
             amount,
             other.id,
         )
     await ctx.send(
         _("Successfully gave {amount} {rarity} crate(s) to {other}.").
         format(amount=amount, other=other.mention, rarity=rarity))
     await self.bot.log_transaction(ctx,
                                    from_=ctx.author,
                                    to=other,
                                    subject="crates",
                                    data=[amount, rarity])
示例#13
0
 async def invest(self, ctx, amount: IntGreaterThan(0)):
     _("""Invest some of your money and put it to the guild bank.""")
     if ctx.character_data["money"] < amount:
         return await ctx.send(_("You're too poor."))
     async with self.bot.pool.acquire() as conn:
         g = await conn.fetchrow(
             'SELECT * FROM guild WHERE "id"=$1;', ctx.character_data["guild"]
         )
         if g["banklimit"] < g["money"] + amount:
             return await ctx.send(_("The bank would be full."))
         profile_money = await conn.fetchval(
             'UPDATE profile SET money=money-$1 WHERE "user"=$2 RETURNING money;',
             amount,
             ctx.author.id,
         )
         guild_money = await conn.fetchval(
             'UPDATE guild SET money=money+$1 WHERE "id"=$2 RETURNING money;',
             amount,
             g["id"],
         )
     await ctx.send(
         _(
             "Done! Now you have `${profile_money}` and the guild has `${guild_money}`."
         ).format(profile_money=profile_money, guild_money=guild_money)
     )
     await self.bot.log_transaction(
         ctx, from_=ctx.author, to=0, subject="guild invest", data=amount
     )
示例#14
0
 async def roll(self, ctx, maximum: IntGreaterThan(0)):
     _("""Roll a random number.""")
     await ctx.send(
         _(":1234: You rolled **{num}**, {author}!").format(
             num=random.randint(0, maximum), author=ctx.author.mention
         )
     )
示例#15
0
 async def pay(self, ctx, amount: IntGreaterThan(0),
               member: MemberWithCharacter):
     _("""[Guild Officer only] Pay money from the guild bank to a user.""")
     async with self.bot.pool.acquire() as conn:
         guild = await conn.fetchrow('SELECT * FROM guild WHERE "id"=$1;',
                                     ctx.character_data["guild"])
         if guild["money"] < amount:
             return await ctx.send(_("Your guild is too poor."))
         await conn.execute(
             'UPDATE guild SET money=money-$1 WHERE "id"=$2;', amount,
             guild["id"])
         await conn.execute(
             'UPDATE profile SET money=money+$1 WHERE "user"=$2;', amount,
             member.id)
     await ctx.send(
         _("Successfully gave **${amount}** from your guild bank to {member}."
           ).format(amount=amount, member=member.mention))
     await self.bot.log_transaction(ctx,
                                    from_=0,
                                    to=member,
                                    subject="guild pay",
                                    data=amount)
     await self.bot.http.send_message(
         guild["channel"],
         f"**{ctx.author}** paid **${amount}** to **{member}**")
示例#16
0
    async def followers(self, ctx, limit: IntGreaterThan(0)):
        _("""`<limit>` - A whole number from 0 to 25. If you are a God, the upper bound is lifted.

            Display your God's (or your own, if you are a God) top followers, up to `<limit>`.

            The format for this is as follows:
              - Placement
              - User ID
              - Amount of favor
              - current luck

            The result is attached as a text file.""")
        if ctx.author.id in self.bot.gods:
            god = self.bot.gods[ctx.author.id]
        elif not ctx.character_data["god"]:
            return await ctx.send(
                _("You are not following any god currently, therefore the list cannot"
                  " be generated."))
        else:
            if limit > 25:
                return await ctx.send(
                    _("Normal followers may only view the top 25."))
            god = ctx.character_data["god"]
        data = await self.bot.pool.fetch(
            'SELECT * FROM profile WHERE "god"=$1 ORDER BY "favor" DESC LIMIT $2;',
            god,
            limit,
        )
        formatted = "\n".join([
            f"{idx + 1}. {i['user']}: {i['favor']} Favor, Luck: {i['luck']}"
            for idx, i in enumerate(data)
        ])
        await ctx.send(file=discord.File(filename="followers.txt",
                                         fp=BytesIO(formatted.encode())))
示例#17
0
 async def remove_money(self, ctx, amount: IntGreaterThan(0)):
     _("""Removes money from a trade.""")
     if ctx.transaction["money"] - amount >= 0:
         ctx.transaction["money"] -= amount
         await ctx.message.add_reaction(":blackcheck:441826948919066625")
     else:
         await ctx.send(_("Resulting amount is negative."))
示例#18
0
    async def adminsetcooldown(
        self,
        ctx,
        user: Union[discord.User, int],
        command: str,
        cooldown: IntGreaterThan(-1) = 0,
    ):
        _("""[Bot Admin only] Sets someone's cooldown to a specific time in seconds (by default removes the cooldown)"""
          )
        if not isinstance(user, int):
            user_id = user.id
        else:
            user_id = user

        if cooldown == 0:
            result = await self.bot.redis.execute("DEL",
                                                  f"cd:{user_id}:{command}")
        else:
            result = await self.bot.redis.execute("EXPIRE",
                                                  f"cd:{user_id}:{command}",
                                                  cooldown)

        if result == 1:
            await ctx.send(_("The cooldown has been updated!"))
            await self.bot.http.send_message(
                self.bot.config.admin_log_channel,
                f"**{ctx.author}** set **{user}**'s cooldown to {cooldown}.",
            )
        else:
            await ctx.send(
                _("Cooldown setting unsuccessful (maybe you mistyped the command name or there is no cooldown for the user?)."
                  ))
示例#19
0
 async def offercrate(
     self,
     ctx,
     quantity: IntGreaterThan(0),
     rarity: CrateRarity,
     price: IntFromTo(0, 100_000_000),
     buyer: MemberWithCharacter,
 ):
示例#20
0
 async def shop(
     self,
     ctx,
     itemtype: str.title = "All",
     minstat: float = 0.00,
     highestprice: IntGreaterThan(-1) = 1_000_000,
 ):
     _("""Lists the buyable items on the market.""")
示例#21
0
 async def shop(
     self,
     ctx,
     itemtype: str.title = "All",
     minstat: float = 0.00,
     highestprice: IntGreaterThan(-1) = 1_000_000,
 ):
     _(
示例#22
0
 async def remove_crates(self, ctx, amount: IntGreaterThan(0), rarity: CrateRarity):
     _("""Removes crates from a trade.""")
     if (res := ctx.transaction["crates"][rarity] - amount) >= 0:
         if res == 0:
             del ctx.transaction["crates"][rarity]
         else:
             ctx.transaction["crates"][rarity] -= amount
         await ctx.message.add_reaction(":blackcheck:441826948919066625")
示例#23
0
    async def roll(self, ctx, maximum: IntGreaterThan(0)):
        _("""`<maximum>` - A whole number greater than 0

            Roll a dice with `<maximum>` sides and let the bot display the outcome."""
          )
        await ctx.send(
            _(":1234: You rolled **{num}**, {author}!").format(
                num=random.randint(0, maximum), author=ctx.author.mention))
示例#24
0
 async def shop(
     self,
     ctx,
     itemtype: str.title = "All",
     minstat: float = 0.00,
     highestprice: IntGreaterThan(-1) = 1_000_000,
 ):
     _("""Show the market with all items and prices.""")
示例#25
0
 async def shop(
     self,
     ctx,
     itemtype: str.title = "All",
     minstat: float = 0.00,
     highestprice: IntGreaterThan(-1) = 1_000_000,
 ):
     _("""`[itemtype]` - The type of item to filter; defaults to all item types
示例#26
0
    async def tradecrate(
        self,
        ctx,
        other: MemberWithCharacter,
        amount: IntGreaterThan(0) = 1,
        rarity: CrateRarity = "common",
    ):
        _(
            """`<other>` - A user with a character
            `[amount]` - A whole number greater than 0; defaults to 1
            `[rarity]` - The crate's rarity to trade, can be common, uncommon, rare, magic or legendary; defaults to common

            Give your crates to another person.

            Players must combine this command with `{prefix}give` for a complete trade."""
        )
        if other == ctx.author:
            return await ctx.send(_("Very funny..."))
        elif other == ctx.me:
            return await ctx.send(
                _("For me? I'm flattered, but I can't accept this...")
            )
        if ctx.character_data[f"crates_{rarity}"] < amount:
            return await ctx.send(_("You don't have any crates of this rarity."))
        async with self.bot.pool.acquire() as conn:
            await conn.execute(
                f'UPDATE profile SET "crates_{rarity}"="crates_{rarity}"-$1 WHERE'
                ' "user"=$2;',
                amount,
                ctx.author.id,
            )
            await conn.execute(
                f'UPDATE profile SET "crates_{rarity}"="crates_{rarity}"+$1 WHERE'
                ' "user"=$2;',
                amount,
                other.id,
            )
            await self.bot.log_transaction(
                ctx,
                from_=ctx.author.id,
                to=other.id,
                subject="crates",
                data={"Rarity": rarity, "Amount": amount},
                conn=conn,
            )
        await self.bot.cache.update_profile_cols_rel(
            ctx.author.id, **{f"crates_{rarity}": -amount}
        )
        await self.bot.cache.update_profile_cols_rel(
            other.id, **{f"crates_{rarity}": amount}
        )

        await ctx.send(
            _("Successfully gave {amount} {rarity} crate(s) to {other}.").format(
                amount=amount, other=other.mention, rarity=rarity
            )
        )
示例#27
0
    async def bid(self, ctx, amount: IntGreaterThan(0)):
        _(
            """`<amount>` - the amount of money to bid, must be higher than the current highest bid

            Bid on an ongoing auction.

            The amount is removed from you as soon as you bid and given back if someone outbids you. This is to prevent bidding impossibly high and then not paying up."""
        )
        if self.top_auction is None:
            return await ctx.send(_("No auction running."))
        if amount <= self.top_auction[1]:
            return await ctx.send(_("Bid too low."))
        if ctx.character_data["money"] < amount:
            return await ctx.send(_("You are too poor."))
        async with self.bot.pool.acquire() as conn:
            await conn.execute(
                'UPDATE profile SET "money"="money"+$1 WHERE "user"=$2;',
                self.top_auction[1],
                self.top_auction[0].id,
            )
            await self.bot.cache.update_profile_cols_rel(
                self.top_auction[0].id, money=self.top_auction[1]
            )
            await self.bot.log_transaction(
                ctx,
                from_=1,
                to=self.top_auction[0].id,
                subject="bid",
                data={"Amount": self.top_auction[1]},
                conn=conn,
            )
            self.top_auction = (ctx.author, amount)
            self.auction_cm.shift_by(60 * 30)
            await conn.execute(
                'UPDATE profile SET "money"="money"-$1 WHERE "user"=$2;',
                amount,
                ctx.author.id,
            )
            await self.bot.cache.update_profile_cols_rel(ctx.author.id, money=-amount)
            await self.bot.log_transaction(
                ctx,
                from_=ctx.author.id,
                to=2,
                subject="bid",
                data={"Amount": amount},
                conn=conn,
            )
        await ctx.send(_("Bid submitted."))
        channel = discord.utils.get(
            self.bot.get_guild(self.bot.config.game.support_server_id).channels,
            name="auctions",
        )
        await channel.send(
            f"**{ctx.author.mention}** bids **${amount}**! Check above for what's being"
            " auctioned."
        )
示例#28
0
    async def set_money(self, ctx, amount: IntGreaterThan(-1)):
        _("""`<amount>` - The amount of money to set, must be greater than -1

            Sets an amount of money in the trading session. You cannot set more money than you have.
            To add or remove money, consider `{prefix}trade add/remove money`.

            You need to have an open trading session to use this command.""")
        if await self.bot.has_money(ctx.author.id, amount):
            ctx.transaction["money"] = amount
            await ctx.message.add_reaction(":blackcheck:441826948919066625")
        else:
            await ctx.send(_("You are too poor."))
示例#29
0
    async def remove_money(self, ctx, amount: IntGreaterThan(0)):
        _("""`<amount>` - The amount of money to remove, must be greater than 0

            Removes money from the trading session. You cannot remove more money than you added.
            To add money, consider `{prefix}trade add money`.

            You need to have an open trading session to use this command.""")
        if ctx.transaction["money"] - amount >= 0:
            ctx.transaction["money"] -= amount
            await ctx.message.add_reaction(":blackcheck:441826948919066625")
        else:
            await ctx.send(_("Resulting amount is negative."))
示例#30
0
 async def followers(self, ctx, limit: IntGreaterThan(0)):
     """[God Only] Lists top followers."""
     data = await self.bot.pool.fetch(
         'SELECT * FROM profile WHERE "god"=$1 ORDER BY "favor" DESC LIMIT $2;',
         self.bot.gods[ctx.author.id],
         limit,
     )
     formatted = "\n".join([
         f"{idx + 1}. {i['user']}: {i['favor']} Favor, Luck: {i['luck']}"
         for idx, i in enumerate(data)
     ])
     await ctx.send(file=discord.File(filename="followers.txt",
                                      fp=BytesIO(formatted.encode())))