lottery.py 文件源码

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

项目:Jumper-Cogs 作者: Redjumpman 项目源码 文件源码
def _signup_lottery(self, ctx):
        """Signs you up to track lottery stats.
        You must have the required role to sign-up for stat tracking.
        If you lose the role, or it changes your stats will still be tracked
        and the information can be viewed when you get the role again.

        By default, anyone can sign up.
        """
        author = ctx.message.author
        settings = self.check_server_settings(author.server)

        if author.id in settings["Members"]:
            return await self.bot.say("You are already signed-up to track stats.")

        role = settings["Config"]["Role"]
        if role not in [r.name for r in author.roles]:
            return await self.bot.say("You do not have the required role to track stats.")

        settings["Members"][author.id] = {"Name": author.name, "Entries": 0, "Won": 0}
        self.save_system()

        await self.bot.say("Congratulations {}, you can now start tracking your lottery stats. "
                           "To view your stats use the command "
                           "{}lottery stats.".format(author.name, ctx.prefix))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号