Sfoglia il codice sorgente

优化hello插件

master
6vision 7 mesi fa
parent
commit
c5b549f450
1 ha cambiato i file con 11 aggiunte e 4 eliminazioni
  1. +11
    -4
      plugins/hello/hello.py

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

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


class Hello(Plugin):

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

def __init__(self):
super().__init__()
try:
self.config = super().load_config()
if not self.config:
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")
self.handlers[Event.ON_HANDLE_CONTEXT] = self.on_handle_context
except Exception as e:


Loading…
Annulla
Salva