Skip to content

Commit

Permalink
📝 update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
RF-Tar-Railt committed Nov 4, 2024
1 parent ce974d4 commit f9dd3fa
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,28 @@ load_plugin("::auto_reload", {"watch_dirs": ["plugins"]})

app = Entari(WS(port=5140, path="satori"))
app.run()
```
```

使用配置文件:
```yaml
# config.yml
basic:
network:
- type: ws
port: 5140
path: satori
plugins:
example_plugin: true
::echo: true
::auto_reload: true
plugin:
auto_reload:
watch_dirs: ["plugins"]
```
```python
from arclet.entari import Entari

app = Entari.load("config.yml")
app.run()
```
4 changes: 2 additions & 2 deletions arclet/entari/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ def from_config(cls, config: EntariConfig | None = None):
ignore_self_message = config.basic.get("ignore_self_message", True)
configs = []
for conf in config.basic.get("network", []):
if conf["type"] == "websocket":
if conf["type"] in ("websocket", "websockets", "ws"):
configs.append(WebsocketsInfo(**{k: v for k, v in conf.items() if k != "type"}))
elif conf["type"] == "webhook":
elif conf["type"] in ("webhook", "wh", "http"):
configs.append(WebhookInfo(**{k: v for k, v in conf.items() if k != "type"}))
for plug, enable in config.basic.get("plugins", {}).items():
if enable:
Expand Down

0 comments on commit f9dd3fa

Please sign in to comment.