コード例 #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):
    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()
            bot.SendTo(contact, duzhan)
        # elif content == "想39":
        #     xiang39 = "补档请看" + '\n' + "http://t.cn/RCbRLjZ"
        #     bot.SendTo(contact, xiang39)
        # elif content == "剁椒鱼头":
        #     duojiaoyutou = "我们都爱剁椒鱼头"
        #     bot.SendTo(contact, duojiaoyutou)
        elif content == "欢迎新人":
            welcome = setting.welcome()
            bot.SendTo(contact, welcome)
        elif content == "help":
            help = '''废物机器人口令帮助:\n“集资”或“打卡”:返回集资地址"\n“集资榜”或“jzb”:返回集资金额榜单\n“打卡榜”或“dkb”:返回打卡天数榜单\n'''
            bot.SendTo(contact, help)
コード例 #3
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)
コード例 #4
0
ファイル: mission.py プロジェクト: chinshin/CQBot48GUI
 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)
コード例 #5
0
def onQQMessage(bot, contact, member, content):
    if contact.ctype == 'group' and contact.nick == groupid:
        if content == '打卡':
            jz = ''
            jz = jz + setting.wds_name() + '\n' + setting.wds_url()
            bot.SendTo(contact, str(jz))
        elif content == 'wds20' or content == 'rank':
            bot.SendTo(contact, modian.rank(1))
        elif content == 'dkb' or content == '打卡榜':
            bot.SendTo(contact, modian.rank(2))
        elif content == "独占":
            duzhan = "独占请集资" + '\n' + setting.wds_name(
            ) + '\n' + setting.wds_url()
            bot.SendTo(contact, duzhan)
        elif content == "help":
            help = '''Nemo操作手册:\n摩点相关\n1.“打卡”:返回集资地址"\n2.“rank”或“wds20”:返回集资金额榜单\n3.“打卡榜”或“dkb”:返回打卡天数榜单\n\n查询类\n1."集资查询+ID"返回某一ID的集资总额(数据每个月更新一次)\n2."我的2017+ID"返回2017年度账单\n3."微博故事+费沁源(或UID)"返回微博故事下载链接\n(注:所有查询类请求格式均为"命令+冒号+参数(ID))'''
            bot.SendTo(contact, help)
コード例 #6
0
ファイル: group.py プロジェクト: appletails/CQBot_tl
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)