beginner d.js
const TOKEN = "ggggg"
const clientId = "1169295307490742333"
const guildId = "1169296221278576670"
const Discord = require("discord.js")
const Routes = Discord.Routes
const Rest = require("@discordjs/rest")
const rest = new Rest.REST(
{
version: "10",
}
).setToken(TOKEN)
const client = new Discord.Client({
intents: [
"Guilds",
"GuildMessages",
"MessageContent"
]
})
client.login(TOKEN)
client.on("ready", () => {
console.log(`Ready as ${client.user.displayName} ${client.user.discriminator}`)
})
client.on("messageCreate", (message) => {
message.reply("Yo yo")
})
client.on("interactionCreate", (interaction) => {
if (interaction.isChatInputCommand()) {
console.log(interaction.options.getString("food"))
interaction.reply({
content: "Heyy!!!!"
})
}
})
async function slashCmd() {
const commands = [
{
name: "purge",
description: "Mass delete discord messages on a channel",
options: [
{
name: "Amount",
description: "Amount of numbers to delete",
type: 4,
required: true
}
]
}
]
try {
console.log('Started refreshing application (/) commands.')
await rest.put(Routes.applicationGuildCommands(clientId, guildId), {
body: commands,
})
} catch (err) {
console.log(err)
}
}
slashCmd()const TOKEN = "ggggg"
const clientId = "1169295307490742333"
const guildId = "1169296221278576670"
const Discord = require("discord.js")
const Routes = Discord.Routes
const Rest = require("@discordjs/rest")
const rest = new Rest.REST(
{
version: "10",
}
).setToken(TOKEN)
const client = new Discord.Client({
intents: [
"Guilds",
"GuildMessages",
"MessageContent"
]
})
client.login(TOKEN)
client.on("ready", () => {
console.log(`Ready as ${client.user.displayName} ${client.user.discriminator}`)
})
client.on("messageCreate", (message) => {
message.reply("Yo yo")
})
client.on("interactionCreate", (interaction) => {
if (interaction.isChatInputCommand()) {
console.log(interaction.options.getString("food"))
interaction.reply({
content: "Heyy!!!!"
})
}
})
async function slashCmd() {
const commands = [
{
name: "purge",
description: "Mass delete discord messages on a channel",
options: [
{
name: "Amount",
description: "Amount of numbers to delete",
type: 4,
required: true
}
]
}
]
try {
console.log('Started refreshing application (/) commands.')
await rest.put(Routes.applicationGuildCommands(clientId, guildId), {
body: commands,
})
} catch (err) {
console.log(err)
}
}
slashCmd()Whenever a start it up it runs an error that does not make sense. I am new to discord js but I have been working with discord bots for about 5 years with discord.py