Skip to content

Commit 6f9f9d0

Browse files
committed
CHANGES:
- /mission manage now modifies the mission when selected.
1 parent 06a7a8f commit 6f9f9d0

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

plugins/mission/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ async def reload(self, interaction: discord.Interaction):
127127
await interaction.response.defer()
128128
self.env.embed.set_footer(text="Restarting, please wait ...")
129129
await interaction.edit_original_response(embed=self.env.embed)
130-
await self.server.current_mission.restart()
130+
await self.server.restart(modify_mission=self.modify_mission)
131131
# wait for a possible resume
132132
with suppress(TimeoutError, asyncio.TimeoutError):
133133
await self.server.wait_for_status_change([Status.RUNNING], 2)

services/README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ with the ServiceRegistry, to be able to be used anywhere in the code.
3636

3737
A sample might look like this:
3838
```python
39-
from core import ServiceRegistry, Service
39+
from core import ServiceRegistry, Service, Server
4040

4141
# Register the service with the ServiceRegistry.
4242
# You can define an optional plugin, that determines if this services should be loaded or not.
@@ -52,6 +52,14 @@ class MyService(Service):
5252
async def stop(self, *args, **kwargs):
5353
await super().stop()
5454
# do something on service stop
55+
56+
async def switch(self):
57+
await super().switch()
58+
# called when a master switch happened
59+
60+
def get_config(self, server: Server | None = None, **kwargs) -> dict:
61+
# you can overwrite the get_config() method to implement your own config-reader.
62+
...
5563
```
5664
That's more or less it. You have access to any other core functionality of the bot in here. You can access other services
5765
(be aware - you might not be on the master node!), the database, the local servers (unless you are on the master, then

0 commit comments

Comments
 (0)