LogoFuyu Docs
示例代码

快速模板

快速启动一个插件的开发

快速开始

Examples.ts
import { Plugin } from "@plugin/BasePlugin.ts";
import type { Client } from "tdl";

export default class LifePlugin extends Plugin {
  type = "general"; // 插件类型可选 "general" 或 "bot" , "user"
  name = "插件唯一名称"; // 插件唯一名称
  version = "1.0.0"; // 插件版本号
  description = "插件简短描述"; // 插件简短描述
  constructor(client: Client) {
    super(client);
    this.cmdHandlers = {
      // 命令注册名称
      hello: {
        description: "问候用户", // 命令的简短描述
        scope: "private", // 命令的运行环境 "all" | "private" | "group" | "channel" 可数组表示多个环境
        permission: "owner", // 命令的调用权限 "owner" | "admin" | "all"
        showInHelp: true,
        handler: async (updateNewMessage, _args) => {
          console.log(updateNewMessage);
        },
      },
    };
  }
}

On this page