Skip to content

Commit

Permalink
Merge pull request #7 from ExpTechTW/fix/cdps/component-style-fix
Browse files Browse the repository at this point in the history
fix(cdps): bad unordered list usage
  • Loading branch information
kamiya10 committed Jun 9, 2024
2 parents 938cc34 + c8468d8 commit d16c1f4
Show file tree
Hide file tree
Showing 54 changed files with 670 additions and 422 deletions.
18 changes: 14 additions & 4 deletions docs/api/earthquake/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@ pagination_prev: null
pagination_next: null
---

import ApiEndpoint from '@site/src/components/ApiEndpoint';
import ApiEndpoint from "@site/src/components/ApiEndpoint";

# 地震

<div style={{display: 'flex', flexDirection: 'column', gap: '8px'}}>
<ApiEndpoint method='get' title='取得地震報告列表' path='/eq/report' to='/docs/api/earthquake/report'/>
<ApiEndpoint method='get' title='取得詳細地震報告' path='/eq/report/:id' to='/docs/api/earthquake/report-detail'/>
<div style={{ display: "flex", flexDirection: "column", gap: "8px" }}>
<ApiEndpoint
method="get"
title="取得地震報告列表"
path="/eq/report"
to="./report"
/>
<ApiEndpoint
method="get"
title="取得詳細地震報告"
path="/eq/report/:id"
to="./report-detail"
/>
</div>
27 changes: 21 additions & 6 deletions docs/api/weather/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,27 @@ pagination_prev: null
pagination_next: null
---

import ApiEndpoint from '@site/src/components/ApiEndpoint';
import ApiEndpoint from "@site/src/components/ApiEndpoint";

# 氣象

<div style={{display: 'flex', flexDirection: 'column', gap: '8px'}}>
<ApiEndpoint method='get' title='取得天氣預報資訊' path='/weather/forecast/:code' to='/docs/api/weather/forecast' />
<ApiEndpoint method='get' title='取得即時天氣資訊' path='/weather/realtime/:code' to='/docs/api/weather/realtime' />
<ApiEndpoint method='get' title='取得天氣資訊' path='/weather/all/:code' to='/docs/api/weather/all'/>
</div>
<div style={{ display: "flex", flexDirection: "column", gap: "8px" }}>
<ApiEndpoint
method="get"
title="取得天氣預報資訊"
path="/weather/forecast/:code"
to="./forecast"
/>
<ApiEndpoint
method="get"
title="取得即時天氣資訊"
path="/weather/realtime/:code"
to="./realtime"
/>
<ApiEndpoint
method="get"
title="取得天氣資訊"
path="/weather/all/:code"
to="./all"
/>
</div>
14 changes: 4 additions & 10 deletions docs/cdps/command/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ sidebar_position: 3

# 指令

- CDPS 提供簡易的 CLI 工具 執行對應操作。

:::note

- 下方指令在 Source Code 下,需將 `cdps` 替換成 `python main.py`

:::
CDPS 提供簡易的 CLI 工具 執行對應操作。

## 查看 CDPS 的幫助訊息

Expand All @@ -22,8 +16,8 @@ cdps -h

:::note

- 可以查看**子指令**幫助訊息
- 範例 `cdps pack -h`
可以查看**子指令**幫助訊息
範例 `cdps pack -h`

:::

Expand All @@ -49,7 +43,7 @@ cdps init
cdps start
```

## 重新生成默認配置 (config.yml)
## 重新生成預設設定 (config.yml)

```bash
cdps gendefault
Expand Down
19 changes: 11 additions & 8 deletions docs/cdps/config/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@
sidebar_position: 2
---

# 配置
# 設定

- 自定義你的 CDPS 伺服器。
自定義你的 CDPS 伺服器。

## 配置檔
## 設定檔

- `./config.yml`
`./config.yml`

```yml
version: 1 # config 版本號
# 設定檔版本號
version: 1

# "DEBUG" , "INFO" , "WARN" or "ERROR"
log_level: "DEBUG" # 日誌紀錄等級
# 日誌紀錄等級
# 可用的值:"DEBUG"、"INFO"、"WARN" 或 "ERROR"
log_level: "DEBUG"

log_save_days: 7 # 日誌保留天數
# 日誌保留天數
log_save_days: 7
```
12 changes: 6 additions & 6 deletions docs/cdps/develop/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ sidebar_position: 6

# 開發

- 這是關於開發 `CDPS` 的文件,如果是要開發擴充 [點擊這裡](../plugin)
這是關於開發 `CDPS` 的文件,如果是要開發擴充 [點擊這裡](../plugin)

:::note

- 如果是一般用戶,可以略過這裡(快跑!!!)
如果是一般用戶,可以略過這裡(快跑!!!)

:::

## 從原始碼啟動

- clone 原始碼
- 複製原始碼
- 在根目錄中使用 `python main.py` 啟動 CDPS

## 貢獻

- 至 GitHub 提交 [PR](https://github.com/ExpTechTW/CDPS/pulls)
至 GitHub 提交 [PR](https://github.com/ExpTechTW/CDPS/pulls)

:::tip

- 開發時應保持 `簡潔` 的原則。
- 若非所有用戶所需之功能,可以參考利用 [Inject 注入](/docs/cdps/miscellaneous/inject) 的方式實現。
開發時應保持 `簡潔` 的原則。
若非所有用戶所需之功能,可以參考利用 [Inject 注入](../miscellaneous/inject) 的方式實現。

:::

Expand Down
11 changes: 5 additions & 6 deletions docs/cdps/miscellaneous/dependencies.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ sidebar_position: 8

:::note

- 這是說明 CDPS 擴充之間的依賴關係,如果要找 PyPI 依賴 [點擊這裡](./pip)
這是說明 CDPS 擴充之間的依賴關係,如果要找 PyPI 依賴 [點擊這裡](./pip)

:::

## 聲明依賴

- `cdps.json` 中 聲明
`cdps.json` 中 聲明

:::tip

- 依賴中 `cdps` 為必須的。
依賴中 `cdps` 為必須的。

:::

Expand All @@ -34,11 +34,10 @@ sidebar_position: 8

## 用途

- 檢查是否有執行擴充所需的其他擴充
檢查是否有執行擴充所需的其他擴充

:::tip

- 舉例 `cdps_discord` 需要 `cdps_report` 來提供 地震報告 資料。
- 上述例子 `cdps_report` 就是 `cdps_discord` 所需的依賴。
舉例來說,`cdps_discord` 需要 `cdps_report` 提供地震報告資料。換句話說,`cdps_report` 就是 `cdps_discord` 所必需的依賴。

:::
27 changes: 18 additions & 9 deletions docs/cdps/miscellaneous/event.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,48 @@ sidebar_position: 12

# 自定義事件註冊

- 除了 CDPS 本身,**擴充**還可以分發自己的 事件。
除了 CDPS 本身,**擴充**還可以分發自己的 事件。

:::tip

- **自定義事件**是擴充之間,傳遞訊息的一種方式。
**自定義事件**是擴充之間,傳遞訊息的一種方式。

:::

## 用法

```py
# color_log ( plugin ) 分發 Log 事件
from cdps.plugin.events import Event # 導入 Event 基類
from cdps.plugin.manager import Manager # 導入 擴充管理器

class onLogEvent(Event): # 自定義事件
# 導入 Event 基類
from cdps.plugin.events import Event

# 導入 擴充管理器
from cdps.plugin.manager import Manager

# 自定義事件
class onLogEvent(Event):
""" 當 輸出日誌 """

def __init__(self, log):
self.pid = log

# 獲取 擴充管理器 實例
event_manager = Manager()

event_manager = Manager() # 獲取 擴充管理器 實例
event_manager.call_event(onLogEvent("test")) # 觸發 自定義事件
# 觸發 自定義事件
event_manager.call_event(onLogEvent("test"))
```

```py
# discord (plugin) 獲取分發的 Log 事件 發送到 Discord
from cdps.plugin.manager import Listener, event_listener
from plugins.color_log.main import onLogEvent # 導入上述 color_log 擴充 中的 onLogEvent 事件

# 導入上述 color_log 擴充 中的 onLogEvent 事件
from plugins.color_log.main import onLogEvent

@event_listener(onLogEvent) # 裝飾器
# 裝飾器
@event_listener(onLogEvent)
class onLogListener(Listener):

def on_event(self, event):
Expand Down
8 changes: 4 additions & 4 deletions docs/cdps/miscellaneous/events_list.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sidebar_position: 1

# 事件列表

- 查看可用的事件。
查看可用的事件。

## 目錄

Expand All @@ -16,16 +16,16 @@ sidebar_position: 1

#### 回傳參數 `pid`

- 當伺服器被啟動
當伺服器被啟動

## onServerCloseEvent

#### 回傳參數 `reason(關閉原因)`

- 當伺服器被關閉
當伺服器被關閉

## onCommandEvent

#### 回傳參數 `command(用戶輸入內容)`

- 當用戶輸入指令到 terminal
當用戶輸入指令到 terminal
9 changes: 4 additions & 5 deletions docs/cdps/miscellaneous/focus-load.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,23 @@ sidebar_position: 5

# 完全載入

- 等待擴充完全載入後,再繼續下一步動作(載入其他擴充)
完全載入是等待所有擴充套件完全載入後,才進行的下一步操作(如載入其他擴充)。

:::danger

- 這個選項通常不需要使用。
- 如果不清楚此選項用意,不要輕易使用。
這個選項通常不需要使用。如果不確定此選項的用途,請避免使用。

:::

:::tip

- 通常在使用了 `Inject 注入` 的擴充中,需要啟用此功能,確保 `Inject 注入` 完成
如果使用了 `Inject` 注入功能,通常需要啟用這個選項以確保 `Inject` 注入完成

:::

## 用法

- `cdps.json` 中 聲明
`cdps.json` 中聲明以下內容:

```json
{
Expand Down
2 changes: 1 addition & 1 deletion docs/cdps/miscellaneous/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sidebar_position: 7

# 雜項

- 這裡紀錄著,一些瑣碎的東西。
這裡紀錄著,一些瑣碎的東西。

## 目錄

Expand Down
Loading

0 comments on commit d16c1f4

Please sign in to comment.