add jokes kekw
This commit is contained in:
parent
4dd06821d1
commit
8c5b317e11
3 changed files with 16 additions and 1 deletions
|
@ -44,6 +44,7 @@ export const reuploadCommands = async () => {
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
)
|
)
|
||||||
.setDefaultMemberPermissions(PermissionFlagsBits.ModerateMembers),
|
.setDefaultMemberPermissions(PermissionFlagsBits.ModerateMembers),
|
||||||
|
new SlashCommandBuilder().setName('joke').setDescription("it's a joke"),
|
||||||
].map((command) => command.toJSON());
|
].map((command) => command.toJSON());
|
||||||
|
|
||||||
const rest = new REST({ version: '10' }).setToken(process.env.DISCORD_TOKEN!);
|
const rest = new REST({ version: '10' }).setToken(process.env.DISCORD_TOKEN!);
|
||||||
|
|
11
src/commands/joke.ts
Normal file
11
src/commands/joke.ts
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import type { CacheType, ChatInputCommandInteraction } from 'discord.js';
|
||||||
|
|
||||||
|
export const jokeCommand = async (
|
||||||
|
i: ChatInputCommandInteraction<CacheType>
|
||||||
|
) => {
|
||||||
|
await i.deferReply();
|
||||||
|
const joke = await fetch('https://icanhazdadjoke.com', {
|
||||||
|
headers: { Accept: 'text/plain' },
|
||||||
|
}).then((r) => r.text());
|
||||||
|
await i.editReply(joke);
|
||||||
|
};
|
|
@ -9,6 +9,7 @@ import { membersCommand } from './commands/members';
|
||||||
import { starsCommand } from './commands/stars';
|
import { starsCommand } from './commands/stars';
|
||||||
import { modrinthCommand } from './commands/modrinth';
|
import { modrinthCommand } from './commands/modrinth';
|
||||||
import { tagsCommand } from './commands/tags';
|
import { tagsCommand } from './commands/tags';
|
||||||
|
import { jokeCommand } from './commands/joke';
|
||||||
|
|
||||||
import random from 'just-random';
|
import random from 'just-random';
|
||||||
import { green, bold, yellow } from 'kleur/colors';
|
import { green, bold, yellow } from 'kleur/colors';
|
||||||
|
@ -118,7 +119,9 @@ client.on('interactionCreate', async (interaction) => {
|
||||||
await interaction.channel.send(interaction.options.getString('content')!);
|
await interaction.channel.send(interaction.options.getString('content')!);
|
||||||
await interaction.editReply('I said what you said!');
|
await interaction.editReply('I said what you said!');
|
||||||
} else if (commandName === 'tag') {
|
} else if (commandName === 'tag') {
|
||||||
tagsCommand(interaction);
|
await tagsCommand(interaction);
|
||||||
|
} else if (commandName === 'joke') {
|
||||||
|
await jokeCommand(interaction);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue