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

Method sendOrEdit

ai/ai.ts:1161–1183  ·  view source on GitHub ↗
(
    msg: Api.Message,
    text: string,
    options?: MessageOptions,
  )

Source from the content-addressed store, hash-verified

1159class MessageSender {
1160 static async sendOrEdit(
1161 msg: Api.Message,
1162 text: string,
1163 options?: MessageOptions,
1164 ): Promise<Api.Message> {
1165 try {
1166 const edited = await msg.edit({ text, ...options });
1167 if (edited) return edited;
1168 } catch (error: any) {
1169 if (isMessageNotModifiedError(error)) {
1170 return msg;
1171 }
1172 if (shouldFallbackToReplyOnEditError(error)) {
1173 const replied = await msg.reply({ message: text, ...options });
1174 if (replied) return replied;
1175 }
1176 throw error;
1177 }
1178
1179 const replied = await msg.reply({ message: text, ...options });
1180 if (replied) return replied;
1181 throw new Error("消息发送失败");
1182 }
1183
1184 static async sendNew(
1185 msg: Api.Message,
1186 text: string,

Callers 4

sendProcessingFunction · 0.45
sendErrorMessageFunction · 0.45
editMessageFunction · 0.45
AIPluginClass · 0.45

Calls 3

editMethod · 0.45

Tested by

no test coverage detected