nsfw.py 文件源码

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

项目:jose 作者: lnmds 项目源码 文件源码
def whip(self, ctx, *, person: discord.User=None):
        """Whip someone.

        If no arguments provided, shows how many whips you
        received.

        The command has a 5/1800s cooldown per-user
        """
        if not person:
            whip = await self.whip_coll.find_one({'user_id': ctx.author.id})
            if not whip:
                return await ctx.send(f'**{ctx.author}** was never whipped')

            return await ctx.send(f'**{ctx.author}** was whipped'
                                  f' {whip["whips"]} times')

        if person == ctx.author:
            return await ctx.send('no')

        uid = person.id
        whip = await self.whip_coll.find_one({'user_id': uid})
        if not whip:
            whip = {
                'user_id': uid,
                'whips': 0,
            }
            await self.whip_coll.insert_one(whip)

        await self.whip_coll.update_one({'user_id': uid},
                                        {'$inc': {'whips': 1}})

        await ctx.send(f'**{ctx.author}** whipped **{person}** '
                       f'They have been whipped {whip["whips"] + 1} times.')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号