# Zhamao Framework: ZMPlugin类 参考

ZMPlugin类 参考
类 ZMPlugin 继承关系图:
[图例]

## Public 成员函数

| __construct (string $dir)
| getDir ()
| addBotEvent (BotEvent $event)
| addBotCommand (BotCommand $command)
| addEvent (string $event_name, callable $callback, int $level=20)
| addHttpRoute (Route $route)
| getBotEvents ()
| getBotCommands ()
| getEvents ()
| getRoutes ()

## Protected 属性

string | $dir
array | $bot_events = []
array | $bot_commands = []
array | $events = []
array | $routes = []

## 详细描述

单文件插件声明类

## 构造及析构函数说明

## __construct()

__construct | ( | string | $dir | ) |

## 成员函数说明

## addBotCommand()

addBotCommand | ( | BotCommand | $command | ) |

## addBotEvent()

addBotEvent | ( | BotEvent | $event | ) |

## addEvent()

addEvent | ( | string | $event_name,
|  | callable | $callback,
|  | int | $level = `20`
| ) |  |

## addHttpRoute()

addHttpRoute | ( | Route | $route | ) |

## getBotCommands()

getBotCommands | ( |  | ) |

## getBotEvents()

getBotEvents | ( |  | ) |

## getDir()

getDir | ( |  | ) |

## getEvents()

getEvents | ( |  | ) |

## getRoutes()

getRoutes | ( |  | ) |

## 结构体成员变量说明

## $bot_commands

array $bot_commands = []

protected

## $bot_events

array $bot_events = []

protected

## $dir

string $dir

protected

## $events

array $events = []

protected

## $routes

array $routes = []

protected

该类的文档由以下文件生成:

- src/ZM/Plugin/ZMPlugin.php