#development
1 messages · Page 1159 of 1
nice
do i need to have it on a second server/path?
passed on your nginx or what
i dinnae use nginx
is there any reason your doing mongo behind nginx?
uh
just cuz?
just because you have nginx doesnt mean everything needs to go through it
or that theres any benefit to it
how can i not pass it?
there's no point to put mongo behind nginx if you're not going to be accessing it from outside the vps
i want to access it outside
for now, i would just try and get mongo working without nginx
it works but i want to connect through compass
and then add your nginx mongo stuff after.
compass can connect remotely without nginx i would expect
Hm
honestly, contact your vps provider.
would expect they would have better info/would be able to look at your actual setup
I dunno why my script still has 3 issues, can I paste it here soo u can see what’s wrong?
i was having issue setting something up, contacted my vps provider and they went through the setup with me
i cant really say if i can be helpful without more info @viral lynx
giving us the errors/code/language/lib goes a long way
const Discord = require('discord.js');
const client = new Discord.Client();
client.once('ready', => {
console.log('PARKUS is online!');
});
client.login('token');
Parkus is name of bot btw
your replacing token with your bots token in your actual code right?
once works aswell
once works
token is my bot’s token. I cannot share it
Yes
try doing "node yourfilename"
i can connect from local
if i embed a content on a page that should be the content?
yeah, if thats what you named it
hmmmmmmmmmmm ok
Still nothing
alright, id probably ignore that video and use the proper guide
https://discordjs.guide/
🤔
http{}
stream {
upstream stream_mongo_backend {
server localhost:27017;
}
server {
listen 27017;
location / {
proxy_pass http://stream_mongo_backend;
}
}
}
ah
im still confused
fml
const Discord = require('discord.js');
const client = new Discord.Client();
client.once('ready', => {
console.log('PARKUS is online!');
});client.login('token');
@viral lynx Is not on?
on('ready'
events can use on or once
Not once.
???
VSC says to change ; to , in console.log('PARKUS is online!');
client.on('ready', => {
console.log('PARKUS is online!');
});
ONCE WORKS
Put on ready not once.
Hm
STOP GIVING INCORRECT INFO
Once works?
Ok. For me is on.
For me no
Strange.
on and once work
whats the difference between on and once :thenk:
Alr.
once runs once and only ever once per run
on runs on every relevant event
how can i show the custom status in the message?
i tried a code like this but it still says 'custom status'
kisi.presence.activities.forEach((activity) => {
if (activity.type === 'CUSTOM_STATUS') {
embed.addField('Özel Durum',`\n${activity.name}`)
}
})
did you name your client kisi?
kisi
isnt that so confusing?
const kisi = message.mentions.users.first() || client.users.cache.get(args.join(' ')) || message.author;
@earnest phoenix Where are u from?
hey i keep getting this error Cannot read property 'send' of undefined
Im tryna make a cmd where my friend and i can chat toeach other through my bot where it sends a dm to my friend
like i can do .send @username hi there
i want to register a listener
but where would i put
the self.bot.lavalink.register_event_listener(self.on_lavalink_event)
@mellow fjord turkey
hey i keep getting this error Cannot read property 'send' of undefined
Im tryna make a cmd where my friend and i can chat toeach other through my bot where it sends a dm to my friend
like i can do .send @username hi there
@zenith knoll show your code
k
the end
user can be undefined at times
what's client
use ("257062280779268097").tag
("257062280779268097").username
You can't
??
You should check if user is not equal to undefined
aproxthethat that's not a thing
You need to grab the user class and do .send on it
You should check if
useris not equal toundefined
@sudden geyser how
Bruh
if conditions
ik
if (user == undefined)
//smth
}
it def is undefined
cause it says so
but how fix
like
not to want to be spoon fed
but
the code is correct
its what the docs said
Sure
or use .then
Get isnt a promise
.then is better than making your whole command handler async which i definetely didn't do for mine
cuz
well
you can only run await in an async function
🤔 but he is using get
Ok, there is only one hope for me to fix that script
its not a promise
Discord.js is made for promises, also yeah .get() isnt a promise
Imma just give up, scripting isn’t for everyone. Well, thanks to anyone that tried to helped me ;-;
Tf
well .get used to be a promise
Your code is korrekt
Show the stuff around your code
Maybe it's an error in that
okay
on v11 .get returned a promise v12 uses a new caching system
what is the difference between caching and normal promises
100% promises
discord.js lied
cache is already cached, so theres no need for a promise
^
oh wait i accidentally made it send two times :P
fetch gets from discord sometimes so it needs a promise
Tf
You understood wrong what i said
how do I make a database for my bot? dependency: discord.js
woo any idea what i should do?
it still doesnt matter what you said code, get isnt a promise
is the error send of undefined?
how do I make a database for my bot? dependency: discord.js
@cosmic agate mongodb
im not a mongodb user
or use mongoose


.fetch
Thnx
From Discord not from cacge
i havnt dabbled in the arts of dmming anyone exept for message author
ok
.fetch()?
why give up
and how do I set up the database? note: I'm a beginner in db
uh how do i get the number of guilds my bot is in i kinda forgot
uh how do i get the number of guilds my bot is in i kinda forgot
@sharp thicket what language and library
lol
@sharp thicket read your documentation
mongodb discord.js
Just search guilds
@misty sigil discord.js
any1 can elp with this ?
node
what is client defined as
Its i docs
client
<guildManager>.cache.size() iirc
ty
client.guilds.cache.size
``
hmm
${client.guilds.cache.size}
He knows
i added the the buildpack
How to configure my db?
@viral iris no ask to ask
@earnest phoenix how to fix this ?
I no dev
did you contact your vps provider like i suggested?
@solemn latch u mean the repo /
?

that looks like a heroku error, which i cant comment on
Hi, i made the 8ball command and i have this error saying ' Cannot read property '1' of undefined'. Should I show the code
yeah
How do I win the position Bot Developer?
okay
have an approved bot @cosmic agate
const Discord = require('discord.js');
const Client = require('discord.js')
const client = new Discord.Client();
module.exports = {
name: '8ball',
description: "Tells you random answers",
execute(bot, message, args) {
//const prefix = 'h!';
let question = args.join(" ")
if (!question) {
return message.reply("Please ask a question")
} else {
let responses = ["It is certain.", "It is decidedly so.", "Without a doubt.", "Yes - definitely.", "You may rely on it.", "As I see it, yes.",
"As I see it, yes.", "Most likely.", "Outlook is good.", "Yes.", "Signs point to yes.", "Reply hazy, try again.",
"Ask again later.", "Better not tell you now.", "Cannot predict now.", "Concentrate and ask again.", "Don't count on it.",
"My reply is no.", "My sources say no.", "Outlook not so good.", "Very doubtful."
]
let Response = responses[Math.floor(Math.random() * (responses.length))]
let embed = new Discord.MessageEmbed()
.setTitle('8ball')
.addField(`Your question:`, question)
.addField(`Reply`, responses[Response])
.setColor('RANDOM')
//.setDescription('Your question: ' + question + "\nMy reply: " + Response)
message.channel.send(embed)
}
}
}
@cosmic agate upload and get ur bot verified on top.gg
@earnest phoenix i said u args(1).join(" ")
I uploaded
did u try that
ik i changed it xD
Get it verified
i tried that out
Zac
but didn't work
o
Okay
Oh i will remove it
Remove both
one of the problems of naming your client bot
u need to define only in main file
okay
const Discord = require('discord.js');
module.exports = {
name: '8ball',
description: "Tells you random answers",
execute(bot, message, args) {
//const prefix = 'h!';
let question = args(1).join(" ")
if (!question) {
return message.reply("Please ask a question")
} else {
let responses = ["It is certain.", "It is decidedly so.", "Without a doubt.", "Yes - definitely.", "You may rely on it.", "As I see it, yes.",
"As I see it, yes.", "Most likely.", "Outlook is good.", "Yes.", "Signs point to yes.", "Reply hazy, try again.",
"Ask again later.", "Better not tell you now.", "Cannot predict now.", "Concentrate and ask again.", "Don't count on it.",
"My reply is no.", "My sources say no.", "Outlook not so good.", "Very doubtful."
]
let Response = responses[Math.floor(Math.random() * (responses.length))]
let embed = new Discord.MessageEmbed()
.setTitle('8ball')
.addField(`Your question:`, question)
.addField(`Reply`, responses[Response])
.setColor('RANDOM')
//.setDescription('Your question: ' + question + "\nMy reply: " + Response)
message.channel.send(embed)
}
}
}
your feeding response into Response into responses
is there any reason your doing that?
I can't have the same name?
O one thing i noticied as woo mentionedx
your already getting text with Response then feeding that into responses again
responses[Response] replace this with response
capital R
so just Response basically
Reponse
Yeh
wait lemme try something
which is why good variable names is so important
the codes practically unreadable because you have
response
responses
Response
or to be fancy ${Response}
and remove this line: .addField(Reply, responses[Response])?
just replace responses[Response]
with
Response
.addField(`Reply`, Response)
also, is Response sounding weird to anyone else
okay

And btw her problem was it cannot read question
nah, just have said response so many times that it sounds weird
const Discord = require('discord.js');
module.exports = {
name: '8ball',
description: "Tells you random answers",
execute(bot, message, args) {
//const prefix = 'h!';
let question = args[1].join(" ")
if (!question) {
return message.reply("Please ask a question")
} else {
let responses = ["It is certain.", "It is decidedly so.", "Without a doubt.", "Yes - definitely.", "You may rely on it.", "As I see it, yes.",
"As I see it, yes.", "Most likely.", "Outlook is good.", "Yes.", "Signs point to yes.", "Reply hazy, try again.",
"Ask again later.", "Better not tell you now.", "Cannot predict now.", "Concentrate and ask again.", "Don't count on it.",
"My reply is no.", "My sources say no.", "Outlook not so good.", "Very doubtful."
]
let Response = responses[Math.floor(Math.random() * (responses.length))]
let embed = new Discord.MessageEmbed()
.setTitle('8ball')
.addField(`Your question:`, question)
.addField(`Reply`, Response)
.setColor('RANDOM')
//.setDescription('Your question: ' + question + "\nMy reply: " + Response)
message.channel.send(embed)
}
}
}
i think it was because it was trying to read response[Response] as a property
o
which should be solved now
p
const args = message.content.slice(prefix.length).split(" ");
which should be solved now
But tbh question comes before it and response is declared after it
and it cannot read question
But maybe i am wrong
day 3 of html coding, anyone know how make a object to show a embed on discord?
[number]
reads as an array
[string]
reads as a property
day 3 of html coding, anyone know how make a object to show a embed on discord?
You wanna learn html or discord.js/discord.py
which i believe is why arrays are actually objects if you typeof them
Cannot read property '1' of undefined
@earnest phoenix worked?

o
guess not

can you show the part of your main where you execute your commands?
command.execute()
const command = args.shift().toLowerCase();
const commandFiles = `./commands/${command}.js`;
if (fs.existsSync(commandFiles)) {
require(`./commands/${command}.js`).execute(message, args);
} else {
message.channel.send("error, not found");
}
hello i need help im new to bot and stuff soo idk how to remove undefind text from embeds
.execute(message, args);
execute(bot, message, args)
your setting bot as message
message as args
and args as null
so you cant read property [1] of null
or undefined
Me:
if (m.getContent().orElse("").startsWith("test")) {
Eclipse:
Unlikely argument type for equals(): String seems to be unrelated to Optional<String>
I'm not even calling equals(), are you drunk Eclipse?
But then when i did args[0], i had an error too
I have defined it in main tho
they need to be the same
.execute(message, args);
execute(bot, message, args)
yeah but your not passing it correctly to the function
Is
if (!message.author.webhook) return; the correct way to ignore webhooks in d.js? I'd try it and see but I don't have a webhook to test
oh
i think its actually just
message.webhookID
if(!message.webhookID)
args[0].join is not a function
Thanks
can i see your updated execute function and command.execute?
args[0] is not an array, its an item from the array
.join() only works on arrays
with [0] you're extracting an item from it, so its not an array anymore
wasnt even an array in the first place 🤷♂️
So i didn't change anything in that command.execute so it's just like
const command = args.shift().toLowerCase();
const commandFiles = `./commands/${command}.js`;
if (fs.existsSync(commandFiles)) {
require(`./commands/${command}.js`).execute(message, args);
} else {
message.channel.send("error, not found");
}
i just removed 'bot' in that 8ball file
okay, then yeah. what tim said now
thats not a good way to check if the command exists, but oh well
the problem is not there
the problem is in the command itself
or maybe before that code
where you define args
where do you use args[0] ?
In main ```js
const args = message.content.slice(prefix.length).split(" ");
Hmm not anywhere
then its inside the command
well it has to be somewhere
otherwise there would be no error about .join not being a function
whats the full error?
most errors tell you the location of the error
Oh it says in main and 8ball
TypeError: args[0].join is not a function
at Object.execute
^ this is in 8ball
now it wouldn't make sense to join a string, would it?
you would join an array instead
change args[0].join
to args.join
🤷♂️ i did that at the begining
What does Promise { <pending> } mean?
promise is pending
it's a promise that's pending
bruh where can i install java 13 because oracle requires me to login and i cba
openjdk
kl ty
Oh yes it works!
Thanks guys
wait nm openjdk doesn't have j13
yeah
nm
they do in the archive
where's that
wrong chan
A lot of people still use Java 8
doesn't justify you using it lol
oh nvm found it
wait what imagine using java 8
Also since Java 9 on, there were a lot of changes that break things
Also I've been using it for years
I've just been too lazy to update it lol
It works fine
it does not 💀
There is no incentive for me right now to switch
there have been many performance updates including GC improvements
and java 10 got var
I dislike non typed variables
Yes there okay, I've used JavaScript
I just don't care for them
Well I gtg
I'm at work lol, just getting off break oof
What's typescript
so, how can i get channels's id, created by
GuildChannelManager.create()
What's typescript
@earnest phoenix https://www.typescriptlang.org/
TypeScript extends JavaScript by adding types to the language. TypeScript speeds up your development experience by catching errors and providing fixes before you even run your code.
if you like types
if you like typed code, sure
will it break my current code
typescript does not interpret js files
you will have to convert them all to ts files, in which case, yes
everything will need to be typed
Hey I can't ping tim
interpret?
Hey I can't ping tim
@delicate shore f
goto his astro dev server
Then ping
he probably will reply faster there
@quartz kindle where r u from ?
Lmfao
@earnest phoenix
they're technically a testing environment but they don't care if you use them for production stuff
pricing?
@zenith knoll free
o
Peace out and .......
Buh-bye
real vps is better
but you can upgrade for more stuff
real vps much better
^
hmm
as its 24/7
not just one day
Discord is lagging a lot for me
then off for 3 mins
then a day
@delicate shore same, i'm noticing high ping on my bot too
Oh nice to hear I'm not alone xd
Only go above that like once a month
Lmfao
star this for good luck
lel
lol
My first bot ping is high second is fine
Thanks for the helpfulness
Also it's 12 am here
I gotta sleep before my mom comes
Good night 🥱
12:30 to be exact
Name a user dumb enough to make two feature rich AF multi purpose bots even tho one is fine
@delicate shore is the guy
@delicate zephyr I'm being bullied for being stupid in here
@honest perch by who
yes
But what's the point
but ts is going to know that it's a string so you don't have to implicitly apply the type iirc
so you can have typed code
So whats the point of having types on general
Sorry
Is portuguese
you can identify runtime issues (with types) without going into runtime, statistics have shown that typescript had reduced amount of bugs caused by results by ~15%, and typescript compiles down to "proper" javascript
and ESNext support
my embed doesn't work :(: const Discord = require ('discord.js'); const embed = new Discord.MessageEmbed () .setTitle (" Commands ") .setColor (" # 15f153 ") .setDescripition (" bla " ) message.channel.send (embed);};
this is really unreadable, do you mind formatting it?
so, how can i get channel's id, created by
GuildChannelManager.create() ?
Smfh
you can await the .create
and then use .id on it
Is it looks like
ch.id```?
await guild.channels.create().id?
no i mean use let, not var
no, the first one was correct
Oh
let ch = await guild.channels.create();
it doesnt matter if you use var or let, but let gives you protection against accidentally replacing an existing value, while var doesnt
https://hasteb.in/vucawuki.cs Why play my bot not a music?
i don't know, try asking it why it not a music
generally, use let unless you need var for some reason
@low phoenix, you have to init broadcast and dispatcher after connecting to voice
@hybrid roost also connection.play(broadcast); to connection.play(dispatcher);
@buoyant orchid's bot @rocky zealoteer cat got declined for nsfw content
oof i pinged some random guy
ehm
sorry
😂
So, it is not working
are you in an async function
you need to use the async keyword to make the function that you're trying to use await in asynchronous
@pure saddle
e.g
async function test() {
await eee.eee()
}
@earnest phoenix check the channel description please
Hi
do not ping people randomly
?
How do I make my bot leave a specific server using eval?
lib?
yeah so you need to search for the guild first so you can run the .leave() function on it
Wdym search for it
all guilds are cached, so you need to search through the guild cache
so how are you identifying it by? id?
Ye
Last time I tried to produce a list of server's it provided an error, I don't remember the error tho. It was a couple weeks ago
so you would do client.guilds.cache.get(GUILD_ID) to search for it
and then store that value, or just do .leave(); on it, to make it leave that guild
and now?
why delete?
your ip is private
dont share it randomly
still private unless you have a website
okay?
so dont share it
kann i write without ip?
https://hasteb.in/iqebifid.cs why say no such file or directory 'C:\Users\Administrator\Desktop\BaseRadio-DC\http:\mybestprivateipwhyidontknow/baseradio_128kb'
better xd?
is there a file there?
did you ask it to open a file?
i write fs.createReadStream('And here the stream url')
fs is for reading files
playing? probably a dispatcher?
getting? lavalink or ffmpeg or something
how can i get custom status
for a bot? I've seen setting a game or a watching status
could someone help me figure out how to upload random memes from /r/dankmemes?
What ist type type for a broadcast.play mp3?
@fierce stag using the reddit api?
i need help making a blackjack command
whatcha need storm?
I need some help with a blackjack command
okay
client.on("message", async (message) => {
if (message.content.startsWith(config.prefix + "badmeme")) {
const api = require('imageapi.js');
let subreddit = "dankmemes"
let redditImage = await api(subreddit)
let dankEmbed = new discord.MessageEmbed()
.setTitle(`Random meme from r/${subreddit}`)
.setURL(`https://reddit.com/r/${subreddit}`)
.setImage(redditImage)
.setColor("#0099ff")
message.channel.send(dankEmbed)
}}); ```
I was using this, I found it in this server and modified it a bit, it sends images just fine but half the embeds are blank due to videos from the subreddit
I am making a major bot that has currency, moderation, music, much more
okay, but what specifically about blackjack do you need help with
anyone know why the remote ssh keeps asking me to put in my password although i have already
I need some code
Sorry
we dont give code here
no spoonfeeding
Ok
thanks though

Can you give me a site/vid where it teaches you how to do that?
i mean most of a blackjack command is just implementing rules
i think commando or d.js guide has something along those lines
@solemn latch defined it above as imageapi.js
I use got for images, it is pretty simple
got module
Can someone say How long i need wait to get my bot approved?
3-4 weeks
4+ weeks from submission
@earnest phoenix https://www.youtube.com/watch?v=1A14eyfh8Fs i would NOT recommend doing it this, way, its better to properly learn a database and do the logic yourself, but thats a rough gist
this is mainly to learn what you should do, not something you should copy, which is likely outdates
I dont copy
youtube videos are horrible for learning
bruh
'give code'
how do i send a custom emoji inside of a text message
honestly, just pulling up a page about blackjack rules and implementing each rule one by one is pretty straight forward
"give code"
<:name:id>
I need some code
bruh
^^
just keep that in mind, dont copy that as its likely outdated
just learn from the framework
const threehead = message.guild.emojis.find(emoji => emoji.name === "3head");
Only YouTube videos you should be watching about programming are ones from trusted sources like freecodecamp, CSDojo, TravesyMedia, etc.
And even then, you should only really watch the ones that actually teach you a language
i'd always recommend docs instead
why doesnr message.guild.emojis.find() work
docs are updated constantly, youtube videos are hard to make a new on on every update
Yeah, that's why I'd only suggest it for actually learning a language, especially if you are more of a visual learner who needs someone to execute examples, etc.
djs 12 requires you to use cache to find @worthy glacier
its kinda hard to find a good framework on github,so i sent him that video to show a basic idea of what framework he should be using
when i use cache it says cant read property find of undef
on djs 11?
when i go back to the djs 11 docs, its amazing how much cleaner having managers actually is(djs 11 is messy)
if your on v11
find doesnt take a function i dont think

have you done remote manual requests?
No reports of webhooks not working so 🤔
you saw in #topgg-api right?
Last blind guess. DId you make sure to press "Save"? 
100% did lmao
aye
have you tried using someone elses code?
a wot now?
i just used the snippet provided in the docs, nothing that should not work

inb4 webhook auth issues
i remember him showing leviBeta as his auth
should work with blank, no?
def upperCase
i might switch the auth code to just a
just to make sure its not lowerCase'ing it
Send me the full URL in DMs
aight
help ?
SyntaxError: Identifier 'user' has already been declared
at wrapSafe (internal/modules/cjs/loader.js:1053:16)
at Module._compile (internal/modules/cjs/loader.js:1101:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
read the error
thx
i saw that but what do i do then
if im aning a user i have to use user
baning
We literally cannot help if you don't post ur code, so I'm going to go & work on my project
Perhaps someone else can help
k
done
case 'kick':
const user = message.mentions.users.first();
if (user) {
const member = message.guild.member(user);
if (member) {
member.kick('You have been kicked!').then(() => {
message.reply('The has been successfuly kicked!');
}).catch(err => {
message.reply('I was unable to kick the user. (Are they a higher rank? Do I have kick permssions?');
console.log(err);
});
} else {
message.reply("That user isn\'t in this server")
}
} else {
message.reply("You need to mention a user!")
}
break;
case 'ban':
const user = message.mentions.users.first();
if (user) {
const member = message.guild.member(user);
if (member) {
member.ban('You have been Banned!').then(() => {
message.reply('The has been successfuly Banned!');
}).catch(err => {
message.reply('I was unable to Ban the user. (Are they a higher rank? Do I have ban permssions?');
console.log(err);
});
} else {
message.reply("That user isn\'t in this server")
}
} else {
message.reply("You need to mention a user!")
}
break;
see
use hastebin plox
^
wdym
Few things you should know if you want to ask for help btw: @earnest phoenix
- Post ur code into something like https://hastebin.com/about.md so its formatted & doesn't spam chat
- Give us traceback, & tell us the EXPECTED outcome, not just "dis don't work"
- Don't ask to ask
I don't want to sound rude, but you'll get much more help if you follow these 3 things
https://hastebin.com // https://paste.mod.gg (mirror)
oh
cant even put there
it says something gone wrong
it looks like your just doing const user;
in every case.
why dont you just do const user once before the switch case?
hey everyone
oh
every time i run my bot half of the index file gets deleted
whats the v12 replacement for message.client.users.get
also, why not just get the member
const member = message.mentions.members.first();
since when is message.client a thing
ok
never used it
its really nice, no need to pass your client everywhere
anyway i have a seriously bad problem
f
everytime i run the bot half of the index file gets removed
i haven't the slightest clue why
oh man that sounds super annoying
psa, use git just for these kinds of weird things 
all i've done recently was:
separated all of my commands into subdirectories for easy organizing
change the way it gets the command files because of this (i reverted this but it still doesn't work)
i know i know but this is just a small bot so i didn't bother
how can i fix thix problem please
it always give the same result
can we see your main file?
preferably in hastebin or something.
maybe only the sections that could lead to it?
@dense patio
index.js?
yes
let first = message.mentions.roles.first();
let second = message.mentions.roles.map(r=>r)[1]
message.channel.send(` (first mention:${first})
sencond mention${second} `)
its not in order
all i've changed was the way the files are read, i'll put both methods i've tried into a hastebin
which is why you shouldnt use message.mentions.x.first() unless your only expecting one mention
wdym
typically, regex
i tried to use it but the same problem
it return the same result just with id
*te mention mention
let first = regex the first arg
let second = regex the second arg
then get the users from there
https://pastebin.com/wRZbuXKx here's the file reader @solemn latch
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
i changed a couple things for readability so something might be broken but both work for their intended purpose
hellp
the newer one worked too for my first few runs, i was trying to fix another problem when it suddenly said "unexpected end of input", and i was like what? so i reopened the file and saw that half of it was gone
Waiting for the debugger to disconnect...
c:\Users\jdkdbdkdb\Downloads\index.js:53
if (user) {
^
ReferenceError: Cannot access 'user' before initialization
at Client.<anonymous> (c:\Users\hfkdbsdkd\Downloads\index.js:53:13)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (c:\Users\jdjdbdh\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (c:\Users\djfbfjdbfn\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (c:\Users\jfbfjdbsdjf\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
at WebSocketShard.onPacket (c:\Users\jfkfbdfjed\node_modules\discord.js\src\client\websocket\WebSocketShard.js:436:22)
at WebSocketShard.onMessage (c:\Users\jdjdfbgkf\node_modules\discord.js\src\client\websocket\WebSocketShard.js:293:10)
at WebSocket.onMessage (c:\Users\jdkdbfjf\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage (c:\Users\jfdfkdbd\node_modules\ws\lib\websocket.js:797:20)
cant use user before you define it
only the first part of the error messages are important btw
ok
if(user)
const user
will error
same with member
yup
const user = message.mentions.users.first() || message.author;
how to i update this to v12
that works in v12
@solemn latch should i declare regx or what ?
then why doesnt .setImage(user.avatarURL) work?
replace avatarURL with avatarURL()
do you know anything woo
send the code in question
let regex = /[^<>@]/g;
let first = regex.args[0];
let second = regex.args[1];
like this ?
Woo knows quite a lot
thanks @dense patio
np
send the code in question
@dense patio i alredy did
oh ok
im trying to become tim @misty sigil 
i got like 3 people asking me questions 🤔
Doesnt d.js have statics for regex?
please help
yeah
@solemn latch so ._.
@earnest phoenix what do you need
Waiting for the debugger to disconnect...
c:\Users\jdkdbdkdb\Downloads\index.js:53
if (user) {
^
ReferenceError: Cannot access 'user' before initialization
at Client.<anonymous> (c:\Users\hfkdbsdkd\Downloads\index.js:53:13)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (c:\Users\jdjdbdh\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (c:\Users\djfbfjdbfn\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (c:\Users\jfbfjdbsdjf\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
at WebSocketShard.onPacket (c:\Users\jfkfbdfjed\node_modules\discord.js\src\client\websocket\WebSocketShard.js:436:22)
at WebSocketShard.onMessage (c:\Users\jdjdfbgkf\node_modules\discord.js\src\client\websocket\WebSocketShard.js:293:10)
at WebSocket.onMessage (c:\Users\jdkdbfjf\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage (c:\Users\jfdfkdbd\node_modules\ws\lib\websocket.js:797:20)
this
code?
you don't need to send the whole thing !
the error here is quite obvious
then say please
in the code they send, user was defined before the statement
honestly, i dont see how this code could be deleing anything. i think someone else will have to take a look @dense patio
you're trying to use user before it was defined
if you just showed some code we could tell you how to fix it easier, but you're using user before it's defined
mg i altredy showed
send it again on another website
case 'ban':
const member = message.mentions.members.first();
if (user) {
const member = message.guild.member(user);
if (member) {
member.ban('You have been Banned!').then(() => {
message.reply('The has been successfuly Banned!');
}).catch(err => {
message.reply('I was unable to Ban the user. (Are they a higher rank? Do I have ban permssions?');
console.log(err);
});
} else {
message.reply("That user isn\'t in this server")
}
} else {
message.reply("You need to mention a user!")
}
break;
there
you never defined user...
also 2 const statements
read my messages
@dreamy cedar that last regex you sent will match any character that is a ^, <, > or @
:(
Also that, you have const member being defined twice
mentions are sent in the form <@userid>
Nice spam
please just send one message
no its me being mad
Yeah, we can tell you're having a tantrum
please just send one message
@sonic lodge ok
you are misunderstanding what your being told
keep it civil
ok
what your error is saying is that you are using user BEFORE you have defined it.
to solve it, move your variable definition (let user = ...) above the if statement.
people like culpas dont deserve help
dude
what your error is saying is that you are using user BEFORE you have defined it.
to solve it, move your variable definition (let user = ...) above the if statement.
@karmic compass @earnest phoenix
lol
const user
if(user)
^ works
if(user)
const user
^^^ doesnt work
my head is with a big headchik thats y im mad
Multiple people helping at once doesn't help
the program evaluates your code from tip to bottom
no
you sure?
yes
i saw that you defined user within a command case
@slender thistle the issue is that he cant accept that the solution we tell him is the solution...
ill come back when things are calmed down
It shouldnt need to be repeated more than once that "cannot access before initialization" means you're using it before it's defined.
yeah true
dude ima just go away and search beter helpº
you'll get the same answers
The side issue is that there's too many people here trying to explain it
you'll get the same answers
@earnest phoenix no they are teling me the same 1000
times
yeah exactly
maybe that's the solution??
Just because you refuse to accept help doesn't mean it's bad
i alredy said i dint define user multiple times
You never defined it
alright
good to know
let's start from the beginning
Why are you still trying if they clearly refuse to listen
i'm procrastinating fixing my own problems
^^^^ me
@earnest phoenix paste your entire code here:
https://pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
....
na leave him be
Some people can't even help themselves, just gotta learn when to leave it at that
I don't mean to be rude but just ignore him, & he'll go waste someone elses time since he refuses to listen

dude
i alredy told you i didnt define user multiple times
wassup :))
ima post the whole code and youl see
why does this not register
that's what i just said
> I didn't define user
> Tries to use it in code
> doesn't work
> surprised_pikachu.png
@worthy glacier what do you mean by not register
use ids
@worthy glacier it’s a member vs a user
or that
Could someone help me? I have a command that pulls memes from /r/dankmemes, but the videos are appearing as blank in the embeds - https://pastebin.com/DF1gVYPL
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
@worthy glacier cuz it is a object
and that
@worthy glacier console.log and u will see ur error
i thought you couldn't put videos on embeds?
^ Same
exactly, how do I prevent my code from pulling videos? and just images
here
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
console.log(message.mentions.members.first())
meme boy
oooh so .members is different from .users
Is it actually scraping the pages? Or is it using an API? @fierce stag
filter for posts that are video
oooh so .members is different from .users
@worthy glacier yea
@earnest phoenix using imageapi.js, the code is here https://pastebin.com/DF1gVYPL
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
may i ask how long you've been coding for @earnest phoenix ?
1 month
😬
@earnest phoenix you could use
message.mentions.members.first();
rather than
message.mentions.users.first();
and skip the
if(user) and const member = message.guild.member(user); lines
Error: Shard 0's process exited before its Client became ready.
this is so vague
it literally tells me nothing
worlds best error
i reverted all of the changes i made to the command folders
so it's just like it was an hour ago
but now i'm getting this
oh
the entire index.js is empty
well that explains it
lmao
bruh
bruh
what could possibly be causing this
bruh how is that happening
i haven't done anything that would even remotely touch the index file
was anyone able to look at my code and think of anything?
what did you need help with?
that lib doesnt really explain whats returned completely
https://pastebin.com/DF1gVYPL my code is pulling images aswell as videos from /r/dankmemes, and videos cant be embedded, how to fix?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
if it returns the format(mp4 gif png etc)
you should check if its an unallowed format and re-search if it is



