1. First Bot 的 token
1071865921:AAF-yxkGqL3ICDkUsXGhrMXA3r9KjW8be282. channel ID
-1001218272236
3. telegram bot 資訊(First Bot)
{"ok":true,"result":{"id":1071865921,"is_bot":true,"first_name":"First Bot","username":"austin72905_bot","can_join_groups":true,"can_read_all_group_messages":false,"supports_inline_queries":false}}
4. 設一個webhook才能接收訊息(用getUpdate得到的資訊)
{"ok":true,"result":[{"update_id":76191705, "message":{"message_id":83,"from":{"id":1143269186,"is_bot":false,"first_name":"Austin","last_name":"Lin","username":"austin72905TW","language_code":"zh-hans"},"chat":{"id":1143269186,"first_name":"Austin","last_name":"Lin","username":"austin72905TW","type":"private"},"date":1584461581,"text":"\u5b89\u5b89"}}]}5. bot 傳送訊息
https://api.telegram.org/bot1071865921:AAF-yxkGqL3ICDkUsXGhrMXA3r9KjW8be28/sendMessage?chat_id=1143269186&text=%E4%BD%A0%E5%A5%BD6. bot 傳送訊息的JSON
{"ok":true,"result":{"message_id":92,"from":{"id":1071865921,"is_bot":true,"first_name":"First Bot","username":"austin72905_bot"},"chat":{"id":1143269186,"first_name":"Austin","last_name":"Lin","username":"austin72905TW","type":"private"},"date":1584505179,"text":"\u4f60\u597d"}}7. 設定webhook 響應方式
(1)通用URL(2)First bot 設定https://api.telegram.org/bot1071865921:AAF-yxkGqL3ICDkUsXGhrMXA3r9KjW8be28/setwebhook?url=[myboturl](3)在家用的 https://api.telegram.org/bot1071865921:AAF-yxkGqL3ICDkUsXGhrMXA3r9KjW8be28/setwebhook?url=https://8a287be6.ngrok.io
------------- norok 部分 ------------------
ngrok 網址
https://blog.alantsai.net/posts/2018/04/devtooltips-5-ngrok-allow-public-to-access-localhost-website-and-sql-server8. ngrok token:
1ZHbSkF627Mpm53irDWZRBiyXRf_7fMVtb2turMtV1mafZaaB
9. ngrok 隨機產生的網址
ngrok http -host-header=rewrite https://localhost:23283/家裡的:
ngrok http -host-header=rewrite https://localhost:44351/
---------telegram bot 相關網址--------------------
c# telegram bot library
webhook 概念
http://studyhost.blogspot.com/2016/06/telegram-bot.html
C# 透過 Telegram Bot 發送訊息
一步步打造 Telegram Bot
telegram bot 文擋
Python Telegram Bot 教學 (by 陳達仁)
淺談開發機器人php
-------interface(介面)的用處--------------
為何設計service 曾要先寫介面?
將實現與使用分離開來,只要專注在實現就好
Controller一定要儘量少的邏輯,其實反過來說,是指Service的邏輯應該高內聚,這樣Controller如Service的耦合自然就是最低,Controller真真正正的坐到,不用理會Service的實現,只需要呼叫即可。
iservice service 分開
controller 跟 service 分開
第三方機器人的service不寫在第三方專案就要寫在第四方?
(第三方機器人不能直接呼叫第三方專案)
過多的商業邏輯處理反而會讓 Controller 的流程控制與商業邏輯混在一起
沒有留言:
張貼留言