plugin.py 文件源码

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

项目:simple-qq-bot 作者: ihciah 项目源码 文件源码
def lotty(msg):
        message = msg[u'content']
        sender_qq = msg[u'sender_qq']
        db = MyDB()
        if msg[u'type'] == u'group_message':
            my_name = msg[u'receiver']
            message = message.replace(u'@' + my_name, u'').strip()
        if message in ReplyStrings.lotty:
            user = db.get_user_info(sender_qq)
            if not user:
                return True, ReplyStrings.unknown_error
            coin = user[1]
            if coin < Coin.lotty_price:
                return True, ReplyStrings.insufficient_coin % (Coin.lotty_price, coin)
            got = int(random.normalvariate(Coin.lotty_mu, Coin.lotty_sigma))
            got = max(got, Coin.lotty_min)
            got = min(got, Coin.lotty_max)
            db.mod_coin(sender_qq, got)
            return True, ReplyStrings.lotty_win % (got, Coin.lotty_max)
        return False, u""
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号