实现泰拉瑞亚 TModLoader 服务器与 QQ 群双向互通的 NoneBot2 插件
Project description
中文 README | English README | 中文通信文档 | English Protocol
nonebot-plugin-terralink
✨ A NoneBot2 plugin for two-way communication between Terraria TModLoader servers and QQ Groups ✨
📖 Introduction
TerraLink is a NoneBot2 plugin designed to bridge Terraria TModLoader servers with QQ groups. Using the WebSocket protocol, it connects to the TML mod client to synchronize in-game chat and events to QQ groups in real-time. It also supports sending management commands from QQ to the game server, querying item recipes, viewing player inventories, and more.
Core Features
- 🔗 Two-way Communication: Real-time sync of game chat ↔ QQ group messages.
- 🎨 Rich Text Rendering: Beautiful image responses based on HTML/CSS (Item details, Inventory, Recipe trees, etc.).
- 🎮 Complete Command System: Supports 16+ server management and query commands.
- 🔐 Secure Authentication: Token-based authentication system.
- 📱 Multi-Server Support: One Bot can manage multiple TML servers simultaneously.
- 🚀 High Performance: Built on asyncio and websockets.
💿 Installation
Install using nb-cli
Open the command line in your nonebot2 project root and run:
nb plugin install nonebot-plugin-terralink
Install using package manager
In your nonebot2 plugin directory, run the appropriate command:
pip
pip install nonebot-plugin-terralink
⚙️ Configuration
Configure the following options in your NoneBot .env or .env.prod file:
# Plugin Master Switch
terralink_enabled=true
# WebSocket Listening Port (TModLoader connects to this port)
terralink_port=7778
# Command Prefix (Used to identify commands in QQ groups)
terralink_cmd_prefix=/
# Resource path (Required, used to load local textures)
# How to obtain resources: Can only be obtained by installing the TerraNoneBridge mod in the game client. First, configure the mod configuration item "Custom export path".
# An example of "Custom export path" is: "D:\desktop\temp\tmodass". You need to create an empty folder for resource export, such as tmodass, so that resources will not be scattered into the upper directory.
# Use the "/tnb exportassets" command in single-player or local host mode to export resources, and manually place the resources in a location accessible to the server.
# Example: "/www/program/nonebot2/lolbot/data/terralink/tmodass" or "data/terralink/tmodass"
terralink_resource_path=""
# Multi-Server Mapping List (JSON Format)
terralink_links=[
{"token": "your_secret_token_1", "group_id": 123456789, "name": "Survival Server"},
{"token": "your_secret_token_2", "group_id": 987654321, "name": "Calamity Server"}
]
💻 Commands
1. Admin Commands (SuperUser Only)
💀 boss
Check the boss defeat progress of the current world.
- Command:
/boss - Aliases:
bosses,进度
💊 buff
Give a buff to a specific player or all players.
- Command:
/buff <player/all> <BuffName> [seconds]
🗡️ butcher
Kill all hostile mobs in the server.
- Command:
/butcher
📤 exportassets
Export in-game resources (textures, etc.). This is a time-consuming operation. The Bot intercepts this command to prevent accidental triggers.
- Command:
/exportor/exportassets
🎁 give
Give items to a specific player.
- Command:
/give <player> <ItemName> [amount]
🦵 kick
Kick a player from the server.
- Command:
/kick <player> [reason]
💾 save
Force save the world.
- Command:
/save
💧 settle
Force settle all liquids in the world.
- Command:
/settle
⏰ time
Query or set the world time.
- Command:
/time [dawn/noon/dusk/midnight] - Note: Query time if no argument is provided; set time otherwise.
2. Query Commands (Available to All Users)
📖 help
Show the command help menu.
- Command:
/help - Aliases:
帮助,菜单
🎒 inv
View a player's inventory, armor, and accessories.
- Command:
/inv <player> - Aliases:
inventory,查背包
👥 list
Show the list of currently online players.
- Command:
/list - Aliases:
在线,who,ls
🔍 query
Query item details (stats, drops, NPC sales, simple recipes).
- Command:
/query <ItemName/ID> - Aliases:
查询,属性
🔨 recipe
Generate a complete crafting tree image for an item, including all raw materials.
- Command:
/recipe <ItemName/ID> - Aliases:
合成,配方
🔎 search
Fuzzy search for item names.
- Command:
/search <keyword> - Aliases:
搜索,查找
📊 tps
View server performance status (TPS, memory, entity count, etc.).
- Command:
/tps - Aliases:
status,性能
💰 Sponsor
If you find this plugin helpful, consider buying the author a coffee ☕
📄 License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nonebot_plugin_terralink-0.4.4.tar.gz.
File metadata
- Download URL: nonebot_plugin_terralink-0.4.4.tar.gz
- Upload date:
- Size: 22.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
528249f99336860587dc857cd52a9697dab3cb5d2eb051bf704c2936e758e55d
|
|
| MD5 |
5f28a508ef1a903b2abcaac3a631dfa4
|
|
| BLAKE2b-256 |
cd0ba9fb56a4a9f8b334967e488ea30530b950ef4bbf1014e7acb8d22c8a6617
|
File details
Details for the file nonebot_plugin_terralink-0.4.4-py3-none-any.whl.
File metadata
- Download URL: nonebot_plugin_terralink-0.4.4-py3-none-any.whl
- Upload date:
- Size: 24.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2deff71a5b0a01519c2efc7d37bf00ae9f24b8d0e3aa90b978615f39141d00ec
|
|
| MD5 |
3b3ce95dba64b6a94aaa5f3765b505b2
|
|
| BLAKE2b-256 |
f804ad55e2347ca21fb3c0701bbeced18a329ccc8750e2346ac214e4b36c8403
|