nonebot2/website/docs/tutorial/plugin/example.mdx

33 lines
806 B
Plaintext
Raw Normal View History

2022-01-07 10:38:04 +00:00
---
sidebar_position: 6
description: 简单插件示例
---
import CodeBlock from "@theme/CodeBlock";
2022-01-07 13:03:03 +00:00
import Messenger from "@site/src/components/Messenger";
2022-01-07 10:38:04 +00:00
# 插件示例
## 命令式问答示例
import WeatherSource from "!!raw-loader!../../../../tests/examples/weather.py";
2022-01-08 05:00:08 +00:00
import WeatherTest from "!!raw-loader!../../../../tests/test_examples/test_weather.py";
2022-01-07 10:38:04 +00:00
<CodeBlock className="language-python">{WeatherSource}</CodeBlock>
2022-01-08 05:00:08 +00:00
<Messenger
msgs={[
{ position: "right", msg: "/天气" },
{ position: "left", msg: "你想查询哪个城市的天气呢?" },
{ position: "right", msg: "上海" },
{ position: "left", msg: "上海的天气是..." },
]}
/>
2022-01-07 10:38:04 +00:00
2022-01-08 05:00:08 +00:00
<details>
<summary>测试示例</summary>
2022-01-07 10:38:04 +00:00
<CodeBlock className="language-python">{WeatherTest}</CodeBlock>
2022-01-08 05:00:08 +00:00
</details>