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

Class SendAtPlugin

sendat/sendat.ts:417–649  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

415 private readonly helpText: string = `⏰ <b>定时发送消息插件</b>
416
417<b>使用方法:</b>
418<code>.sendat 时间 | 消息内容</code> - 添加定时任务
419<code>.sendat list</code> - 查看我的任务
420<code>.sendat list all</code> - 查看所有任务(管理员)
421<code>.sendat rm 任务ID</code> - 删除任务
422<code>.sendat pause 任务ID</code> - 暂停任务
423<code>.sendat resume 任务ID</code> - 恢复任务
424
425<b>时间格式示例:</b>
426• <code>.sendat 16:00:00 date | 投票截止!</code> - 每天16:00发送
427• <code>.sendat every 23:59:59 date | 又是无所事事的一天呢。</code> - 每天23:59:59发送
428• <code>.sendat every 1 minutes | 又过去了一分钟。</code> - 每分钟发送
429• <code>.sendat 3 times 1 minutes | 此消息将出现三次。</code> - 每分钟发送,共3次
430
431<b>支持的时间单位:</b>
432seconds, minutes, hours, date, times`;
433
434 description = this.helpText;
435
436 constructor() {
437 super();
438 this.taskManager = new SendTaskManager();
439 }
440
441 cmdHandlers = {
442 sendat: async (msg: Api.Message) => {
443 await this.handleSendAtCommand(msg);
444 }
445 // Panel Settings Adapter
446 panelAdapter: PanelSettingsAdapter = {
447 id: "sendat",
448 title: "定时发送",
449 description: "定时消息发送配置",
450 category: "插件配置",
451 icon: "📅",
452 getSchema: (): PanelSettingField[] => [
453 {
454 "key": "timezone",
455 "label": "时区",
456 "type": "string",
457 "default": "Asia/Shanghai"
458 },
459 {
460 "key": "defaultChat",
461 "label": "默认发送 Chat ID",
462 "type": "string"
463 }
464],
465 getValues: async (): Promise<Record<string, unknown>> => {
466 const db = await JSONFilePreset<any>(path.join(createDirectoryInAssets("sendat"), "config.json"), {} as any);
467 return db.data as Record<string, unknown>;
468 },
469 setValues: async (patch: Record<string, unknown>): Promise<void> => {
470 const db = await JSONFilePreset<any>(path.join(createDirectoryInAssets("sendat"), "config.json"), {} as any);
471 Object.assign(db.data, patch);
472 await db.write();
473 },
474 };

Callers

nothing calls this directly

Calls 1

handleSendAtCommandMethod · 0.95

Tested by

no test coverage detected