shop.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:Jumper-Cogs 作者: Redjumpman 项目源码 文件源码
def _list_shop(self, ctx):
        """Shows a list of all the shop items. Roles are blue."""
        user = ctx.message.author
        settings = self.check_server_settings(user.server)
        shop_name = settings["Config"]["Shop Name"]
        column1 = ["[{}]".format(subdict["Item Name"].title())
                   if "Role" in subdict else subdict["Item Name"].title()
                   for subdict in settings["Shop List"].values()]
        column2 = [subdict["Quantity"] for subdict in settings["Shop List"].values()]
        column3 = [subdict["Item Cost"] for subdict in settings["Shop List"].values()]
        column4_raw = [subdict["Discount"] for subdict in settings["Shop List"].values()]
        column4 = [x + "%" if x != "0" else "None" for x in list(map(str, column4_raw))]
        if not column1:
            await self.bot.say("There are no items for sale in the shop.")
        else:
            data, header = self.table_builder(settings, column1, column2,
                                              column3, column4, shop_name)
            msg = await self.shop_table_split(user, data)
            await self.shop_list_output(settings, msg, header)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号