#Slash Commands
17 messages · Page 1 of 1 (latest)
same way you do in javascript
Which is?
well idk, depends what discord library you're using
?...
@sour wyvern can i plz send u my code rq and can u plz convert it into a slash command if u dont mind? it's not long
// Require the necessary discord.js classes
const { Client, Events, GatewayIntentBits, BaseCommandInteraction, Interaction, MessageEmbed, SlashCommandBuilder, CommandInteraction, MessageContent, TextChannel} = require('discord.js')
const { token, guild, modmail } = require('./config.json');
// Create a new client instance
const client = new Client({ intents: [GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent, ] });
// When the client is ready, run this code (only once)
// We use 'c' for the event parameter to keep it separate from the already defined 'client'
client.once(Events.ClientReady, (c: { user: { tag: any; }; }) => {
console.log(`Ready! Logged in as ${c.user.tag}`);
});
client.on('messageCreate', async (message) => {
if (message.content === 'modmail') {
await message.reply({ content: `Hello! If you wish to contact our staff, then just react to my message in the <#${modmail}> channel, or just shoot me a D.M.! Thanks!`, ephemeral: true }) }
});
// Log in to Discord with your client's token
client.login(token);
there's an example of how to register a slash command in the discord.js package description: https://www.npmjs.com/package/discord.js
the docs also have that same example as well as a bunch more info that might help you: https://discord.js.org/docs#/docs/discord.js/main/general/welcome
!resolved
@heavy flicker
Because your issue seemed to be resolved, this post was marked as resolved by @frosty cove.
If your issue is not resolved, you can reopen this post by running !reopen.
If you have a different question, make a new post in #1057653400046674112.
!reopen
@frosty cove I fail to see how you figured that someone ignoring me means that my case is somehow resolved.
well, multiple things
your thread isn't really TypeScript-related in the first place, you might be using TypeScript, but this is not a question about TypeScript
also you got pointed the the documentation of the library you're using,
so you just need to read that and do as they recommend in the the docs
also you kinda changed your original question from "how to do I make that?" to "can you make that for me?"
which is not the point of those help threads
don't expect people do do your work for you
we don't mind showing the direction and providing resources