机器人代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
from wxpy import * import requests, json, time
bot = Bot(console_qr=-2, cache_path=True)
bot = Bot()
@bot.register(Group) def print_messages(msg): user_name = msg.sender.self.name content = msg.raw['Content'] friend_name = msg.raw['ActualNickName'] print("{} - 说 - {}".format(friend_name, content))
type = msg.raw['Type']
keywords_dic = {
'你好': '你好,我是机器人', '写作变现': '写作变现系列,真香!http://t.cn/AxHLdYK', '自动化办公': '基础如何学习自动化办公? http://t.cn/AxHPxpx',
} if '程序员晚枫' in user_name: for key in keywords_dic.keys(): if key in content: res_keyword_reply = '''{}''' reply_content = res_keyword_reply.format(keywords_dic[key]) return reply_content
bot.join()
|


相关阅读
🎓 AI 编程实战课程
程序员晚枫专注AI编程培训,通过 《30讲 · AI编程训练营》,让小白也能用AI做出实际项目。帮你从零上手!