{"id":21440345,"url":"https://github.com/brianoy/eew_discord_notify","last_synced_at":"2025-04-19T19:12:56.624Z","repository":{"id":147014110,"uuid":"580524973","full_name":"brianoy/EEW_discord_notify","owner":"brianoy","description":"（配合地牛Wake Up!）在地震速報觸發時順便發送discord訊息提醒伺服器","archived":false,"fork":false,"pushed_at":"2024-12-08T09:19:59.000Z","size":9488,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"packed","last_synced_at":"2025-03-29T12:05:38.470Z","etag":null,"topics":["batch","discord","discordwebhook","earthquakes","eew","powershell","python","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brianoy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-12-20T19:27:04.000Z","updated_at":"2024-12-30T03:34:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"20b2de17-7864-427b-94e6-f1976ca5ddb9","html_url":"https://github.com/brianoy/EEW_discord_notify","commit_stats":{"total_commits":34,"total_committers":1,"mean_commits":34.0,"dds":0.0,"last_synced_commit":"3e165d58af3345fc1d91517c00324c3bc23b5114"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianoy%2FEEW_discord_notify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianoy%2FEEW_discord_notify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianoy%2FEEW_discord_notify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianoy%2FEEW_discord_notify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brianoy","download_url":"https://codeload.github.com/brianoy/EEW_discord_notify/tar.gz/refs/heads/packed","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249774107,"owners_count":21323589,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["batch","discord","discordwebhook","earthquakes","eew","powershell","python","python3"],"created_at":"2024-11-23T01:12:43.560Z","updated_at":"2025-04-19T19:12:56.591Z","avatar_url":"https://github.com/brianoy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EEW_discord_notify\n由discord webhook推播地震速報，使用python編寫，打包為exe後可直接被「地牛Wake Up!」觸發\n\n```mermaid\n      graph LR\n      start[地震發生] --\u003e input[地牛wakeup!被觸發]\n      input -- 觸發*exe.cmd.bat. --\u003e conditionA{看自己選擇\\n傳入變數:強度時間}\n      conditionA -- 分支:split\\n傳入變數: 強度時間 --\u003e conditionC{earthquick.bat}\n      conditionA -- 分支:packed\\n傳入變數: 強度時間 --\u003e conditionB{discord_notify.exe} -- webhook post--\u003e send[discord傳訊息]\n      conditionC -- 觸發\\n傳入變數: 強度時間 --\u003e conditionD{discord_notify.py} -- webhook post--\u003e send[discord傳訊息]\n      send[discord傳訊息] --\u003e stop[程式結束]\n```\n# 使用說明\n\n\n### 第一步 獲取discord伺服器內的頻道webhook網址\n\n#### 文字頻道點擊右鍵-\u003e編輯頻道/點擊齒輪icon-\u003e整合-\u003ewebhook-\u003e新增webhook\n    \n\u003cimg src=\"https://user-images.githubusercontent.com/24865458/208754730-8b555ce3-bc43-447b-9c04-3a4f9f26b0e7.png\" width=\"60%\"\u003e\n\n### 第二步 在右方Release處選擇最新exe檔案\n- 你也可以自己修改sourcefile後再編譯成exe\n- 路徑不可以有中文\n\n\u003cimg src=\"https://user-images.githubusercontent.com/24865458/227401524-95423ca6-b000-4f2b-8c48-a92c07466edb.png\" width=\"60%\"\u003e\n\n\n### 第三步 在地牛wake up!中選擇剛剛解壓縮的discord_notify.exe的路徑\n- 路徑不可以有中文\n\n\u003cimg src=\"https://user-images.githubusercontent.com/24865458/208751019-a2ca4838-1839-4e55-9cf6-a49853e98d78.png\" width=\"60%\"\u003e\n\n\n### 第四步 設定discord_notify.ini中webhook的網址及其他細項\n- 需和exe在同一目錄\n1) 首次使用先打開discord_notify.exe，windows defender會提示不要打開，按下信任發行者後將會跳出命令提示字元的介面，此時同一個資料夾下會多一個discord_notify.ini檔案\n2) 點擊discord_notify.ini，用自己習慣的編輯器打開，會看到下方的樣子\n```ini\n[DEFAULT]\n1.網址說明 = 請複製discord webhook網址進去，無須加雙引號\nwebhookurl = https://discord.com/api/webhooks/1000000000000000000/abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789000000\n2.延遲說明 = 請輸入在程式結束後視窗保留的時間，預設為5秒鐘，無須加雙引號\nsleep_time = 5\n3.地區說明 = 請輸入在地震訊息發出後，需要被顯示的地區，預設不顯示，為NULL，無須加雙引號\narea = NULL\n```\n3) 把```https://discord.com/api/webhooks/1000000000000000000/abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789000000```變成自己的webhook網址\n4) 延遲指的是啟動discord_notify.exe後，該視窗存在的時間，若看的到print出來的訊息就可以看到會有倒數的秒數\n5) 地區是指原訊息是```警告：地區預計震度5強級地震  預計到達時間:20秒``` \n  \n    若設成```area = 台北```即變成```警告：台北地區預計震度5強級  地震預計到達時間:20秒```\n\n\n### 第五步 在地牛wake up!中點擊測試\n\u003cimg src=\"https://user-images.githubusercontent.com/24865458/227400584-86fa5f4c-5f41-40d8-b1d0-a2ac437390a6.png\" width=\"60%\"\u003e\n\n### 第六步 看看訊息有沒有跳出來\n![image](https://user-images.githubusercontent.com/24865458/227400802-92ab6e7c-0834-46e6-b8be-6e906572b1ad.png)\n\n\n\n# icon使用\n\u003cimg src=\"https://user-images.githubusercontent.com/24865458/229744187-4a5c7285-7e3e-4415-a875-188fb1af8ffc.png\" width=\"2.5%\"\u003e\u003ca href=\"https://www.flaticon.com/free-icons/earthquake\" title=\"earthquake icons\"\u003eEarthquake icons created by Freepik - Flaticon\u003c/a\u003e\n\n遵守flaticon.com\n的License summary: For commercial and personal projects\n\n# 打包\n由\u003ca href=\"https://pypi.org/project/auto-py-to-exe/\"\u003eauto-py-to-exe\u003c/a\u003e 打包 discord_notify.exe\n\n##### SHA256: 17c98a8ccd88f5ddbe83e72f3642bc2f23cfecb190fb4c76b7b0c3bbf5181ac7\n\n##### CRC64: 1E13AAFE12725A7A\n\n##### MD5: 807eb52396053cb556c40c56e690d8db\n\n# 常見QA\n1) 看不到ini檔怎麼辦\n\n\u003e 把discord_notify.exe執行一次後，如果當前目錄沒有ini檔即會再次生成ini檔，可以在裡面調整webhook網址、顯示地區、視窗關閉秒數\n\n2) 為什麼按下測試後只會跳出CMD的介面，不會顯示東西\n\n\u003e 地牛wakeup!中測試按鈕似乎會讓執行的東西都看不到print，如果有debug的需求可以透過tests資料夾的四個測試，直接點開cmd即可  \n**注意regenerate_ini_file_test.cmd會將ini刪除**\n    \n3) 為什麼不直接用windows自帶的curl寫在cmd就好\n\n\u003e 因為curl傳中文字訊息出去會變亂碼，試過改編碼```chcp 65001```依然無解\n\n4) 為什麼看不到編輯頻道的選項\n\n\u003e 因為你沒有該伺服器管理頻道的權限\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrianoy%2Feew_discord_notify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrianoy%2Feew_discord_notify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrianoy%2Feew_discord_notify/lists"}