Files
zhamao-framework/docs/api/ZM/Context/Context.md

218 lines
3.4 KiB
Markdown
Raw Normal View History

2022-03-27 16:42:36 +08:00
# ZM\Context\Context
## getServer
```php
public function getServer(): Server
```
### 描述
作者很懒,什么也没有说
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| Server | |
## getData
```php
public function getData(): mixed
```
### 描述
作者很懒,什么也没有说
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |
## reply
```php
2022-04-02 17:31:48 +00:00
public function reply(array|string $msg, bool|callable|Closure $yield): array|bool
2022-03-27 16:42:36 +08:00
```
### 描述
only can used by cq->message event function
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
2022-04-02 17:31:48 +00:00
| msg | array|string | 要回复的消息 |
| yield | bool|callable|Closure | 是否协程挂起true是否绑定异步事件Closure |
2022-04-01 18:48:48 +08:00
2022-03-27 16:42:36 +08:00
### 返回
| 类型 | 描述 |
| ---- | ----------- |
2022-04-02 17:31:48 +00:00
| array|bool | 返回API调用结果 |
2022-03-27 16:42:36 +08:00
## finalReply
```php
2022-04-02 17:31:48 +00:00
public function finalReply(array|string $msg, bool $yield): mixed
2022-03-27 16:42:36 +08:00
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
2022-04-02 17:31:48 +00:00
| msg | array|string | 要回复的消息 |
| yield | bool | 是否协程挂起true是否绑定异步事件Closure |
2022-04-01 18:48:48 +08:00
2022-03-27 16:42:36 +08:00
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |
## waitMessage
```php
public function waitMessage(string $prompt, int $timeout, string $timeout_prompt): string
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| prompt | string | |
| timeout | int | |
| timeout_prompt | string | |
2022-04-01 18:48:48 +08:00
2022-03-27 16:42:36 +08:00
### 返回
| 类型 | 描述 |
| ---- | ----------- |
2022-04-02 17:31:48 +00:00
| string | 返回用户输入的内容 |
2022-03-27 16:42:36 +08:00
## getArgs
```php
2022-04-02 17:31:48 +00:00
public function getArgs(int|string $mode, string|Stringable $prompt_msg): float|int|string
2022-03-27 16:42:36 +08:00
```
### 描述
2022-04-02 17:31:48 +00:00
根据选定的模式获取消息参数
2022-03-27 16:42:36 +08:00
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
2022-04-02 17:31:48 +00:00
| mode | int|string | 获取的模式 |
| prompt_msg | string|Stringable | 提示语回复 |
2022-04-01 18:48:48 +08:00
2022-03-27 16:42:36 +08:00
### 返回
| 类型 | 描述 |
| ---- | ----------- |
2022-04-02 17:31:48 +00:00
| float|int|string | |
2022-03-27 16:42:36 +08:00
## getNextArg
```php
public function getNextArg(string $prompt_msg): int|mixed|string
```
### 描述
2022-04-02 17:31:48 +00:00
获取下一个参数
2022-03-27 16:42:36 +08:00
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
2022-04-02 17:31:48 +00:00
| prompt_msg | string | 提示语回复 |
2022-04-01 18:48:48 +08:00
2022-03-27 16:42:36 +08:00
### 返回
| 类型 | 描述 |
| ---- | ----------- |
2022-04-02 17:31:48 +00:00
| int|mixed|string | 返回获取的参数 |
2022-03-27 16:42:36 +08:00
## getFullArg
```php
public function getFullArg(string $prompt_msg): int|mixed|string
```
### 描述
2022-04-02 17:31:48 +00:00
获取接下来所有的消息当成一个完整的参数(包含空格)
2022-03-27 16:42:36 +08:00
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
2022-04-02 17:31:48 +00:00
| prompt_msg | string | 提示语回复 |
2022-04-01 18:48:48 +08:00
2022-03-27 16:42:36 +08:00
### 返回
| 类型 | 描述 |
| ---- | ----------- |
2022-04-02 17:31:48 +00:00
| int|mixed|string | 返回获取的参数 |
2022-03-27 16:42:36 +08:00
## getNumArg
```php
public function getNumArg(string $prompt_msg): int|mixed|string
```
### 描述
2022-04-02 17:31:48 +00:00
获取下一个数字类型的参数
2022-03-27 16:42:36 +08:00
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
2022-04-02 17:31:48 +00:00
| prompt_msg | string | 提示语回复 |
2022-04-01 18:48:48 +08:00
2022-03-27 16:42:36 +08:00
### 返回
| 类型 | 描述 |
| ---- | ----------- |
2022-04-02 17:31:48 +00:00
| int|mixed|string | 返回获取的参数 |
2022-03-27 16:42:36 +08:00
## cloneFromParent
```php
2022-04-02 17:31:48 +00:00
public function cloneFromParent(): ContextInterface
2022-03-27 16:42:36 +08:00
```
### 描述
作者很懒,什么也没有说
### 返回
| 类型 | 描述 |
| ---- | ----------- |
2022-04-02 17:31:48 +00:00
| ContextInterface | 返回上下文 |