#Slash Commands

17 messages · Page 1 of 1 (latest)

heavy flicker
#

How do I make a slash command in TypeScript? Thanks.

sour wyvern
heavy flicker
sour wyvern
#

well idk, depends what discord library you're using

heavy flicker
#

@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);
heavy flicker
#

@sour wyvern where did you disappear to

#

it's been 25 min

west rune
#

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

discord.js

discord.js is a powerful Node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.

frosty cove
#

!resolved

pastel wigeonBOT
#

@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.

heavy flicker
#

!reopen

#

@frosty cove I fail to see how you figured that someone ignoring me means that my case is somehow resolved.

frosty cove
#

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