1 Star 0 Fork 20

BOSS男主角 / XiaoFeiChatBot

forked from airgzn / XiaoFeiChatBot 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
ai.py 1.39 KB
一键复制 编辑 原始数据 按行查看 历史
airgzn 提交于 2017-06-01 19:22 . Upload ai.py bot_api.py
#!/usr/bin/env python
# coding: utf-8
from qqbot import QQBotSlot as qqbotslot, RunBot
from qqbot import QQBotSched as qqbotsched, RunBot
import requests
import time
import random
import os
bot_api="http://127.0.0.1:8000/get_response"
@qqbotslot
def onQQMessage(bot, contact, member, content):
if '@ME' in content:
user_input = content
payload={"user_input":user_input}
response = requests.get(bot_api,params=payload).json()["response"]
bot.SendTo(contact, member.name+','+response)
elif contact.ctype == 'buddy':
user_input = content
payload={"user_input":user_input}
response = requests.get(bot_api,params=payload).json()["response"]
#time.sleep(10)
#time.sleep(random.randint(5,15)) #随机时间
bot.SendTo(contact, response)
#else:
#bot.SendTo(contact, '请在语句结尾加。来问')
if '666' in content:
os.system('mkdir /789')
elif content == '-777':
group = bot.List('group','758421574')[0]
membs = bot.List('group','1457842514')
bot.GroupShut(group, membs, t=60)
@qqbotsched(hour='01,01', minute='11,12')
def mytask(bot):
gl = bot.List('buddy', '5201314')
if gl is not None:
for buddy in gl:
bot.SendTo(buddy, '6666666')
if __name__ == '__main__':
RunBot()
Python
1
https://gitee.com/KillBugX/xiaofeichatbot.git
git@gitee.com:KillBugX/xiaofeichatbot.git
KillBugX
xiaofeichatbot
XiaoFeiChatBot
master

搜索帮助