joel joel joel
This commit is contained in:
12
commands/command.d.ts
vendored
Normal file
12
commands/command.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import type {
|
||||
CacheType,
|
||||
ChatInputCommandInteraction,
|
||||
SlashCommandBuilder,
|
||||
} from "discord.js";
|
||||
|
||||
export interface Command {
|
||||
data: SlashCommandBuilder;
|
||||
execute: (
|
||||
interaction: ChatInputCommandInteraction<CacheType>
|
||||
) => Promise<void>;
|
||||
}
|
||||
0
commands/ihatejoel/index.ts
Normal file
0
commands/ihatejoel/index.ts
Normal file
0
commands/ilovejoel/index.ts
Normal file
0
commands/ilovejoel/index.ts
Normal file
35
commands/index.ts
Normal file
35
commands/index.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { readdirSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import type { Command } from "./command";
|
||||
|
||||
export const readCommands = async (): Promise<Command[]> => {
|
||||
const foldersPath = path.join(__dirname);
|
||||
const commandFolders = readdirSync(foldersPath, {
|
||||
withFileTypes: true,
|
||||
})
|
||||
.filter((file) => file.isDirectory())
|
||||
.map((file) => file.name);
|
||||
|
||||
let commands: Command[] = [];
|
||||
|
||||
for (const folder of commandFolders) {
|
||||
const commandsPath = path.join(foldersPath, folder);
|
||||
const commandFiles = readdirSync(commandsPath).filter((file) =>
|
||||
file.endsWith(".ts")
|
||||
);
|
||||
for (const file of commandFiles) {
|
||||
const filePath = path.join(commandsPath, file);
|
||||
const command = require(filePath).default as Command;
|
||||
// Set a new item in the Collection with the key as the command name and the value as the exported module
|
||||
if ("data" in command && "execute" in command) {
|
||||
commands.push({ data: command.data, execute: command.execute });
|
||||
} else {
|
||||
console.log(
|
||||
`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return commands;
|
||||
};
|
||||
13
commands/ping/index.ts
Normal file
13
commands/ping/index.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { SlashCommandBuilder } from "discord.js";
|
||||
import type { Command } from "../command";
|
||||
|
||||
const command: Command = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("ping")
|
||||
.setDescription("Replies with Pong!"),
|
||||
execute: async (interaction) => {
|
||||
await interaction.reply("Pong!");
|
||||
},
|
||||
};
|
||||
|
||||
export default command;
|
||||
74
commands/prompt/index.ts
Normal file
74
commands/prompt/index.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
import {
|
||||
ActionRowBuilder,
|
||||
ModalBuilder,
|
||||
SlashCommandBuilder,
|
||||
TextInputBuilder,
|
||||
TextInputStyle,
|
||||
type APIApplicationCommandOptionChoice,
|
||||
type ModalActionRowComponentBuilder,
|
||||
} from "discord.js";
|
||||
import type { Command } from "../command";
|
||||
import { personalities } from "../../client";
|
||||
|
||||
const createCommand = (): SlashCommandBuilder => {
|
||||
const builder = new SlashCommandBuilder()
|
||||
.setName("prompt")
|
||||
.setDescription("Get a prompt from the AI.")
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName("prompt")
|
||||
.setDescription("The prompt to use.")
|
||||
.addChoices(
|
||||
...personalities.map(
|
||||
(personality) =>
|
||||
({
|
||||
name: personality.name,
|
||||
value: personality.name,
|
||||
} as APIApplicationCommandOptionChoice<string>)
|
||||
)
|
||||
)
|
||||
.setRequired(false)
|
||||
) as SlashCommandBuilder;
|
||||
|
||||
return builder;
|
||||
};
|
||||
|
||||
const command: Command = {
|
||||
data: createCommand(),
|
||||
execute: async (interaction) => {
|
||||
const prompt = interaction.options.getString("prompt") || "regular";
|
||||
const personality = personalities.find(
|
||||
(personality) => personality.name === prompt
|
||||
);
|
||||
|
||||
if (!personality) {
|
||||
await interaction.reply({
|
||||
content: "Invalid personality",
|
||||
ephemeral: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const chanceInput = new TextInputBuilder()
|
||||
.setCustomId("chance")
|
||||
.setLabel("Chance to use this prompt (0-1)")
|
||||
.setValue(personality?.chance.toString())
|
||||
.setRequired(true)
|
||||
.setStyle(TextInputStyle.Short);
|
||||
|
||||
const chanceRow =
|
||||
new ActionRowBuilder<ModalActionRowComponentBuilder>().addComponents(
|
||||
chanceInput
|
||||
);
|
||||
|
||||
await interaction.showModal(
|
||||
new ModalBuilder()
|
||||
.setTitle(`Prompt: ${prompt}`)
|
||||
.setCustomId("prompt")
|
||||
.addComponents(chanceRow)
|
||||
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
export default command;
|
||||
24
commands/register.ts
Normal file
24
commands/register.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { REST, Routes } from "discord.js";
|
||||
import type { Command } from "./command";
|
||||
|
||||
export const registerCommands = async (
|
||||
commands: Command[],
|
||||
clientId: string
|
||||
) => {
|
||||
const DISCORD_TOKEN = Bun.env.DISCORD_TOKEN;
|
||||
if (!DISCORD_TOKEN) {
|
||||
console.error("No DISCORD_TOKEN found in environment variables.");
|
||||
return;
|
||||
}
|
||||
|
||||
const rest = new REST({ version: "10" }).setToken(DISCORD_TOKEN);
|
||||
|
||||
try {
|
||||
await rest.put(Routes.applicationCommands(clientId), {
|
||||
body: commands.map((command) => command.data.toJSON()),
|
||||
});
|
||||
console.log(`Registered ${commands.length} commands.`);
|
||||
} catch (error) {
|
||||
console.error("Error while registering commands:", error);
|
||||
}
|
||||
};
|
||||
72
commands/sex/index.ts
Normal file
72
commands/sex/index.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
import { SlashCommandBuilder } from "discord.js";
|
||||
import type { Command } from "../command";
|
||||
|
||||
export const numbers: Record<string, string> = {
|
||||
"132079479907418113": "20030901-5113", // sverker,
|
||||
"294830423912218636": "20031021-3236", // fredrik
|
||||
"533598514081693696": "20040703-0022", // fideli,
|
||||
"282237160642445312": "20030122-7286", // linnea
|
||||
"269503767232249856": "20030606-1417", // alfred
|
||||
"234393030675660800": "20030924-9597", // sigge
|
||||
"202112342660481033": "20030720-2150", // joel
|
||||
"134007088325197824": "20030712-7753", // eric
|
||||
"281158186260758529": "20031104-6759", // kim
|
||||
};
|
||||
|
||||
const command: Command = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("sex")
|
||||
.setDescription("wouldnt you like to know"),
|
||||
execute: async (interaction) => {
|
||||
let reply = `du äcklar mig. ${
|
||||
numbers[interaction.user.id] || ""
|
||||
}. jag trodde bättre om dig.`;
|
||||
|
||||
switch (interaction.user.id) {
|
||||
case "282237160642445312":
|
||||
reply = `Jag hämtar rep.\nNer på knä. ${numbers[interaction.user.id]} ;)`;
|
||||
break;
|
||||
|
||||
case "132079479907418113":
|
||||
reply = `det är som i omegaverse. jag är alfa och du är omega. du är min nu ${
|
||||
numbers[interaction.user.id]
|
||||
}`;
|
||||
break;
|
||||
|
||||
case "294830423912218636":
|
||||
reply = `Självklart pookie björn :3 ${numbers[interaction.user.id]}`;
|
||||
break;
|
||||
|
||||
case "533598514081693696":
|
||||
reply += "\ndu borde ta det med fredrik >:(";
|
||||
break;
|
||||
|
||||
case "269503767232249856":
|
||||
reply += `\ndäremot... tid och plats? >:)`;
|
||||
break;
|
||||
|
||||
case "234393030675660800":
|
||||
reply += `\ndimman kommer dimman kommer dimman kommer dimman kommer`;
|
||||
break;
|
||||
|
||||
case "202112342660481033":
|
||||
reply += `\njoel du är för stark för sex... du är för stark för allt`;
|
||||
break;
|
||||
|
||||
case "281158186260758529":
|
||||
reply += `\nman talar inte om sådant här.`;
|
||||
break;
|
||||
|
||||
default:
|
||||
reply = "du står på en lista nu. grattis";
|
||||
break;
|
||||
}
|
||||
|
||||
await interaction.reply({
|
||||
content: reply,
|
||||
ephemeral: true,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default command;
|
||||
Reference in New Issue
Block a user