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""
评论列表
文章目录