Browse Source

优化hello插件

master
6vision 7 months ago
parent
commit
c5b549f450
1 changed files with 11 additions and 4 deletions
  1. +11
    -4
      plugins/hello/hello.py

+ 11
- 4
plugins/hello/hello.py View File

@@ -17,17 +17,24 @@ from config import conf
version="0.1", version="0.1",
author="lanvent", author="lanvent",
) )


class Hello(Plugin): class Hello(Plugin):

group_welc_prompt = "请你随机使用一种风格说一句问候语来欢迎新用户\"{nickname}\"加入群聊。"
group_exit_prompt = "请你随机使用一种风格介绍你自己,并告诉用户输入#help可以查看帮助信息。"
patpat_prompt = "请你随机使用一种风格跟其他群用户说他违反规则\"{nickname}\"退出群聊。"

def __init__(self): def __init__(self):
super().__init__() super().__init__()
try: try:
self.config = super().load_config() self.config = super().load_config()
if not self.config: if not self.config:
self.config = self._load_config_template() self.config = self._load_config_template()
self.group_welc_fixed_msg = self.config["group_welc_fixed_msg"]
self.group_welc_prompt = self.config["group_welc_prompt"]
self.group_exit_prompt = self.config["group_exit_prompt"]
self.patpat_prompt = self.config["patpat_prompt"]
self.group_welc_fixed_msg = self.config.get("group_welc_fixed_msg", {})
self.group_welc_prompt = self.config.get("group_welc_prompt", self.group_welc_prompt)
self.group_exit_prompt = self.config.get("group_exit_prompt", self.group_exit_prompt)
self.patpat_prompt = self.config.get("patpat_prompt", self.patpat_prompt)
logger.info("[Hello] inited") logger.info("[Hello] inited")
self.handlers[Event.ON_HANDLE_CONTEXT] = self.on_handle_context self.handlers[Event.ON_HANDLE_CONTEXT] = self.on_handle_context
except Exception as e: except Exception as e:


Loading…
Cancel
Save