def rank(type): msg = '' err = False err_msg = '返回rank错误\n' detail = getDetail(str(setting.pro_id())) # type=1:总额榜 if type == 1: msg = msg + setting.wds_name() + '·聚聚榜TOP20\n' + '------------\n' dic = getRankings(setting.pro_id(), 1, 1) if int(dic['status']) == 0: for data in dic['data']: msg = msg + '【第' + str(data['rank']) + '名】: ' +data['nickname'] + '支持了' + str(data['backer_money']) + '元\n' elif int(dic['status']) == 2: err = True err_msg += dic['message'] elif type == 2: msg = msg + setting.wds_name() + '·打卡榜TOP20\n' + '------------\n' dic = getRankings(setting.pro_id(), 2, 1) if int(dic['status']) == 0: for data in dic['data']: msg = msg + '【第' + str(data['rank']) + '名】: ' +data['nickname'] + '已打卡' + str(data['support_days']) + '天\n' elif int(dic['status']) == 2: err = True err_msg += dic['message'] msg = msg + '【摩点】:' + setting.wds_url() + '\n目前集资进度:¥' +\ str(detail['data'][0]['already_raised']) + '\n目标:¥' +\ detail['data'][0]['goal'] if err is True: return err_msg elif err is False: return msg
def rank(type): msg = '' err = False err_msg = '返回rank错误\n' detail = getDetail(str(setting.pro_id())) # type=1:总额榜 if type == 1: msg = msg + setting.wds_name() + '·聚聚榜TOP20\n' + '------------\n' dic = getRankings(setting.pro_id(), 1, 1) if int(dic['status']) == 0: for data in dic['data']: msg = msg + '【第' + str( data['rank']) + '名】: ' + data['nickname'] + '支持了' + str( data['backer_money']) + '元\n' elif int(dic['status']) == 2: err = True err_msg += dic['message'] elif type == 2: msg = msg + setting.wds_name() + '·打卡榜TOP20\n' + '------------\n' dic = getRankings(setting.pro_id(), 2, 1) if int(dic['status']) == 0: for data in dic['data']: msg = msg + '【第' + str( data['rank']) + '名】: ' + data['nickname'] + '已打卡' + str( data['support_days']) + '天\n' elif int(dic['status']) == 2: err = True err_msg += dic['message'] msg = msg + '【摩点】:' + setting.wds_url() + '\n目前集资进度:¥' +\ str(detail['data'][0]['already_raised']) + '\n目标:¥' +\ detail['data'][0]['goal'] if err is True: return err_msg elif err is False: return msg
def newOrder(stamp10, secondsDelay): newOrders = [] # 获取一次订单信息,返回一个dictionary orderDict = getOrders(setting.pro_id(), 1) # 查询失败则返回错误信息 if int(orderDict['status']) == 2: return orderDict['message'] # 查询成功,遍历data for data in orderDict['data']: pay_time = data['pay_time'] # 将字符串时间转换为unix时间戳 data['pay_time'] = int(time.mktime(time.strptime(pay_time, '%Y-%m-%d %H:%M:%S'))) # 筛选订单时间在查询时间前的设定时间段之间的订单 if data['pay_time'] >= stamp10 - secondsDelay and data['pay_time'] < stamp10: newOrders.append(data) msgDict = {} # 有新订单 if newOrders: # 获取项目信息 detail = getDetail(setting.pro_id()) # 查询失败则返回错误信息 if int(detail['status']) == 2: return detail['message'] # 查询成功,初始化消息 msgDict['msg'] = [] msg = '' for newOrder in newOrders: msg = "感谢 " + newOrder['nickname'] +\ " 聚聚在【" + setting.wds_name() + "】中支持了 ¥" +\ str(newOrder['backer_money']) + '\n' msgDict['msg'].append(msg) msgDict['end'] = '【摩点】:' + setting.wds_url() + '\n目前集资进度:¥' +\ str(detail['data'][0]['already_raised']) + '\n目标:¥' +\ str(detail['data'][0]['goal']) return msgDict
def newOrder(stamp10, secondsDelay): newOrders = [] orderDict = getOrders(setting.pro_id(), 1) if int(orderDict['status']) == 2: return orderDict['message'] for data in orderDict['data']: pay_time = data['pay_time'] data['pay_time'] = int(time.mktime(time.strptime(pay_time, '%Y-%m-%d %H:%M:%S'))) if data['pay_time'] >= stamp10 - secondsDelay and data['pay_time'] < stamp10: newOrders.append(data) msgDict = {} if newOrders: detail = getDetail(setting.pro_id()) if int(detail['status']) == 2: return detail['message'] msgDict['msg'] = [] msg = '' for newOrder in newOrders: msg = "感谢 " + newOrder['nickname'] +\ " 聚聚在【" + setting.wds_name() + "】中支持了 ¥" +\ str(newOrder['backer_money']) + '\n' msgDict['msg'].append(msg) msgDict['end'] = '【摩点】:' + setting.wds_url() + '\n目前集资进度:¥' +\ str(detail['data'][0]['already_raised']) + '\n目标:¥' +\ str(detail['data'][0]['goal']) return msgDict
def handle_msg(context): if context['user_id'] != context['self_id']: if setting.shutup(): for word in setting.shutup(): if word in context['message']: bot.set_group_ban(group_id=setting.groupid(), user_id=context['user_id'], duration=30 * 60) if context['message'] == 'wds20' or context[ 'message'] == 'jz20' or context['message'] == 'rank': rank1_array = modian.rank(1) for rank1_msg in rank1_array: bot.send(context, rank1_msg) elif context['message'] == 'dkb' or context['message'] == '打卡榜': rank2_array = modian.rank(2) for rank2_msg in rank2_array: bot.send(context, rank2_msg) elif context['message'] == '项目进度' or context['message'] == '进度': jd_array = modian.result(setting.pro_id()) jd = '' for jd_msg in jd_array: jd += jd_msg bot.send(context, jd) elif '我的卡片:' or '我的卡片:' in context['message']: nickname = context['message'][5:] mycard = querry_card.querry(nickname) bot.send(context, mycard) elif context['message'][:3] == '补卡:' or context['message'][:3] == '补卡:': nickname = context['message'][3:] buka = add_card_auto.check_data(nickname) bot.send(context, buka)
def handle_msg(context): if context['group_id'] == setting.groupid( ) and context['user_id'] != context['self_id']: if setting.shutup(): for word in setting.shutup(): if word in context['message']: bot.set_group_ban(group_id=setting.groupid(), user_id=context['user_id'], duration=30 * 60) if context['message'] == '集资' or context['message'] == 'jz' or context[ 'message'] == '打卡' or context['message'] == 'dk': jz = '' jz += setting.wds_name() + '\n' + setting.wds_url() bot.send(context, jz) elif context['message'] == 'wds20' or context[ 'message'] == 'jz20' or context['message'] == 'rank' or context[ 'message'] == '聚聚榜' or context[ 'message'] == 'jzb' or context['message'] == '集资榜': bot.send(context, modian.rank(1)) elif context['message'] == 'dkb' or context[ 'message'] == '打卡榜' or context['message'] == 'dk20' or context[ 'message'] == 'dakabang': bot.send(context, modian.rank(2)) elif "独占" in context['message']: duzhan = "独占请集资" + '\n' + setting.wds_name( ) + '\n' + setting.wds_url() bot.send(context, duzhan) elif context['message'] == '欢迎新人': bot.send(context, setting.welcome()) elif context['message'] == '项目进度' or context['message'] == '进度': jd = modian.result(setting.pro_id()) + '\n' + setting.wds_url() bot.send(context, jd)
def handle_msg(context): if context['group_id'] == setting.groupid( ) and context['user_id'] != context['self_id']: # 关键词禁言 if setting.shutup(): for word in setting.shutup(): if word in context['message']: bot.set_group_ban(group_id=setting.groupid(), user_id=context['user_id'], duration=30 * 60) # 关键词回复 if context['message'] == '集资' or context['message'] == 'jz' or context[ 'message'] == '打卡' or context['message'] == 'dk': jz = '' jz_array = modian.md_init(setting.pro_id()) for jz_dict in jz_array: jz += jz_dict['name'] + '\n' + jz_dict['url_short'] + '\n' bot.send(context, jz) elif context['message'] == 'wds20' or context[ 'message'] == 'jz20' or context['message'] == 'rank' or context[ 'message'] == '聚聚榜' or context[ 'message'] == 'jzb' or context['message'] == '集资榜': rank1_array = modian.rank(1) for rank1_msg in rank1_array: bot.send(context, rank1_msg) elif context['message'] == 'dkb' or context[ 'message'] == '打卡榜' or context['message'] == 'dk20' or context[ 'message'] == 'dakabang': rank2_array = modian.rank(2) for rank2_msg in rank2_array: bot.send(context, rank2_msg) elif "独占" in context['message']: dz = '' dz_array = modian.md_init(setting.pro_id()) for dz_dict in dz_array: dz += dz_dict['name'] + '\n' + dz_dict['url_short'] + '\n' duzhan = "独占请集资" + '\n' + dz bot.send(context, duzhan) elif context['message'] == '欢迎新人': bot.send(context, setting.welcome()) elif context['message'] == '项目进度' or context['message'] == '进度': jd_array = modian.result(setting.pro_id()) jd = '' for jd_msg in jd_array: jd += jd_msg + '\n' bot.send(context, jd)
def diff(num): detail = getDetail(str(setting.pro_id())) msg = '' if num > 20: num = 20 order = getOrders(setting.pro_id(), 1) if int(order['status']) == 2: return order['message'] for i in range(0, num): msg += "ID: " + order['data'][i]['nickname'] +\ " 的聚聚刚刚在【" + setting.wds_name() + "】中支持了 ¥" +\ str(order['data'][i]['backer_money']) + '\n' + "感谢这位聚聚对" +\ setting.idol_name() + "的支持" + '\n' msg += '【摩点】:' + setting.wds_url() + '\n目前集资进度:¥' +\ str(detail['data'][0]['already_raised']) + '\n目标:¥' +\ str(detail['data'][0]['goal']) return msg
def newOrder(stamp10, secondsDelay): msgDict_array = [] pro_id_array = md_init(setting.pro_id()) for pro_id_dict in pro_id_array: newOrders = [] # 获取一次订单信息,返回一个dictionary orderDict = sorted_orders(pro_id_dict['pro_id'], 1) # 查询失败则返回错误信息 if int(orderDict['status']) == 2: WARN("modian newOrder error", "获取订单错误", orderDict['message']) return orderDict['message'] # 20180319,防止空订单,循环查询五次 retry = 0 while not len(orderDict['data']): INFO("modian newOrder info", "疑似空订单") orderDict = sorted_orders(pro_id_dict['pro_id'], 1) retry += 1 if retry > 5: INFO("modian newOrder info", "订单5次为空,判断为无人集资") break # 查询成功,遍历data for data in orderDict['data']: pay_success_time = data['pay_success_time'] # 将字符串时间转换为unix时间戳 data['pay_success_time'] = int(time.mktime(time.strptime(pay_success_time, '%Y-%m-%d %H:%M:%S'))) # 筛选订单时间在查询时间前的设定时间段之间的订单 if data['pay_success_time'] >= stamp10 - secondsDelay and data['pay_success_time'] < stamp10: newOrders.append(data) msgDict = {} # 有新订单 if newOrders: # 获取项目信息 detail = getDetail(pro_id_dict['pro_id']) # 查询失败则返回错误信息 if int(detail['status']) == 2: WARN("modian newOrder error", "获取项目信息错误", detail['message']) return detail['message'] # 查询成功,初始化消息 msgDict['msg'] = [] msg = '' for newOrder in newOrders: msg = "ID: " + newOrder['nickname'] +\ " 的聚聚刚刚在【" + pro_id_dict['name'] + "】中支持了 ¥" +\ str(newOrder['backer_money']) + '\n' + "感谢这位聚聚对" +\ setting.idol_name() + "的支持" + '\n' msgDict['msg'].append(msg) msgDict['end'] = '【摩点】:' + pro_id_dict['url_short'] + '\n目前集资进度:¥' +\ str(detail['data'][0]['already_raised']) + '\n目标:¥' +\ str(detail['data'][0]['goal']) msgDict_array.append(msgDict) msgDict_array.append(orderDict) return msgDict_array
def newOrder(stamp10, secondsDelay): newOrders = [] # 获取一次订单信息,返回一个dictionary orderDict = getOrders(setting.pro_id(), 1) # 查询失败则返回错误信息 if int(orderDict['status']) == 2: return orderDict['message'] # 查询成功,遍历data for data in orderDict['data']: pay_time = data['pay_time'] # 将字符串时间转换为unix时间戳 data['pay_time'] = int(time.mktime(time.strptime(pay_time, '%Y-%m-%d %H:%M:%S'))) # 筛选订单时间在查询时间前的设定时间段之间的订单 if data['pay_time'] >= stamp10 - secondsDelay and data['pay_time'] < stamp10: newOrders.append(data) msgDict = {} # 有新订单 if newOrders: # 获取项目信息 detail = getDetail(setting.pro_id()) # 查询失败则返回错误信息 if int(detail['status']) == 2: return detail['message'] # 查询成功,初始化消息 msgDict['msg'] = [] msg = '' for newOrder in newOrders: msg = "ID: " + newOrder['nickname'] +\ " 的聚聚刚刚在【" + setting.wds_name() + "】中支持了 ¥" +\ str(newOrder['backer_money']) + '\n' + "感谢这位聚聚对" +\ setting.idol_name() + "的支持" + '\n' msgDict['msg'].append(msg) msgDict['end'] = '【摩点】:' + setting.wds_url() + '\n目前集资进度:¥' +\ str(detail['data'][0]['already_raised']) + '\n目标:¥' +\ str(detail['data'][0]['goal']) return msgDict
def rank(type): msg_array = [] err = False err_msg = '返回rank错误\n' pro_id_array = md_init(setting.pro_id()) for pro_id_dict in pro_id_array: msg = '' detail = getDetail(pro_id_dict['pro_id']) # type=1:总额榜 if type == 1: msg = msg + pro_id_dict['name'] + '·聚聚榜TOP20\n' + '------------\n' dic = getRankings(pro_id_dict['pro_id'], 1, 1) if int(dic['status']) == 0: for data in dic['data']: msg = msg + '【第' + \ str(data['rank']) + '名】: ' + data['nickname'] + \ '支持了' + str(data['backer_money']) + '元\n' elif int(dic['status']) == 2: err = True err_msg += dic['message'] elif type == 2: msg = msg + pro_id_dict['name'] + '·打卡榜TOP20\n' + '------------\n' dic = getRankings(pro_id_dict['pro_id'], 2, 1) if int(dic['status']) == 0: for data in dic['data']: msg = msg + '【第' + \ str(data['rank']) + '名】: ' + data['nickname'] + \ '已打卡' + str(data['support_days']) + '天\n' elif int(dic['status']) == 2: err = True err_msg += dic['message'] msg = msg + '------------\n【摩点】:' + pro_id_dict['url_short'] + '\n目前集资进度:¥' +\ str(detail['data'][0]['already_raised']) + '\n目标:¥' +\ detail['data'][0]['goal'] msg_array.append(msg) if err is True: WARN("modian rank error", err_msg) return err_msg elif err is False: return msg_array
def num(): datas = {'status': 0} page = 1 sum = 0 sum_person = 0 person = [] # 总次数 while True: orders = getOrders(setting.pro_id(), page) page += 1 if int(orders['status']) == 2: datas['status'] = 2 datas['err_msg'] = orders['message'] break if len(orders['data']) == 0: break sum += len(orders['data']) for data in orders['data']: if data['nickname'] not in person: person.append(data['nickname']) datas['sum'] = sum sum_person = len(person) datas['sum_person'] = sum_person return datas
def newOrder(stamp10, secondsDelay): msgDict_array = [] pro_id_array = md_init(setting.pro_id()) for pro_id_dict in pro_id_array: newOrders = [] # 获取一次订单信息,返回一个dictionary orderDict = getOrders(pro_id_dict['pro_id'], 1) # 查询失败则返回错误信息 if int(orderDict['status']) == 2: return orderDict['message'] # 查询成功,遍历data for data in orderDict['data']: pay_time = data['pay_time'] # 将字符串时间转换为unix时间戳 data['pay_time'] = int( time.mktime(time.strptime(pay_time, '%Y-%m-%d %H:%M:%S'))) # 筛选订单时间在查询时间前的设定时间段之间的订单 if data['pay_time'] >= stamp10 - secondsDelay and data[ 'pay_time'] < stamp10: newOrders.append(data) msgDict = {} if newOrders: detail = getDetail(pro_id_dict['pro_id']) if int(detail['status']) == 2: return detail['message'] msgDict['msg'] = [] msg = '' for newOrder in newOrders: pay_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(newOrder['pay_time'])) if float(newOrder['backer_money']) < 10: msg = "感谢 " + newOrder['nickname'] +\ " 聚聚在【" + pro_id_dict['name'] + "】中支持了 ¥" +\ str(newOrder['backer_money']) + '集资满10元可以抽卡哦' else: if float(newOrder['backer_money']) < 100: file = card.percent_1() if 100 <= float(newOrder['backer_money']) < 1000: file = card.percent_20() if float(newOrder['backer_money']) >= 1000: file = card.percent_100() cardname = file[6:-4] msg = "感谢 " + newOrder['nickname'] +\ " 聚聚在【" + pro_id_dict['name'] + "】中支持了 ¥" +\ str(newOrder['backer_money']) + '\n'+'恭喜获得卡片: ' + cardname end = '【摩点】:' + pro_id_dict['url_short'] + '\n目前集资进度:¥' +\ str(detail['data'][0]['already_raised']) + '\n目标:¥' +\ str(detail['data'][0]['goal']) msg = [ { 'type': 'text', 'data': { 'text': msg } }, { 'type': 'image', 'data': { 'file': file } }, { 'type': 'text', 'data': { 'text': end } }, ] db = connect_database() cursor = db.cursor() cursor.execute( "INSERT INTO fqy_card VALUES (%s,%s,%s,%s,%s)", (pro_id_dict['pro_id'], newOrder['nickname'], cardname, newOrder['backer_money'], str(pay_time))) db.commit() db.close() msgDict['msg'].append(msg) # msgDict['end'] = '【摩点】:' + pro_id_dict['url_short'] + '\n目前集资进度:¥' +\ # str(detail['data'][0]['already_raised']) + '\n目标:¥' +\ # str(detail['data'][0]['goal']) msgDict_array.append(msgDict) return msgDict_array
def newOrder(stamp10, secondsDelay): msgDict_array = [] pro_id_array = md_init(setting.pro_id(0)) for pro_id_dict in pro_id_array: newOrders = [] # 获取一次订单信息,返回一个dictionary orderDict = sorted_orders(pro_id_dict['pro_id'], 1) # 查询失败则返回错误信息 if int(orderDict['status']) == 2: WARN("modian newOrder error", "获取订单错误", orderDict['message']) print(orderDict['message']) return msgDict_array # 20180319,防止空订单,循环查询五次 retry = 0 while not len(orderDict['data']): INFO("modian newOrder info", "疑似空订单") orderDict = sorted_orders(pro_id_dict['pro_id'], 1) retry += 1 if retry > 5: INFO("modian newOrder info", "订单5次为空,判断为无人集资") break # 不具备本地order.josn的写法 查询成功,遍历摩点库 # for data in orderDict['data']: # pay_success_time = data['pay_success_time'] # # 将字符串时间转换为unix时间戳 # data['pay_success_time'] = int(time.mktime(time.strptime(pay_success_time, '%Y-%m-%d %H:%M:%S'))) # # 筛选订单时间在查询时间前的设定时间段之间的订单 # if data['pay_success_time'] >= stamp10 - secondsDelay and data['pay_success_time'] < stamp10: # newOrders.append(data) # ------ 20180723具备本地order.json的写法 ------ # 获得本地库 data = setting.openjson("order/" + str(pro_id_dict['pro_id'])) # 判断本地库是都为空 if data == []: newOrders = orderDict["data"] else: # 获得摩点库 alldata = orderDict["data"] # 对摩点库进行排序 alldata = setting.sortOrder(alldata) # 与本地库对比 if alldata[0]["pay_success_time"] == data[0]["pay_success_time"]: pass else: print("发现遗漏订单" + str(pro_id_dict['pro_id'])) # 获取本地库第一个订单的时间转换为时间戳 oneTime = int( time.mktime( time.strptime(data[0]["pay_success_time"], '%Y-%m-%d %H:%M:%S'))) # 循环摩点接口所有订单 for i in range(len(alldata)): # 将摩点订单时间转换为时间戳 iTime = int( time.mktime( time.strptime(alldata[i]["pay_success_time"], '%Y-%m-%d %H:%M:%S'))) # 在摩点库中找到本地最新的那一个订单 if iTime == oneTime: for j in range(i): newOrders.append(alldata[j]) data = newOrders + data setting.writejson(data, "order/" + str(pro_id_dict['pro_id'])) # 有新订单 msgDict = [] if newOrders: # 获取项目信息 detail = getDetail(pro_id_dict['pro_id']) # 查询失败则返回错误信息 if int(detail['status']) == 2: WARN("modian newOrder error", "获取项目信息错误", detail['message']) # return detail['message'] # 查询成功,初始化消息 msg = '' for newOrder in newOrders: msg = "ID:" + newOrder['nickname'] + "\n" +\ "金额:¥ " + str(newOrder['backer_money']) + '\n' +\ "项目:" + pro_id_dict['name'] + "\n" +\ "链接:" + pro_id_dict['url_short'] + "\n" +\ "感谢"+newOrder['nickname']+"对" + setting.idol_name() + "的支持呦~" + \ tool.relay(newOrder['backer_money']) +\ card.DrawCard(newOrder["user_id"],newOrder["nickname"],newOrder["backer_money"]) if str(pro_id_dict['pro_id']) == str( setting.openjson('ini')['modian']['pk']) or ( setting.openjson('ini')['pk']['status'] and not (setting.openjson('ini')['modian']['pk'])): msg += tool.showPk("\n\npk实况:") msgDict.append(msg) msgDict_array.append(msgDict) return msgDict_array
def handle_msg(context): # 获取管理员 adminArr = answer.Admin() # 获取超级管理员 administrator = answer.Administrator() # 开始进行关键字触发 if context['group_id'] in setting.groupid() and context['user_id'] != context['self_id']: # 关键词禁言 if setting.shutup(): for word in setting.shutup(): if word in context['message']: bot.set_group_ban(group_id=context['group_id'], user_id=context['user_id'], duration=5*60) # 关键词回复 if context['message'] in ['集资','jz','打卡','摩点','Jz']: jz_array = modian.md_init(setting.pro_id()) for item in jz_array: if version == "pro": jz = [ {'type': 'share', 'data': { "url": item['url_long'], "title": item['name'], "content": "谢谢大家的支持~比心心~", "image": "https://p.moimg.net/ico/2019/04/09/20190409_1554800123_9103.jpg?imageMogr2/auto-orient/strip" }} ] else: jz ='%s\n%s\n谢谢大家的支持~比心心~' % (item['name'],item['url_short']) bot.send(context, jz) time.sleep(.1) elif context['message'] in ['Rank','rank','集资榜']: rank1_array = modian.rank(1) for rank1_msg in rank1_array: bot.send(context, rank1_msg) elif context['message'] in ['dkb','打卡榜']: rank2_array = modian.rank(2) for rank2_msg in rank2_array: bot.send(context, rank2_msg) elif context['message'] in ['项目进度','进度']: jd_array = modian.result(setting.pro_id()) jd = '' for jd_msg in jd_array: jd += jd_msg + '\n' bot.send(context, jd) # ------------------------------------------------------------------------ # --------------------- 全部人指令 ----------------------------- elif context['message'] in ['今日集资','昨日集资']: msg = tool.today(context['message']) bot.send(context, msg) # --------------------- 追加管理员指令,修改ini.json ----------------------------- elif '更换项目 ' in context['message'] or '更换id ' in context['message']: msg = '' if context['user_id'] in adminArr or context['user_id'] in administrator: msg = answer.changeProid(context['message']) else: msg = '你没有权限' bot.send(context, msg) # 超级管理员指令 26440 26262 elif '添加管理 ' in context['message']: msg = '' if context['user_id'] in administrator: QQnum = context['message'][15:-1] msg = answer.addAdmin(QQnum) else: msg = '你没有权限' bot.send(context, msg) elif '撤销管理 ' in context['message'] or '删除管理 ' in context['message']: msg = '' if context['user_id'] in administrator: QQnum = context['message'][15:-1] msg = answer.delAdmin(QQnum) else: msg = '你没有权限' bot.send(context, msg) elif '开启每日播报' in context['message'] or '关闭每日播报' in context['message']: msg = '' if context['user_id'] in administrator: msg = answer.todayShow(context['message']) else: msg = '你没有权限' bot.send(context, msg) # --------------------- 娱乐指令,调用answer.json ----------------------------- elif context['message'] in [robot+'在么',robot+'在吗',robot+'在不在']: msg = answer.roundMsg() bot.send(context, msg) # --------------------- 接力指令 ----------------------------- elif context['message'] in ["开启接力","接力开启","关闭接力"] or "接力金额 " in context['message']: msg = '' if context['user_id'] in adminArr or context['user_id'] in administrator: msg = tool.relayOpen(context['message']) else: msg = "你没有操作权限哦" bot.send(context, msg) elif context['message'] in ['棒数','查看棒数']: bot.send(context, tool.relayNum()) elif '接力 ' in context['message']: msg = '' if context['user_id'] in adminArr or context['user_id'] in administrator: msg = tool.addNum(context['message']) else: msg = "你没有操作权限哦" bot.send(context, msg) # --------------------- pk指令 ----------------------------- elif context['message'] in ["开启pk","关闭pk"]: msg = '' if context['user_id'] in adminArr or context['user_id'] in administrator: msg = tool.changePK(context['message']) else: msg = "你没有操作权限哦" bot.send(context, msg) elif 'pk项目 ' in context['message']: msg = '' if context['user_id'] in adminArr or context['user_id'] in administrator: msg = tool.addPk(context['message']) else: msg = "你没有操作权限哦" bot.send(context, msg) elif 'pkid ' in context['message']: msg = '' if context['user_id'] in adminArr or context['user_id'] in administrator: msg = answer.changeProid(context['message'],True) else: msg = '你没有权限' bot.send(context, msg) elif context['message'] in ['查看pk','pk']: bot.send(context, tool.showPk("pk实况")) if tool.showPk("pk实况") else '' # --------------------- 抽卡指令 ----------------------------- elif context['message'] == '我的信息': bot.send(context, card.seachMy(False,context['user_id'])) elif context['message'] == '积分抽卡': bot.send(context, card.intDraw(context['user_id'])) elif "查卡 " in context['message']: name = context['message'][3:] bot.send(context, card.showCard(name)) elif "查 " in context['message']: name = context['message'][2:] bot.send(context, card.seachMy(True,name)) elif "绑定 " in context['message']: # 绑定 @QQnum nick_name msg = '' if context['user_id'] in adminArr or context['user_id'] in administrator: arr = context['message'][3:].split(" ", 1) nick_name = arr[1] QQnum = arr[0][10:-1] msg = card.bind(QQnum,nick_name) else: msg = "你没有操作权限哦" bot.send(context, msg) elif "补偿 " in context['message']: # 补偿 @QQnum 分数 msg = '' if context['user_id'] in adminArr or context['user_id'] in administrator: arr = context['message'][3:].split(" ", 1) QQnum = arr[0][10:-1] num = arr[1] msg = card.addDraw(QQnum,num) else: msg = "你没有操作权限哦" bot.send(context, msg) elif context['message'] in ["开启抽卡","关闭抽卡"]: msg = '' if context['user_id'] in adminArr or context['user_id'] in administrator: if context['message'] == "开启抽卡": msg = card.changeDraw(1) else: msg = card.changeDraw(0) else: msg = "你没有操作权限哦" bot.send(context, msg)