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

Function extractQuestionFromArgs

outdated/gemini/gemini.ts:1030–1056  ·  view source on GitHub ↗
(args: string[], replyMsg?: Api.Message | null)

Source from the content-addressed store, hash-verified

1028}
1029
1030function extractQuestionFromArgs(args: string[], replyMsg?: Api.Message | null): { userQuestion: string; displayQuestion: string; apiQuestion: string } {
1031 const userQuestion = args.join(" ");
1032
1033 if (!userQuestion && replyMsg?.text) {
1034 const replyText = Utils.removeEmoji(replyMsg.text.trim());
1035 return {
1036 userQuestion: "",
1037 displayQuestion: replyText,
1038 apiQuestion: replyText
1039 };
1040 } else if (userQuestion && replyMsg?.text) {
1041 const cleanUserQuestion = Utils.removeEmoji(userQuestion);
1042 const replyText = Utils.removeEmoji(replyMsg.text.trim());
1043 return {
1044 userQuestion: cleanUserQuestion,
1045 displayQuestion: cleanUserQuestion,
1046 apiQuestion: `原消息内容: ${replyText}\n\n问题: ${cleanUserQuestion}`
1047 };
1048 } else {
1049 const cleanUserQuestion = Utils.removeEmoji(userQuestion);
1050 return {
1051 userQuestion: cleanUserQuestion,
1052 displayQuestion: cleanUserQuestion,
1053 apiQuestion: cleanUserQuestion
1054 };
1055 }
1056}
1057
1058async function handleSearch(msg: Api.Message, args: string[]): Promise<void> {
1059 const replyMsg = await msg.getReplyMessage();

Callers 5

handleSearchFunction · 0.85
handleImageFunction · 0.85
handleTTSFunction · 0.85
handleAudioFunction · 0.85
handleSearchAudioFunction · 0.85

Calls 1

removeEmojiMethod · 0.80

Tested by

no test coverage detected