Add prompt filtering
This commit is contained in:
parent
fbbc821d74
commit
cd3f83ffd7
@ -3,5 +3,6 @@
|
|||||||
"ALLOWED_IDS": ["1266775948548903026", "1151129960141037659", "1275008490959667234", "1234866477086019648", "1277611369578889277", "1242022836529266708", "1275098630059200586", "1277311957405405296", "1277936618749300760", "1275899048171409528"],
|
"ALLOWED_IDS": ["1266775948548903026", "1151129960141037659", "1275008490959667234", "1234866477086019648", "1277611369578889277", "1242022836529266708", "1275098630059200586", "1277311957405405296", "1277936618749300760", "1275899048171409528"],
|
||||||
"admin": "593524756393754635",
|
"admin": "593524756393754635",
|
||||||
"shapeGuild": "1277635303363973173",
|
"shapeGuild": "1277635303363973173",
|
||||||
"shapeChannel": "1277652579547086860"
|
"shapeChannel": "1277652579547086860",
|
||||||
|
"shapeUserId": "1277634934781120542"
|
||||||
}
|
}
|
10
index.js
10
index.js
@ -39,21 +39,25 @@ async function getMessageContent(message) {
|
|||||||
const buffer = Buffer.from(response.data, "binary");
|
const buffer = Buffer.from(response.data, "binary");
|
||||||
const file = new MessageAttachment(buffer, attachment.name);
|
const file = new MessageAttachment(buffer, attachment.name);
|
||||||
|
|
||||||
if (message.content) return { content: `${message.author.displayName}: ${message.content} `, files: [file] };
|
if (message.content) return { content: filterPrompt(`${message.author.displayName}: ${message.content}`), files: [file] };
|
||||||
else return {files: [file]};
|
else return {files: [file]};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Ошибка при получении файла:", error.message);
|
console.error("Ошибка при получении файла:", error.message);
|
||||||
return "Я нихуя не понял.";
|
return "Я нихуя не понял.";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!message.reference) return message.author.displayName + ": " + message.content;
|
if (!message.reference) return filterPrompt(`${message.author.displayName}: ${message.content}`);
|
||||||
else {
|
else {
|
||||||
let reply = message.channel.messages.fetch(message.reference.messageId);
|
let reply = message.channel.messages.fetch(message.reference.messageId);
|
||||||
return `${message.author.displayName}: ${message.content} \`Ответ на: ${reply.author.displayName}: + ${reply.content}\``;
|
return filterPrompt(`${message.author.displayName}: ${message.content} \`Ответ на: ${reply.author.displayName}: ${reply.content}\``);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function filterPrompt(string) {
|
||||||
|
return string.replace(client.user.id, config.shapeUserId).replace(client.guilds.cache.get(config.shapeGuild).members.cache.get(config.shapeUserId));
|
||||||
|
}
|
||||||
|
|
||||||
async function sendToAI(message) {
|
async function sendToAI(message) {
|
||||||
if (message.author.id == client.user.id) return;
|
if (message.author.id == client.user.id) return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user