#development
1 messages ยท Page 1440 of 1
do undefined.prototype.[null] see what happens pls
return ""
i wonder if you can even do retarded shit like that
Error moment
idk if js shields against smart idiot devs
smart for knowing what prototype even does
undefined has no prototype
Neither null
trying to cause errors when undefined happens
Everything other than undefined and null has a prototype, i think
true false dont
nor process
i just tried
there goes my idea of fucking with every empty array
can i legit not break shit with this?
You gotta access it's constructor however
oh good call
Wait what does Boolean.prototype.valueOf() even do
let dbData = readDB();
dbData[collection][key] = data;
writeDB(dbData);``` how can I make this look nice?
Uhh, is it not nice enough?
Uh oh no pg_hba.conf entry for host "71.234.227.103", user "root", database "exo", SSL off
This is what I get when I try to connect to my ubuntu postgresql database from popsql
does anyone know why?
true
Configure your hba file
It's in etc/postgresql/
Ig
On the bottom add 0.0.0.0 host
const fs = require('fs');
const path = require('path')
class DB {
constructor(path) {
this._path = path.resolve(path);
if(!fs.existsSync(this._path)) throw 'Specified path does not exist.'
try {
this._data = JSON.parse(fs.readFileSync(file, 'utf8'));
} catch (err) {
this._data = {}
fs.writeFileSync(file, '{}', 'utf8');
}
}
readDB() {
try {
return JSON.parse(fs.readFileSync(this._path, 'utf8'));
} catch (err) {
throw 'An error occured when reading from the DB\n' + err;
}
}
_writeDB(data) {
if(!data) throw 'Tried to write to DB without any data.'
try {
data = JSON.stringify(data);
fs.writeFileSync(path.resolve(__dirname, 'tmp/data.json'), data);
fs.renameSync('tmp/data.json', this._path)
return true;
} catch (err) {
throw 'An error occured when writing to the DB:\n' + err;
}
}
saveToDB(collection, key, data) {
if(!collection) throw 'Tried to save to DB without a collection name'
if(!key) throw 'Tried to save to DB without a key'
if(!data) throw 'Tried to save to DB without an data'
let dbData = readDB();
dbData[collection][key] = data;
writeDB(dbData);
return true;
}
clearDB(boolean) {
if(boolean !== true) throw 'Tried to clear DB without a true boolean.'
writeDB({})
}
}```
I think it looks good
I did https://blog.bigbinary.com/2016/01/23/configure-postgresql-to-allow-remote-connection.html I followed this article.
conflicting vars
fuck
Follow digital ocean steps, their setup tutorial is good af
ty
can you send me the link
Search in Google
changed it to databasePath
It'll be first 2 links
if(!fs.existsSync(this._path)) throw 'Specified path does not exist.'
try {
this._data = JSON.parse(fs.readFileSync(file, 'utf8'));
} catch (err) {
this._data = {}
fs.writeFileSync(file, '{}', 'utf8');
}
``` you're throwing an error if it doesnt exist, then creating it if it doesnt exist
o
Postgresql setup ubuntu VERSION
true I just assumed it was checking it had a readable data
ok I gtg eat
@ me if you have any other changes
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-18-04 @lyric mountain ?
this one?
@lyric mountain It doesn't say anything about pg_hba.conf
it's just like how to create users, table, databases, etc
You sure?
What are you trying to setup?
my pg_hba.conf and postgresql.conf file to allow connections from popsql
Did u follow their setup steps?
No need to ping btw
ok
I'll try that out
would the hostname of my database be the ip address?
@lyric mountain
It'd be 0.0.0.0 ig
oh ok
To accept all incoming connections
no but like in my popsql connection page
Use 127.0.0.1 if you want to accept only local connections
I have popsql on my computer and the database is on my vps
0.0.0.0 then
That'll accept only ipv6
Use 0.0.0.0
0.0.0.0/0 ?
No, only 0.0.0.0
ok
Uh oh connect ECONNREFUSED 207.246.87.164:5432 this is what I'm getting from popsql
Is port 5432 open?
how do I check if it's open?
Ufw status
it says status: inactive
should I do ufw allow 5432? I don't remember the exact command.
You're running without firewall then
Well, idk if Ubuntu has another kind of built in firewall
Apart from ufw
Anyway, that ain't the issue then
oh ok
I can't connect to the database from psql either
Not even from inside the vps?
I'll show you it
which part do you want to see?
Is your postgres a fresh install?
That looks like some missing file
it'll work if I change it back
If you do sudo -i -u postgres then psql does it connect?
Probably corrupted files then
Either that or missing
Export the database then try reinstalling it
yeah I think so
Comment the 0.0.0.0 line to see if it works again
it's systemctl restart postgresql right?
Ah, mb, it does have /0
oh ok
That's my hba file
I'll add that
@lyric mountain it worked! Thanks!
Yw
if (!args[1]) return message.reply("Not a valid code.")
db.fetch(`premium_code`)
if (args[1])```
kinda stuck here
im trying to make it so it checks if args 1 is a valid premium_code
nvm
how come this happens
if (!args[1]) return message.reply("You did not specify your code!");
Because args[1] is null
how come this doesnt work
db.delete(`premium_code`, args[0])```
its letting me claim the code multiple times
also, even if i generate more than one code, it overrides
It overrides because it can only have one key-value pair
const pcode = db.fetch(`premium_code`)
if (!args[0]) return message.reply("You did not specify your code!");
if (args[0] != pcode) return message.reply("Not a valid code.");
if (args[0] === pcode) return message.channel.send("You have sucessfully redeemed your code.");
let user = message.author
db.set(`premium_${user.id}`, "true")
db.delete(`premium_code`, args[0])
}```
full code
oof
how would i make it so
it does like
code1, code2
etc
or actually
You need to store an array in that key
multiple values
let pcode = makeid(20)
db.set(`premium_code`, pcode)
message.author.send('Here is your premium code: ' + pcode)
}```
function makeid(length) {
var result = 'PREMIUM-';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}```
thats what i have rn
That'll override
oof
how would i make it so it increments
so like
code1 - code
code2 - code
etc
You need to store as an array
well tbh even if i did do that
id have to fetch all codes in redeem
how would i do that
You ๐ store ๐ an ๐ array
wait
I question if that makeid function is very secure
db.set('myItems', ['Sword', 'Lock'])
// -> ['Sword', 'Lock']
db.push('myItems', 'Dagger')
// -> ['Sword', 'Lock', 'Dagger']```
wdym secure?
eh nvm
it just generates a code lol
was thinking of something else
You could just generate a hash from the timestamp or something
But that's another story
o i have an idea
db.push('premium_codes', args[0])
im pretty sure
that would work
No
Still a common key-value
Imagine thw following
Your premium-key is a cup
You can only put one juice in it
o
To put another juice you need to empty the cup first
OR you use an array, which would be a multi-fruit juice
Still one juice, but N fruits
this is giving bigint errors
but i thought the LEAST would stop that
can someone please help ๐ฉ
HOW TO RANDOM AN ARRAY
is it ```js
const result = array[Math.random((Math.floor()* array.length))]
why that doesnt work
Math.floor and Math.random should be swapped.
Math.floor rounds a number down. Math.random generates a random decimal point between 0 and 1 (exclusive).
You also don't need two parentheses (()) around your multiplication. Only one.
im still confused on how to add multiple values to premium_code
if i were to make an array
how would i have it set in the db
idk
How do I check if there is a duplicate array in an array?
[[1,2][3,4][1,2]] //true```
there is no easy way to do that if the arrays are separate references
you'd need to do something like map(x => x.join())
You'd need to iterate over every element in the inner arrays and see if they end up matching
It's painful
Or flat map, then iterate with the index to see if the other array has the same value
and stored the codes in the table
then checked for the codes in the table
doubt thatd work tho
How do I check if an array is inside an array?
@sterile lantern data is serialized when stored to a database, meaning an array or object must be converted into a json string
of course you can
you just need to think in terms of stringified data
but if you1re going for SQL, its better to create a table for it, and add each code as a separate row
sql is sqlite or are those different
again, no easy way to do that if the arrays are separate references
array sucks
you will need to convert the arrays to strings and then use indexOf or includes
or use .some()
for example
[[1,2],[2,3]].some(x => x.join() === "1,2") // true
its not that arrays suck, its how arrays work in js
right
each array is a reference to some data in memory
two different arrays are two different locations in memory, even if their contents are exactly the same
wont that return a false positive?
Sql is a totally different world for those used to mongo
[[1,2][3,4]].some(x => x.join() === "2,3") // true
But it's goddamn powerful
no, that would be false
let array = ['pcode',];
let string = array.join(',');
db.set('premium_codes', string);```
i made an example thingy
but
Yeah, that's a CSV array
You just need to split it for usage
Append
and would that update the db automatically?
no
A csv is a simple collection of strings separated by commas
value1,value2,value3...
To extract an array from that just split by commas
Then push the new key to the array
And join with commas again
aaa this is complex
Not at all
you could simply make the code itself part of the key
part of the key?
OHH yeah ik what u mean code(code here), "not claimed"
or honestly
what if i just store the code
with not claimed as a value
and check if that is in the db
let newcode = "abcdef"
db.set(`codes_${newcode}`, true);
if(db.get("codes_abcdef")) { do something and then delete it }
let pcode = makeid(20)
db.set(`code_${pcode}`, "not claimed")```
maybe i shouldnt use pcode twice one sec
once a code is used to you delete it? or do you keep all used codes saved?
then you dont need "not claimed", its easier to just set it to true
You never know
There's a reason why big businesses will keep all your input data even if you "delete" or replace it
Be it for analysis or defense against complaints
or just selling it 
i love how companies are legally required to say they protect your data and don't share it with anyone
but we all know that behind the curtains it's being sold and shared with other companies & services
cough discord
@quartz kindle could you explain what a .d.ts is used for and how to write it
or anyone tbh
How do I check if an array inside an array has a duplicate?
[[1,2],[3,4],[3,4]] //true
[[1,2],[3,4],[5,6]] //false
this is a good detailed answer https://stackoverflow.com/questions/7376598/in-javascript-how-do-i-check-if-an-array-has-duplicate-values
No, because it's an array not a string nor a number
write your own function that compares two arrays
@quartz kindle Can you help me on how to check if there is a duplicate array in an array of arrays
write your own function that compares two arrays, then use it to compare the arrays in the first array of arrays to the second array of arrays
that solution is a good one
loop through every value
add the value to an array
check if the array has the value
if it does return true
otherwise return false
do you host the site?
How do I check if an array inside an array has a duplicate?
[[1,2],[3,4],[3,4]] //true
[[1,2],[3,4],[5,6]] //false
What's the use of lavalink?
I can directly play songs with ytdl
Why user user lavalink?
could someone help if they have a chance
are you using nginx?
yes
check to make sure you aren't redirecting to ssl on ssl or something
make sure you aren't redirecting more than once
im using cloudflare if that means anything
It shouldn't
tbh not sure
what did you change to create the error
nginx or code?
or just setting up
id have to ask the person who changed it
i know it had to do with
changing from certbot to ssl certificate
oh
but he messed up somewhere
do you know anyone that could help me?
Tim could probably but he is still afk
do you know nginx woo?
i know a touch
looks like a redirect loop? maybe? ๐คทโโ๏ธ
do you have a redirect, pointing to a redirect, that redirects to the first redirect?
but whoever did messed up
i dont think so, this all worked before he did this
changed it
you dont happen to have a git(or other version control) of the changes he did?
Why are you forwarding it tk same url
^
With $1
whcih one
See the pic
1st and 3rd
Also https doesnt matter much
Change https with nginx
Not dns redirect
dont know how
how to set background colour of the bot page?
@blissful axle (pinging other dev)
Woo still here?
i may be sup.
ok do you know anything about .d.ts?
i dont know much about typescript
i wish i knew this
um weird
when i use www.
is this a page rule problem?
or a dns record
page rule
or nginx
k yeah bc it was working
wait page rules is cf
was
yeah that is nginx issue
Wait a min
i didnt do this part of the website
First you redirect all port 80 to https
How do I check if an array inside an array has a duplicate?
[[1,2],[3,4],[3,4]] //true
[[1,2],[3,4],[5,6]] //false
wdym
You will have to edit nginx config
where?
To setup these
sorry for all the dumb questions
oh fun, let me come up with a solution for tim to show up with a 10x cleaner and 100x faster solution.
@carmine summit loop through the array
@carmine summit what language?
js
bet
@cerulean ingot use search engine according to your need
If you fail let me know
First try
It's easy
no i just dont know how to get to nginx config
You are using which os?
ohhhh
for(let i = 0; i <= array.length; i++) {
if(secondaryArray.includes(array[i])) return true
secondaryArray.push(array[i])
}
return false;``` @carmine summit
thanks
um i dont have a nginx file
im using the pterodactyl panel for this website
jokes on you it doesnt work
Hey
and i can see it loading bc its redirecting so much
Get Hey
how to get name of guild which has X number og users or more
huh
what library do you use?
He uses discord.js
which version
got a question
ok cool
@cerulean ingot search where is nginx located
maybe
client.guilds.cache.filter(guild => guild.memberCount > 400000)
thakns
The subtle art of using a search engine
that returns an array
@cerulean ingot https://pterodactyl.io/panel/0.7/webserver_configuration.html
The open-source server management solution.
It's there on top
omg i finally found it
thanks but i got it
/etc/nginx
dont have any idea what to do though :)
it should be an array right?
@cerulean ingot nginx has a default page setup
it returns [object map]
So you configure it for your website
So i have a staff server where staff has to run a command to accept an application but the user that submitted the application is not in that server because its a staff server. They are in the bots main server tho. If you do client.users.cache.get(user).send(message) it does not work because the bot cant send a dm to a user that is not in the server that the command is executed in so is there a way i can get the server they are in and send them a dm from that server?
discord.js
it should be .first() then
ok
client.users.parse(user).send()
no wait
Hi
Is there a way I can insert an image in the server description ?
wym?
no im busy
ig they still need to be cached ๐
so if i send a message in that server then will they get cached?
like if i were to do a awaitMessages type command
anybody know how to do the message latency?
what language
D.js
nope
like ping?
Yes
message.channel.send("Pinging...").then(m =>{
var ping = m.createdTimestamp - message.createdTimestamp;
m.edit(`Ping: ${ping}ms`)
});
OO ty
np
yeah
my bot is a quarter of a second which seems correct
idk how you cant test if its right but looking at the code it seems like it cant be wrong
Noo
Does djs not have a latency field in the client?
It does have it
https://github.com/Million900o/JSON-DB rate code Woo and flaze
you can use the websocket to get the ping
Is that for the websocket
then why did he use timestamp comparison lmao
for the json db competiton? 
nah, i think we force all the best devs to make their own jsondb, and we put them against each other.
no space
lmao
you know what
the code inspectors arrived
flaze
lmao
yes
pr my code with linting
hmmm
tomorrow I will be making an example
yo
it took me so many git pushes because I don't have node on my pc yet
question
yea
do u use py?
done
so umm
yikes
should I make different collections different files?
seems like a good idea
How do I check if an array inside an array has a duplicate?
[[1,2],[3,4],[3,4]] //true
[[1,2],[3,4],[5,6]] //false
I sent a link LOL
And then wrote out the code ish
loop over the array
Add each value to another array
Before that check if the array has the value
Return true or false
Use a for loop
function checkIfDuplicateExists(w){ return new Set(w).size !== w.length }
no
doesnt work
Yo guys is sharing code allowed
No
Ok
What?
So all you need to do is compare a set of an array with the array
Thatโs so smart
Lmao
i just got it off of stackoverflow lol
99% of people ik can barely install software without antivirus and people think of ideas like that
Ik ik i saw the stack overflow link
when I searched the question
oh
Oh
Okay never mind that doesn't work
that would have been so smart go
Tho*
Phones suck
What should i name my json DB?
jason
function checkDupes(array) {
const check = [];
for (const element of array) {
if (check.find(x => x.toString() === element.toString())) return true;
check.push(element);
}
return false;
}
checkDupes([[1, 2], [1, 2], [1, 4]]); // true```
hmm
Works for arrays and strings
What about objects
jason.db
capital J feels odd to me
Nope, [object Object]
Jason.db jason.db Jason.DB jason.DB
jason.db
Ok
Nice
:)
Means I can use it
Time to publish one so that you can't use it
poggers
@pale vessel help writing a lib is hard
always has been
i assume you don't know anything about it
Lib to connect to discord?
yes
I made a simple one
Nice
i'm only reiceving 3 events from socket
HELLO
GUILD_CREATE
READY
not getting anything else
bro did you specify intents
uh what
what api version? v8?
v6
Why is it not square anymore when I set it to 15x15, but in 14x14 it works fine? shutup im not a psycho!! im using light mode to count the squares
depends on the device?
ehhh?
Well make sure you arenโt like concating to a string
or the natural message wrap
what is the message wrap btw
if 14x14 works then just use that
but I wanna use 100x100
not really
@carmine summit yeah message wrap doesn't fit 100 characters on one line
Gn people of #development
dont do it like that
Gn
btw if i were to use canvas, id have to learn it and have a lot of patience
@pale vessel yeah i don't get this
var body = ''
for(lines = 0; 14 >= lines; lines++) {
body += ':black_square::black_square: ...` + '\n'
}
message.channel.send(body)
and this is 44x44
do my thing
weird amirit
let map = [];
for (i = 0; i < defaultX; i++) {
map.push("\n");
for (j = 0; j < defaultY; j++) {
map.push(["black", i, j]);
}
}
return map;
}```btw heres the code imm using
does discord api have endpoint to list all server which has add my bot?
can't find any in here https://discord.com/developers/docs/resources/guild
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
@pale vessel what did i borked
what doesn't work
as i said
yes
socket.on("message", (d) => {
const data: object = JSON.parse(d)
switch (data.op) {
case 0: console.log(data.t)
case 10: {
console.log("HELLO recieved.")
setInterval(() => {
socket.send(JSON.stringify({op: 1}))
}, data.d.heartbeat_interval)
login()
}
}
})
well,,,, it works!!!
eye rape :sadblob:
bro break your cases
nahh it will go over 2000chars
wdym break my cases
break;
hm
its just me being childish
whats the sqrt of 2000?
no nvm 44x44 is the highest it can get
btw do you prefer it raw or in a code block?
@pale vessel ah yes
busted data
how????
btw how do I get messages by id?
whitout channel id
if it requires a channel id welp
i don't think you can
you can if it's cached
cached?
you mean if its after the bot being run?
or cached that if its stored in a variable
what do you mean
did you enable compression
yes
Otherwise you need the channel
const id = "id";
const message = client.channels.cache.find(x => x.messages?.cache.has(id)).messages.cache.get(id);```
oohh look at that it works again ๐
thanks for the explaination
It finds the channel that has the message and get the message from that channel
client.channels.fetch(ins.channelId).messages.fetch(ins.messageId)
```Why is this returning undefined?
if(message.content.startsWith(prefix + "userinfo" )){
const user = message.mentions.users.first() || message.member.user
const member = guilds.members.cache.get(user.id)
console.log(member)
const embed = new MessageEmbed()
.setAuthor(`User info for ${user.username}`, user.displayAvatarURL())
.addFields(
{
name: 'User tag',
value: user.tag,
},
{
name: 'Is bot',
value: user.bot,
},
{
name: 'Nickname',
value: member.nickname || 'None',
},
{
name: 'Joined Server',
value: new Date(member.joinedTimestamp).toLocaleDateString(),
},
{
name: 'Joined Discord',
value: new Date(user.createdTimestamp).toLocaleDateString(),
},
{
name: 'Roles',
value: member.roles.cache.size - 1,
}
)
fetch is a promise
read the error, guilds is not defined
๐
indexOf and find the index
then .splice?
yup
huh
How do I call some code from an other script in index.js using a class?
I did require the script in index.js
constructor(client, message){
client_ = client;
message_ = message;
}
startDms(){
message_.author.send('Hello');
}
}
module.exports = dms;```
In index.js: `dms.startDms()`
Error I get: dms.startDms() is not a function
Does someone know how to do it?
Please teach me discord.js
Is there a way i can get the IP address of my heroku application?
ok but how can i use the commands
Read the docs etc
lol, im getting an odd pattern in my bandwidth usage of my bot
There's a getting started guide
past 12 hours
half a megabit per second?
I understood the commands where do I enter the commands?
You have to understand that they don't magically appear
Start here then I guess https://discordjs.guide/
i need help in using ejs
can i use this tag inside head tag in ejs file?
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
\โน๏ธ
@terse berry the method is on the prototype of the class
Nvm I got it
also you should create a new instance of it instead of calling the method on the class directly
Yea sure.
You can use this tag in head.
But currently there is latest version of fontawesome
5.15.1
?
lol
i was just using that for copy/paste
I've got a question
If I add an event listener for guildMemberAdd will it be fired when the bot itself is added to a server?
No
well is there a seperate event for when the bot is added to a server
Whats wrong here ? <img src="https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.jeep-official.it%2Fmopar%2F404-page-not-found&psig=AOvVaw264By3-yOx6seeyDNEjrGR&ust=1607677264266000&source=images&cd=vfe&ved=0CAIQjRxqFwoTCLD0l9WGw-0CFQAAAAAdAAAAABAD" height="345">
guildCreate
@earnest phoenix bruh that url is not an actual image
it's a redirect with some google tracker salt
tfw people can't even steal images from google properly nowadays ๐
xD
@earnest phoenix i canged url to https://cdn.discordapp.com/attachments/769978450986663966/786519680562364416/16075912781268967198454753146244.png
Still not working
show code
Um
how to fix this ?
and PLEASE stop using glitch
@dusky marten heroku bad
<h1 style="color:blue; font-size:50px;"> 404 Page Not Found </h1>
<img src="https:/https://cdn.discordapp.com/attachments/769978450986663966/786519680562364416/16075912781268967198454753146244.png">
Whole code is there
@earnest phoenix bruh momenti
does that url look normal with two protocols
yes, new protocol
Error: Unable to retrieve video metadata this is main error in my music bot
https squared
that name tho
ok wait
Calling `ytdl.getInfo` with a callback will be removed in a near future release. Use async/await. Error: Error parsing info: Unable to retrieve video metadata at getWatchPage (C:\Users\Mukesh\Desktop\hehe\node_modules\ytdl-core-discord\node_modules\ytdl-core\lib\info.js:75:13) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async exports.getBasicInfo (C:\Users\Mukesh\Desktop\hehe\node_modules\ytdl-core-discord\node_modules\ytdl-core\lib\info.js:84:22) at async Map.getOrSet (C:\Users\Mukesh\Desktop\hehe\node_modules\ytdl-core-discord\node_modules\ytdl-core\lib\cache.js:24:19) at async exports.getInfo (C:\Users\Mukesh\Desktop\hehe\node_modules\ytdl-core-discord\node_modules\ytdl-core\lib\info.js:226:14) at async Map.getOrSet (C:\Users\Mukesh\Desktop\hehe\node_modules\ytdl-core-discord\node_modules\ytdl-core\lib\cache.js:24:19) (node:43104) UnhandledPromiseRejectionWarning: Error [VOICE_PLAY_INTERFACE_BAD_TYPE]: Unknown stream type at VoiceConnection.play (C:\Users\Mukesh\Desktop\hehe\node_modules\discord.js\src\client\voice\util\PlayInterface.js:84:11) at play (C:\Users\Mukesh\Desktop\hehe\system\music.js:39:8) at processTicksAndRejections (internal/process/task_queues.js:93:5) (Use `node --trace-warnings ...` to show where the warning was created) (node:43104) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:43104) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
this is error
it is working properly suddenly this happens
@dusky marten send your bot code for the command too
which code ?
The code that caused the error
no all code is perfect
this is main error - Error: Error parsing info: Unable to retrieve video metadata
i think there is some update needed
nope
like
updatd of ytdl-core@4.0.3
@dusky marten why are you messaging me man
i think the problem is that the video link is invalid
no i just puted name of song
and it is working and suddenly this happens
you can use the youtube api to search songs then pass the url to ytdl
try running the play command again except send the exact link this time
i have all api and etc
it should probably work with normal links
No not that
it is working properly
but today it stucks
i sure it needed an updated
but idk wht
updated
try updating
also @quartz kindle might be able to help you he's a master of programming
^
ping me 
instead of using a callback
ytdl.getInfo("something", function(){
// idk
})
``` use as they told you **async/ await** ```js
let info = ytdl.getInfo("somthingelse")
// do stuff
@past needle that was not the error
let me try
that was not the fix for your error
oh
@past needle he sent the async/await warning message along with the actual error
k
@past needle
const { MessageEmbed } = require("discord.js")
const { QUEUE_LIMIT, COLOR } = require("../config.json");
module.exports = {
async play(song, message) {
const queue = message.client.queue.get(message.guild.id);
let embed = new MessageEmbed()
.setColor(COLOR);
if (!song) {
queue.channel.leave();
message.client.queue.delete(message.guild.id);
embed.setAuthor("MUSIC QUEUE IS ENDED NOW :/")
return queue.textChannel
.send(embed)
.catch(console.error);
}
try {
var stream = await ytdlDiscord(song.url, {
highWaterMark: 1 << 25
});
} catch (error) {
if (queue) {
queue.songs.shift();
module.exports.play(queue.songs[0], message);
}
if (error.message.includes === "copyright") {
return message.channel.send("THIS VIDEO CONTAINS COPYRIGHT CONTENT");
} else {
console.error(error);
}
}
const dispatcher = queue.connection
.play(stream, { type: "opus" })
.on("finish", () => {
if (queue.loop) {
let lastsong = queue.songs.shift();
queue.songs.push(lastsong);
module.exports.play(queue.songs[0], message);
} else {
queue.songs.shift();
module.exports.play(queue.songs[0], message);
}
})
.on("error", console.error);
dispatcher.setVolumeLogarithmic(queue.volume / 100); //VOLUME
embed.setAuthor("Started Playing Song", message.client.user.displayAvatarURL())
.setDescription(`**[${song.title}](${song.url})**`)
queue.textChannel
.send(embed)
.catch(err => message.channel.send("UNABLE TO PLAY SONG"));
}
};
^^^
Question
I'm not stupid, but this reset button just refreshes, right?
I pressed it once and the data didn't go
@dusky marten you're not using ytdl-core you are using ytdl-core-discord
yes
Please reply if you think what I said is true! ๐
so how can i update it
ytdl-core-discord uses ytdl-core v3.4.2
latest version of ytdl-core is v4.1.4
so i have to npm i ytdl-core v4.1.4 ?
ytdl-core-discord has not been updated for 2 months, and its github repo was removed
ytdl-core was last updated 2 days ago
ok so now wht can i do to play songs ?
really idk how to
read their documentation
which ?
ytdl-core
k
k thx
how can i return the image from the message.author as a small image on my DiscordEmbed?
if i use message.author.displayAvatarURL it doesnt send the image but the link
@timber fractal did you add () at the end of URL
What is the best way to make an online dashboard for a bot?
there's no good or bad way, i just suggest getting started
start with making simple html etc
there's always bad ways, yeah you're right
I don't know py either
Anybody knows?
Yes
im messed up with this from 5 hours
this

