MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / handleSubscribe

Method handleSubscribe

lu_bs/lu_bs.ts:260–294  ·  view source on GitHub ↗
(msg: Api.Message)

Source from the content-addressed store, hash-verified

258 if (!chatId) {
259 await msg.edit({ text: "❌ 无法获取聊天ID", parseMode: "html" });
260 return;
261 }
262
263 // 检查权限
264 const hasPermission = await this.checkPermission(msg);
265 if (!hasPermission) {
266 await msg.edit({
267 text: "❌ 权限不足,无法操作整点报时",
268 parseMode: "html"
269 });
270 return;
271 }
272
273 // 检查是否已订阅
274 if (this.db.data.subscriptions.includes(chatId)) {
275 await msg.edit({
276 text: "❌ 你已经订阅了整点报时",
277 parseMode: "html"
278 });
279 return;
280 }
281
282 // 添加订阅
283 this.db.data.subscriptions.push(chatId);
284 await this.db.write();
285
286 await msg.edit({
287 text: "✅ 你已经成功订阅了整点报时",
288 parseMode: "html"
289 });
290 }
291
292 // 处理退订
293 private async handleUnsubscribe(msg: Api.Message) {
294 const chatId = msg.chatId?.toString();
295 if (!chatId) {
296 await msg.edit({ text: "❌ 无法获取聊天ID", parseMode: "html" });
297 return;

Callers 1

LuBsPluginClass · 0.95

Calls 3

checkPermissionMethod · 0.95
writeMethod · 0.80
editMethod · 0.45

Tested by

no test coverage detected