#Wiktor.
1 messages · Page 1 of 1 (latest)
Hey casey
alright chat cooldown is aids so i made a thread
Are you trying to send that embed to a specific channel?
Yeah ahaha thank you
I need to learn more simple js, i learn by trial and error
When I send in the command /embed, I want it to reply with that embed
How do I do this?
Have you got a command handler and event handler set up?
Yep would you like to head into dms so I can screenshare?
In a school lesson rn cant call lmao
Are you putting that code into an event or command
Send me the guide ur using
But it just says that message is not defined and I don't know how to define it
send code from both
const Discord = require('discord.js')
const fs = require('fs');
const { Client, Collection, Intents } = require('discord.js');
const { token } = require('./config.json');
const client = new Discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES"] })
let statusSet = false;
client.on("ready",async() => {
console.log(`${client.user.username} is online!`)
setInterval(() => {
if(statusSet) client.user.setActivity("Wiktor.#0001", {type: "WATCHING"})
else {
statusSet = true;
client.user.setActivity("Test", {type: "WATCHING"})
}
}, 60 * 1000)
});
client.commands = new Collection();
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
client.commands.set(command.data.name, command);
}
client.on("interactionCreate", async i => {
if (!i.isCommand()) return;
client.commands.get(i.commandName)?.execute(i)
});
const eventFiles = fs.readdirSync('./events').filter(file => file.endsWith('.js'));
for (const file of eventFiles) {
const event = require(`./events/${file}`);
if (event.once) {
client.once(event.name, (...args) => event.execute(...args));
} else {
client.on(event.name, (...args) => event.execute(...args));
}
}
client.login(token)```
const { SlashCommandBuilder } = require('@discordjs/builders');
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const { clientId, guildId, token } = require('./config.json');
const fs = require("fs")
const commandFiles = fs.readdirSync("./commands").filter(x => x.endsWith(".js"))
const slashCommands = [];
for(const file of commandFiles) {
const command = require("./commands/" + file)
slashCommands.push(command.data)
}
const rest = new REST({ version: '9' }).setToken(token);
rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: slashCommands })
.then(() => console.log('Successfully registered application commands.'))
.catch(console.error);```
1 index.js
2 deploy-commands.js
I do not recommend just copying straight from the guide.
Are you trying to use slash commands or regular
Slash commands
Everything works, other than this embed command and I want to make it work..
// at the top of your file
const Discord = require('discord.js');
const client = new Discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES"] })
const { MessageEmbed, Client } = require('discord.js');
// inside a command, event listener, etc.
const exampleEmbed = new MessageEmbed()
.setColor('#0099ff')
.setTitle('Some title')
.setURL('https://discord.js.org/')
.setAuthor({ name: 'Some name', iconURL: 'https://i.imgur.com/AfFp7pu.png', url: 'https://discord.js.org' })
.setDescription('Some description here')
.setThumbnail('https://i.imgur.com/AfFp7pu.png')
.addFields(
{ name: 'Regular field title', value: 'Some value here' },
{ name: '\u200B', value: '\u200B' },
{ name: 'Inline field title', value: 'Some value here', inline: true },
{ name: 'Inline field title', value: 'Some value here', inline: true },
)
.addField('Inline field title', 'Some value here', true)
.setImage('https://i.imgur.com/AfFp7pu.png')
.setTimestamp()
.setFooter('Some footer text here', 'https://i.imgur.com/AfFp7pu.png');
message.send({ embeds: [exampleEmbed] });```
Error^
1 moment
Alright
const { SlashCommandBuilder } = require('@discordjs/builders');
module.exports = {
data: new SlashCommandBuilder()
.setName('embed')
.setDescription('Sends the embed!'),
async execute(interaction) {
const exampleEmbed = new MessageEmbed()
.setColor('#0099ff')
.setTitle('Some title')
.setURL('https://discord.js.org/')
.setAuthor({ name: 'Some name', iconURL: 'https://i.imgur.com/AfFp7pu.png', url: 'https://discord.js.org' })
.setDescription('Some description here')
.setThumbnail('https://i.imgur.com/AfFp7pu.png')
.addFields(
{ name: 'Regular field title', value: 'Some value here' },
{ name: '\u200B', value: '\u200B' },
{ name: 'Inline field title', value: 'Some value here', inline: true },
{ name: 'Inline field title', value: 'Some value here', inline: true },
)
.addField('Inline field title', 'Some value here', true)
.setImage('https://i.imgur.com/AfFp7pu.png')
.setTimestamp()
.setFooter('Some footer text here', 'https://i.imgur.com/AfFp7pu.png');
interaction.channel.send({embeds: [exampleEmbed]}
},
};
try that
you didnt actually build your command
I copied the guide so Lol
that goes into embed.js?
what?
take off that }
No don’t
Not sure what the error is there
It's underlined red
And it's supposed to be correct
take off that }
and then add a )
Now it underlines underneath
)
Give me a minute to get back to my pc
send all the code
@cyan dune
I hardly ever use slash commands but just gimme a sec
@sonic pilot I mean i can change back to normal commands, if its easier? But I'd need your help doing it all
const { SlashCommandBuilder } = require('@discordjs/builders');
module.exports = {
data: new SlashCommandBuilder()
.setName('embed')
.setDescription('Sends the embed!'),
async execute(interaction) {
const exampleEmbed = new MessageEmbed()
.setColor('#0099ff')
.setTitle('Some title')
.setURL('https://discord.js.org/')
.setAuthor({ name: 'Some name', iconURL: 'https://i.imgur.com/AfFp7pu.png', url: 'https://discord.js.org' })
.setDescription('Some description here')
.setThumbnail('https://i.imgur.com/AfFp7pu.png')
.addFields([
{ name: 'Regular field title', value: 'Some value here' },
{ name: '\u200B', value: '\u200B' },
{ name: 'Inline field title', value: 'Some value here', inline: true },
{ name: 'Inline field title', value: 'Some value here', inline: true },
])
.addField('Inline field title', 'Some value here', true)
.setImage('https://i.imgur.com/AfFp7pu.png')
.setTimestamp()
.setFooter('Some footer text here', 'https://i.imgur.com/AfFp7pu.png');
interaction.channel.send({embeds: [exampleEmbed]})
};
@sonic pilot
remove the ,
ahhh sorry
add a ;
is this supposed to be a bracket
line 20
@sonic pilot when are normal commands going poof?
lol
const { SlashCommandBuilder } = require('@discordjs/builders');
module.exports = {
data: new SlashCommandBuilder()
.setName('embed')
.setDescription('Sends the embed!'),
async execute(interaction) {
const exampleEmbed = new MessageEmbed()
.setColor('#0099ff')
.setTitle('Some title')
.setURL('https://discord.js.org/')
.setAuthor({ name: 'Some name', iconURL: 'https://i.imgur.com/AfFp7pu.png', url: 'https://discord.js.org' })
.setDescription('Some description here')
.setThumbnail('https://i.imgur.com/AfFp7pu.png')
.addFields(
{ name: 'Regular field title', value: 'Some value here' },
{ name: '\u200B', value: '\u200B' },
{ name: 'Inline field title', value: 'Some value here', inline: true },
{ name: 'Inline field title', value: 'Some value here', inline: true },
)
.addField('Inline field title', 'Some value here', true)
.setImage('https://i.imgur.com/AfFp7pu.png')
.setTimestamp()
.setFooter('Some footer text here', 'https://i.imgur.com/AfFp7pu.png');
interaction.channel.send({embeds: [exampleEmbed]})
}
};
when will they be turning to slash commands
i got it
const { SlashCommandBuilder } = require('@discordjs/builders');
module.exports = {
data: new SlashCommandBuilder()
.setName('embed')
.setDescription('Sends the embed!'),
async execute(interaction) {
const exampleEmbed = new MessageEmbed()
.setColor('#0099ff')
.setTitle('Some title')
.setURL('https://discord.js.org/')
.setAuthor({ name: 'Some name', iconURL: 'https://i.imgur.com/AfFp7pu.png', url: 'https://discord.js.org' })
.setDescription('Some description here')
.setThumbnail('https://i.imgur.com/AfFp7pu.png')
.addFields(
{ name: 'Regular field title', value: 'Some value here' },
{ name: '\u200B', value: '\u200B' },
{ name: 'Inline field title', value: 'Some value here', inline: true },
{ name: 'Inline field title', value: 'Some value here', inline: true },
)
.addField('Inline field title', 'Some value here', true)
.setImage('https://i.imgur.com/AfFp7pu.png')
.setTimestamp()
.setFooter('Some footer text here', 'https://i.imgur.com/AfFp7pu.png');
interaction.channel.send({embeds: [exampleEmbed]})
}
};
there u go
ok let me run it
WORKS @sonic pilot thanks man
although
theres no slash command for it
i need to run node deploy-commands.js
yes
slash commands make me cry
if i design a nice looking boti want everyone to see it
not just the person running the cmd
ahh
ugh
ik why
const { MessageEmbed } = require("discord.js");
on top line
below ur other variables
theres somethign to make it viewable
ephemeral: false
const { SlashCommandBuilder } = require('@discordjs/builders');
const { MessageEmbed } = require("discord.js");
module.exports = {
data: new SlashCommandBuilder()
.setName('embed')
.setDescription('Sends the embed!'),
async execute(interaction) {
const exampleEmbed = new MessageEmbed()
.setColor('#0099ff')
.setTitle('Some title')
.setURL('https://discord.js.org/')
.setAuthor({ name: 'Some name', iconURL: 'https://i.imgur.com/AfFp7pu.png', url: 'https://discord.js.org' })
.setDescription('Some description here')
.setThumbnail('https://i.imgur.com/AfFp7pu.png')
.addFields(
{ name: 'Regular field title', value: 'Some value here' },
{ name: '\u200B', value: '\u200B' },
{ name: 'Inline field title', value: 'Some value here', inline: true },
{ name: 'Inline field title', value: 'Some value here', inline: true },
)
.addField('Inline field title', 'Some value here', true)
.setImage('https://i.imgur.com/AfFp7pu.png')
.setTimestamp()
.setFooter('Some footer text here', 'https://i.imgur.com/AfFp7pu.png');
interaction.channel.send({embeds: [exampleEmbed]})
}
};
that'll work
still i just dont like it tbh
put this
js is confusing
interaction.deferUpdate()
add that in at the top
above the embed
but below the asyn excecute
ill write it for u 1 sec
ok
const { SlashCommandBuilder } = require('@discordjs/builders');
const { MessageEmbed } = require("discord.js");
module.exports = {
data: new SlashCommandBuilder()
.setName('embed')
.setDescription('Sends the embed!'),
async execute(interaction) {
interaction.deferUpdate()
const exampleEmbed = new MessageEmbed()
.setColor('#0099ff')
.setTitle('Some title')
.setURL('https://discord.js.org/')
.setAuthor({ name: 'Some name', iconURL: 'https://i.imgur.com/AfFp7pu.png', url: 'https://discord.js.org' })
.setDescription('Some description here')
.setThumbnail('https://i.imgur.com/AfFp7pu.png')
.addFields(
{ name: 'Regular field title', value: 'Some value here' },
{ name: '\u200B', value: '\u200B' },
{ name: 'Inline field title', value: 'Some value here', inline: true },
{ name: 'Inline field title', value: 'Some value here', inline: true },
)
.addField('Inline field title', 'Some value here', true)
.setImage('https://i.imgur.com/AfFp7pu.png')
.setTimestamp()
.setFooter('Some footer text here', 'https://i.imgur.com/AfFp7pu.png');
interaction.channel.send({embeds: [exampleEmbed]})
}
};
ugh
wdym
@sonic pilot would you help me transfer to normal commands
I need to do some school work ngl. theres alot of good tutorials on yt
Aghh
If you dm me when u seriously need help i can help but i need to do work lmao
ok ill add you thanks for the help anyways