python qqbot 简易复读机

qqbot 简易小插件:
具体的插件用法请访问qqbot github
基于smartQQ的qqbot 已经被弃用

from datetime import datetime
import timedef onQQMessage(bot,contact,member,content):if content == '-hello':bot.SendTo(contact,'你好我是机器人')elif content == '-stop':bot.SendTo(contact, '你好我关了哦。')bot.Stop()tempWord = ''
tempTime = 0
times = 0
lastContent = ""def onQQMessage(bot,contact,member,content):global tempWordglobal tempTimeglobal timesnow = time.time()print(times)if times > 20: #当复读超过20次的时候就不要复读了print('times > 10')return -1elif (now - tempTime) > 3000:print('times more  than 3s')elif (now - tempTime) <= 3000: #三秒内有人复读则启动复读程序if(tempWord == content):#当前内容与之前的一份内容一样启动复读bot.SendTo(contact,content)times += 1tempWord = ''returnelse:tempWord = contentelse:print('it wont happen')tempTime = float(now)

启动并且注册插件之后,qq机器人就被注入了灵魂,可以实现复读功能了。后续的更为高级的复读功能正在开发中。

Published by

风君子

独自遨游何稽首 揭天掀地慰生平

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注