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

Method handleUnsubscribe

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

Source from the content-addressed store, hash-verified

295 if (!chatId) {
296 await msg.edit({ text: "❌ 无法获取聊天ID", parseMode: "html" });
297 return;
298 }
299
300 // 检查权限
301 const hasPermission = await this.checkPermission(msg);
302 if (!hasPermission) {
303 await msg.edit({
304 text: "❌ 权限不足,无法操作整点报时",
305 parseMode: "html"
306 });
307 return;
308 }
309
310 // 检查是否已订阅
311 if (!this.db.data.subscriptions.includes(chatId)) {
312 await msg.edit({
313 text: "❌ 你还没有订阅整点报时",
314 parseMode: "html"
315 });
316 return;
317 }
318
319 // 移除订阅
320 this.db.data.subscriptions = this.db.data.subscriptions.filter((id: string) => id !== chatId);
321 delete this.db.data.lastMessages[chatId];
322 await this.db.write();
323
324 await msg.edit({
325 text: "✅ 你已经成功退订了整点报时",
326 parseMode: "html"
327 });
328 }
329
330 // 处理列表查看
331 private async handleList(msg: Api.Message) {
332 const chatId = msg.chatId?.toString();
333 if (!chatId) {
334 await msg.edit({ text: "❌ 无法获取聊天ID", parseMode: "html" });
335 return;

Callers 1

LuBsPluginClass · 0.95

Calls 3

checkPermissionMethod · 0.95
writeMethod · 0.80
editMethod · 0.45

Tested by

no test coverage detected