Skip to content
This repository has been archived by the owner on May 5, 2024. It is now read-only.

如何二次开发自定义功能

Yinzo edited this page Jan 17, 2016 · 2 revisions
  • 根据功能类型修改对应文件:

    • 群聊功能:Group.py
    • 私聊功能:Pm.py
    • 临时对话功能:Sess.py
  • 在对应类(class)中编写方法,方法的参数固定为self与msg,即

def [Function Name](self, msg):

  • 需要注意方法的返回值,执行成功请返回True,没有执行或执行失败请返回False
  • 在对应类的process_order中,选择适当的位置加入你添加的功能的名称(Function Name),你添加的位置决定了功能的执行顺序如
self.process_order = [
            "repeat",
            "callout",
        ]
  • 在共有设置中添加功能的开关,如
callout = 0
repeat = 1

0代表关闭、1代表开启

  • (可选)在Config.py中的DefaultConfigs类下的__init__方法中添加属性的默认参数。
  • 私有设置会在程序启动后收到消息时自动由共有设置生成
Clone this wiki locally