[WordPress] 外掛分享: Telegram Bot Master

首頁外掛目錄 › Telegram Bot Master
WordPress 外掛 Telegram Bot Master 的封面圖片
⚠ 此外掛已下架 — 不再更新維護,建議勿安裝。
全新外掛
安裝啟用
尚無評分
1276 天前
最後更新
問題解決
WordPress 4.9+ PHP 7.2+ v1.0.0 上架:2022-04-12

內容簡介

GitHub專案:https://github.com/bots-master/wp-bots-master

功能列表
– Telegram機器人整合
– 發送訊息給所有Telegram機器人訂閱者
– 發送訊息至Telegram群組聊天中
– 發送訊息至Telegram頻道中

系統需求

需要PHP版本7.2或以上

移除外掛程式

想要完全刪除外掛程式,請按以下步驟執行:
1. 刪除DB資料表wx_bot_users:

SQL查詢:DROP TABLE IF EXISTS wx_bot_users;

移除WP選項:

delete_option(‘telegram_api_token’);
delete_option(‘welcome_message’);
delete_option(‘unknown_message’);

完成!現在資料庫中已不含此外掛程式的資料

如何使用
收集訂閱者

!!! 重要 !!!
如果使用者在機器人程式安裝之前已訂閱了機器人,這個功能將無法使用。
此外掛程式無法從Telegram那邊取得您機器人的舊訂閱者。

因此,以下步驟完成後您才可以傳送訊息給訂閱者
1. 在WP管理員中設定Telegram機器人API Token
2. 使用者訂閱機器人(傳送任何訊息或按任何按鈕)

現在您可以傳送訊息給訂閱者了。

群組聊天 / 頻道

新增群組聊天 / 頻道到聊天機器人

前往Telegram並建立一個公開的群組聊天或頻道(聊天室)
將您的機器人加入該聊天室。它必須能夠張貼訊息。
複製聊天室的username
前往 Bot Master > Channels 並在此處新增username

現在,當您在 Bot Master > Send Message中傳送訊息時,您的機器人會將該訊息發佈到聊天室中

程式碼用法
使用 WebXID\BotsMaster\ChatBot;
使用 WebXID\BotsMaster\ChatBot\BotUser;

BotUser::find(['type_id' => ChatBot\BotUser::TYPE_CHAT]); // 返回所有群組聊天和頻道列表
BotUser::find(['type_id' => ChatBot\BotUser::TYPE_USER]); // 返回所有訂閱者

BotUser::all(); // 返回所有記錄

// -------------------------

$bot_user = BotUser::findOne(['type_id' => ChatBot\BotUser::TYPE_USER]);

if ($bot_user) {
ChatBot::factory($bot_user)
->sendMessage('<b>Hello</b> world!'); // 如果外掛程式正確安裝,將傳送訊息
}

請查看文件https://core.telegram.org/bots/api#html-style以獲取允許的HTML標記

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.0.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Telegram Bot Master」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

GitHub project: https://github.com/bots-master/wp-bots-master
The features list
– Telegram Bot integration
– Send a message to all Telegram Bot’s Subscribers
– Send a message to Telegram Group Chat
– Post a message in Telegram Channel
Requirements
PHP version 7.2 or later
Uninstall The Plugin
To uninstall the plugin permanently, follow the next steps:
1. Drop the DB table wx_bot_users:
SQL Query: DROP TABLE IF EXISTS wx_bot_users;

Remove WP Options:
delete_option(‘telegram_api_token’);
delete_option(‘welcome_message’);
delete_option(‘unknown_message’);

Done! Now, there is no data of the plugin in DB
How To Use
Collect Subscribers
!!! IMPORTANT !!!
If a user was subscribed to a bot before the bot installing, it will not works.
The plugin does not able to grab your bot’s old subscribers from the Telegram side.
So, you are able to message users after the next steps
1. Set a Telegram Bot API Token in WP Admin
2. A user subscribe to the bot (send any message or click any button)
Now, you are able to message the subscriber.
Group Chat / Channel
Add Group Chat / Channel to The Chatbot

Go to the Telegram and create public a Group Chat or a Channel (Chat)
Add your Bot to the Chat. It has to be able to post a message.
Copy the Chat username
Go to Bot Master > Channels and add the username here

Now, your bot will posts a message to the Chat, you send at Bot Master > Send Message
Code Usage
use WebXID\BotsMaster\ChatBot;
use WebXID\BotsMaster\ChatBot\BotUser;

BotUser::find(['type_id' => ChatBot\BotUser::TYPE_CHAT]); // returns all Group Chats and Channels list
BotUser::find(['type_id' => ChatBot\BotUser::TYPE_USER]); // returns all subscribers

BotUser::all(); // returns all records

// -------------------------

$bot_user = BotUser::findOne(['type_id' => ChatBot\BotUser::TYPE_USER]);

if ($bot_user) {
ChatBot::factory($bot_user)
->sendMessage('Hello world!'); // will send the message, if the plugin installed correctly
}

Please, check the Doc https://core.telegram.org/bots/api#html-style to get allowed HTML tags

延伸相關外掛

文章
Filter
Apply Filters
Mastodon