def getRoomMsg(): try: koudai = Koudai() # 检查是否有新消息 if koudai.checkNew(): # 判断酷Q版本 if version == 'air': msgArray = koudai.msgAir() elif version == 'pro': msgArray = koudai.msgPro() # 消息序列反向排序 msgArray.reverse() for msg in msgArray: for grpid in groupid(): bot.send_group_msg_async( group_id=grpid, message=msg, auto_escape=False) time.sleep(0.5) # print(msg) # 2019 投票播报 ticket_msg = koudai.getVoteMsg(int(interval_kd)) if ticket_msg: ticket_msg.reverse() for msg in ticket_msg: for grpid in groupid(): bot.send_group_msg_async( group_id=grpid, message=msg, auto_escape=False) time.sleep(0.5) except Exception as e: # raise e WARN('error when getRoomMsg', e) else: pass finally: INFO('room-check completed')
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['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_group_increase(context): if context['group_id'] == setting.groupid()[0]: welcome = [{'type': 'text', 'data': {'text': '欢迎新聚聚:'}}, {'type': 'at', 'data': {'qq': str(context['user_id'])}}, {'type': 'text', 'data': {'text': ' 加入本群\n\n%s' % setting.welcome()}} ] bot.send(context, message=welcome, is_raw=True) # 发送欢迎新人
def getWeibo(delay): bot = CQHttp(api_root='http://127.0.0.1:5700/') while True: global weibo_id_array global firstcheck_weibo wbcontent = '' idcount = -1 if (firstcheck_weibo == 1): weibo_id_array = copy.copy(getidarray()) firstcheck_weibo = False checkwbid = copy.copy(get_5_idarray()) if (firstcheck_weibo == 0): for cardid in checkwbid: idcount += 1 if int(cardid) == 0: continue if cardid not in weibo_id_array: weibo_id_array.append(cardid) retweet = checkretweet(idcount) wbpic = checkpic(idcount) wbscheme = getscheme(idcount) if (retweet): wbcontent = "源源刚刚[转发]了一条微博:" + '\n' + '\n' + getretweetweibo(idcount) + '\n' wbcontent = wbcontent + '\n' + "传送门:" + wbscheme else: wbcontent = "源源刚刚发了一条新微博:" + '\n' + '\n' + getweibo(idcount) + '\n' if (wbpic): wbcontent = wbcontent + getpic(idcount) wbcontent = wbcontent + '\n' + "传送门:" + wbscheme bot.send_group_msg_async(group_id=groupid(), message=wbcontent, auto_escape=False) time.sleep(int(delay))
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 getModian(delay): bot = CQHttp(api_root='http://127.0.0.1:5700/') while True: stampTime = int(time.time()) msgDict = newOrder(stampTime, int(delay)) if msgDict: for msg in msgDict['msg']: msg += msgDict['end'] bot.send_group_msg_async(group_id=groupid(), message=msg, auto_escape=False) time.sleep(0.1) time.sleep(int(delay))
def on_time(): todayType = openjson('ini')['todayType'] if todayType: msg = ["每日集资记录~\n\n"] msgAll = msg[0] + tool.today("定时播报") for grpid in groupid(): bot.send_group_msg_async(group_id=grpid, message=msgAll, auto_escape=False) time.sleep(0.5) else: print('每日播报未开启')
def getModian(): # try: # INFO('check modian') stampTime = int(time.time()) msgDict_arr = newOrder(stampTime, int(interval_md)) for msgDict in msgDict_arr: if msgDict: for msg in msgDict: for grpid in groupid(): bot.send_group_msg_async(group_id=grpid, message=msg, auto_escape=False) time.sleep(0.1)
def getWeibo(): # bot = CQHttp(api_root='http://127.0.0.1:5700/') try: # INFO(printStrTime() + 'check weibo') INFO('check weibo') global weibo_id_array global firstcheck_weibo wbcontent = '' idcount = -1 if (firstcheck_weibo == 1): # INFO(printStrTime() + 'first check weibo') INFO('first check weibo') weibo_id_array = copy.copy(getidarray()) firstcheck_weibo = False checkwbid = copy.copy(get_5_idarray()) if (firstcheck_weibo == 0): for cardid in checkwbid: idcount += 1 if int(cardid) == 0: continue if cardid not in weibo_id_array: weibo_id_array.append(cardid) retweet = checkretweet(idcount) wbpic = checkpic(idcount) wbscheme = getscheme(idcount) if (retweet): wbcontent = "源源刚刚[转发]了一条微博:" + '\n' + '\n' + getretweetweibo( idcount) + '\n' wbcontent = wbcontent + '\n' + "传送门:" + wbscheme else: wbcontent = "源源刚刚发了一条新微博:" + '\n' + '\n' + getweibo( idcount) + '\n' if (wbpic): wbcontent = wbcontent + getpic(idcount) wbcontent = wbcontent + '\n' + "传送门:" + wbscheme # print(printStrTime() + wbcontent) bot.send_group_msg_async(group_id=groupid(), message=wbcontent, auto_escape=False) except Exception as e: WARN('error when getWeibo') finally: # INFO(printStrTime() + 'weibo check completed') INFO('weibo check completed')
def getModian(): # bot = CQHttp(api_root='http://127.0.0.1:5700/') try: # INFO(printStrTime() + 'check modian') INFO('check modian') stampTime = int(time.time()) msgDict_array = newOrder(stampTime, int(interval_md)) for msgDict in msgDict_array: if msgDict: for msg in msgDict['msg']: msg += msgDict['end'] # print(printStrTime() + msg) bot.send_group_msg_async(group_id=groupid(), message=msg, auto_escape=False) time.sleep(0.1) except Exception as e: WARN('error when getModian') finally: # INFO(printStrTime() + 'modian check completed') INFO('modian check completed')
def handle_group_increase(context): if context['group_id'] == setting.groupid(): # ret = bot.get_stranger_info(user_id=context['user_id'], no_cache=False) # welcome = '欢迎新聚聚:@' + ret['nickname'] + ' 加入本群\n\n' + setting.welcome() welcome = [{ 'type': 'text', 'data': { 'text': '欢迎新聚聚:' } }, { 'type': 'at', 'data': { 'qq': str(context['user_id']) } }, { 'type': 'text', 'data': { 'text': '加入本群\n\n%s' % setting.welcome() } }] bot.send(context, message=welcome, is_raw=True) # 发送欢迎新人
def getWeibo(): weibo = Weibo() try: INFO('check weibo') global weibo_id_array global firstcheck_weibo # 初次启动记录前十条微博id if firstcheck_weibo is True: INFO('first check weibo') weibo_id_array = weibo.IdArray firstcheck_weibo = False if firstcheck_weibo is False: # 取最新的前三条微博 for idcount in range(0, 3): # 广告位微博id为0,忽略 if int(weibo.IdArray[idcount]) == 0: continue # 微博id不在记录的id列表里,判断为新微博 if weibo.IdArray[idcount] not in weibo_id_array: msg = [] # 将id计入id列表 weibo_id_array.append(weibo.IdArray[idcount]) # 检查新微博是否是转发 if weibo.checkRetweet(idcount): msg.append( { 'type': 'text', 'data': {'text': '小偶像刚刚转发了一条微博:\n'}}) msg.append( { 'type': 'text', 'data': {'text': '%s\n' % weibo.getRetweetWeibo(idcount)}}) # 原创微博 else: msg.append( { 'type': 'text', 'data': {'text': '小偶像刚刚发了一条新微博:\n'}}) msg.append( { 'type': 'text', 'data': {'text': '%s\n' % weibo.getWeibo(idcount)}}) # 检查原创微博是否带图 if weibo.checkPic(idcount): # 只取第一张图,pro可以直接发图,air则无 msg.append( { 'type': 'image', 'data': {'file': '%s' % weibo.getPic(idcount)[0]}}) # 播报图的总数 if len(weibo.getPic(idcount)) > 1: msg.append( { 'type': 'text', 'data': {'text': '\n(一共有%d张图喔)\n' % len(weibo.getPic(idcount))}}) msg.append( { 'type': 'text', 'data': {'text': '传送门:%s' % weibo.getScheme(idcount)}}) for grpid in groupid(): bot.send_group_msg_async( group_id=grpid, message=msg, auto_escape=False) time.sleep(0.5) # print(msg) except Exception as e: WARN('error when getWeibo', e) finally: INFO('weibo check completed')
import modian import time # global commentNum # global firstcheck global weibo_id_array global firstcheck_weibo weibo_id_array = [] firstcheck_weibo = 1 # commentNum = 0 # firstcheck = 1 groupid = setting.groupid() # 关键字回复 def onQQMessage(bot, contact, member, content): if contact.ctype == 'group' and contact.nick == groupid: if content == 'wds' or content == '集资' or content == 'jz' or content == '打卡' or content == 'dk': jz = '' jz = jz + setting.wds_name() + '\n' + setting.wds_url() bot.SendTo(contact, str(jz)) elif content == 'wds20' or content == 'jz20' or content == 'rank' or content == '聚聚榜' or content == 'jzb' or content == '集资榜': bot.SendTo(contact, modian.rank(1)) elif content == 'dkb' or content == '打卡榜' or content == 'dk20' or content == 'dakabang': bot.SendTo(contact, modian.rank(2)) elif content == "独占": duzhan = "独占请集资" + '\n' + setting.wds_name() + '\n' + setting.wds_url()
# -*- coding: utf-8 -*- from qqbot import qqbotsched from qqbot.utf8logger import INFO from qqbot.utf8logger import WARN import copy import setting groupid = str(setting.groupid()) global firstcheck global chatdetail chatdetail = [] firstcheck = True # 新成员入群欢迎 @qqbotsched(hour='0-23', minute='0-59') def task(bot): global firstcheck new_member = [] # g is list g = bot.List('group', groupid) if firstcheck is True: bot.Update(g[0]) firstcheck = False if g is None: WARN('向 QQ 服务器请求联系人列表和资料失败') elif not g: INFO('该联系人列表内没有和 cinfo 匹配的联系人') elif g: # group_* is object ml_old = copy.copy(bot.List(g[0]))
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)
import sys import setting from qqbot.utf8logger import WARN from qqbot.utf8logger import INFO import requests import urllib3 reload(sys) sys.setdefaultencoding('utf8') urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) global msgTime_array global firstcheck_juju msgTime_array = [] firstcheck_juju = 0 groupid = setting.groupid() # 13位unix时间戳(ms)转为字符串时间 def stamp_to_str(timestamp): x = time.localtime(timestamp / 1000) time_str = time.strftime('%Y-%m-%d %H:%M:%S', x) return time_str # 定时任务,每分钟执行一次 # 查询聚聚房间 # 房间id在setting.py中设置 @qqbotsched(hour='0-23', minute='0-59') def get_juju(bot): global msgTime_array
# -*- coding: utf-8 -*- from qqbot import qqbotsched from qqbot.utf8logger import INFO from qqbot.utf8logger import WARN import copy import setting groupid = str(setting.groupid()) global firstcheck global chatdetail chatdetail = [] firstcheck = True # 新成员入群欢迎 @qqbotsched(hour='0-23', minute='0-59') def task(bot): global firstcheck new_member = [] # g is list g = bot.List('group', groupid) if firstcheck is True: bot.Update(g[0]) firstcheck = False if g is None: WARN('向 QQ 服务器请求联系人列表和资料失败') elif not g: INFO('该联系人列表内没有和 cinfo 匹配的联系人') elif g: # group_* is object
def handle_msg(context): start = datetime.datetime.now().hour if int(start) >= 1 and int(start) <= 6: return # 开始进行关键字触发 if context['group_id'] in setting.groupid(): # 关键词回复 if context['message'] == "招募": msg = "[CQ:at,qq=%d]\n" % context['user_id'] nickname = context['sender']['card'] if context['sender'][ 'card'] else context['sender']['nickname'] msg += chess.DrawCard(context['user_id'], nickname) bot.send(context, msg) elif context['message'][:3] == "进攻 ": if not len(context['message'][3:]): return msg = "[CQ:at,qq=%d]\n" % context['user_id'] cont = chess.battle(context['user_id'], context['message'][3:]) if cont: msg += cont bot.send(context, msg) elif context['message'][:5] == "全军出击 ": if not len(context['message'][5:]): return msg = "[CQ:at,qq=%d]\n" % context['user_id'] cont = chess.battle(context['user_id'], context['message'][5:], True) if cont: msg += cont bot.send(context, msg) elif context['message'][:3] == "复仇 ": if not len(context['message'][3:]): return msg = "[CQ:at,qq=%d]\n" % context['user_id'] cont = chess.battle(context['user_id'], context['message'][3:], True, False) if cont: msg += cont bot.send(context, msg) elif context['message'] == "梭哈": msg = "[CQ:at,qq=%d]\n" % context['user_id'] msg += chess.suoha(context['user_id']) bot.send(context, msg) elif context['message'] == "重置" and context['user_id'] == 476297692: msg = chess.reset() bot.send(context, msg) # elif context['message'] == "进攻list": # msg = chess.battlelist() # if msg: # bot.send(context, msg) elif context['message'][:3] == "出战 ": if not len(context['message'][3:]): return msg = "[CQ:at,qq=%d]\n" % context['user_id'] msg += chess.goBattle(context['user_id'], context['message'][3:]) bot.send(context, msg) elif context['message'][:3] == "替换 ": if not len(context['message'][3:]): return msg = "[CQ:at,qq=%d]\n" % context['user_id'] msg += chess.changeBattle(context['user_id'], context['message'][3:]) bot.send(context, msg) elif context['message'] in ["攻击姿态", "进攻姿态"]: msg = "[CQ:at,qq=%d]\n" % context['user_id'] msg += chess.attack(context['user_id']) bot.send(context, msg) elif context['message'] == "防御姿态": msg = "[CQ:at,qq=%d]\n" % context['user_id'] msg += chess.attack(context['user_id'], True) bot.send(context, msg) elif context['message'] == "融合": msg = "[CQ:at,qq=%d]" % context['user_id'] msga = chess.nchange(context['user_id']) msg += msga if msga != "请先招募": msg += chess.nchange(context['user_id'], "R") msg += chess.nchange(context['user_id'], "SR") bot.send(context, msg) elif context['message'][:3] == "我的 ": if not len(context['message'][3:]): return msg = "[CQ:at,qq=%d]\n" % context['user_id'] msg += chess.oneIdol(context['user_id'], context['message'][3:]) bot.send(context, msg) elif context['message'][:3] == "上锁 ": if not len(context['message'][3:]): return msg = "[CQ:at,qq=%d]\n" % context['user_id'] msg += chess.lockOn(context['user_id'], context['message'][3:], False) bot.send(context, msg) elif context['message'][:3] == "解锁 ": if not len(context['message'][3:]): return msg = "[CQ:at,qq=%d]\n" % context['user_id'] msg += chess.lockOn(context['user_id'], context['message'][3:], True) bot.send(context, msg) elif context['message'] == "锁了": msg = "[CQ:at,qq=%d]\n" % context['user_id'] msg += chess.hasLock(context['user_id']) bot.send(context, msg) elif context['message'] in ["战败", "阵亡"]: msg = "[CQ:at,qq=%d]\n" % context['user_id'] msg += chess.dead(context['user_id']) bot.send(context, msg) # elif context['message'] == "我的对手": # msg = "[CQ:at,qq=%d]\n" % context['user_id'] # msg += chess.battlelist(context['user_id']) # bot.send(context, msg) elif context['message'][:2] == '我的': cont = context['message'][2:] if cont == "信息": msg = "[CQ:at,qq=%d]\n" % context['user_id'] msg += chess.seachMy(context['user_id']) bot.send(context, msg) elif cont == "道具": msg = "[CQ:at,qq=%d]\n" % context['user_id'] msg += chess.seachPack(context['user_id']) bot.send(context, msg) # elif cont.upper() in ["N","R","SR","SSR","UR"]: # msg = "[CQ:at,qq=%d]\n" % context['user_id'] # msg += chess.idolhMy(context['user_id'],cont.upper()) # bot.send(context, msg) # elif cont in [i["name"] for i in setting.openjson("chess/skill")]: # msg = "[CQ:at,qq=%d]\n" % context['user_id'] # msg += chess.showSkill(context['user_id'],cont) # bot.send(context, msg) elif context['message'] == "技能": msg = chess.skills() bot.send(context, msg) elif context['message'][:3] == "出击 " and context['message'][3:] in [ i["name"] for i in setting.openjson("chess/skill") ]: if not len(context['message'][3:]): return msg = "[CQ:at,qq=%d]\n" % context['user_id'] msg += chess.goSkill(context['user_id'], context['message'][3:]) bot.send(context, msg) elif context['message'] == "道具": msg = "[CQ:at,qq=%d]\n" % context['user_id'] msg += pack.backpack() bot.send(context, msg) elif context['message'][:3] == "升级 ": if not len(context['message'][3:]): return msg = "[CQ:at,qq=%d]\n" % context['user_id'] msg += pack.lvUp(context['user_id'], context['message'][3:]) bot.send(context, msg) elif context['message'][:3] == "复活 ": if not len(context['message'][3:]): return msg = "[CQ:at,qq=%d]\n" % context['user_id'] msg += pack.tolive(context['user_id'], context['message'][3:]) bot.send(context, msg) elif context['message'][:3] == "治疗 ": if not len(context['message'][3:]): return msg = "[CQ:at,qq=%d]\n" % context['user_id'] msg += pack.treatment(context['user_id'], context['message'][3:]) bot.send(context, msg) elif context['message'][:2] == "学习": if not len(context['message'][2:]): return msg = "[CQ:at,qq=%d]\n" % context['user_id'] msg += pack.studySkill(context['user_id'], context['message'][2:]) bot.send(context, msg) elif context['message'] == "残血": msg = "[CQ:at,qq=%d]\n" % context['user_id'] msg += chess.blood(context['user_id']) bot.send(context, msg) elif context['message'] == "仇人": msg = "[CQ:at,qq=%d]\n" % context['user_id'] cont = chess.revenge(context['user_id']) if cont: msg += cont bot.send(context, msg) elif context['message'] == "来个对手": msg = "[CQ:at,qq=%d]\n" % context['user_id'] msg += chess.getDui(context['user_id']) bot.send(context, msg) elif context['message'] == "全部解锁": msg = "[CQ:at,qq=%d]\n" % context['user_id'] msg += chess.alllockOn(context['user_id']) bot.send(context, msg)