#Wiktor.

1 messages · Page 1 of 1 (latest)

sonic pilot
#

Hello

sinful otter
#

Hey casey

sonic pilot
#

alright chat cooldown is aids so i made a thread

#

Are you trying to send that embed to a specific channel?

sinful otter
#

Yeah ahaha thank you

sinful otter
#

When I send in the command /embed, I want it to reply with that embed

#

How do I do this?

sonic pilot
#

Have you got a command handler and event handler set up?

sinful otter
#

Yep would you like to head into dms so I can screenshare?

sonic pilot
#

In a school lesson rn cant call lmao

sinful otter
#

Alrighty

#

same haha i wouldnt talk though

sonic pilot
#

Are you putting that code into an event or command

sinful otter
#

embed.js

#

I'm making it as a command like in the guide

sonic pilot
#

Send me the guide ur using

sinful otter
#

But it just says that message is not defined and I don't know how to define it

sonic pilot
#

is your command handler in index?

#

if so send me that rq

sinful otter
#

I have index.js

#

And deploy-commands.js

sonic pilot
#

send code from both

sinful otter
#
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

sonic pilot
#

I do not recommend just copying straight from the guide.

#

Are you trying to use slash commands or regular

sinful otter
sinful otter
sinful otter
sonic pilot
#

send the embed.js code again

#

i think i know why

sinful otter
#
// 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^

sonic pilot
#

1 moment

sinful otter
#

Alright

sonic pilot
#
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

sinful otter
#

that goes into embed.js?

sonic pilot
#

yup

#

Ill brb in 5 mins if it don't work.

sinful otter
#

I got a error

#

@cyan dune yes?

cyan dune
#

what?

sonic pilot
#

Run it and tell me what the error is

#

Wait

cyan dune
#

take off that }

sonic pilot
#

No don’t

sinful otter
#

Not sure what the error is there

#

It's underlined red

#

And it's supposed to be correct

cyan dune
#

take off that }

sinful otter
cyan dune
#

and then add a )

sinful otter
#

Now it underlines underneath

cyan dune
#

)

sonic pilot
#

Give me a minute to get back to my pc

sinful otter
#

it still underlines the one beneath @cyan dune

cyan dune
#

send all the code

sonic pilot
#

I hardly ever use slash commands but just gimme a sec

sinful otter
#

@sonic pilot I mean i can change back to normal commands, if its easier? But I'd need your help doing it all

sonic pilot
#

await interaction.channel.send

#

add await before the bottom line

cyan dune
#
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
#

thats wrong lad

sinful otter
#

@sonic pilot

sonic pilot
#

remove the ,

cyan dune
sinful otter
#

Still the same

sonic pilot
#

add a ;

sinful otter
#

lmao

#

confusing

sonic pilot
#

tf

#

alr 1 sec

sinful otter
#

is this supposed to be a bracket

#

line 20

#

@sonic pilot when are normal commands going poof?

#

lol

sonic pilot
#

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]})
}
};

sinful otter
#

when will they be turning to slash commands

sonic pilot
#

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

sinful otter
#

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

cyan dune
#

yes

sonic pilot
#

slash commands make me cry

#

if i design a nice looking boti want everyone to see it

#

not just the person running the cmd

sinful otter
#

I think ill change to normal commands

sonic pilot
#

ahh

sinful otter
#

ugh

sonic pilot
#

ik why

#

const { MessageEmbed } = require("discord.js");

#

on top line

#

below ur other variables

sinful otter
sinful otter
sonic pilot
#

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

sonic pilot
sinful otter
#

why does this happen lol

sonic pilot
#

ahhh

#

1 sec

cyan dune
#

put this

sinful otter
#

js is confusing

sonic pilot
#

interaction.deferUpdate()

#

add that in at the top

#

above the embed

#

but below the asyn excecute

sinful otter
#

Hm?

#

add it for me my brain hurts 😂

sonic pilot
#

ill write it for u 1 sec

sinful otter
#

ok

sonic pilot
#
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]})
    }
};

sinful otter
sonic pilot
#

tf

#

Imma be honest idk

sinful otter
sonic pilot
#

slash commands make me cry

#

tf

sinful otter
#

when are !commands gonna like expier or smth

#

like the normal prefix commands

sonic pilot
#

wdym

sinful otter
#

@sonic pilot would you help me transfer to normal commands

sonic pilot
#

I need to do some school work ngl. theres alot of good tutorials on yt

sinful otter
#

Aghh

sonic pilot
#

If you dm me when u seriously need help i can help but i need to do work lmao

sinful otter
#

ok ill add you thanks for the help anyways