! MYA
! MYA
DIAdiscord.js - Imagine a bot
Created by ! MYA on 8/18/2024 in #djs-questions
javascript object misbehaving
I have no clue why this is happening
16 replies
DIAdiscord.js - Imagine a bot
Created by ! MYA on 8/18/2024 in #djs-questions
An error I do not understand
I made a balance command that gives an error that I dont understand
11 replies
DIAdiscord.js - Imagine a bot
Created by ! MYA on 8/9/2024 in #djs-questions
slash commands not working
My slash commands arent working. Give me a moment to get the code!
32 replies
DIAdiscord.js - Imagine a bot
Created by ! MYA on 8/9/2024 in #djs-questions
linking external modules
I made a warn.js with a module.export but I dont know how to link it back to my index.js file
3 replies
DIAdiscord.js - Imagine a bot
Created by ! MYA on 8/9/2024 in #djs-questions
Async not working
when I write this code it shows a red underline underneath it
10 replies
DIAdiscord.js - Imagine a bot
Created by ! MYA on 11/15/2023 in #djs-questions
MySQL db making my brain implode
I have 3 files involved in this
10 replies
DIAdiscord.js - Imagine a bot
Created by ! MYA on 11/12/2023 in #djs-questions
d.js query
Hey quick question. Is there a way i can find out when my bot joins a server and get that servers id?
4 replies
DIAdiscord.js - Imagine a bot
Created by ! MYA on 11/8/2023 in #djs-questions
Reaction Error
let lastNumb = 0;

client.on("messageCreate", msg => {
const num = Number(msg.content)
if (num >= 0) {

if (num == lastNumb + 1) {
msg.react(":white_check_mark:")
lastNumb += 1
} else {
msg.reply(`uh oh we lost it at: ${lastNumb}`)
}


} else if (num < 0) {
msg.reply("invalid number")
}

});
let lastNumb = 0;

client.on("messageCreate", msg => {
const num = Number(msg.content)
if (num >= 0) {

if (num == lastNumb + 1) {
msg.react(":white_check_mark:")
lastNumb += 1
} else {
msg.reply(`uh oh we lost it at: ${lastNumb}`)
}


} else if (num < 0) {
msg.reply("invalid number")
}

});
17 replies
DIAdiscord.js - Imagine a bot
Created by ! MYA on 11/3/2023 in #djs-questions
SyntaxError: Unexpected token 'export'
const Discord = require("discord.js")

const buttonCommand = new Discord.SlashCommandBuilder()
.setName("channels")
.setDescription("channels cmd")

export default buttonCommand.toJSON();
const Discord = require("discord.js")

const buttonCommand = new Discord.SlashCommandBuilder()
.setName("channels")
.setDescription("channels cmd")

export default buttonCommand.toJSON();
5 replies
DIAdiscord.js - Imagine a bot
Created by ! MYA on 11/2/2023 in #djs-questions
What is the proper way to use slash commands
I have seen many ways u can use slash commands but I want to know the most flexible and easiest way
27 replies
DIAdiscord.js - Imagine a bot
Created by ! MYA on 11/2/2023 in #djs-questions
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
11 replies