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

Method setAutoDelSetting

autodel/autodel.ts:204–230  ·  view source on GitHub ↗
(msg: Api.Message, seconds: number, isGlobal: boolean)

Source from the content-addressed store, hash-verified

202 }
203
204 private async setAutoDelSetting(msg: Api.Message, seconds: number, isGlobal: boolean): Promise<void> {
205 const chatId = isGlobal ? "0" : msg.peerId.toString();
206
207 // 安全限制:最小删除时间为5秒,防止滥用
208 if (seconds < 5) {
209 await msg.edit({
210 text: "❌ 为了安全考虑,自动删除时间不能少于5秒"
211 });
212 return;
213 }
214
215 this.settings.set(chatId, seconds);
216
217 if (this.db) {
218 try {
219 this.db.prepare(
220 "INSERT OR REPLACE INTO autodel_settings (chat_id, seconds) VALUES (?, ?)"
221 ).run(chatId, seconds);
222 } catch (error) {
223 console.error("Failed to save setting:", error);
224 }
225 }
226
227 await msg.edit({
228 text: `✅ 设置自动删除任务成功。\n⚠️ 注意:只会删除您自己发送的消息`
229 });
230 }
231
232 // 监听所有消息,为符合条件的消息添加删除任务
233 listenMessageHandler = async (msg: Api.Message): Promise<void> => {

Callers 1

handleAutoDelMethod · 0.95

Calls 4

runMethod · 0.80
errorMethod · 0.80
editMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected