I wanted to write a bot that adds a value to embed with the /add command to get a sheet with values, if the /del command then it removes 1 value from embed and if I call the /list command Then embed is output with values in a column, please help.
<code>require('dotenv').config();
const {Client, Events, GatewayIntentBits, EmbedBuilder, SlashCommandBuilder, PermissionsBitField, Permission } = require ("discord.js")
const client = new Client ({intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent] });
client.on(Events.ClientReady, (x) => {
console.log(`${x.user.tag} is ready!`);
client.user.setActivity(`Coding Discord Bot for reply`);
const add = new SlashCommandBuilder()
.addSubcommand((subcommand) =>
subcommand
.setName("add")
.setDescription("Adds points to the user.")
)
.addNumberOption(option =>
option
.setName ("id 2")
.setDescription ("second value")
.setRequired(true)
)
const del = new SlashCommandBuilder()
.setName ("del")
.setDescription ("delete stroke")
const embed = new SlashCommandBuilder()
.setName ("embed")
.setDescription ("embed")
client.application.commands.create(add);
client.application.commands.create(del);
client.application.commands.create(embed);
});
client.on("interactionCreate", (interaction) => {
if (interaction.commandName === "embed") {
const embed = new EmbedBuilder()
.setAuthor({
name: "Info",
url: "https://example.com",
})
.setTitle("Example Title")
.setURL("https://example.com")
.setImage("https://cubedhuang.com/images/alex-knight-unsplash.webp")
.setThumbnail("https://dan.onl/images/emptysong.jpg")
.setColor("#00b0f4")
.setFooter({
text: "Example Footer",
iconURL: "https://slate.dan.onl/slate.png",
})
.setTimestamp();
interaction.reply({embeds: });
}
});
client.login(process.env.TOKEN);
</code>
<code>require('dotenv').config();
const {Client, Events, GatewayIntentBits, EmbedBuilder, SlashCommandBuilder, PermissionsBitField, Permission } = require ("discord.js")
const client = new Client ({intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent] });
client.on(Events.ClientReady, (x) => {
console.log(`${x.user.tag} is ready!`);
client.user.setActivity(`Coding Discord Bot for reply`);
const add = new SlashCommandBuilder()
.addSubcommand((subcommand) =>
subcommand
.setName("add")
.setDescription("Adds points to the user.")
)
.addNumberOption(option =>
option
.setName ("id 2")
.setDescription ("second value")
.setRequired(true)
)
const del = new SlashCommandBuilder()
.setName ("del")
.setDescription ("delete stroke")
const embed = new SlashCommandBuilder()
.setName ("embed")
.setDescription ("embed")
client.application.commands.create(add);
client.application.commands.create(del);
client.application.commands.create(embed);
});
client.on("interactionCreate", (interaction) => {
if (interaction.commandName === "embed") {
const embed = new EmbedBuilder()
.setAuthor({
name: "Info",
url: "https://example.com",
})
.setTitle("Example Title")
.setURL("https://example.com")
.setImage("https://cubedhuang.com/images/alex-knight-unsplash.webp")
.setThumbnail("https://dan.onl/images/emptysong.jpg")
.setColor("#00b0f4")
.setFooter({
text: "Example Footer",
iconURL: "https://slate.dan.onl/slate.png",
})
.setTimestamp();
interaction.reply({embeds: });
}
});
client.login(process.env.TOKEN);
</code>
require('dotenv').config();
const {Client, Events, GatewayIntentBits, EmbedBuilder, SlashCommandBuilder, PermissionsBitField, Permission } = require ("discord.js")
const client = new Client ({intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent] });
client.on(Events.ClientReady, (x) => {
console.log(`${x.user.tag} is ready!`);
client.user.setActivity(`Coding Discord Bot for reply`);
const add = new SlashCommandBuilder()
.addSubcommand((subcommand) =>
subcommand
.setName("add")
.setDescription("Adds points to the user.")
)
.addNumberOption(option =>
option
.setName ("id 2")
.setDescription ("second value")
.setRequired(true)
)
const del = new SlashCommandBuilder()
.setName ("del")
.setDescription ("delete stroke")
const embed = new SlashCommandBuilder()
.setName ("embed")
.setDescription ("embed")
client.application.commands.create(add);
client.application.commands.create(del);
client.application.commands.create(embed);
});
client.on("interactionCreate", (interaction) => {
if (interaction.commandName === "embed") {
const embed = new EmbedBuilder()
.setAuthor({
name: "Info",
url: "https://example.com",
})
.setTitle("Example Title")
.setURL("https://example.com")
.setImage("https://cubedhuang.com/images/alex-knight-unsplash.webp")
.setThumbnail("https://dan.onl/images/emptysong.jpg")
.setColor("#00b0f4")
.setFooter({
text: "Example Footer",
iconURL: "https://slate.dan.onl/slate.png",
})
.setTimestamp();
interaction.reply({embeds: });
}
});
client.login(process.env.TOKEN);
New contributor
FAFFA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.