telegram shell 傳訊息

TOKEN="XXXX:XXXXXXXXXXXXXX" #token
chat_ID="XXXXX" # group id=-xxxxx
MODE=’HTML’ #可換 HTML 或 Markdown
URL="https://api.telegram.org/bot${TOKEN}/sendMessage" #api

1.訊息
curl -s -X POST $URL -d chat_id=${chat_ID} -d parse_mode=${MODE} -d text="${message_text}" 2>&1

2.貼圖
curl -s -X POST https://api.telegram.org/bot$BOT_API_KEY/sendSticker -d sticker="CAADAgAD3QADMNSdEY1VJRWnGm6vFgQ" -d chat_id=$CHAT_ID

3.文件
curl -F chat_id=$chat_ID -F document=@"v2.sh" https://api.telegram.org/bot$TOKEN/sendDocument

4.照片
curl -s -X POST "https://api.telegram.org/bot${TOKEN}/sendPhoto" -F chat_id=$chat_ID -F photo="@baiyue.jpg"

參考

https://core.telegram.org/bots

本篇發表於 未分類。將永久鍊結加入書籤。

發表迴響

您的電子郵件位址並不會被公開。 必要欄位標記為 *

*

您可以使用這些 HTML 標籤與屬性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>