25 lines
639 B
TypeScript
25 lines
639 B
TypeScript
import type { Message } from "discord.js";
|
|
import type { Command } from "../service";
|
|
import Chan from "../../util/chan";
|
|
|
|
export default {
|
|
name: "chan",
|
|
description: "Get random media from a 4chan board.",
|
|
usage: ".chan <board> [search]",
|
|
execute: async (message: Message) => {
|
|
const [, board, search] = message.content.split(/\s+/);
|
|
|
|
if (!board) {
|
|
await message.reply("Usage: .chan <board> [search]")
|
|
return;
|
|
};
|
|
|
|
if (Chan.isNsfwBoard(board)) {
|
|
await message.reply("Fuck off nigger")
|
|
return;
|
|
};
|
|
|
|
await message.reply(await Chan.getMediaLink(board, search));
|
|
}
|
|
} satisfies Command;
|