Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@
![output](https://github.com/ExpTechTW/RTS-GIF-Maker/assets/44525760/fa644258-edab-42cc-bf1b-897f89bb078d)

## 索引
- [說明](#說明)
- [貢獻者](#貢獻者)
- [發佈規則](#發佈規則)
- [合作](#合作)

## 說明
- [main.py](https://github.com/ExpTechTW/RTS-GIF-Maker/blob/Release/main.py) 手動輸入時間戳生成 `GIF` 到 相同路徑
- [webhook.py](https://github.com/ExpTechTW/RTS-GIF-Maker/blob/Release/webhook.py) 自動抓取 [ExpTech | 探索科技](https://github.com/ExpTechTW) 檢知報告api 生成 `GIF` 並使用 `webhook` 發送到 `Discord`
> [!WARNING]
> 開啟 [webhook.py](https://github.com/ExpTechTW/RTS-GIF-Maker/blob/Release/webhook.py) 時,會在相同路徑生成名為 `first_5_timestamp.json` 記錄最後五筆 ID

## 貢獻者
- whes1015 `文檔`

Expand Down
14 changes: 11 additions & 3 deletions webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,16 @@ def init(self) -> None:
return

if not os.path.exists(self.first_5_timestamp_folder):
with open(self.first_5_timestamp_folder, "w") as f:
json.dump(self.get_first_5_timestamp(), f, ensure_ascii=False, indent=4)
got_response = self.get_response_with_retry()
if got_response:
first_5_ids = self.get_first_5_timestamp(got_response)
with open(self.first_5_timestamp_folder, "w") as f:
json.dump(first_5_ids, f, ensure_ascii=False, indent=4)
self.first_5_timestamp = first_5_ids
else:
self.log("無法獲取初始資料,創建空的 JSON 文件", 2)
with open(self.first_5_timestamp_folder, "w") as f:
json.dump([], f, ensure_ascii=False, indent=4)
else:
self.first_5_timestamp = self.get_data_from_json()

Expand Down Expand Up @@ -225,7 +233,7 @@ def start(self):

while retry_count < max_retries:
try:
response = requests.get(f"https://api-2.exptech.dev/api/v1/trem/rts-image/{timestamp}",)
response = requests.get(f"https://api-1.exptech.dev/api/v1/trem/rts-image/{timestamp}",)

if response.status_code == 200:
result_image = self.raw.copy()
Expand Down