aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tests/plugins/test.py
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2023-08-09 14:36:37 +0800
committer简律纯 <i@jyunko.cn>2023-08-09 14:36:37 +0800
commit85ec2f7dc55a672b07272a50f11eb86460f38671 (patch)
tree8517989c8cc6444df8ae7ae50802a3b81766b01f /tests/plugins/test.py
parent642a278b1e2cc11fee587b933413a30c057753c1 (diff)
downloadHydroRoll-85ec2f7dc55a672b07272a50f11eb86460f38671.tar.gz
HydroRoll-85ec2f7dc55a672b07272a50f11eb86460f38671.zip
feat:all
Diffstat (limited to 'tests/plugins/test.py')
-rw-r--r--tests/plugins/test.py35
1 files changed, 0 insertions, 35 deletions
diff --git a/tests/plugins/test.py b/tests/plugins/test.py
deleted file mode 100644
index 6f3bc3b..0000000
--- a/tests/plugins/test.py
+++ /dev/null
@@ -1,35 +0,0 @@
-from iamai import Plugin
-from iamai.exceptions import GetEventTimeout
-
-
-class Weather(Plugin):
- async def handle(self) -> None:
- args = self.event.get_plain_text().split(" ")
- if len(args) >= 2:
- await self.event.reply(await self.get_weather(args[1]))
- else:
- await self.event.reply("请输入想要查询天气的城市:")
- try:
- city_event = await self.event.adapter.get(
- lambda x: x.type == "message", timeout=10
- )
- except GetEventTimeout:
- return
- else:
- await self.event.reply(
- await self.get_weather(city_event.get_plain_text())
- )
-
- async def rule(self) -> bool:
- if self.event.adapter.name != "cqhttp":
- return False
- if self.event.type != "message":
- return False
- return self.event.message.startswith("天气")
-
- @staticmethod
- async def get_weather(city):
- if city not in ["北京", "上海"]:
- return "你想查询的城市暂不支持!"
- return f"{city}的天气是..."
-