ggghaith
ggghaith
DIAdiscord.js - Imagine an app
Created by ggghaith on 11/6/2024 in #djs-questions
Use an application bot slash commands in dms
Iy didnt work for me
48 replies
DIAdiscord.js - Imagine an app
Created by ggghaith on 11/6/2024 in #djs-questions
Use an application bot slash commands in dms
Can you do it
48 replies
DIAdiscord.js - Imagine an app
Created by ggghaith on 11/6/2024 in #djs-questions
Use an application bot slash commands in dms
Just in dms
48 replies
DIAdiscord.js - Imagine an app
Created by ggghaith on 11/6/2024 in #djs-questions
Use an application bot slash commands in dms
Now it doesnt work anywhere else
48 replies
DIAdiscord.js - Imagine an app
Created by ggghaith on 11/6/2024 in #djs-questions
Use an application bot slash commands in dms
@Qjuh it only eorked in dms
48 replies
DIAdiscord.js - Imagine an app
Created by ggghaith on 11/6/2024 in #djs-questions
Use an application bot slash commands in dms
Thx
48 replies
DIAdiscord.js - Imagine an app
Created by ggghaith on 11/6/2024 in #djs-questions
Use an application bot slash commands in dms
Oh sorry but I add it to the SlashCommandBuilder Right
48 replies
DIAdiscord.js - Imagine an app
Created by ggghaith on 11/6/2024 in #djs-questions
Use an application bot slash commands in dms
@Qjuh i add it to new SlashCommandBuilder right
48 replies
DIAdiscord.js - Imagine an app
Created by ggghaith on 11/6/2024 in #djs-questions
Use an application bot slash commands in dms
Ok so I just edit the context type
48 replies
DIAdiscord.js - Imagine an app
Created by ggghaith on 11/6/2024 in #djs-questions
Use an application bot slash commands in dms
Look
48 replies
DIAdiscord.js - Imagine an app
Created by ggghaith on 11/6/2024 in #djs-questions
Use an application bot slash commands in dms
@Qjuh it is already installable
48 replies
DIAdiscord.js - Imagine an app
Created by ggghaith on 11/6/2024 in #djs-questions
Use an application bot slash commands in dms
The docs dont show to what I can set it
48 replies
DIAdiscord.js - Imagine an app
Created by ggghaith on 11/6/2024 in #djs-questions
Use an application bot slash commands in dms
I wanted to be available in dma
48 replies
DIAdiscord.js - Imagine an app
Created by ggghaith on 11/6/2024 in #djs-questions
Use an application bot slash commands in dms
To what
48 replies
DIAdiscord.js - Imagine an app
Created by ggghaith on 11/6/2024 in #djs-questions
Use an application bot slash commands in dms
What should I edit
48 replies
DIAdiscord.js - Imagine an app
Created by ggghaith on 11/6/2024 in #djs-questions
Use an application bot slash commands in dms
Then how
48 replies
DIAdiscord.js - Imagine an app
Created by ggghaith on 11/6/2024 in #djs-questions
Use an application bot slash commands in dms
Should I set it
48 replies
DIAdiscord.js - Imagine an app
Created by ggghaith on 11/6/2024 in #djs-questions
Use an application bot slash commands in dms
@Qjuh to what
48 replies
DIAdiscord.js - Imagine an app
Created by ggghaith on 11/6/2024 in #djs-questions
Use an application bot slash commands in dms
So I install another package
48 replies
DIAdiscord.js - Imagine an app
Created by ggghaith on 11/6/2024 in #djs-questions
Use an application bot slash commands in dms
const { Client, GatewayIntentBits, SlashCommandBuilder } = require('discord.js');
const { token } = require('./config.json'); // Store your bot token in config.json

const client = new Client({ intents: [GatewayIntentBits.Guilds] }); // Updated this line

// Event listener for when the bot is ready
client.once('ready', () => {
console.log('Bot is online!');
// Register slash commands when the bot is ready
client.application.commands.set([
new SlashCommandBuilder().setName('hello').setDescription('Say hello to the bot!'),
]).then(() => {
console.log('Slash commands registered');
}).catch(console.error);
});

// Event listener for interactions (slash commands)
client.on('interactionCreate', async (interaction) => {
if (!interaction.isCommand()) return;

const { commandName } = interaction;

if (commandName === 'hello') {
await interaction.reply('Hello! 👋');
}
});

// Log in to Discord with your app's token
client.login(token);
const { Client, GatewayIntentBits, SlashCommandBuilder } = require('discord.js');
const { token } = require('./config.json'); // Store your bot token in config.json

const client = new Client({ intents: [GatewayIntentBits.Guilds] }); // Updated this line

// Event listener for when the bot is ready
client.once('ready', () => {
console.log('Bot is online!');
// Register slash commands when the bot is ready
client.application.commands.set([
new SlashCommandBuilder().setName('hello').setDescription('Say hello to the bot!'),
]).then(() => {
console.log('Slash commands registered');
}).catch(console.error);
});

// Event listener for interactions (slash commands)
client.on('interactionCreate', async (interaction) => {
if (!interaction.isCommand()) return;

const { commandName } = interaction;

if (commandName === 'hello') {
await interaction.reply('Hello! 👋');
}
});

// Log in to Discord with your app's token
client.login(token);
48 replies