27 lines
540 B
Markdown
27 lines
540 B
Markdown
# OverUB Examples
|
|
|
|
## Event Logger Plugin
|
|
```python
|
|
from core.plugin import Plugin
|
|
|
|
class EventLogger(Plugin):
|
|
name = "event_logger"
|
|
|
|
async def on_message(self, event):
|
|
self.log.info("Message: %s", getattr(event, "raw_text", ""))
|
|
```
|
|
|
|
## Service Plugin
|
|
```python
|
|
from core.plugin import Plugin
|
|
|
|
class WeatherService(Plugin):
|
|
name = "weather_service"
|
|
|
|
async def on_load(self):
|
|
self.register_service("weather", self)
|
|
|
|
async def get_weather(self, city):
|
|
return {"city": city, "status": "sunny"}
|
|
```
|