#embeds
1 messages ยท Page 1 of 1 (latest)
sorry noisy chat. I'm just trying to find a basic to using them with builders. I want to be able to send an embed back off of a slash command interaction lol
np man lemme show u an rq example
u define the parameters of ur embed
and in the end
u reply with interaction.reply({embeds: [Embed]})
remember that the word between the [] must be the same as the embed that u defined
and ur good
@magic widget just in case u didnt see the replys
ok so I'm on the right track so far. so now it's a bit complicated lol I need to be able to return members names into the embed by their role with one role per embed. I'm going to try and write a loop for it. give me just a second. I'll be right back
definitely needed that lol didn't see that in the docs
ok cool. got you
so u want to return the names of whoever has that role? Sounds interesting gl!
np man
๐
also forgot to say but u need to get the messagge embed and commandinteraction from discord js
and then put in those parameters so it goes with the things ur executing
now go on and gl!
ok so I tried to follow your examples there, and here is what I have with my loop included. Please keep in mind that unless this code is correct, it is pseudo code ๐
const { SlashCommandBuilder } = require('@discordjs/builders');
const { MessageEmbed } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('server')
.setDescription('Get info about the server.'),
async execute(interaction, bot) {
const serverEmbed = new MessageEmbed()
.setColor('#00ff00')
.setTitle(interaction.guild.name)
.setAuthor({ name: interaction.user.tag, iconURL: interaction.user.iconURL })
.setDescription('PLace to display the guild desription')
for (member in interaction.guild.member) {
if (member.top_role === 'Owner') {
serverEmbed.addField('Owners',member.name,true);
} else if (member.top_role === 'Devs') {
serverEmbed.addField('Devs',member.name,true);
} else if (member.top_role === 'Head Administrator') {
serverEmbed.addField('Head Administrator',member.name,true);
} else if (member.top_role === 'Administrator') {
serverEmbed.addField('Administrators',member.name,true);
} else if (member.top_role === 'Moderators') {
serverEmbed.addField('Moderators',member.name,true);
} else if (member.top_role === 'Cyber Administrator') {
serverEmbed.addField('Cyber Administrators',member.name,true);
} else if (member.top_role === 'Cyber Moderator') {
serverEmbed.addField('Cyber Moderator',member.name,true);
} else if (member.top_role === 'Support Staff') {
serverEmbed.addField('Support Staff',member.name,true);
} else if (member.top_role === 'Community Helper') {
serverEmbed.addField('Community Helper',member.name,true);
} else {```
const channel = bot.channels.cache.find(ch => ch.name === 'gawth3r_terminal');
channel.send(error)
}
}
interaction.reply({embeds: [serverEmbed]})
},
};
I tried lol
also, where I'm pulling this information in the for loop to show in the embed, I would also like to do the same thing on my website, but I'll get to that later
I have to get slash commands down, and once I have those down pat then i'll move on to how to integrate a website into a discord bot lol
its looking rly well structured man ๐ looking hella nice and the last part when u send the error and if it works it replies its perfectly done ๐
lol I'm 1.5 years versed in Python ๐ some of it translates easy
sounds like an amazing idea and like a never before seen bot man, looking forwards to seeing that bot online and running ๐ !
OH WOW ALR
IMPRESSED ?
damn man respect
haha once we get a fully functioning version up and running, I'll definitely let you know lol
gotchu man goodluck with everything ๐ !
sorry to bother, but I have another question.
const fs = require('fs');
const { Client, Collection, Intents } = require('discord.js');
const { token } = require('./config.json');
const bot = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_MESSAGES ] });
bot.commands = new Collection();
const eventFiles = fs.readdirSync('./events').filter(file => file.endsWith('.js'));
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require('./commands/${file}');
bot.commands.set(command.name, command);
}
for (const file of eventFiles) {
const event = require('./events/${file}');
if (event.once) {
bot.once(event.name, (...args) => event.execute(...args));
} else {
bot.on(event.name, (...args) => event.execute(...args));
}
}
bot.login(token);
```this is my main bot file. When I run it, I get the error
```node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module './commands/${file}'
Require stack:
- C:\Users\Mekas\Documents\GitHub\Gawth3r-Website\bot.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Users\Mekas\Documents\GitHub\Gawth3r-Website\bot.js:13:21)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
code: 'MODULE_NOT_FOUND',```
requireStack: [ 'C:\\Users\\Mekas\\Documents\\GitHub\\Gawth3r-Website\\bot.js' ]
}```What do I have wrong with my two const variables that load my events and commands into the bot?`
both of those folders, events and commands are in the same directory as bot.js
nevermind. I'm slow. the backticks versus single/double quotes get me lol
did u get it ? ๐
no ๐ฆ
const fs = require('fs');
const { Client, Collection, Intents } = require('discord.js');
const { token } = require('./config.json');
const bot = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_MESSAGES ] });
bot.commands = new Collection();
const eventFiles = fs.readdirSync('./events').filter(file => file.endsWith('.js'));
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
bot.commands.set(command.name, command);
}
for (const file of eventFiles) {
const event = require(`./events/${file}`);
if (event.once) {
bot.once(event.name, (...args) => event.execute(...args));
} else {
bot.on(event.name, (...args) => event.execute(...args));
}
}
bot.login(token);
at Z.runRequest (C:\Users\Mekas\Documents\GitHub\Gawth3r-Website\node_modules\@discordjs\rest\dist\index.js:7:581)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Z.queueRequest (C:\Users\Mekas\Documents\GitHub\Gawth3r-Website\node_modules\@discordjs\rest\dist\index.js:5:2989) {
rawError: { message: 'Unknown Application', code: 10002 },
code: 10002,
status: 404,
method: 'put',
url: 'https://discord.com/api/v9/applications/925933044932702200/guilds/926383175180095500/commands',
requestBody: { attachments: undefined, json: [ [Object], [Object] ] }
}```this is my error now, and idk how to read javascript errors quite precisely just yet lol
try closing and opening vs but did that just happen bcuz of the command or another thing?
I'm not sure. once sec. relaunching vscode, and then running bot again
okokkokok
at Z.runRequest (C:\Users\Mekas\Documents\GitHub\Gawth3r-Website\node_modules\@discordjs\rest\dist\index.js:7:581)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Z.queueRequest (C:\Users\Mekas\Documents\GitHub\Gawth3r-Website\node_modules\@discordjs\rest\dist\index.js:5:2989) {
rawError: { message: 'Unknown Application', code: 10002 },
code: 10002,
status: 404,
method: 'put',
url: 'https://discord.com/api/v9/applications/925933044932702200/guilds/926383175180095500/commands',
requestBody: { attachments: undefined, json: [ [Object], [Object] ] }
}```happened again.
i genuinely dont know man so sorry
all good ๐ ty!
all i had to do was change my ids in my json from int's to str's lmao i hate js
goodluck with everything man