예제 #1
0
파일: group.py 프로젝트: ultraxia/CQBot_fqy
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)
예제 #2
0
def onQQMessage(bot, contact, member, content):
    global chatdetail
    # 被at操作
    if '@ME' in content:
        bot.SendTo(contact, member.name + '我是废物机器人2.0,输入 help 可查看口令')
    #
    if contact.ctype == 'group':
        # shut up
        if setting.shutup():
            for shutup_keyword in setting.shutup():
                if shutup_keyword in content:
                    shutmember(bot, contact, member, content)
        #
        # 查撤回
        if contact.nick == groupid:
            chatdetail.append(content)
            if len(chatdetail) > 6:
                chatdetail = chatdetail[-6:]
            if content == '-查撤回':
                cd_msg = '最近五条聊天记录:\n'
                cd_num = 1
                for cd in chatdetail[-6:-1]:
                    cd_msg += '【第' + str(cd_num) + '条】' + cd + '\n'
                    cd_num += 1
                bot.SendTo(contact, cd_msg)
예제 #3
0
파일: group.py 프로젝트: CM-unit/qqbot_hzx
def onQQMessage(bot, contact, member, content):
    global chatdetail
    # 被at操作
    if '@ME' in content:
        bot.SendTo(contact, member.name + '我是废物机器人2.0,输入 help 可查看口令')
    #
    if contact.ctype == 'group':
        # shut up
        if setting.shutup():
            for shutup_keyword in setting.shutup():
                if shutup_keyword in content:
                    shutmember(bot, contact, member, content)
        #
        # 查撤回
        if contact.nick == groupid:
            chatdetail.append(content)
            if len(chatdetail) > 6:
                chatdetail = chatdetail[-6:]
            if content == '-查撤回':
                cd_msg = '最近五条聊天记录:\n'
                cd_num = 1
                for cd in chatdetail[-6:-1]:
                    cd_msg += '【第' + str(cd_num) + '条】' + cd + '\n'
                    cd_num += 1
                bot.SendTo(contact, cd_msg)
예제 #4
0
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)
예제 #5
0
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)
예제 #6
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)