-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
49 lines (41 loc) · 1.97 KB
/
Copy pathmain.py
File metadata and controls
49 lines (41 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from astrbot.api.event import filter, AstrMessageEvent, MessageEventResult
from astrbot.api.star import Context, Star, register
from astrbot.api import logger
from .characters import Character, get_character_team
from .characters import Map
@register("astral_party_random", "aurora4123", "《吉星派对》随机地图角色抽取", "1.0")
class MyPlugin(Star):
def __init__(self, context: Context):
super().__init__(context)
async def initialize(self):
"""可选择实现异步的插件初始化方法,当实例化该插件类之后会自动调用该方法。"""
@filter.command("星趴角色")
async def random_character(self, event: AstrMessageEvent):
"""随机一个角色"""
character = Character.get_random_character()
yield event.plain_result(f"你抽取到的角色是:{character.value}")
@filter.command("星趴地图")
async def random_map(self, event: AstrMessageEvent):
"""随机一个地图"""
_map = Map.get_random_map()
yield event.plain_result(f"你抽取到的地图是:{_map.value}")
@filter.command("星趴队伍")
async def random_team(self, event: AstrMessageEvent):
"""随机一个队伍"""
team = get_character_team()
message = "你抽取到的队伍是:\n"
for character in team:
message += f"{character.value} \n"
yield event.plain_result(message)
@filter.command("星趴随机")
async def random(self, event: AstrMessageEvent):
"""随机一个地图和队伍"""
team = get_character_team()
_map = Map.get_random_map()
map_message = f"你抽取到的地图是:{_map.value}\n"
team_message = "队伍:\n"
for character in team:
team_message += f" {character.value} \n"
yield event.plain_result(map_message + team_message)
async def terminate(self):
"""可选择实现异步的插件销毁方法,当插件被卸载/停用时会调用。"""