Update Bot to latest Discordeno Version 21.0.0 and add nsfw check for rule34 and yandere api calls
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { Bot, Message, transformEmbed } from "npm:discordeno@18.0.1";
|
||||
import { defaultString } from "@root/defaultString.ts";
|
||||
import { Bot, DiscordEmbed, Message} from "@discordeno";
|
||||
import { logMessage } from "@root/logging.ts";
|
||||
import { getPosts } from "@root/plugins/yandere/api/api.ts";
|
||||
|
||||
@@ -7,10 +6,10 @@ export async function yandereMessageHandler(bot: Bot, message: Message) {
|
||||
const command = message.content.split(" ").slice(1).join(" ");
|
||||
const args = command.match(/(\[.+\])/g)
|
||||
if (command === "drop") {
|
||||
const embed = (await getPosts("[limit: 1]"))[0]
|
||||
const embed: DiscordEmbed | undefined = (await getPosts("[limit: 1]"))[0]
|
||||
if (embed === undefined) throw Error("undefined embed")
|
||||
bot.helpers.sendMessage(message.channelId, {
|
||||
embeds: [transformEmbed(bot, embed)]
|
||||
embeds: [embed]
|
||||
})
|
||||
} else if (command.startsWith("drop [") && command.endsWith("]")) {
|
||||
logMessage(message);
|
||||
@@ -18,7 +17,7 @@ export async function yandereMessageHandler(bot: Bot, message: Message) {
|
||||
const generatedEmbeds = await getPosts(args[0]);
|
||||
for (const embed of generatedEmbeds) {
|
||||
bot.helpers.sendMessage(message.channelId, {
|
||||
embeds: [transformEmbed(bot, embed)],
|
||||
embeds: [embed],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user