-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpluginTemplates.py
More file actions
48 lines (38 loc) · 1.47 KB
/
Copy pathpluginTemplates.py
File metadata and controls
48 lines (38 loc) · 1.47 KB
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
# coding:utf-8
# __ __ ____ _ ____ _ _____
# | \/ |_ _| _ \ __ _(_)_ __ | __ ) ___ | |_|___ \
# | |\/| | | | | |_) / _` | | '_ \ | _ \ / _ \| __| __) |
# | | | | |_| | _ < (_| | | | | | | |_) | (_) | |_ / __/
# |_| |_|\__,_|_| \_\__,_|_|_| |_| |____/ \___/ \__|_____|
from Lib import *
import logging
api = OnebotAPI.OnebotAPI()
config = {}
class PluginInfo:
def __init__(self, config_):
"""
:param config_:框架配置文件
"""
global config
config = config_
self.NAME = "插件名称" # 插件名称
self.AUTHOR = "作者" # 插件作者
self.VERSION = "版本" # 插件版本
self.DESCRIPTION = "描述" # 插件描述
self.HELP_MSG = "帮助" # 插件帮助
api.set_ip(config["api"]["host"], config["api"]["port"])
# 发送群聊消息
def group_msg_send(group_id, message: str | QQRichText.QQRichText):
gname = api.get("/get_group_info", {"group_id": group_id})["group_name"]
logging.info("发送群 {}({}) 的消息: {}".format(gname, group_id, str(message)))
api.get("/send_group_msg", {"group_id": group_id, "message": message})
# 主函数
def main(report, work_path):
"""
:param report: go-cqhttp上报的消息
:param work_path: main.py所在的路径
:return:
"""
bot_name = config["account"]["nick_name"]
bot_uid = config["account"]["user_id"]
bot_admin = config["account"]["bot_admin"]