#development
1 messages · Page 790 of 1
Hello i need a little help with my bot witch its in JavaScript i am using discord.js
so i wanted to use fetchUser to get user tag and when user cant be find i want to show his id
@round ridge hello,
If you don't know lemme tell you that fetchUser if for user account.
https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=fetchUser
i am using it for bot i use normally fetchUser but i want when he will not find it just reply with id
i used it like that
const user = await bot.fetchUser(userr).catch(error => { userr })
ok so then check if user exists
if(!user) { user = userr }
if user does not exist, replace it with id
ye i know
@quartz kindle i did what you told me and still reply with error:
(node:26760) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown User
:p
@round ridge change it to await bot.fetchUser(userr).catch(() => {})
still errored:
(node:26928) UnhandledPromiseRejectionWarning: TypeError: Assignment to constant variable.
do you have const user anywhere else?
let MUser = message.author.id;
if(!userr) return message.reply("ID?");
let breason = args.join(" ").slice(19);
if (!breason) return message.channel.send('Specify a reason!')
const user = await bot.fetchUser(userr).catch(() => {})
if(!user) {
user = userr
}
const mod = await bot.fetchUser(MUser)
This is full varibles
oh ye i forgot
now is working thx
by fetchUser do i am able to get only that user tag
oh thx 🙂
@earnest phoenix show code
you should show the code of the help command you use i think
^
@ocean frigate 200 iq
can someone help again
Code:
bot.guilds.members.forEach(member => { if (userr != client.user.id) member.kick(`ModBot Secruiti This User Got Banned For: ${breason}`); });
Error:
(node:27549) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'forEach' of undefined
how to use lavalink?
@round ridgeyou need to first do loop for each guild and then for each the guild members (and i recommend for, not forEach.
FreestyleToday at 2:55 PM
@ocean frigate 200 iq
What do you mean?
@restive furnace can you help me out how to do loop i never done a loop in any of my projects
you need to use loop-in-loop
like loop(guilds) { loop(members) { code here what u want to do } }
you can use forEach, its just that for has higher performance, although the difference will only be a couple milliseconds
a for loop is a pure/manual loop
while forEach is a helper method on an array that does it for you
the syntax of a for loop is as follows:
performance matters
readability matters too

for(initial value; condition; next iteration) {
// code
}```
like now i put it all and still get error about loop think
nonono dont copy paste
okay but how i am able to to that all?
you know what, just use forEach
because anyway you need to convert guilds to an array if you want to use for
but you can use for in
for(let guild in bot.guilds) {
bot.guilds[guild].members
}```
rn i am thinking what is that i rly never used any of loops stuff
Is there a performance difference between a casual for and for in loops 
for is still faster yes
@round ridge the concept of a loop is simply a block of code that repeats until a condition is met
there are many uses for loops, for instance, go over a list and repeat a block of code on each item of a list until the list ends
for(let guild in bot.guilds) {
bot.guilds[guild].members
}```
@quartz kindle so if i would do some like that do i add forEach ?
to like check users
Technically infinite loops are considered loops too, right? 
bot.guilds.forEach(guild => {
guild.members.forEach(member => {
// member
})
})
or
for(let guild in bot.guilds) {
for(let member in bot.guilds[guild].members) {
// bot.guilds[guild].members[member]
}
}``` or any combination of them
forEach is more readable and easier to use, but for is faster
for can be used for many other things, while forEach can only be used for arrays and collections, or other custom list-like things
for in can be used in objects, forEach cant
for is a loop that you create and manipulate however you want, forEach is a loop that is only available if the data you want to use it on provides it
you can use for to get for example the length of the text (which you don't need since the length property does that)
and other things
for (statement 1; statement 2; statement 3) {
// code block to be executed
}
or well if you want every element in an array
for (let index = 0; index < array.length; index++) {
const element = array[index];
}
if you want to learn about about it visit this site https://www.w3schools.com/js/js_loop_for.asp
also you should not forget this
Anyone know how to use a message collector in PMs?
same way as in server?
Yeah
I just need to send something like, reply with accept or deny, then it will watch what they say, and do something depending on what they said.
This is my code right now.. I'm a little lost.
else if(args[0] == "invite"){
let chnv = server.channels.find(c => c.name === `voice_${uid}` && c.type == "voice")
let chn = server.channels.find(c => c.name === `chat_${uid}` && c.type == "text")
let cate = server.channels.find(c => c.name == `party_${uid}` && c.type == "category")
let role = msg.guild.roles.find(role => role.name === `${uid}`)
let invm = msg.guild.member(msg.mentions.users.first() || msg.guild.members.get(args[0]));
//console.log(invm.user)
invm.send(`${u} has invited you to their party!\n\nPlease respond with \`accept\` or \`deny\`.`)
const waiting = await new Discord.MessageCollector(invm, m => msg.author.id === `${invm.user.id}`, { time: 15000 })
await waiting.on('collect', async m => {
if(m.content.toLowerCase() === "accept"){
await invm.addRole(role)
invm.send(`You have joined the party!\n\nClick on <#${chn.id}> to get started!`)
u.send(`${invm.nickname} has accepted your invite!`)
} else if(m.content.toLowerCase() === "deny"){
invm.send(`You have declined this invite.`)
u.send(`${invm.nickname} has declined your invite!`)
}
else {
invm.send(`Invalid response! Please ask for a new invite!`)
u.send(`${invm.nickname} has declined your invite!`)
}
})```
you could do ur custom msg collector like
on message -> if message channel type is dm and author is the wanted -> if message deny (-> function) or message accerpt (-> function) or no message (-> function)
@restive furnace
const dbl = new DBL(DBLAPITOKEN, bot);
// Optional events
dbl.on("posted", () => {
console.log("Server count posted!");
});
dbl.on("error", e => {
console.log(`Oops! ${e}`);
});``` is that enough?
Or how to do it?
Would I have to do that in a top level file, or can I do that in the command?
The accept or deny only applies in this command, it wouldn't apply at any other point.
HMMMMMMMMMM
I'll try something, I'll let you know. 🙂
UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received undefined
Im getting this error but i cant seem to fix it
@violet nimbus yes that is enough
Hey, Tim's here lol
I'm still lost, if you want to take a look, you tend to be super helpful.
what are you trying to do?
My code has moved to,
else if(args[0] == "invite"){
let chnv = server.channels.find(c => c.name === `voice_${uid}` && c.type == "voice")
let chn = server.channels.find(c => c.name === `chat_${uid}` && c.type == "text")
let cate = server.channels.find(c => c.name == `party_${uid}` && c.type == "category")
let role = msg.guild.roles.find(role => role.name === `${uid}`)
let invm = msg.guild.member(msg.mentions.users.first() || msg.guild.members.get(args[0]));
//console.log(invm.user)
let filter = msg.channel.type.toLowerCase() == 'dm' && m.author.id === `${invm.user.id}`
invm.send(`${u} has invited you to their party!\n\nPlease respond with \`accept\` or \`deny\`.`)
const waiting = await new Discord.MessageCollector(filter, { time: 15000 })
await waiting.on('collect', async m => {
//if(m.author.id !== `${invm.user.id}`){ return }
if(m.content.toLowerCase() === "accept"){
await invm.addRole(role)
invm.send(`You have joined the party!\n\nClick on <#${chn.id}> to get started!`)
u.send(`${invm.nickname} has accepted your invite!`)
} else if(m.content.toLowerCase() === "deny"){
invm.send(`You have declined this invite.`)
u.send(`${invm.nickname} has declined your invite!`)
}
else {
invm.send(`Invalid response! Please ask for a new invite!`)
u.send(`${invm.nickname} has declined your invite!`)
}
})```
The new error is ```js
TypeError: Cannot read property 'setMaxListeners' of undefined```
I'm trying to use a messagecollector in pms.
can this command be initiated in dms? or is it a guild command that sends a dm then awaits for it?
Guild command that sends to dm and awaits for it
then await it and get the channel from it
let dmMessage = await invm.send(); let reply = await dmMessage.channel.awaitMessages(filter)
dude
check the docs for how to use awaitMessages

that code doesnt make any sense
that is possibly
the most impressive piece of lack of basics knowledge ive ever seen
I have a new bug, it's odd.
DiscordAPIError: Cannot send an empty message```
That's the error,
```js
else if(args[0] == "invite"){
let chnv = server.channels.find(c => c.name === `voice_${uid}` && c.type == "voice")
let chn = server.channels.find(c => c.name === `chat_${uid}` && c.type == "text")
let cate = server.channels.find(c => c.name == `party_${uid}` && c.type == "category")
let role = msg.guild.roles.find(role => role.name === `${uid}`)
let invm = msg.guild.member(msg.mentions.users.first() || msg.guild.members.get(args[0]));
//console.log(invm.user)
invm.send(`${u} has invited you to their party!\n\nPlease respond with \`accept\` or \`deny\`.`);
let dmMessage = await invm.send();
const waiting = dmMessage.channel.createMessageCollector(dmMessage.channel, m => m.author.id === invm.user.id, { time: 500000 });
waiting.on('collect', async m => {
//if(m.author.id !== `${invm.user.id}`){ return }
if(m.content.toLowerCase() === "accept"){
await invm.addRole(role)
invm.send(`You have joined the party!\n\nClick on <#${chn.id}> to get started!`)
u.send(`${invm.nickname} has accepted your invite!`)
} else if(m.content.toLowerCase() === "deny"){
invm.send(`You have declined this invite.`)
u.send(`${invm.nickname} has declined your invite!`)
}
else {
invm.send(`Invalid response! Please ask for a new invite!`)
u.send(`${invm.nickname} has declined your invite!`)
}
})```
That's the code
It is sending the DM to the user in question, it just seems to not be waiting for a response.
Which part is confusing?
send the message, why are you sending the message then sending nothing right after?
Oh
OHHH
Call me dumb
lol
Okay, now that that is working LOL,
New issue
TypeError: Function.prototype.apply was called on [object Object], which is a object and not a function```
@earnest phoenix your code is not valid in any programming language i know, learn the basics of how programming works
@dense drift i told you to use channel.awaitMessages()
else if(args[0] == "invite"){
let chnv = server.channels.find(c => c.name === `voice_${uid}` && c.type == "voice")
let chn = server.channels.find(c => c.name === `chat_${uid}` && c.type == "text")
let cate = server.channels.find(c => c.name == `party_${uid}` && c.type == "category")
let role = msg.guild.roles.find(role => role.name === `${uid}`)
let invm = msg.guild.member(msg.mentions.users.first() || msg.guild.members.get(args[0]));
//console.log(invm.user)
let dmMessage = await invm.send(`${u} has invited you to their party!\n\nPlease respond with \`accept\` or \`deny\`.`);
const waiting = dmMessage.channel.createMessageCollector(dmMessage.channel, m => m.author.id === invm.user.id, { time: 500000 });
waiting.on('collect', async m => {
//if(m.author.id !== `${invm.user.id}`){ return }
if(m.content.toLowerCase() === "accept"){
await invm.addRole(role)
await invm.send(`You have joined the party!\n\nClick on <#${chn.id}> to get started!`)
await u.send(`${invm.nickname} has accepted your invite!`)
} else if(m.content.toLowerCase() === "deny"){
await invm.send(`You have declined this invite.`)
await u.send(`${invm.nickname} has declined your invite!`)
}
else {
await invm.send(`Invalid response! Please ask for a new invite!`)
await u.send(`${invm.nickname} has declined your invite!`)
}
})```
Code if you need to see it again
you cant use a collector like that
you dont need to use a collector here, you can remove your entire collector code
and look at the docs for how to use awaitMessages
show your "normal" code
this is not normal code
show the full code
show the embed part, and the message send part
Okay, I've done a bit of code changing, and now I'm even more confused lol.
Also, don't @ tim every time.
TypeError: Function.prototype.apply was called on #<Object>, which is a object and not a function```
Error,
```js
let dmMessage = await invm.send(`${u} has invited you to their party!\n\nPlease respond with \`accept\` or \`deny\`.`);
let filter = dmMessage.channel
dmMessage.channel.awaitMessages({
max: 1,
time: 500000 })
.then(async(collected) => {
console.log(collected)
if (collected.content.toLowerCase() == 'accept') {
await invm.addRole(role)
await invm.send(`You have joined the party!\n\nClick on <#${chn.id}> to get started!`)
await u.send(`${invm.nickname} has accepted your invite!`)
} else if (collected.content.toLowerCase() == "deny") {
await invm.send(`You have declined this invite.`)
await u.send(`${invm.nickname} has declined your invite!`)
} else {
await invm.send(`Invalid response! Please ask for a new invite!`)
await u.send(`${invm.nickname} has declined your invite!`)
}
})```
Code
@earnest phoenix delete this const client = new Discord.Client();
then you need to separate the message into arguments, for example let args = message.content.split(" ") then you need to make a different description depending on the argument, for example: ```js
...
.setFooter();
if(args[1] === "utilita") {
avatarEmbed.setDescription(Ciao ${message.author}. Ecco i miei comandi: __**Utilità**__ t!avatar o t!avatar @user: manda l'avatar di chi ha taggato o di sè stesso t!ping: dice i ping del bot t!aiuto: manda in privato i comandi del bot t!help: manda in chat i comandi del bot)
} else if(args[1] === "fun") {
avatarEmbed.setDescription(Ciao ${message.author}. Ecco i miei comandi: __**FUN**__ t!random: manda un numero random t!doge: manda l'emoji del doge t!buonasera: Risponde Buonasera t!ciao o t!ciao @user: il bot ti saluta t!RIP: il bot ti risponde scrivendo RIP)
} else {
avatarEmbed.setDescription(Ciao ${message.author}. Ecco i miei comandi: __**Utilità**__ t!avatar o t!avatar @user: manda l'avatar di chi ha taggato o di sè stesso t!ping: dice i ping del bot t!aiuto: manda in privato i comandi del bot t!help: manda in chat i comandi del bot __**FUN**__ t!random: manda un numero random t!doge: manda l'emoji del doge t!buonasera: Risponde Buonasera t!ciao o t!ciao @user: il bot ti saluta t!RIP: il bot ti risponde scrivendo RIP __**Photoshop**__ t!triggered: Triggera l'immagine profilo di sè stessi o propria t!inversione: Inverte i colori della propria immagine profilo di sè stessi o propria **ULTERIORI INFO USARE t!photoshop help** __**In Costruzione / Riparazione**__ t!nick @user: per cambiare il ick di un utente t!userinfo: manda le info di un utente (non funziona ancora, ma quasi) t!serverinfo: manda le info di un server (non funziona ancora, ma quasi)
);
}
@dense drift this is the example for awaitMessages in the docs: js // Await !vote messages const filter = m => m.content.startsWith('!vote'); // Errors: ['time'] treats ending because of the time limit as an error channel.awaitMessages(filter, { max: 4, time: 60000, errors: ['time'] }) .then(collected => console.log(collected.size)) .catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));
the filter must be a function that checks what the messages should be to pass it
Okayyy
I think I understand
Let me give it a shot
Okay, you're a life saver, it's now listening, but it just jumps to the last else every time...
let ug = msg.guild.member(invm.user.id)
let dmMessage = await invm.send(`${u} has invited you to their party!\n\nPlease respond with \`accept\` or \`deny\`.`);
let filter = m => m.content.startsWith('accept')
dmMessage.channel.awaitMessages(filter, {
max: 1,
time: 500000 })
.then(async collected => {
console.log(collected.content)
if (collected.content.toLowerCase() == 'accept') {
ug.addRole(role)
invm.send(`You have joined the party!\n\nClick on <#${chn.id}> to get started!`)
u.send(`${invm.nickname} has accepted your invite!`)
} else if (collected.content.toLowerCase() == "deny") {
invm.send(`You have declined this invite.`)
u.send(`${invm.nickname} has declined your invite!`)
} else {
invm.send(`Invalid response! Please ask for a new invite!`)
u.send(`${invm.nickname} has declined your invite!`)
}
}).catch(() => {
invm.send(`Timed out, please ask for a new invite from ${u}.`)
})
It always just says timed out.
what does console.log(collected.content) show?
undefined
also, your filter should contain all possible answers, not only one
collected is probably a collection, just in case you want to await for more than 1 message
so collected.first().content
I tweaked it to
let ug = msg.guild.member(invm.user.id)
let dmMessage = await invm.send(`${u} has invited you to their party!\n\nPlease respond with \`accept\` or \`deny\`.`);
let filter = m => m.content.startsWith(['accept', 'deny'])
dmMessage.channel.awaitMessages(filter, {
max: 1,
time: 500000 })
.then(async collected => {
console.log(collected)
if (collected.content.toLowerCase() == 'accept') {
ug.addRole(role)
invm.send(`You have joined the party!\n\nClick on <#${chn.id}> to get started!`)
u.send(`${invm.nickname} has accepted your invite!`)
} else if (collected.content.toLowerCase() == "deny") {
invm.send(`You have declined this invite.`)
u.send(`${invm.nickname} has declined your invite!`)
} else {
invm.send(`Invalid response! Please ask for a new invite!`)
u.send(`${invm.nickname} has declined your invite!`)
}
}).catch(() => {
invm.send(`Timed out, please ask for a new invite from ${u}.`)
})```
startsWith doesnt work like that
filter = m => m.content.toLowerCase() === "accept" || m.content.toLowerCase() === "deny"
Oh yeah lol
that way only accept or deny will be valid answers, everything else will be ignored
I'm half asleep
so you can also remove this else { invm.send(`Invalid response! Please ask for a new invite!`) u.send(`${invm.nickname} has declined your invite!`) }
let ug = msg.guild.member(invm.user.id)
let dmMessage = await invm.send(`${u} has invited you to their party!\n\nPlease respond with \`accept\` or \`deny\`.`);
let filter = m => m.content.toLowerCase() === "accept" || m.content.toLowerCase() === "deny"
dmMessage.channel.awaitMessages(filter, {
max: 1,
time: 500000 })
.then(async collected => {
console.log(collected)
if (collected.content.toLowerCase() == 'accept') {
ug.addRole(role)
invm.send(`You have joined the party!\n\nClick on <#${chn.id}> to get started!`)
u.send(`${invm} has accepted your invite!`)
} if (collected.content.toLowerCase() == "deny") {
invm.send(`You have declined this invite.`)
u.send(`${invm} has declined your invite!`)
.catch(() => {
invm.send(`Timed out, please ask for a new invite from ${u}.`)
})
}```
Now it's posting the same thing
Undefined, and timed out
collected is still undefined?
yeah
let ug = msg.guild.member(invm.user.id)
let dmMessage = await invm.send(`${u} has invited you to their party!\n\nPlease respond with \`accept\` or \`deny\`.`);
let filter = m => m.content.toLowerCase() === "accept" || m.content.toLowerCase() === "deny"
dmMessage.channel.awaitMessages(filter, {
max: 1,
time: 500000 })
.then(collected => {
console.log(collected)
if (collected.content.toLowerCase() == 'accept') {
ug.addRole(role)
invm.send(`You have joined the party!\n\nClick on <#${chn.id}> to get started!`)
u.send(`${invm} has accepted your invite!`)
} if (collected.content.toLowerCase() == "deny") {
invm.send(`You have declined this invite.`)
u.send(`${invm} has declined your invite!`)
.catch(() => {
invm.send(`Timed out, please ask for a new invite from ${u}.`)
})}})
}```
Now it's not undefined
It's a collection as expected
Collection [Map] {
1|boomer | '678564268295323660' => Message {
1|boomer | channel: DMChannel {
1|boomer | type: 'dm',
1|boomer | deleted: false,
1|boomer | id: '678533789839786003',
1|boomer | recipient: [User],
1|boomer | lastMessageID: '678564268295323660',
1|boomer | lastPinTimestamp: null,
1|boomer | messages: [Collection [Map]],
1|boomer | _typing: Map {}
1|boomer | },
1|boomer | deleted: false,
1|boomer | id: '678564268295323660',
1|boomer | type: 'DEFAULT',
1|boomer | content: 'accept',
1|boomer | author: User {
1|boomer | id: '375073714833981441',
1|boomer | username: 'Lootgamer77',
1|boomer | discriminator: '7758',
1|boomer | avatar: 'c948087af467626a0b5b44df3a1bf030',
1|boomer | bot: false,
1|boomer | lastMessageID: '678564268295323660',
1|boomer | lastMessage: [Circular]
1|boomer | },
1|boomer | member: null,
1|boomer | pinned: false,
1|boomer | tts: false,
1|boomer | nonce: '678564256207077376',
1|boomer | system: false,
1|boomer | embeds: [],
1|boomer | attachments: Collection [Map] {},
1|boomer | createdTimestamp: 1581852728676,
1|boomer | editedTimestamp: null,
1|boomer | reactions: Collection [Map] {},
1|boomer | mentions: MessageMentions {
1|boomer | everyone: false,
1|boomer | users: Collection [Map] {},
1|boomer | roles: Collection [Map] {},
1|boomer | _content: 'accept',
1|boomer | _client: [Client],
1|boomer | _guild: undefined,
1|boomer | _members: null,
1|boomer | _channels: null
1|boomer | },
1|boomer | webhookID: null,
1|boomer | hit: null,
1|boomer | _edits: []
1|boomer | }
1|boomer | }```
TypeError: Cannot read property 'toLowerCase' of undefined
1|boomer | at E:\Discord bots\Boomer\commands\default\party.js:147:39
1|boomer | at processTicksAndRejections (internal/process/task_queues.js:94:5)```
Ayyyyyyyyy
It works!!!!!
❤️ <#
Holy moly, that's 3 hours of coding now working lolol
Thanks soooo sooo much for your help as always
👍
client.on('message', message => {
if (message.author.id === '430964083160776705'){
if(message.content.toLowerCase().startsWith('y!addmod')){
let User = message.mentions.users.first()
if (!User) return message.channel.send('doge ping someone!')
let student = {
name: 'Mike'
};
let data = JSON.stringify(student, null, 2);
fs.writeFile('database.json', data, (err) => {
if (err) throw err;
console.log('Data written to file');
});
console.log('This is after the write call');
}
}
});
is there something I did wrong
depends what you're trying to do
I made a json file
named database.json
I want to send the userid of who I ping in the json file
it was not working so I just replayed User. Id with mike
its stil not working
the way your code is right now, it will replace the entire database with one user every time
and writeFile writes buffers by default afaik, so you need to set it to write utf8
, data, "utf8", err =>
oh
I will try it
still
didnt work
client.on('message', message => {
if (message.author.id === '430964083160776705'){
if(message.content.toLowerCase().startsWith('y!addmod')){
let User = message.mentions.users.first()
if (!User) return message.channel.send('doge ping someone!')
let student = {
name: 'Mike'
};
let data = JSON.stringify(student, null, 2);
fs.writeFile('database.json', data, "utf8", (err) => {
if (err) throw err;
console.log('Data written to file');
});
console.log('This is after the write call');
}
}
});
it didnt send mike to the database
and yes it sent the message to the console
if you want you can send me a code which serves my purpose
which message?
which message was sent to the console
and you opened the database.json file?
ye
and it has nothing inside it?
nope
delete it and try again
do you have any other code that writes to that file?
also, console.log(data) before fs.writeFile
nope
Try not using glitch
Glitch.com don't really like apps editing files
@earnest phoenix make it online
is there any other website I can use
@finite bough free no
Free yes, without a con, no.
@warm marsh wdym
what's the con
E.g. heroku but its limited.
nah
Heroku has postgres?
But it sucks
Fair. You're just better of paying a couple dollars/pounds/euros per month to get a vps.
For a bot? Nah.
Wait, Google Cloud or Azure do trials/free credits.
Hello how do u fix the music to search and hear the music
Langauge, show code (pastebin pref).
@tight plinth can i use a module called fs extra
That won't change being able to write and read files consistently on glitch.
How heroku works :
-Clone the girhub repo of your bot
-npm install
-npm start
I am so confused
@finite bough try this: console.log(require("./database.json")) right after your console.log("data written to file"), still inside the fs scope
It clones the repo, it don't edit it
oki
Can someone join my server and help me
So databases with heroku are a bad idea coz they reset every time u restart ur bot
json sorry, not js
Pls anyone
@toxic mauve are you trying to fix a bot you made?
Yes
how did you make it?
I added the music rythim
did you code it?
How u code it
so its not a bot you made?
Go to the bots support server.
ask the people who coded the bot
Can I get code
-wrongserver
Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Support Server" button on the bot's page, not the "Join Discord" button at the top of our website. If there isn't a button that says Join Support Server, then we can't help you. Sorry :(
@quartz kindle in the console there was this line {name: mike}
how to fetch guildmember property from msg author property
@finite bough so the file is being written correctly, and then something is deleting it
so the problem is glitch, not your code
in visual studio code @earnest phoenix
unless some other part of your code is doing that
@surreal sage messages have a .member getter for that
I believe its not
I don't think message.author.member will work
??? message.author is the member
C# all the way 

i cant believe its actually harder to scrape sfw anime images than it is hentai
wtf is this world

Technically harder for sfw since some sfw images could be seen as nsfw
Can anyone help me how can i change authorized link.
Like open my own web page after authorize complete(when anyone adding my bot)
can any mod help me
I need a small help on Discord.js
What I am trying to do is ...
I dont want to make the bot leave the voice channel when I am in a different voice channel.
What I have soo far
if(message.member.voiceChannel !== message.client.user.voiceChannel) return```
It doesnt quite work
It might be better to compare the id of the channel
if(message.member.voiceChannel.id !== message.client.user.voiceChannel.id) return
Like this?
Where's the code?
What code?
Try it and see if it works
oks
What do you mean with code bot? You need to code your own bot
I don't mean like that I mean in bot orders I mean pots but and so on because I put it in the bot my right
what
is that even english
please help me
console error
(node:3972) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined
CODE
let leave = member.guild.channels.get(leavechannel);
leave.send(`${leavemessage2}, ${member}!`, attachment);```
On what do you need help on?
for some reason the event is not running
but I have given everything well the hits are good too
@heavy marsh
Error means you cant send it
so there is an error in ```js
let leave = member.guild.channels.get(leavechannel);
but it shouldn't be a mistake
con.query(`SELECT * FROM prefix WHERE id = ('${member.guild.id}')`, async (err, rows) => {
if(err) throw err;
if (rows[0].welcome === 1) {
console.log(`Goodbye event kivan kapcsolva a ${member.guild.name} Szerveren`)
} else {
const leavemessage = rows[0].leavemessage
const leavemessage2 = rows[0].leavemessage2
let leavechannel = rows[0].leavechannel
let leave = member.guild.channels.get(leavechannel);```
is member defined?
ahhh your trying to do the member leave event
YES
CAVAS ON
learn to debug
inspect the values of your variables
see what went wrong and where
^
try removing and adding bits of code
@earnest phoenix error code got it just don't know why you do it js (node:3972) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined at Query.<anonymous> (C:\Users\Headsoht\Desktop\henota\events\guildMemberRemove.js:71:8)
what dont you simple do js client.channels.get(`Channel ID`).send(`BLa BLa Bla`)
no

it isn't
You are trying to do x.send where x is not defined
so some thing wrong with the variable right
if(message.member.voiceChannel.id !== message.client.user.voiceChannel.id) return
Is this wrong
ok nvm i get it lol
error code js (node:6828) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined at Query.<anonymous> (C:\Users\Headsoht\Desktop\henota\events\guildMemberAdd.js:68:39)
stop being a help vampire and read what we told you
codejs bot.channels.get(`${welcomechannel}`).send(`${welcomemessage2}, ${member}!`, attachment);
(${welcomechannel}) might be an id that is invaild
message.client.user.voiceChannel.id
Is this wrong to get the voice channel id for which the bot is connected to?
a bot can be connected to multiple channels at once
so, yes
don't make up your own properties and read the docs
Yey I am going through it now ... my bad
Ohh thanks
how to setup give role with use sticker only
sticker?
which lib are you using
what???
which library do you use
bot
@upbeat wing which language do you use
are you using javascript? @upbeat wing
no
what do you do use
i don know to use can you help me
see the image above
no
hello
@summer torrent noooooo
?
no
i have bot mee6
lmao
lol
🤦♂️
read the channel topic
sorry
@upbeat wing go to mee6 support server
nobody reads channel topics
@upbeat wing #verify channel
i don know
ask on mee6 support server
Is it possible to create a database file & use it inside a node module installed via npm
depends on what exactly you want to do, but most likely yes
I only need it to store some data that needs to be persistent
that the module would require
then yes
this @summer torrent
-wrongserver
Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Support Server" button on the bot's page, not the "Join Discord" button at the top of our website. If there isn't a button that says Join Support Server, then we can't help you. Sorry :(
picture changed from pokemon bot to luca
i need help how can i make webhook to get who vote on my bot
i did
ahm.. my bot seems to be offline and cant login. I get this error:
at timeout.client.setTimeout (/rbd/pnpm-volume/7280dbe1-5cd8-4dd7-8365-79abebaab974/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/ClientManager.js:40:57)
at Timeout.setTimeout [as _onTimeout] (/rbd/pnpm-volume/7280dbe1-5cd8-4dd7-8365-79abebaab974/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/Client.js:436:7)
at ontimeout (timers.js:498:11)
at tryOnTimeout (timers.js:323:5)
at Timer.listOnTimeout (timers.js:290:5)```
nvm
apparently Discord created a new token O_o"
I think Discord sometimes automatically creates a new token if it sees that your token is leaked somewhere, or maybe if you break the rate limit a lot. But I am not sure
it's odd though. Atm i just got another new token. And atm it's trying to login again but it's taking relative long.. once again.
So.. i assume there's going to be a similar error again
It used to work untill today though
Like nothing has changed at all since like 3 weeks
i prefer to reclusively make my bot class and if one instance dies who cares i just have another 9999 left
Web says Discord is banning IPs
@peak venture did your bot cross 2500 servers by any chance?
are you loading files?
Yws
so @quartz kindle the thing is that it loaded all the files and only to actually "login" it fails.
Can you guys tell me how much ram your bot uses? (and guild count to compare)
@quartz kindle apparently the bot has been banned according to the topic:
https://support.glitch.com/t/discord-ban-mega-thread-the-second-discord-bot-something-took-too-long-to-do/12157/303
So i posted my project there in awaitance
i guess discord banned several of glitch's ip addresses
so it seems
since its a free service, many people use it for selfbots, spam, raids, etc
btw; how did i store this session info or is that done automaticly?
@cinder patio tell me how much yours uses and which language library, and i'll tell you if its normal
since glitch auto updates if you ever write any single line of code
it will always login and login
and thats the problem
48MB with discord.js, but I also have an express server running on the same proccess
low as fuck
bot is in 2 guilds with 4 users total
in glitch/heroku?
Is there any difference between blob and text data types in mysql 
when I just run it on my pc
typically, discord.js will use an average of 100mb per 200-400 guilds, depending on how many members the guilds have
with default configuration
if there are many guilds with many members your kinda screwed
If you use heroku or glitch I suggest buying a vps
with a decent amount of ram
yea I'll definitely buy a VPS, I already have 1 but it only has 1GB ram
I mean memory not RAM
i asked about glitch/heroku because i dont think they count node's own process as part of its ram usage, so while node itself uses 40-50mb ram, glitch/heroku sometimes report 10/15mb ram
memory = ram
https://nmw03.is-inside.me/xGGCaDbQ.png
how to fix this?
discord.js has a lot of room for tweaking though, so you can make it use 10x less ram if you disable and/or clear caching
I run the process using pm2, don't know if that can add some bytes
you can use client.sweepMessages
yes pm2 runs on its own process, which will add another 10-20mb total, but it doesnt matter much
client.sweepMessages removes some messages depending how long ago they got sent from the cache
which you can specify
you can disable message caching, sweep members, users, channels, etc
you can remove the caching of most things and fetch them only if needed
i made a library which disables all caches on a class level
I'm planning on deleting / making some properties of guilds / roles / users but I doubt that would save much RAM
better than nothing
I am not sure if I want to do the caching myself
what will your bot do?
depending on your needs, you can also disable events, and use discord's new intents system, which will massively reduce cpu and bandwidth usage
not much, only needs to see perms and posts messages
for perms you need to cache guilds, channels, members and roles
do you need welcome messages?
do you need to access people's online/idle status or their nicknames?
nope
then you can probably use intents
@quartz kindle can't I do response.3vs3Victories ?
https://nmw03.is-inside.me/8X9Swr1H.png
uh... context please?
context?
show entire code
tim isn't magic
well he is but not that magic
what the hell is this
@summer torrent key names cannot start with numbers when using dot notation
you need to use bracket notation
response["3vs3Victories"]
ty
Hi
css in long desc
space-track.org has the weirdest API i've ever seen
who the hell uses query parameters like this: param/value/param/value/param/value
in any order
Wait what
crunchyroll's api works using hash codes
It's literally like param1/value1?
you have to send a request to get the hash to then use that hash to get the thing u want
@slender thistle /basicspacedata/query/class/tle/distinct/true/predicates/NORAD_CAT_ID,TLE_LINE1,TLE_LINE2/EPOCH/>now-2/
Good God save the humanity
plus they use cookies for auth instead of api keys
you have to send a get request with a cookie in the header
That's gonna be a fat api
my webscraper api has a higher limit than that 
why do they even bother exposing the api if they don't want people to utilise it.. almost at all
they also say "please contact us and we will help you configure your use case for best efficiency"
sent them an email a week ago, no answer
they also ask you to use cURL with --limit-rate=100k (max 100kb per second download speed)
@quartz kindle thanks now its somehow working
but can u tell me how can I add more ids in a single json file
if u want to see the code again
client.on("message", message => {
if (message.author.id === "430964083160776705" || message.author.id === "469076843430150154") {
if (message.content.toLowerCase().startsWith("y!addmod")) {
let User = message.mentions.users.first();
if (!User) return message.channel.send("doge ping someone!");
let student = {
name: `${User.id}`
};
let data = JSON.stringify(student, null, 2);
console.log(data)
fs.writeFile("./mod.json", data, "utf8", err => {
if (err) console.log(err);
console.log("Data written to file");
console.log(require("./mod.json"))
});
message.channel.send('Hello! This is the reply message.')
console.log("This is after the write call");
}
}
})
@finite bough a json file cannot be parsed partially, so you make operations to the whole file at once
if you save to it, the whole file will be replaced
so you need to load the whole file, make the change and then save the whole file again
for this reason, json files are not a good storage solution and databases are preferred
cant u just push it?
nope because it breaks the json structure
theoretically you could insert data into a list, but I don't know any parser that does that when it updates a file
show his code and i'll explain what he did
see? he does exactly what i said
he reads the entire file, makes the change then saves the entire file again
hm?
he reads the entire file, edits the data and then saves the entire file
how can I do that
you can read a json file using require() or by using fs.readFile() or fs.readFileSync()
yes
using require will keep a copy of the file in memory
using fs will not
fs.readFile is an async function, fs.readFileSync is not
that would be the easiest way yes
remember this?
thats reading the file
ye
so you read it, then you edit it, then you save it again
hmm I will try thanks
check this
o
use json as db
json = fastest and safest database solution
™️
how do i make a code that runs multiple scripts?
what do you mean?
in discord.js how to get the number of voice channel the bot is connected to?
Thank you
i was trying to make a avatar command but it says the else is the problem
i was trying to make a avatar command but it says the else is the problem
// AVATAR COMMAND //
else if (command === 'avatar') {
if (!message.mentions.users.size) {
return message.channel.send(`Your avatar: <${message.author.displayAvatarURL}>`);
}
const avatarList = message.mentions.users.map(user => {
return `${user.username}'s avatar: <${user.displayAvatarURL}>`;
});
// send the entire array of strings as a message
// by default, discord.js will `.join()` the array with `\n`
message.channel.send(avatarList);
}
Thats a really dumb way to map a collection for someone’s avatar
Really?
How do you add a channel to a category?
channel.setParent("categoryID") isn't working
Please ping
Why does lavalink deafen my bot? random question
Language?
Most languages have that as an option.
E.g javascript (d.js)
const player = client.player.join({ guild, channel, host }, { selfdeaf: true });
Maybe spam
Ban yh
im still getting this error(2 months btw)
MongooseTimeoutError: Server selection timed out after 30000 ms
const mongoose = require("mongoose");
mongoose.connect('mongodb+srv://arcle:<pass>@xeroc-z467s.mongodb.net/test?retryWrites=true&w=majority',{
useNewUrlParser: true,
useUnifiedTopology: true
});```
useUnifiedTopology: true someone told me to change this to false
but i still get the error
How can I send a fake vote event to test my bot ?
There's a test button in the same place where you put your webhook thingy
Thanks
@fallen arch you're using atlas? did you whitelist your ip address?
yes
I do not understand how to set up a webhook with the js api :/
okay
@earnest phoenix where is your bot hosted?
My bot is hosted on a vps, why ?
👀
dbl sends webhooks to YOU, not to discord
your URL field should be your vps's ip address + webhook port + webhook url
And what is the webhook port and webhook url ?
the port you define in the js api options
for example: YOUR.VPS.IP.ADDRESS:5000/dblwebhook
if the port you set up is 5000
I see, thanks
also make sure the authorization field in the website is the same as the webhookAuth in the api options
i did connect to my cluster
I have this :/
no
then remove the webhookServer option
mongoose
whats wrong with this connection string:
'mongodb+srv://arcle:<password>@xeroc-z467s.mongodb.net/test?retryWrites=true&w=majority'
I can't help much XC
@fallen arch replace <password> with password of db user
i did that ofc
lulz
@earnest phoenix not normal, where is that 404 coming from?
👍
mongodb://user:pass@localhost:27017/rootcollection?authSource=admin
thats my mongodb string (with creds removed ofc)
hes using Atlas, not a local installation
any ideas for a discord bot?
const dbl = new DBL(DBLAPITOKEN, bot);
dbl.postStats(serverCount);
dbl.on("posted", () => {
console.log("Server count posted!");
});
dbl.on("error", e => {
console.log(`Oops! ${e}`);
});```
Is it enough?
At the area labelled 'main' (near the bottom), cprefix should equal udata.personalPrefix when udata.voted == true however this is not the case and it instead outputs data.prefix. I am quite unsure of how to solve this. Any suggestions?
function message(client, message) {
guildData.findOne(
{
guildId: message.channel.guild.id
},
async (err, data) => {
if (!data) {
return;
} else {
var cprefix = data.prefix;
userData.findOne(
{
userId: message.author.id,
guildId: message.channel.guild.id
},
async (err, udata) => {
if (!udata) {
return;
} else {
if (udata.voted == true) { /* this condition returns true */
var cprefix = udata.personalPrefix;
message.channel.send(cprefix); /* outputs udata.personalPrefix */
//cprefix == udata.personalPrefix here
}
}
})
/* main */
message.channel.send(cprefix); /* outputs data.prefix */
//cprefix == data.prefix here
})
}
@sinful belfry the .send() part is outside of the second callback
would it be okay if I called const dbl = new DBL(Bot.config.topGGToken) every time my bot gets a voteLocked command?
Doesn't that not call the api
isnt that only client-side?
@quartz kindle wdym i dont really understand.
@mystic violet it should be ok, but its not really good practice to repeatedly create new instances for no reason
just create one dbl instance and attach it somewhere where you can access, like client for example
@sinful belfry the second .findOne part only applies to things that are inside it
ah ok
the final message.channel.send is inside the first callback, but outside the second, so it only has access to the things inside the first one
oh so if i enclose the last message.channel.send() in the second one too then the variable should be defined correctly?
ok ty i will try it out
Looking for some assistance in resolving this ```[FATAL] Possibly Unhandled Rejection at: Promise Promise {
<rejected> { [Error: SQLITE_CANTOPEN: unable to open database file] errno: 14, code: 'SQLITE_CANTOPEN' } } reason: SQLITE_CANTOPEN: unable to open database file
[FATAL] Possibly Unhandled Rejection at: Promise Promise {
<rejected> { [Error: SQLITE_CANTOPEN: unable to open database file] errno: 14, code: 'SQLITE_CANTOPEN' } } reason: SQLITE_CANTOPEN: unable to open database file``` using Discord.JS and SQLite
I don't even know where to begin with this error and the odd part is the bot still uses the Database as it should it still functions properly regardless
I am also not looking to be spoon fed this is just my first time working with SQL and my first time getting this error and have been unable to find anything in guides, Reddit ect
which sqlite driver/library are you using?
@quartz kindle
SQLite v3.0.3
&
SQLite3 v4.1.1
https://www.npmjs.com/package/sqlite
I am using both
I don't have an actual client side set up yet to manage/login to the database right now it's all done through the bot as I just set it up about a day or two ago
Like I said the bot still reads and writes to the database regardless of the error so I honestly am stumped on what the issue is. For example the bot has economy commands (Work, Bank ect) linked to the database I can work and earn money and it will still add it to my balance in the database.
why are you using both?
the problem is likely that one of them is being blocked because the other one is using the file
you're not supposed to have multiple libraries doing the same thing lol
but double the libraries is double the performance
Ahh okay sorry like I said I'm new to SQL the guide I was referncing listed both
So that's why I did that
that's a whacky guide
I honestly assumed I didn't need SQLite3 cause my bot only ever calls SQLite just didn't want to delete it and break something
@scenic kelp it was a very whack very poorly designed guide
90% of what they listed was old or outdated functions
But like I said my bot only ever calls SQLite const sql = require("sqlite"); so I'll just delete the other one
Thanks for advising me that the double is likely the issue 😁
I updated discord.js to v12 and when i run my bot that have 200+ guilds, i get this debug log and my bot doesn't listening to any message
[WS => Shard 0] [HeartbeatTimer] Didn't receive a heartbeat ack last time, assuming zombie connection. Destroying and reconnecting.```
but when i change the bot token to another bot with only have 2 guilds and with the same code, i get this log and my bot is working properly
```[WS => Shard 0] Shard received all its guilds. Marking as fully ready.```
can someone help me with this?
if you ask my code, i already try with simple code like this but only bots that have 2 guilds work
```const Discord = require('discord.js');
const client = new Discord.Client();
client.on("debug", (e) => console.info(e));
client.on("ready", () => {
console.log("Logged in!");
});
client.on('message', message => {
console.log(message.content);
if (message.content === 'ping') {
message.channel.send('Pong.');
}
});
client.login("mytoken");```
If you are using v12 even I have heard a few people say they have better luck with v12.0.0-dev
v12 is v12.0.0-dev lol
Other then that I'm useless lol I have no experience in shards yet
@restive night try client.on("raw",console.log)
Oh 🤔 what are the changes exactly cause I have heard a few people saying that updating breaks certain functions
you installed via npm install discordjs/discord.js right?
on the 200 guilds or on the 2 guilds?
200
a lot of GUILD_CREATE right?
that is normal
does it ever stop logging?
or does it keep logging a bunch o stuff forever?
lots of PRESENCE_UPDATE right?
does any MESSAGE_CREATE appear in the logs?
no, i thinks its only PRESENCE_UPDATE and GUILD_CREATE
why its not happening on bot that only have 2 guilds?
very strange
you're not receiving some packets idk why
try reinstalling discord.js and maybe try resetting your token
already try that both reinstaling discord.js and reset token but still stuck with this
and this only happens in v12, not in v11 right?
maybe try an earlier commit
i g2g now
URIError: URI malformed
the hell does that mean?
that its invalid/became invalid while parsing
invalid in what way?
idk
We don't know what your URI looks like, but it is not how it should be
^
RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty.```
:/
Let me tell you the error MessageEmbed field values may not be empty.
People should learn to read error logs tbh
Lol yup
@analog roost that error is simple literally tells you what's wrong
Either one of your Embed fields are empty or it can't read what you have in it
Well nvm found out what I had to do 😆
😁
it appears like errors are written in an alien language for others or they just are too lazy to actually understand it
I think the last, usually the error message is pretty clear
Yeah
it appears like errors are written in an alien language for others
@marble juniper check out C++ error messages.
there are no bot owner properties
discord doesnt know and doesnt care who the owner is
Yeah I was gonna say usually for that stuff I just use something like const Owner = client.users.get('OwnerID')
you can set one like <Client>.owner = await client.users.fetch("your-id") if you want
but I don't see why you would
TimToday at 9:37 PM
there are no bot owner properties
discord doesnt know and doesnt care who the owner is
the client is able to fetch information about itself which includes the owner
as for other bots, you can't know who the owner is from the API
client.fetchApplication()
ah yeah theres fetchapplication
👋
I use python
and I made my first bot
soo
Now im waiting
for it to get approved...
how long it will take for it to be?
about a week
an embed?
an embed?
i think he means the embed color I can't help with that idk much about python
Approval is around 2 weeks
Oh hey that's my botum
Timo, did you call your bot Chip because Chips are made from Potatoes?
No, and this is not related to Development
lmao
D.py embeds:
# To start / create an initial embed we use discord.Embed()
embed = discord.Embed()
# Embed() has Kwargs title, description, color
embed = discord.Embed(title="This is a title",
description="This is a description",
color=<Some hex code>)```
basic embed
Interesting I kinda like the python layout.
https://cog-creators.github.io/discord-embed-sandbox/
This can be used to help visualise Embeds and help generate the bulk of the code
thanks!
@modest maple Real men do embed.title = "This is a title" 
so, tupperbox is offline, how do we bring him back to life?
On the bot page
If you're talking about a bot that's on top.gg, find its bot page and click on "Join Support Server" button 
If they have a support server listed that is

I need a surefire way to convert anything into a string that I can log to the console. I'm creating a custom logger and getting errors trying to convert things to primitives. Is there a surefire way in JS to convert anything into a string? I'm ok with something become something like [Object: null prototype] {}, it just needs to convert to a string. I've tried using String(<thing>) , str = thing + '', thing.toString(), etc. All have thrown errors. The function that I need this in a logging function, similar to console.log.
log (...args) {
...
args.join(' ') <- this is where I get errors
...
console.log(prefix + chalk.bgRed()) // ~
}```
Please ping me with a response
there is no surefire way, but i think the closest you can get is util.inspect
hm, I'll try that
would it be best to inspect all args or just the ones that aren't strings?
aight
its output is similar to that of JSON.stringify
👍
Is there any db's like rethinkdb? cause I cant install rethink, the windows link isnt working
Mongo is probably the closest you can get
But it's still quite different
The instructions here aren't working? https://rethinkdb.com/docs/install/windows/
where is the bot list ;;;—-
https://top.gg @copper shoal
@zealous veldt press download on the zip
@mystic violet https://download.rethinkdb.com/windows/
@zealous veldt javascript has the .toString() function on all objects
log (...args) {
args.map(a => a.toString())
console.log(...args)
}
lmao
however, you should be able to log objects to the console without any issues
for example
function log(...args) {
console.log('some new thing', ...args)
}```
I have a t4 bot in my discord and it stopped working all of a sudden. Anyone has any ideas what I can do to fix it?
Anyone have any idea how I would go about printing a loop in 1 message?
for (let i = 1; i < +a; i++) {
msg.channel.send(`**${i}** - ${client.games.get(i)}`)
}```
My code is that, and instead of it printing 1 message at a time, I would like to map it, and send it in a single message. I'm confused. Thanks in advance!
let messageArray = message.content.split(" "); is right for command handler? Hope everyone understand this
error:```let messageArray = message.content.split(' ');
^
ReferenceError: message is not defined```
module.exports = {
name: 'name of command here',
description: 'description here',
execute(client, message, args) {```
What's yours look like?
Btw, regarding webhooks
I have this issue of invalid webhook token
The webhook is from this channel
Hello can someone help me with this https://pastebin.com/xwTBEAbZ ? ^^
i got some error but i do not found them / how to fix it
Hey
If anyone can give me some tips to making a bot at all please please message me <3
@primal dove what is the error?
imma guess its because you try to delete the message twice
and also this
remove the message.delete after if (message.deletable) @IDBLOCK#9999
bruh
Lol he left
@dense drift in case nobody answered your question from an hour ago, you'd create a string and concatenate each line to it and then send the message after the loop
How do I add each line?
Is that PHP?
javascript
Oh then it'd just be like
var fullString = "";
for(...){
fullString += (your message);
}
channel.send(fullString);
You can probably do it without the loop
var fullString = "";
for (let i = 1; i < +a; i++) {
fullString += `**${i}** - ${client.games.get(i)}`
}
msg.channel.send(fullString)
return```
Something like this?
is client.games a Map
It's pulling from my database, that's why I use the loop.
Yeah it should be a loop for sure
Yes, however the map would have stuff I don't want.
That's close however u interpret the entire statement as a string when u add it to the fullString
So it will print out the line of code, not the data from the code
I think anyway, you can try that
I'm not very experienced with jQuery
Im just trying to develop my first bot and cant get off the part where i have to start up my bot im sorry to both you people but can anyone help me xd
Yes, however the map would have stuff I don't want.
You could still apply filters without a loop
Yeah np
Depending on what exactly your filtering is like, it may actually be very simple
That's alright, this worked perfectly! Thanks for the help.
🙂
can anyone help me start my bot please? its on the part where i start the bot so its online and every time i do node index.js it just says module not found
rauxs, have you ever written a node js application before?
no
i'd recommend you follow these steps:
1 - run 'npm install' from command line
2 - run node index.js
3 - profit
profit?
idk, isnt that the intent?
but either way, it sounds like node modules werent available
It's missing discord.js probably
what does the error say
If you're making a node bot
could be missing the entire package.json lol
Error: Cannot find module 'C:\Users(my name)\index.js'
[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:981:15)[39m
[90m at Function.Module._load (internal/modules/cjs/loader.js:863:27)[39m
[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)[39m
[90m at internal/main/run_main_module.js:18:47[39m {
code: [32m'MODULE_NOT_FOUND'[39m,
requireStack: []
}
C:\Users(my name)>
is the file 'index.js' within your user directory?
yes
show your directory
also
Does it have discord.js code in there and no discord.js?
straight up having the main file in your user folder
Hi
^
If your file is elsewhere you'll have to navigate ur command line to it first
personally, i would create a brand new folder somewhere called 'app' or w.e
then i'd move my index.js, and package.json file into that folder
i will get new token
and follow the 3 steps from above
Did you install node
yes
oooohhh
i did
its not finding it
Have you restarted your pc since
type node --v
no....
in the command line
how can node --version work though when it cant find 'node' ...
strange, but mmk 🙂
also, idk if case matters on requires, but you have a capitalized D
is what i use
it might require case sensitivity more if your running a linux machine
np, tyt 🙂



