--- disqus: ahb0222 GA : G-VF9ZT413CG --- > [color=#40f1ef][name=LHB阿好伯, 2024/11/12][:earth_africa:](https://www.facebook.com/LHB0222/) [TOC] ![image](https://hackmd.io/_uploads/ryxYDaoVye.png) ![image](https://hackmd.io/_uploads/HkgdDao4ye.png) # Discord ## 創建伺服器 ![image](https://hackmd.io/_uploads/r1ldJTxGJx.png) ## 創建應用 https://discord.com/developers/applications?new_application=true ![image](https://hackmd.io/_uploads/rkNfChlz1g.png) ## 取得安裝連結 設定權限 ![image](https://hackmd.io/_uploads/Hyi76pxfJx.png) 取得安裝連結 ![image](https://hackmd.io/_uploads/HJxpyaefJx.png) 將安裝連結用瀏覽器打開後新增至剛剛創建的伺服器中 ![image](https://hackmd.io/_uploads/r1PzxTlfJx.png) ![image](https://hackmd.io/_uploads/HkSx6TxMkl.png) ### 開啟伺服器設定取得伺服器ID ![image](https://hackmd.io/_uploads/SkDF6enQJg.png) ## 使用nose-red測試 安裝node-red-contrib-discord-advanced節點 ![image](https://hackmd.io/_uploads/HJ65TpxGkg.png) 新增discordMessageManager節點 ![image](https://hackmd.io/_uploads/ryVgAalfyg.png) 設定伺服器ID ![image](https://hackmd.io/_uploads/Sk_fGTgzkl.png) 取得令牌並添加到node-red中 ![image](https://hackmd.io/_uploads/HJXBCTxGyg.png) ![image](https://hackmd.io/_uploads/B124G6eGyl.png) 測試 ![image](https://hackmd.io/_uploads/S17d06eGyg.png) ```json= [{"id":"00729d2c9e228802","type":"inject","z":"4d5bcbd127f2b8cf","name":"測試","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"測試","payloadType":"str","x":730,"y":680,"wires":[["1fe141722b0ada85"]]},{"id":"294d0de4de3a8322","type":"debug","z":"4d5bcbd127f2b8cf","name":"debug 90","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1100,"y":660,"wires":[]},{"id":"1fe141722b0ada85","type":"discordMessageManager","z":"4d5bcbd127f2b8cf","name":"阿好伯","channel":"","token":"","x":930,"y":660,"wires":[["294d0de4de3a8322"]]}] ``` ![image](https://hackmd.io/_uploads/HJ1FRaxfke.png) # Telegram # 創建機器人 >[!Tip]搜尋 >`@BotFather` ![image](https://hackmd.io/_uploads/SJGuNhsNkx.png) >[!Note] 輸入 >/newbot ![image](https://hackmd.io/_uploads/rkxrykpkkg.png) # node-red-contrib-telegrambot 安裝` https://flows.nodered.org/node/node-red-contrib-telegrambot` 輸入剛剛得到的Bot名稱跟金鑰 ![image](https://hackmd.io/_uploads/ByXalpsEkx.png) ![image](https://hackmd.io/_uploads/Skl2epoVJg.png) ## 創建群組 ![image](https://hackmd.io/_uploads/SJtBe0lGyg.png) 加入Bot ![image](https://hackmd.io/_uploads/Bywn-pi41e.png) 取得群組ID ![image](https://hackmd.io/_uploads/SJuef6oEJx.png) ## 發送訊息 ![image](https://hackmd.io/_uploads/SJYYGaiVkl.png) 將ChatID寫到函數中 ```javascript= msg.payload = { chatId: <ChatID>, messageId: 11, type: "message", content: msg.payload, date: Date.now() }; return msg; ``` 訊息測試 ![image](https://hackmd.io/_uploads/Sy73GTs41g.png) # 參考資料 https://medium.com/zrealm-robotic-process-automation/10-%E5%88%86%E9%90%98%E5%BF%AB%E9%80%9F%E7%A7%BB%E8%BD%89-line-notify-%E5%88%B0-telegram-bot-%E9%80%9A%E7%9F%A5-6922e90ba90c 🌟 🌟全文可以至下方連結觀看或是補充 全文分享至 https://www.facebook.com/LHB0222/ https://www.instagram.com/ahb0222/ 有疑問想討論的都歡迎於下方留言 喜歡的幫我分享給所有的朋友 \o/ 有所錯誤歡迎指教 # [:page_with_curl: 全部文章列表](https://hackmd.io/@LHB-0222/AllWritings) ![](https://i.imgur.com/nHEcVmm.jpg)