#ot | JS and discord.js

1 messages · Page 1 of 1 (latest)

white crown
#

thread is dead but i thought i'd ask

#

logged back onto a project of mine

#

and the bot isn't even working now

#

all i get is this

supple shuttle
#

did you npm install it all?

#

looks like a missing dependency

white crown
#

sorry if thats the wrong thing tho

#

i'm not the best at this kinda stuff

supple shuttle
#

npm install

#

it's a command to grab all the dependencies 🙂

white crown
#

where do i run the command btw?, but ty for the help

#

searched around a bit and i think the platform i'm using is outdated

supple shuttle
#

in a terminal

white crown
#

think i might have to switch to replit

supple shuttle
#

yeah discord is now in v14

white crown
supple shuttle
#

but.. if you upgrade from v12 to v14 you will have some bits of code to rewrite completely

white crown
#

ran the command and it's just giving me alot of errors and checkPERMS statements

#

yea i'll probably have to switch

#

thanks for your help tho

supple shuttle
#

welcome to the great world of javascript, everything gets deprecated too freaking fast

earnest palm
#

👀

earnest palm
supple shuttle
#

classic

earnest palm
#

hey, it's my turn to have troubles...

#

Any ideas?

supple shuttle
#

wrong folder most likely

#

ah no, the command is just npm run start

earnest palm
supple shuttle
#

what does it say now

#

and in which folder do you execute the command

earnest palm
supple shuttle
#

do dir and show what's in that folder

earnest palm
supple shuttle
#

well looks like there's nothing in your folder?

#

you sure it's the correct one?

earnest palm
supple shuttle
#

also Bot panda.. that looks strangely like a thing i wrote on my white board

earnest palm
#

x)

supple shuttle
#

ok, is there scripts in the package.json file

earnest palm
#

ye

supple shuttle
#

that's not a script, that's a dependency

#

you don't have npm scripts in that, so it doesn't know what to do

earnest palm
#

what do I do then?

supple shuttle
#

try npm start?

earnest palm
supple shuttle
#

do just npm run?

earnest palm
#

mb

supple shuttle
#

hmm i think you need to specify your main file

#
  "main": "index.js",
#

inside your package.json

earnest palm
#

done

#

but same

supple shuttle
#

weird. had you done npm init before?

#

npm install.. something like that

earnest palm
#

of course

earnest palm
#

@supple shuttle đŸ„Č

supple shuttle
#

it's odd that your package.json has just that

earnest palm
#

@supple shuttle If we pay attention. Mu discord JS is V.13.8 but we now are on the version 14

#

Maybe it's the pb

#

Hey, here is my code and my error:

#
const { Client, Intents, DiscordAPIError, MessageEmbed, Permissions } = require('discord.js');
const { token } = require('./config.json');
const colors = require('./couleurs.json');
const config = require('./config.json');
const { memberNicknameMention } = require('@discordjs/builders');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_MESSAGES] });

client.login(token)

client.once('ready', async() =>{
    console.log(`Logged in as ${client.user.tag} ==> ✔`);
    // Statut
    client.user.setActivity(config.activity)
}) 

client.on('messageCreate', async(message) => {
    let recruitEmbed = new MessageEmbed()
        .setColor(colors.rougeFoncé)
        .setTitle('Recrutement Hieros Lokhos')
        .setURL('https://forms.gle/Ru4XWKGGCyBroDet9')
        .setDescription('Conditions de recrtutement de la Hieros Lokhos')
        .setAuthor({name:'𝐾𝑚𝑚𝑎#9999', inconURL:'https://cdn.discordapp.com/avatars/275676354408611840/a_b37ae188ed5a59b6343ac0608e6091ad.gif?size=4096'})
        .addFields(
            { name:'Ce que nous recherchons :', value:'ă…€', inline:false },
            { name: 'ă…€', value:'- 3 joueurs/joueuses' },
            { name: 'ă…€', value:'- Un coach qui n\'entraine pas de hauts elos' },
            { name:'Les critĂšres :', value:'ă…€', inline:false },
            { name: 'ă…€', value:'- Avoir 16ans', inline:false },
            { name: 'ă…€', value:'- Être sur PC', inline:false },
            { name: 'ă…€', value:'- Être mature, respectueux/respectueuse, comprĂ©hensif/comprĂ©hensive et savoir se dĂ©tendre', inline:false },
            { name: 'ă…€', value:'- Être actif en moyenne au moins 3 jour par semaine', inline:false },
            { name:'Nos projets :', value:'ă…€', inline:false },
            { name: 'ă…€', value:'- Passer de bons moments ensemble tout en progressant', inline:false },
            { name: 'ă…€', value:'- Faire des tournois Ă  petite Ă©chelle Ă  court terme et peut-ĂȘtre des tournois officiels Ă  long terme' }
        )
        .addField({ name:'Candidater', value:'Intéressé.e ? Pour candidater il te suffit de cliquer sur "Recrutement Hieros Lokhos" afin de remplir le formulaire !', inline:false })
        .setFooter({text:'DĂ©veloppĂ© par 𝐾𝑚𝑚𝑎#9999', inconURL:'https://cdn.discordapp.com/avatars/275676354408611840/a_b37ae188ed5a59b6343ac0608e6091ad.gif?size=4096'})

        if(message.content == 'formule magique (:') {
            message.channel.send({ embeds: [recruitEmbed] });
        } else {
            return
        }
});
#
RangeError [EMBED_FIELD_NAME]: MessageEmbed field names must be non-empty strings.
    at Function.verifyString (C:\JavaScript\BOT HL\node_modules\discord.js\src\util\Util.js:427:41)
    at Function.normalizeField (C:\JavaScript\BOT HL\node_modules\discord.js\src\structures\MessageEmbed.js:543:18)
    at C:\JavaScript\BOT HL\node_modules\discord.js\src\structures\MessageEmbed.js:565:14
    at Array.map (<anonymous>)
    at Function.normalizeFields (C:\JavaScript\BOT HL\node_modules\discord.js\src\structures\MessageEmbed.js:564:8)
    at MessageEmbed.addFields (C:\JavaScript\BOT HL\node_modules\discord.js\src\structures\MessageEmbed.js:328:42)
    at MessageEmbed.addField (C:\JavaScript\BOT HL\node_modules\discord.js\src\structures\MessageEmbed.js:319:17)
    at Client.<anonymous> (C:\JavaScript\BOT HL\index.js:36:10)
    at Client.emit (node:events:390:28)
    at MessageCreateAction.handle (C:\JavaScript\BOT HL\node_modules\discord.js\src\client\actions\MessageCreate.js:26:14) {
  [Symbol(code)]: 'EMBED_FIELD_NAME'
}
supple shuttle
#

ill check out when im back at my desk

supple shuttle
#

{ name: 'ă…€', value:'- 3 joueurs/joueuses' },
name is an empty string (it's spaces, probably interpreted as empty)

#

i think you outta put all the lines in a field in the value

#

for instance
{ name:'Ce que nous recherchons :', value:'- 3 joueurs/joueuses<br>- Un coach qui n\'entraine pas de hauts elos', inline:false },

not sure for what character to use for line breaks, might be \n

earnest palm
#

@supple shuttle this was invisible caracteres

#

But someone gave me the solution

#

In addField

#

I did like in addFields

#

But this isn't the same

supple shuttle
#

oh

earnest palm
#

I don't need {} and name: or value:

supple shuttle
#

alright

white crown
#

oh discord.js

#

im not sure about the ques above, but i have a really basic one

#

im just starting out so

supple shuttle
#

ask ahead

white crown
#

after the person sends the command, how do you make the bot ping them along with the command?

#

like "here you go (user)!"

supple shuttle
#

you want a ping or a reply?

white crown
supple shuttle
#

in your message listener you'll get the id of the user who sent the command

#

with this you can use the client of the bot to send a message in a specific channel with a ping of the user, iirc it's <@id>

earnest palm
#

If you need help with discord js ask me

#

I know a bit

#

I'm learning

#

But I know some little things

white crown
#

this worked, tysm!

white crown
earnest palm
#

ot | JS and discord.js