Update src/messages.ts

This commit is contained in:
2025-03-25 20:27:52 +00:00
parent 81acdb34be
commit 7d021a89bb

View File

@@ -1,7 +1,6 @@
import { Bot, Message } from "npm:discordeno@18.0.1";
import { dropdeineMutti, r34test, refresh } from "./r34api.ts";
import { logMessage } from "./logging.ts";
import { communicate, setMemory } from "./ollama_api.ts";
import { dropYandere, dropYandere5, getPage, setPage } from "./yandereapi.ts";
import * as dotenv from "jsr:@std/dotenv";
@@ -104,49 +103,8 @@ export async function messagehandler(bot: Bot, message: Message) {
}
break;
// TODO Add exception for when the ollama api is down
case `${prefix}brainrotgf`:
logMessage(message);
if (
(message.channelId === 754338073101205524n ||
message.guildId === undefined) ||
message.authorId != 1281272527792111698n
) {
bot.helpers.sendMessage(message.channelId, {
content: await communicate("brainrotgf", args.join(" ")),
});
}
break;
case `${prefix}brainrotgfmem`:
logMessage(message);
if (
(message.channelId === 754338073101205524n ||
message.guildId === undefined) ||
message.authorId != 1281272527792111698n
) {
if (args[0] !== undefined) {
const arg = args[0].toLowerCase();
if (arg === "true" || arg === "false") {
const memoryActive = arg === "true";
setMemory(memoryActive);
bot.helpers.sendMessage(message.channelId, {
content: "AI Memory is now set to " + memoryActive,
});
} else {
bot.helpers.sendMessage(message.channelId, {
content:
"ERROR: Invalid argument. Use true or false.",
});
}
} else {
bot.helpers.sendMessage(message.channelId, {
content: "Please provide an argument",
});
}
}
break;
}
}
function defaultString(s: string): string {
return s === "" ? "ERROR: Tried to send empty message" : s;
}
}