pandolia / qqbot

QQBot: A conversation robot base on Tencent's SmartQQ
Other
3.68k stars 877 forks source link

Plugin #355

Closed ghost closed 6 years ago

ghost commented 6 years ago
# -*- coding: utf-8 -*-

def onQQMessage(bot, contact, member, content):
    if content == '-hello':
        bot.SendTo(contact, unicode('你好,我是QQ机器人'))
    elif content == '-stop':
        bot.SendTo(contact, unicode('QQ机器人已关闭'))

当我按照你的步骤把这段代码放到plugin里面后运行 qq plug sample 后出现以下错误提示

错误:无法加载插件 sample ,<class 'SyntaxError'>: (unicode error) 'utf-8' codec can't decode byte 0xbb in position 2: invalid start byte (sample.py, line 7)
pandolia commented 6 years ago

应该是文件 sample.py 没有保存为 utf8 编码。