Skip to content

Commit

Permalink
Merge pull request #45 from spongedsc/v
Browse files Browse the repository at this point in the history
  • Loading branch information
artifishvr authored May 12, 2024
2 parents 152be0e + 568bc8e commit 2ae2aa5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ client.on("messageCreate", async message => {
let formattedUserMessage = `${message.author.username} (${await getPronouns(message.author.id)}) on ${DateTime.now().setZone('utc').toLocaleString(DateTime.DATETIME_FULL)}: ${message.content}\n${imageDetails}`;
if (message.reference) {
await message.fetchReference().then(async (reply) => {
if (reply.author.id == "954288870244114473") {
if (reply.author.id == client.user.id) {
formattedUserMessage = `> ${reply}\n${formattedUserMessage}`;
} else {
formattedUserMessage = `> ${reply.author.username}: ${reply}\n${formattedUserMessage}`;
Expand All @@ -142,7 +142,17 @@ client.on("messageCreate", async message => {
}

// Send AI response
message.reply({ content: `${response}`, failIfNotExists: false });
let no_longer_exists = false;
try {
await message.channel.messages.fetch(message.id);
} catch (e) {
console.warn(e);
no_longer_exists = true;
message.reply({ content: `\`\`\`\n${message.author.username}: ${message.content}\n\`\`\`\n\n${response}`, failIfNotExists: false });
}
if (!no_longer_exists) {
message.reply({ content: `${response}`, failIfNotExists: false });
}

// tts!
if (message.member.voice.channel) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "spongegpt",
"version": "1.29.1",
"version": "1.29.4",
"description": "custom AI chatbot for discord",
"main": "index.js",
"type": "module",
Expand Down

0 comments on commit 2ae2aa5

Please sign in to comment.