The functionality of this bot is to relay messages between multiple groups, including but not limited to Discord, Telegram, and other messaging software. Inspired by the Chinese Wikipedia Interconnection Group and zhmrtbot.
This project is a modification of LilyWhiteBot, originally named "qq-tg-irc."
The development of this project is based on a fork and, according to the definition of the upstream project, it supports message synchronization between various communication software, including Discord, Telegram, WeChat (WeChat), IRC, QQ, and more. However, this project is developed and maintained exclusively for message synchronization between Discord and Telegram.
- Prepare a bot account as needed. (Specific methods are provided later.)
- Install Node.js, version requirement: >=7.x.
- Download the bot's core.
- Execute:
npm install
node main.js
- If you're concerned about crashes, you can run it in a loop, for example:
while true; do node main.js; done
, or:
:a
node main.js
goto a
- Modify
config.example.js
according to your actual needs and rename it toconfig.js
. - Format for QQ groups:
qq/QQ group number
; Format for Telegram groups:telegram/a string of numbers
(this number can be obtained using/thisgroupid
, as explained later, and please note that this number is negative); Format for IRC channels:irc/#channel name
, don't forget the#
; Format for Discord channels:discord/channel ID
.
To set up a Telegram bot, follow these steps:
-
Find the user @BotFather on Telegram and interact with it. Follow the on-screen prompts to create a bot account.
-
After setting up the bot, BotFather will provide you with a Token. You need to fill this Token into the
config.js
file. -
Remember to execute the
/setprivacy
command to set the bot's Privacy to DISABLED. This allows the bot to see messages within groups. -
Initially, you can keep the "groupid-tg" within the
config.js
under the "plugins" section. Then, run the program and enter/thisgroupid
in the group. This action will allow the bot to automatically provide the group ID for interconnection. If you don't understand the previous sentence, you can also add @combot to the group and enter/stat
to see the number provided by the bot. Note that the number is negative.
To set up a Discord bot, follow these steps:
-
Go to the Discord Developer Portal and create an Application.
-
In the Bot section, click "Add Bot." Fill the Token into the
config.js
file. You can refer to the first half of this tutorial for guidance. -
You can find the Channel ID in the URL of the web version; it's the string of numbers at the end.
-
You can also obtain the Channel ID on the desktop version by right-clicking the channel and selecting "Copy Channel ID." On mobile, you can get it by long-pressing the channel and selecting the corresponding option.
Desktop Mobile
You can configure Discord to forward messages via WebHook, where messages forwarded from Telegram will directly display the avatar and name. The setup process is as follows:
-
First, prepare a WebHook for the channel you want to connect. Click on the [
channel
], select [Edit Channel
], and choose [Integrations
] tab. On that page, find WebHooks. If you don't have a WebHook, you will see a [Create Webhook
] button. Click it. If you already have a WebHook or it has been automatically created by the system, it will display [View Webhooks ❯
]. Click it, and you will see a list of WebHooks. Click on the first WebHook (this program only uses the first WebHook of the channel) to enter the WebHook editing page. In the WebHook editing page, you can give your WebHook, serving as the bot, a name. Save the settings. If you entered through [Server Settings
], then in the tabs, find the [APPS
] group and choose the [Integrations
] tab. Follow the same steps as mentioned above. In the end, you'll be given the option to choose the channel. -
In
config.js
, within the"Discord":
settings under"bot":
, set"Webhook":
totrue
. -
Please note that every channel with interconnected/synchronized messages requires the addition of a new WebHook if you want each channel to display avatars from other groups.
Please refer to the old ReadMe for instructions on setting up bots for other platforms, including:
- Setting up a QQ bot
- Setting up an IRC bot
- Setting up a WeChat bot: Add
"WeChat": { ... }
to theconfig.js
and follow the QQ setup.
-
If you set
paeeye
inconfig.js
to//
, you can prevent messages from being seen by other groups by adding//
before your message (e.g., "//hidden"). -
If you allow IRC to accept commands (with "irccommand" in the "plugins" section), you can use
/command command
in Telegram and QQ. This command is not for IRC but for interaction with the bot in IRC channels. -
If you enable IRC queries (with "ircquery" in the "plugins" section), you can use commands like
/names
(get a list of online users),/whois nickname
(whois), and/topic
(get the topic).
To configure the following features, make changes in config.js
:
- filter: Filters messages that match specified rules.
- qqxiaoice: Summons QQ group's XiaoBing. (Requires QQ group owner to enable XiaoBing/BabyQ functionality)
- wikilinky