WeeklyTime
通过 Telegram 机器人 追踪玩家在线时长并向管理员报告。管理员(通过 Telegram ID)可以在私聊、群组和超级群组中请求任意时间段(周、月、累计或自定义)的玩家列表及在线时长数据。
功能
- 在线时长追踪:基于会话,每 N 分钟自动保存,数据存储在 SQLite 数据库中
- 日历周期:每周在 周一 00:00 重置,每月在 1号 00:00 重置(可配置时区),自动清理旧记录
- Telegram 机器人(无需外部库,使用原生 HTTP API):
/time week — 本周统计数据
/time month — 本月统计数据
/time alltime — 累计统计数据
/time <days> — 自定义时间段(1–365 天)
/player <name> [days] — 单个玩家的统计数据
/reset [days] — 重置数据,需配合 /confirm / /cancel 确认
/stats — 插件统计信息
/reload — 重载配置
/help — 命令列表
- 旧别名仍然有效:
/week, /month, /alltime
- 支持在 私聊、群组和超级群组 中使用;支持聊天访问控制(全部 / 白名单 / 黑名单)
- 仅配置的 Telegram 管理员 ID 可使用该机器人
- 前三名显示排名表情符号,可配置时间格式,长列表自动拆分消息
- 本地化:默认
locale: en,内置 messages-en.yml 和 messages-ru.yml,支持自定义语言
兼容性
- 服务器软件:Paper, Spigot, Bukkit, Purpur, Pufferfish, Leaves 以及任何其它 Bukkit 分支。在 Fabric/Quilt 上通过 Banner/CardBoard 兼容
- Minecraft 版本:1.21 – 26.x(需要 Java 21+)
- Folia:完全兼容(不使用 Bukkit 调度器)
- 无必需依赖项:Telegram API 通过 JDK HTTP 客户端调用,SQLite 已内置
安装
- 下载
WeeklyTime-1.00.jar
- 将其放入服务器的
plugins 文件夹
- 重启服务器
- 编辑
plugins/WeeklyTime/config.yml:
telegram.bot-token — 来自 @BotFather 的令牌
telegram.admins — 你的 Telegram ID(可通过 @userinfobot 查找)
- 重启服务器(或运行
/weeklytime reload — 更改令牌仍需重启)
要查找群组的聊天 ID:将机器人添加到群组,发送任意消息,然后检查插件日志——或使用 @userinfobot。
游戏内命令
| 命令 |
描述 |
权限 |
/weeklytime help |
帮助 |
— |
/weeklytime reload |
重载配置文件和本地化文件 |
weeklytime.admin(默认:操作员) |
/weeklytime stats |
数据库统计信息 |
weeklytime.admin |
配置
locale: en
telegram:
bot-token: "YOUR_BOT_TOKEN_HERE"
bot-username: "WeeklyTimeBot"
admins:
- 123456789
access-control:
allowed-chats-mode: "all"
allowed-chats: []
database:
path: "plugins/WeeklyTime/player_times.db"
tracking:
save-interval-minutes: 5
min-session-seconds: 30
disabled-worlds: []
timezone: "system" # "system" 或 IANA 名称,例如 "Europe/Minsk"
keep-records-days: 90 # 自动清理旧记录
output:
max-players-per-message: 30
min-time-minutes: 1
time-format: "short"
show-rank-emojis: true
divider-char: "━"
performance:
cache-duration-seconds: 60
本地化
plugins/WeeklyTime/lang/ 文件夹中包含 messages-en.yml 和 messages-ru.yml(首次启动时提取)。要添加你自己的语言,复制一个文件并重命名为 messages-<code>.yml,编辑后在配置中设置 locale: <code>。缺失的字符串会回退到内置的英文模板,然后是俄文。
注意事项
- 会话数据在退出时以及每隔
save-interval-minutes 分钟保存
- 位于
disabled-worlds 中的玩家不会被追踪
- 在线时长按玩家 UUID 存储,因此重命名不会丢失历史记录
/reset 需要确认以防止意外数据丢失
许可证
MIT。作者:Sooqwess
WeeklyTime
Tracks player playtime and reports it to admins via a Telegram bot. Admins (by Telegram ID) can request the player list with playtime for any period — week, month, all-time or custom — in private chats, groups and supergroups.
Features
- Playtime tracking: session-based, auto-saved every N minutes, stored in SQLite
- Calendar periods: week resets Monday 00:00, month resets on the 1st 00:00 (configurable timezone), automatic cleanup of old records
- Telegram bot (no external libraries, native HTTP API):
/time week — stats for the current week
/time month — stats for the current month
/time alltime — all-time stats
/time <days> — custom period (1–365)
/player <name> [days] — single player stats
/reset [days] — reset data with /confirm / /cancel confirmation
/stats — plugin statistics
/reload — reload configuration
/help — command list
- Old aliases still work:
/week, /month, /alltime
- Works in private chats, groups and supergroups; chat access control (all / whitelist / blacklist)
- Only configured admin Telegram IDs can use the bot
- Rank emojis for top-3, configurable time formats, message splitting for large lists
- Localization:
locale: en by default, messages-en.yml and messages-ru.yml bundled, custom languages supported
Compatibility
- Server software: Paper, Spigot, Bukkit, Purpur, Pufferfish, Leaves and any other Bukkit fork. On Fabric/Quilt it works through Banner/CardBoard
- Minecraft versions: 1.21 – 26.x (Java 21+)
- Folia: fully compatible (no Bukkit scheduler usage)
- No required dependencies: Telegram API is called via the JDK HTTP client, SQLite is bundled
Installation
- Download
WeeklyTime-1.00.jar
- Place it in the server's
plugins folder
- Restart the server
- Edit
plugins/WeeklyTime/config.yml:
telegram.bot-token — token from @BotFather
telegram.admins — your Telegram IDs (find yours via @userinfobot)
- Restart the server (or run
/weeklytime reload — token changes still need a restart)
To find the chat ID of a group: add the bot to the group, send any message, then check the plugin logs — or use @userinfobot.
In-game commands
| Command |
Description |
Permission |
/weeklytime help |
Help |
— |
/weeklytime reload |
Reload config and locale files |
weeklytime.admin (default: operators) |
/weeklytime stats |
Database statistics |
weeklytime.admin |
Configuration
locale: en
telegram:
bot-token: "YOUR_BOT_TOKEN_HERE"
bot-username: "WeeklyTimeBot"
admins:
- 123456789
access-control:
allowed-chats-mode: "all"
allowed-chats: []
database:
path: "plugins/WeeklyTime/player_times.db"
tracking:
save-interval-minutes: 5
min-session-seconds: 30
disabled-worlds: []
timezone: "system" # "system" or IANA name, e.g. "Europe/Minsk"
keep-records-days: 90 # auto-cleanup of old records
output:
max-players-per-message: 30
min-time-minutes: 1
time-format: "short"
show-rank-emojis: true
divider-char: "━"
performance:
cache-duration-seconds: 60
Localization
The plugins/WeeklyTime/lang/ folder contains messages-en.yml and messages-ru.yml (both are extracted on first start). To add your own language, copy a file as messages-<code>.yml, edit it and set locale: <code> in the config. Missing strings fall back to the bundled English template, then to Russian.
Notes
- Session data is saved on quit and every
save-interval-minutes minutes
- Players in
disabled-worlds are not tracked
- Playtime is stored per player UUID, so renames keep the history
/reset requires confirmation to avoid accidental data loss
License
MIT. Author: Sooqwess
评论 0
登录后参与评分
还没有评论,来抢沙发吧