def handle_msg(context): if context['group_id'] in self.pref5.getqqidarray( ) and context['user_id'] != context['self_id']: # 关键词禁言 if self.pref5.getshutwordslist(): for word in self.pref5.getshutwordslist(): if word in context['message']: self.bot.set_group_ban( group_id=context['group_id'], 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 = md_init(self.pref5.getproidarray()) for jz_dict in jz_array: jz += jz_dict['name'] + '\n' + jz_dict[ 'url_short'] + '\n' self.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 = rank(1) for rank1_msg in rank1_array: self.bot.send(context, rank1_msg) elif context['message'] == 'dkb' or context[ 'message'] == '打卡榜' or context[ 'message'] == 'dk20' or context[ 'message'] == 'dakabang': rank2_array = rank(2) for rank2_msg in rank2_array: self.bot.send(context, rank2_msg) elif "独占" in context['message']: dz = '' dz_array = md_init(self.pref5.getproidarray()) for dz_dict in dz_array: dz += dz_dict['name'] + '\n' + dz_dict[ 'url_short'] + '\n' duzhan = "独占请集资" + '\n' + dz self.bot.send(context, duzhan) elif context['message'] == '欢迎新人': self.bot.send(context, self.pref5.getwelcome()) elif context['message'] == '项目进度' or context['message'] == '进度': jd_array = result(self.pref5.getproidarray()) jd = '' for jd_msg in jd_array: jd += jd_msg + '\n' self.bot.send(context, jd)
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)