mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-03-18 05:04:51 +08:00
46 lines
23 KiB
HTML
46 lines
23 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en-US">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||
<title>内置依赖项 | 炸毛框架 v3</title>
|
||
<meta name="description" content="">
|
||
<meta name="generator" content="VuePress 1.9.10">
|
||
<link rel="icon" href="/logo_trans.png">
|
||
<script>
|
||
var _hmt = _hmt || [];
|
||
(function () {
|
||
var hm = document.createElement("script");
|
||
hm.src = "https://hm.baidu.com/hm.js?f0f276cefa10aa31a20ae3815a50b795";
|
||
var s = document.getElementsByTagName("script")[0];
|
||
s.parentNode.insertBefore(hm, s);
|
||
})();
|
||
</script>
|
||
<meta name="description" content="一个高性能聊天机器人 + Web 框架">
|
||
<link rel="preload" href="/assets/css/0.styles.de075592.css" as="style"><link rel="preload" href="/assets/js/app.cf958133.js" as="script"><link rel="preload" href="/assets/js/2.4c04991c.js" as="script"><link rel="preload" href="/assets/js/1.d8755a39.js" as="script"><link rel="preload" href="/assets/js/36.80aace42.js" as="script"><link rel="prefetch" href="/assets/js/10.960912c3.js"><link rel="prefetch" href="/assets/js/11.cd171694.js"><link rel="prefetch" href="/assets/js/12.ff9ca1d1.js"><link rel="prefetch" href="/assets/js/13.a56deac8.js"><link rel="prefetch" href="/assets/js/14.b222a011.js"><link rel="prefetch" href="/assets/js/15.31489867.js"><link rel="prefetch" href="/assets/js/16.e921dbc4.js"><link rel="prefetch" href="/assets/js/17.58f730d3.js"><link rel="prefetch" href="/assets/js/18.26c46c49.js"><link rel="prefetch" href="/assets/js/19.ee0bfd3b.js"><link rel="prefetch" href="/assets/js/20.bb3578b8.js"><link rel="prefetch" href="/assets/js/21.e66f7fe5.js"><link rel="prefetch" href="/assets/js/22.cba8ca48.js"><link rel="prefetch" href="/assets/js/23.cb49f41c.js"><link rel="prefetch" href="/assets/js/24.d95b175a.js"><link rel="prefetch" href="/assets/js/25.b0d69869.js"><link rel="prefetch" href="/assets/js/26.8e7089c0.js"><link rel="prefetch" href="/assets/js/27.333a53a1.js"><link rel="prefetch" href="/assets/js/28.df4b871c.js"><link rel="prefetch" href="/assets/js/29.5427ad45.js"><link rel="prefetch" href="/assets/js/3.07fc018e.js"><link rel="prefetch" href="/assets/js/30.7cb7445a.js"><link rel="prefetch" href="/assets/js/31.5c4bb546.js"><link rel="prefetch" href="/assets/js/32.7fc05474.js"><link rel="prefetch" href="/assets/js/33.9684a4f8.js"><link rel="prefetch" href="/assets/js/34.83e32a28.js"><link rel="prefetch" href="/assets/js/35.95d03df6.js"><link rel="prefetch" href="/assets/js/37.1eaed2ee.js"><link rel="prefetch" href="/assets/js/38.75fa7a1c.js"><link rel="prefetch" href="/assets/js/39.117f5802.js"><link rel="prefetch" href="/assets/js/4.6623271b.js"><link rel="prefetch" href="/assets/js/40.57eba153.js"><link rel="prefetch" href="/assets/js/41.89c4a7c8.js"><link rel="prefetch" href="/assets/js/42.d8f92f99.js"><link rel="prefetch" href="/assets/js/43.5ee83631.js"><link rel="prefetch" href="/assets/js/44.c09b5b0c.js"><link rel="prefetch" href="/assets/js/45.bd850606.js"><link rel="prefetch" href="/assets/js/46.732b1cef.js"><link rel="prefetch" href="/assets/js/47.2a872d0d.js"><link rel="prefetch" href="/assets/js/48.959e18f4.js"><link rel="prefetch" href="/assets/js/49.a9bb32f7.js"><link rel="prefetch" href="/assets/js/5.073233e8.js"><link rel="prefetch" href="/assets/js/50.ca90a854.js"><link rel="prefetch" href="/assets/js/51.79142530.js"><link rel="prefetch" href="/assets/js/52.fe63ad16.js"><link rel="prefetch" href="/assets/js/53.ed84845a.js"><link rel="prefetch" href="/assets/js/54.3ab7e492.js"><link rel="prefetch" href="/assets/js/55.9028e407.js"><link rel="prefetch" href="/assets/js/56.8173f798.js"><link rel="prefetch" href="/assets/js/57.2166b068.js"><link rel="prefetch" href="/assets/js/58.7c52b6bf.js"><link rel="prefetch" href="/assets/js/59.e9965a7b.js"><link rel="prefetch" href="/assets/js/60.f277436c.js"><link rel="prefetch" href="/assets/js/61.3712f8fe.js"><link rel="prefetch" href="/assets/js/8.899a0731.js"><link rel="prefetch" href="/assets/js/9.e2e8da12.js"><link rel="prefetch" href="/assets/js/vendors~docsearch.303532f0.js">
|
||
<link rel="stylesheet" href="/assets/css/0.styles.de075592.css">
|
||
</head>
|
||
<body>
|
||
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="ant-row"><div class="nav-button"><i aria-label="icon: bars" class="anticon anticon-bars"><svg viewBox="0 0 1024 1024" focusable="false" data-icon="bars" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm0 284a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm0 284a56 56 0 1 0 112 0 56 56 0 1 0-112 0z"></path></svg></i> <span></span></div> <div class="ant-col ant-col-xs-24 ant-col-sm-24 ant-col-md-6 ant-col-lg-6 ant-col-xl-5 ant-col-xxl-4"><a href="/" class="router-link-active home-link"><img src="/logo_trans.png" alt="炸毛框架 v3" class="logo"> <span class="site-name">炸毛框架 v3</span></a> <div class="search-box mobile-search"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div></div> <div class="nav-space-between ant-col ant-col-xs-0 ant-col-sm-0 ant-col-md-18 ant-col-lg-18 ant-col-xl-19 ant-col-xxl-20"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><ul role="menu" id="nav" class="ant-menu ant-menu-horizontal ant-menu-root ant-menu-light"><li role="menuitem" class="ant-menu-submenu ant-menu-submenu-horizontal ant-menu-overflowed-submenu" style="display:none;"><div aria-haspopup="true" class="ant-menu-submenu-title"><span>···</span><i class="ant-menu-submenu-arrow"></i></div></li><li role="menuitem" class="ant-menu-item"><a href="/guide/">
|
||
指南
|
||
</a></li><li role="menuitem" class="ant-menu-submenu ant-menu-submenu-horizontal ant-menu-overflowed-submenu" style="display:none;"><div aria-haspopup="true" class="ant-menu-submenu-title"><span>···</span><i class="ant-menu-submenu-arrow"></i></div></li><li role="menuitem" class="ant-menu-item"><a href="/event/">
|
||
事件
|
||
</a></li><li role="menuitem" class="ant-menu-submenu ant-menu-submenu-horizontal ant-menu-overflowed-submenu" style="display:none;"><div aria-haspopup="true" class="ant-menu-submenu-title"><span>···</span><i class="ant-menu-submenu-arrow"></i></div></li><li role="menuitem" class="ant-menu-item"><a href="/components/bot/bot-context.html">
|
||
组件
|
||
</a></li><li role="menuitem" class="ant-menu-submenu ant-menu-submenu-horizontal ant-menu-overflowed-submenu" style="display:none;"><div aria-haspopup="true" class="ant-menu-submenu-title"><span>···</span><i class="ant-menu-submenu-arrow"></i></div></li><li role="menuitem" class="ant-menu-item"><a href="/plugins/management.html">
|
||
插件
|
||
</a></li><li role="menuitem" class="ant-menu-submenu ant-menu-submenu-horizontal ant-menu-overflowed-submenu" style="display:none;"><div aria-haspopup="true" class="ant-menu-submenu-title"><span>···</span><i class="ant-menu-submenu-arrow"></i></div></li><li role="menuitem" class="ant-menu-item"><a href="/advanced/">
|
||
进阶
|
||
</a></li><li role="menuitem" class="ant-menu-submenu ant-menu-submenu-horizontal ant-menu-overflowed-submenu" style="display:none;"><div aria-haspopup="true" class="ant-menu-submenu-title"><span>···</span><i class="ant-menu-submenu-arrow"></i></div></li><li role="menuitem" class="ant-menu-item"><a href="/update/v3.html">
|
||
更新日志
|
||
</a></li><li role="menuitem" class="ant-menu-submenu ant-menu-submenu-horizontal ant-menu-overflowed-submenu" style="display:none;"><div aria-haspopup="true" class="ant-menu-submenu-title"><span>···</span><i class="ant-menu-submenu-arrow"></i></div></li><li role="menuitem" class="ant-menu-item"><a href="/doxy/" target="_blank">
|
||
API 文档
|
||
<i aria-label="icon: link" class="anticon anticon-link"><svg viewBox="64 64 896 896" focusable="false" data-icon="link" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M574 665.4a8.03 8.03 0 0 0-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 0 0-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 0 0 0 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 0 0 0 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 0 0-11.3 0L372.3 598.7a8.03 8.03 0 0 0 0 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z"></path></svg></i></a></li><li role="menuitem" class="ant-menu-submenu ant-menu-submenu-horizontal ant-menu-overflowed-submenu" style="display:none;"><div aria-haspopup="true" class="ant-menu-submenu-title"><span>···</span><i class="ant-menu-submenu-arrow"></i></div></li><li role="menuitem" class="ant-menu-item"><a href="https://docs-v2.zhamao.xin/" target="_blank">
|
||
炸毛框架 v2
|
||
<i aria-label="icon: link" class="anticon anticon-link"><svg viewBox="64 64 896 896" focusable="false" data-icon="link" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M574 665.4a8.03 8.03 0 0 0-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 0 0-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 0 0 0 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 0 0 0 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 0 0-11.3 0L372.3 598.7a8.03 8.03 0 0 0 0 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z"></path></svg></i></a></li><li role="menuitem" class="ant-menu-submenu ant-menu-submenu-horizontal ant-menu-overflowed-submenu" style="visibility:hidden;position:absolute;"><div aria-haspopup="true" class="ant-menu-submenu-title"><span>···</span><i class="ant-menu-submenu-arrow"></i></div></li></ul> <ul class="extra-group"><li><a href="https://github.com/zhamao-robot/zhamao-framework" target="_blank" rel="noopener noreferrer" class="repo-link"><i aria-label="icon: github" class="anticon anticon-github"><svg viewBox="64 64 896 896" focusable="false" data-icon="github" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M511.6 76.3C264.3 76.2 64 276.4 64 523.5 64 718.9 189.3 885 363.8 946c23.5 5.9 19.9-10.8 19.9-22.2v-77.5c-135.7 15.9-141.2-73.9-150.3-88.9C215 726 171.5 718 184.5 703c30.9-15.9 62.4 4 98.9 57.9 26.4 39.1 77.9 32.5 104 26 5.7-23.5 17.9-44.5 34.7-60.8-140.6-25.2-199.2-111-199.2-213 0-49.5 16.3-95 48.3-131.7-20.4-60.5 1.9-112.3 4.9-120 58.1-5.2 118.5 41.6 123.2 45.3 33-8.9 70.7-13.6 112.9-13.6 42.4 0 80.2 4.9 113.5 13.9 11.3-8.6 67.3-48.8 121.3-43.9 2.9 7.7 24.7 58.3 5.5 118 32.4 36.8 48.9 82.7 48.9 132.3 0 102.2-59 188.1-200 212.9a127.5 127.5 0 0 1 38.1 91v112.5c.8 9 0 17.9 15 17.9 177.1-59.7 304.6-227 304.6-424.1 0-247.2-200.4-447.3-447.5-447.3z"></path></svg></i></a></li> <!----></ul></nav></div></div> <!----></header> <aside class="sidebar"><!----> <ul class="sidebar-links"><li><a href="/components/" aria-current="page" title="组件" class="sidebar-link">组件</a></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>机器人组件</span> <span class="arrow right"><i aria-label="icon: down" class="anticon anticon-down"><svg viewBox="64 64 896 896" focusable="false" data-icon="down" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"></path></svg></i></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>HTTP 组件</span> <span class="arrow right"><i aria-label="icon: down" class="anticon anticon-down"><svg viewBox="64 64 896 896" focusable="false" data-icon="down" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"></path></svg></i></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>框架通用组件</span> <span class="arrow right"><i aria-label="icon: down" class="anticon anticon-down"><svg viewBox="64 64 896 896" focusable="false" data-icon="down" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"></path></svg></i></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>存储组件</span> <span class="arrow right"><i aria-label="icon: down" class="anticon anticon-down"><svg viewBox="64 64 896 896" focusable="false" data-icon="down" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"></path></svg></i></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>依赖注入组件</span> <span class="arrow down"><i aria-label="icon: down" class="anticon anticon-down"><svg viewBox="64 64 896 896" focusable="false" data-icon="down" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"></path></svg></i></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/components/container/dependency-injection.html" title="依赖注入" class="sidebar-link">依赖注入</a></li><li><a href="/components/container/configuration.html" title="容器配置" class="sidebar-link">容器配置</a></li><li><a href="/components/container/dependencies.html" aria-current="page" title="内置依赖项" class="active sidebar-link">内置依赖项</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/components/container/dependencies.html#全局依赖" title="全局依赖" class="sidebar-link">全局依赖</a></li><li class="sidebar-sub-header"><a href="/components/container/dependencies.html#onebot-事件" title="OneBot 事件" class="sidebar-link">OneBot 事件</a></li><li class="sidebar-sub-header"><a href="/components/container/dependencies.html#onebot-动作响应" title="OneBot 动作响应" class="sidebar-link">OneBot 动作响应</a></li><li class="sidebar-sub-header"><a href="/components/container/dependencies.html#http-请求事件-路由事件" title="HTTP 请求事件(路由事件)" class="sidebar-link">HTTP 请求事件(路由事件)</a></li><li class="sidebar-sub-header"><a href="/components/container/dependencies.html#websocket-连接事件" title="WebSocket 连接事件" class="sidebar-link">WebSocket 连接事件</a></li><li class="sidebar-sub-header"><a href="/components/container/dependencies.html#websocket-消息事件" title="WebSocket 消息事件" class="sidebar-link">WebSocket 消息事件</a></li><li class="sidebar-sub-header"><a href="/components/container/dependencies.html#websocket-关闭事件" title="WebSocket 关闭事件" class="sidebar-link">WebSocket 关闭事件</a></li></ul></li></ul></section></li></ul> </aside> <main class="page has-page-anchor"> <div class="theme-antdocs-content content__default"><h1 id="内置依赖项"><a href="#内置依赖项" class="header-anchor">#</a> 内置依赖项</h1> <p>在不同的事件(或周期中),可用的依赖项可能会有所不同。例如,当你在一个命令方法中可以使用 <code>BotContext</code> 依赖,但在一个路由方法中却不能使用。</p> <p>你也可以选择直接查看 <code>src/ZM/Container/ContainerRegistrant.php</code> 文件,大部分依赖都在该处定义。
|
||
GitHub 链接:https://github.com/zhamao-robot/zhamao-framework/blob/main/src/ZM/Container/ContainerRegistrant.php</p> <p>本页面列出在不同事件中可用的依赖项。</p> <h2 id="全局依赖"><a href="#全局依赖" class="header-anchor">#</a> 全局依赖</h2> <p>在任何事件(或任何支持依赖注入的地方)中,你都可以使用以下依赖项:</p> <ul><li><code>Psr\Log\LoggerInterface</code>:日志记录器(可使用类的别名 <code>LoggerInterface</code>)</li> <li><code>Psr\Container\ContainerInterface</code>:容器(可使用别名 <code>ContainerInterface</code>)</li> <li><code>DI\Container</code>:容器,区别在于可以使用 <code>set</code> 方法来动态设置依赖项,与 <code>container</code> 函数返回的实例相同</li> <li><code>ZM\Config\ZMConfig</code>:配置,与 <code>config</code> 函数返回的实例相同(可使用别名 <code>ZMConfig</code>)</li> <li>...</li></ul> <h2 id="onebot-事件"><a href="#onebot-事件" class="header-anchor">#</a> OneBot 事件</h2> <p>在 OneBot 事件(<code>@BotEvent</code>)中,你可以使用以下依赖项:</p> <ul><li><code>OneBot\V12\Object\OneBotEvent</code>:当前事件的实例(可使用别名 <code>OneBotEvent</code>)</li> <li><code>ZM\Context\BotContext</code>:当前事件的上下文,可使用别名 <code>BotContext</code>,部分事件可能不可用(要求传入的事件存在 <code>platform</code> 字段)</li></ul> <h2 id="onebot-动作响应"><a href="#onebot-动作响应" class="header-anchor">#</a> OneBot 动作响应</h2> <p>在 OneBot 动作响应(<code>@BotActionResponse</code>)中,你可以使用以下依赖项:</p> <ul><li><code>OneBot\V12\Object\ActionResponse</code>:当前动作响应的实例(可使用别名 <code>ActionResponse</code>)</li></ul> <h2 id="http-请求事件-路由事件"><a href="#http-请求事件-路由事件" class="header-anchor">#</a> HTTP 请求事件(路由事件)</h2> <p>在 HTTP 请求事件(<code>@Route</code>)中,你可以使用以下依赖项:</p> <ul><li><code>OneBot\Driver\Event\Http\HttpRequestEvent</code>:当前事件的实例(可使用别名 <code>HttpRequestEvent</code>)</li> <li><code>Psr\Http\Message\ServerRequestInterface</code>:当前请求的实例(可使用别名 <code>ServerRequestInterface</code>)</li></ul> <h2 id="websocket-连接事件"><a href="#websocket-连接事件" class="header-anchor">#</a> WebSocket 连接事件</h2> <p>在 WebSocket 连接事件(<code>@BindEvent(WebSocketOpenEvent::class)</code>)中,你可以使用以下依赖项:</p> <ul><li><code>OneBot\Driver\Event\WebSocket\WebSocketOpenEvent</code>:当前事件的实例(可使用别名 <code>WebSocketOpenEvent</code>)</li></ul> <h2 id="websocket-消息事件"><a href="#websocket-消息事件" class="header-anchor">#</a> WebSocket 消息事件</h2> <p>在 WebSocket 消息事件(<code>@BindEvent(WebSocketMessageEvent::class)</code>)中,你可以使用以下依赖项:</p> <ul><li><code>OneBot\Driver\Event\WebSocket\WebSocketMessageEvent</code>:当前事件的实例(可使用别名 <code>WebSocketMessageEvent</code>)</li> <li><code>Choir\WebSocket\FrameInterface</code>:当前消息(帧)的实例(可使用别名 <code>FrameInterface</code>)</li></ul> <h2 id="websocket-关闭事件"><a href="#websocket-关闭事件" class="header-anchor">#</a> WebSocket 关闭事件</h2> <p>在 WebSocket 关闭事件(<code>@BindEvent(WebSocketCloseEvent::class)</code>)中,你可以使用以下依赖项:</p> <ul><li><code>OneBot\Driver\Event\WebSocket\WebSocketCloseEvent</code>:当前事件的实例(可使用别名 <code>WebSocketCloseEvent</code>)</li></ul></div> <footer class="page-edit"><div class="edit-link"><a href="https://github.com/zhamao-robot/zhamao-framework/edit/main/docs/components/container/dependencies.md" target="_blank" rel="noopener noreferrer">Edit this page</a> <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></div> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev"><a href="/components/container/configuration.html" class="prev"><i aria-label="icon: left" class="anticon anticon-left"><svg viewBox="64 64 896 896" focusable="false" data-icon="left" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 0 0 0 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"></path></svg></i>
|
||
容器配置
|
||
</a></span> <!----></p></div> <div class="page-anchor"><div class="ant-space ant-space-vertical" style="width:100%;"><div class="ant-space-item"><div class="page-anchor-offset"><div><div class="ant-anchor-wrapper" style="max-height:100vh;"><div class="ant-anchor"><div class="ant-anchor-ink"><span class="ant-anchor-ink-ball"></span></div><div class="ant-anchor-link"><a href="#全局依赖" title="全局依赖" class="ant-anchor-link-title">全局依赖</a></div><div class="ant-anchor-link"><a href="#onebot-事件" title="OneBot 事件" class="ant-anchor-link-title">OneBot 事件</a></div><div class="ant-anchor-link"><a href="#onebot-动作响应" title="OneBot 动作响应" class="ant-anchor-link-title">OneBot 动作响应</a></div><div class="ant-anchor-link"><a href="#http-请求事件-路由事件" title="HTTP 请求事件(路由事件)" class="ant-anchor-link-title">HTTP 请求事件(路由事件)</a></div><div class="ant-anchor-link"><a href="#websocket-连接事件" title="WebSocket 连接事件" class="ant-anchor-link-title">WebSocket 连接事件</a></div><div class="ant-anchor-link"><a href="#websocket-消息事件" title="WebSocket 消息事件" class="ant-anchor-link-title">WebSocket 消息事件</a></div><div class="ant-anchor-link"><a href="#websocket-关闭事件" title="WebSocket 关闭事件" class="ant-anchor-link-title">WebSocket 关闭事件</a></div></div></div></div></div></div></div></div> </main> <!----></div><div class="global-ui"></div></div>
|
||
<script src="/assets/js/app.cf958133.js" defer></script><script src="/assets/js/2.4c04991c.js" defer></script><script src="/assets/js/1.d8755a39.js" defer></script><script src="/assets/js/36.80aace42.js" defer></script>
|
||
</body>
|
||
</html> |