예제 #1
0
async def _echo(bot: Bot, event: MessageEvent):
    #print(bot.config.custom_config1,type(bot.config.custom_config1))
    if event.get_user_id() not in get_attr('SUPER'):
        text = "你暂无此权限"
    else:
        text = cancel("one", "南岸", get_attr('cookiedic')[event.get_user_id()])
    await bot.send(event, text, at_sender=True)
예제 #2
0
async def _echo(bot: Bot, event: MessageEvent):
    name = event.get_plaintext()[5:]
    if event.get_user_id() not in get_attr('SUPER') and name in get_attr(
            'SUPERNAME'):
        text = '你暂无此权限'
    else:
        try:
            conn = connsql()  #判断是否信息表存在  再更新
            if not sql_isempty(event.get_user_id(), conn):
                sql = '(' + event.get_user_id(
                ) + ',' + name + ',' + "'aaa'" + ')'
                conn.execute("insert into new values" + sql)
                conn.commit()
            else:
                #print("UPDATE new SET name ="+name+ "WHERE id="+ str(event.get_user_id()))
                conn.execute("UPDATE new SET name ='" + name + "'  WHERE id=" +
                             event.get_user_id())
                conn.commit()
            await get_class(bot, event, conn, name)
            text = '绑定成功'
        except Exception as e:
            text = '绑定失败,错误提示' + str(e)
        finally:
            closeconnsql(conn)
    await bot.send(event, text, at_sender=True)
예제 #3
0
async def _echo(bot: Bot, event: MessageEvent):

    if event.get_user_id() not in get_attr('SUPER'):
        text = "你暂无此权限"
    else:
        text = getrep("tmo", "南岸", get_attr('cookiedic')[event.get_user_id()])
    await bot.send(event, text, at_sender=True)
예제 #4
0
파일: smart.py 프로젝트: qaqaqaaaa/jw_bot
async def _echo(bot: Bot, event: MessageEvent):
    if str in event.get_plaintext() and str in event.get_plaintext(
    ) and str in event.get_plaintext():
        text = '你是傻逼'
    else:
        text = '我是你爹'
        await bot.send(event, text, at_sender=True)
예제 #5
0
async def _echo(bot: Bot, event: MessageEvent):
    if event.get_plaintext()!='提示':
        return
    bot = nonebot.get_bots()[get_attr('botqq')]
    if event.get_user_id()not in get_attr('SUPER'):
        text="你暂无此权限"
        await  bot.send(event,text,at_sender=True)
        return
    else:
        await sendmoring()
예제 #6
0
async def _echo(
    bot: Bot,
    event: MessageEvent,
):
    try:
        if event.get_user_id() != get_attr('SUPER')[0]:
            text = "你暂无此权限"
        else:
            name = event.get_plaintext()[5:]
            text = get_info(name)
    except Exception as e:
        text = '错误提示' + str(e)
    await bot.send(event, text, at_sender=True)
예제 #7
0
async def _message(bot: Bot, event: MessageEvent):
    try:
        conn = connsql()
        if event.get_plaintext() != '上周课表':
            return
        if not sql_isempty(event.get_user_id(), conn):
            text = tishi2
        else:
            text = await weekclass(event.get_user_id(), conn, "last")
    except Exception as e:
        text = str(e)
    finally:
        closeconnsql(conn)
    await bot.send(event, text, at_sender=True)
예제 #8
0
async def _message(bot: Bot, event: MessageEvent):
    try:
        conn = connsql()
        if not (event.get_plaintext() == '明日课表'
                or event.get_plaintext() == '明天课表'):
            return
        if not sql_isempty(event.get_user_id(), conn):
            text = tishi2
        else:
            text = await onedaycourse(event.get_user_id(), conn, "tmo")
    except Exception as e:
        text = e
    finally:
        closeconnsql(conn)
    await bot.send(event, text, at_sender=True)
예제 #9
0
async def _message(bot: Bot, event: MessageEvent):
    try:
        conn = connsql()
        if not sql_isempty(event.get_user_id(), conn):
            text = tishi2
        else:
            weekdic = {
                1: "星期一",
                2: '星期二',
                3: '星期三',
                4: '星期四',
                5: '星期五',
                6: '星期六',
                7: '星期天'
            }
            now = int(time.time())
            week = int((now - get_attr('init_time')) / (24 * 60 * 60) + 1) % 7
            if week == 0:
                week = 7
            text = weekdic[week]
    except Exception as e:
        text = str(e)
    finally:
        closeconnsql(conn)
    await bot.send(event, text, at_sender=True)
예제 #10
0
async def _echo(bot: Bot, event: MessageEvent):
    try:
        if re.match("绑定学号 [\d]{12}", event.get_plaintext()):
            return
        text = '绑定格式错误 请输入 绑定学号 631800000000 进行绑定'
    except Exception as e:
        text = e
    await bot.send(event, text, at_sender=True)
예제 #11
0
async def _echo(bot: Bot, event: MessageEvent):
    #print(bot.config.custom_config1,type(bot.config.custom_config1))
    if event.get_user_id() not in get_attr('SUPER'):
        text = "你暂无此权限"
    else:
        text = cancel("tmo", "南岸", get_attr('cookiedic')[event.get_user_id()])
    await bot.send(event, text, at_sender=True)


# cookie = {}
# a = conn.execute("select * from new where name='cdh'")
# for i in a:
#     print(i[2], type(i[2]))
#     cookie = demjson.decode(i[2])
#
# print(cookie, type(cookie))
#
# conn.close()
예제 #12
0
async def _echo(bot: Bot, event: MessageEvent):
    try:
        conn = connsql()
        if not sql_isempty(event.get_user_id(), conn):
            text = tishi2
        else:
            name = ''
            a = conn.execute('select name from new where id={}'.format(
                event.get_user_id()))
            for i in a:
                name = i[0]
            await get_class(bot, event, conn, str(name))
            text = '刷新课表成功'
    except Exception as e:
        text = '刷新课表失败,错误提示' + str(e)
    finally:
        closeconnsql(conn)
    await bot.send(event, text, at_sender=True)
예제 #13
0
async def _echo(bot: Bot, event: MessageEvent):
    try:
        conn = connsql()  #判断是否信息表存在  再更新
        if not sql_isempty(event.get_user_id(), conn):
            text = tishi2
        else:
            conn.execute("delete from new WHERE id={}".format(
                event.get_user_id()))
            conn.commit()
            conn.execute("delete from class WHERE qq={}".format(
                event.get_user_id()))
            print("delete from class WHERE qq={}".format(event.get_user_id()))
            conn.commit()
            text = "解除绑定成功"
    except Exception as e:
        text = '解除绑定失败,错误提示' + str(e)
    finally:
        closeconnsql(conn)
    await bot.send(event, text, at_sender=True)
예제 #14
0
async def _message(bot: Bot, event: MessageEvent):
    try:
        #if event.get_plaintext()=='查成绩' or event.get_plaintext()=='课表' or event.get_plaintext()=='今天课表':
        #   return
        conn = connsql()
        if not sql_isempty(event.get_user_id(), conn):
            text = tishi2
        else:
            a = conn.execute('select name from new where id={}'.format(
                event.get_user_id()))
            name = ''
            for i in a:
                name = i[0]
            gpa = await get_gradepoint(name)
            text = '平均学分绩点(排除校选):' + str(round(gpa[0], 2))
            text += '\n平均学分绩点(所有科目)::' + str(round(gpa[1], 2))
    except Exception as e:
        text = str(e)
    finally:
        closeconnsql(conn)
    await bot.send(event, text, at_sender=True)
예제 #15
0
async def _message(bot: Bot, event: MessageEvent):
    if event.get_plaintext() != '查成绩':
        return
    try:
        conn = connsql()
        if not sql_isempty(event.get_user_id(), conn):
            text = tishi2
        else:
            a = conn.execute('select name from new where id={}'.format(
                event.get_user_id()))
            name = ''
            for i in a:
                name = i[0]
            await get_exam(bot, event, name)
            text = False
    except Exception as e:
        text = str(e)
    finally:
        closeconnsql(conn)
    if text:
        await bot.send(event, text, at_sender=True)
예제 #16
0
async def _message(bot: Bot, event: MessageEvent):
    try:
        conn = connsql()
        if not sql_isempty(event.get_user_id(), conn):
            text = tishi2
        else:
            now = int(time.time())
            zc = int((now - get_attr('init_time')) / (24 * 60 * 60 * 7) + 1)
            text = "本周是第" + str(zc) + "周"
    except Exception as e:
        text = e
    finally:
        closeconnsql(conn)
    await bot.send(event, text, at_sender=True)
예제 #17
0
async def _message(bot: Bot, event: MessageEvent):
    text = event.get_plaintext()
    await bot.send(event, text, at_sender=True)
예제 #18
0
파일: help.py 프로젝트: qaqaqaaaa/jw_bot
async def _echo(bot: Bot, event: MessageEvent):
    if event.get_plaintext()!='帮助':
        return
    text =help_str
    await bot.send(event,text,at_sender=True)
예제 #19
0
파일: smart.py 프로젝트: qaqaqaaaa/jw_bot
async def _echo(bot: Bot, event: MessageEvent):
    if event.get_plaintext() != '':
        text = '暂不清楚你的命令哦'
        await bot.send(event, text, at_sender=True)
예제 #20
0
파일: smart.py 프로젝트: qaqaqaaaa/jw_bot
async def _echo(bot: Bot, event: MessageEvent):
    if event.message_type == 'group' and event.get_plaintext() == '':
        text = '没事@你爹干嘛呢'
        await bot.send(event, text, at_sender=True)
예제 #21
0
파일: test.py 프로젝트: SinonJZH/yuuki-bot
async def _message(bot: Bot, event: MessageEvent):
    text = event.get_plaintext()
    await message_test.finish("是")