#development
1 messages · Page 844 of 1
client.guilds.forEach(ch =>
ch.channels.find(ch =>
ch.name.includes('automeme')? `${ch.send({embed: memeEmbed})}` : ``)
)```
Can i make it easier to find the channel?
I don't think so.
Ohk
@valid frigate Ovh is a good choice but expensive if you don't need a powerful ip.
actually ive heard about ovh
I'm usually using contabo but it's german server so maybe the ping will be very bad.
nah contabo was on my list of "yeah this seems cool"
Ahhh German servers
Anyone know how to stop it?
at Map.find (/rbd/pnpm-volume/04d2b97d-b6b0-4096-bd33-46a980d362e6/node_modules/discord.js/src/util/Collection.js:506:11)
don't mind bad ping too much since well discord datacenters are everywhere
can you post the whole error
Contabo prices are very cheap, but the quality is there ^
hmm ok i will take a look
It's coming from the given code
the problem is that we can't see the given code
oh

It's working but the error is restarting the bot
Why?
Maybe some guilds don't have any channels?
that's not the error
no it wouldn't be like that
they didn't send the error

this
ch.channels.find(ch => ch.name.includes('automeme')? `${ch.send({embed: memeEmbed})}` : ``))
im too tired to tell if this is valid code or not but it might be?
ppl should learn to do console.error(err.message) so it's easier to find the errors
maybe the ternary operator is in the wrong place
msg.guild.channels.find(channel => channel.name === "automeme").send(embed1)
The ternary operator is in the wrong place I think
yeah that was my suspicion
I mean
Le
i think your best bet is .find since you're looking for one channel in every guild
they don't actually have a ternary operator
how is that not a ternary operator
This works perfectly for me:
ch.channels.find(ch => ch.name.includes('gg'))? `${ch.send({embed: memeEmbed})}` : ``)
@dreamy breachyes
Isn't this a discord.js package error?
lul
@valid frigate now im trying .filter
no need
Pff lol
are you on v11 or v12
Anyone know what this is?
(node:9526) UnhandledPromiseRejectionWarning: TypeError: Discord.RichEmbed is not a constructor
```?
new Discord.MessageEmbed()
another solution : read the docs
always works
asking before breaking my bot : will this work? https://lumap.is-inside.me/RrG55Hyp.png
shuffle is a function who shuffles a list
does shuffle return an array
pretty sure you need a spread operator if you're returning an array
bruh
const thing = [ array[0], ...anotherArray ]
...servlist
Does
client.guilds.map
still work?
Oh ok thanks
hi
so
how would i make
a suggestions command
that sends the suggestion
to a webhook
so its sorta like
it runs the webhook when you run the suggestion command
whats the best highWaterMark settings for ytdl? I see ppl using 1024*1024*10, others usingg 600...
and if I use 600 I almost always got my song stopped by ytdl while playing
and 1024*1024*10 is laggy af
its annoying af
umm can someone explain again to me what does this mean?
client.guildshas been changed from a Collection to a Manager.
I read it in the update notes.
hey guys
what will be the eval command (js) to remove a role (role name) from a user (user id)
Also, can someone give me a list of what i should change when I update to Discord.js 12.1.1?
Can```js
client.guilds.size
```js
client.members.size
```still be used?
i was gonna ask that same question
Yeah xd
I read, it didn't help at all
I need help: how to config the Member Count on discord server
ask what u didnt understand
i will help
members.size
and ofc u have to define members and stuff
It's in my server but how do i put it so it starts working
client.guilds.cache.size
Guild#memberCount
Good question i think the last one idk
12v?
Were can i see what v i have on my cellphone?
client.guilds.cache.size
@earnest phoenix client.members.cache.size?
in package.json
how do I wait for my shards to fully spawn? I'm trying to do it manually but not sure how to approach it
yeah that seems like a good workaround, although people were saying there would be a better way to approach it in V12 hmm
v12 had me destroy my entire folder and start from scratch xd
It was hard getting adjusted again
It's not that many changes imo, but I guess that worked
yeah I upgrade to v12, didn't take that long for me to change my embed's around
why error?
14.0v is what i have
client.guilds.reduce is not a function
^
how to fix
oh i fix ty
Ready event file line 16
@finite bough 14.0v
he do be kinda using win 7 
kinda
Windows 7 is the best
wait sendMessage was a function in 11v?
I don't think so
wait sendMessage was a function in 11v?
@finite bough It's message.channel.send?
._.
x)
no discord.js v12 sendMessage doesnt work
in 11v i meant
tes v11 does work
i couldnt see sendMessage function in the docs so i was kinda curious
hoist on the sidebar
if i use ```js
message.author.tag
.username
^
oh ok tanks
hi
const db = require('quick.db')
var economy = new db.table('economy')
module.exports = {
name: 'work',
category: 'economy',
aliases: ['w'],
description: 'Gains money',
usage: 'pichu work',
async execute(client,message) {
if(!economy.get(message.author.id+'.bal')) economy.set(message.author.id+'.bal', 0)
//economy.push(message.author.id+'.bal', 500)
//cooldown
if (economy.get(message.author.id+'.workCooldown')) {
cooldown = economy.get(message.author.id+'.workCooldown')-Date.now()
if (cooldown<43200000) {
let totalSeconds = (cooldown / 1000);
let hours = Math.floor(totalSeconds / 3600);
hours %= 24;
totalSeconds %= 3600;
let minutes = Math.floor(totalSeconds / 60);
let seconds = totalSeconds % 60;
return message.channel.send(`This command has a 12 hour cooldown! You can work again in **${hours}h, ${minutes}m and ${seconds}s**`)
} else {
economy.push(message.author.id+'.bal', 500)
economy.push(message.author.id+'.workCooldown', Date.now()+43200000)
return message.channel.send('Added $500 to your balance!')
}
} else {
economy.push(message.author.id+'.bal', 500)
economy.set(message.author.id+'.workCooldown', Date.now()+43200000)
message.channel.send('Added $500 to your balance!')
}
}
}
```it gives me an error 'Target is not an array', but my log is stupid and I cant find where
line 30
its add
add?
not push
oh
push is basically adding something as an item
add is basically doing what its suppose to do
okeh
how do i fetch someon's id?
right click their pfp and it should say copy id at the bottom 👀
I don't think this works ```js
var user = message.mentions.users.first()
${user.id}
```
Using a bot -_-
bruh
define member
@high bough
user.user.id```
Oof
@astral yoke what error
no mario
@high bough
user.user.id```
@zenith terrace Threw me this error
(node:1071) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined
db!eval message.channel.send("test")
it's .id
no u
wait hold up thats a differnet error i had a minute ago
it's already grabbing users
db!eval message.channel.send("hello");
are you high
yes
oh
i meant scltxn
oh
i am high
i am low
https://discordapp.com/channels/264445053596991498/272764566411149314/694066705600741427 really...no one got it why i was getting errors? i got it... look at the ch ......i used ch as a guild and channel both F
ok
@charred jetty d.js v?
I need a bit help with discord.js@11
Code:
client.on("messageReactionAdd", async (reaction, user) => {
module.exports.connectss.query(`SELECT * FROM orderst WHERE message_id = '694104440411652167'`, function (err, result) {
if (err) throw err;
let record = result[0]
console.log(reaction.member.roles.has(record['role']))
})
})
Error:
(node:13877) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'roles' of undefined
nvm
[djs]
https://paste.menudocs.org/paste/yf8hz
even when I provide a banned users ID it return that they are not banned (most likely something very easy to fix Im a bit spesh)
v12
you probably need to resolve user to member and then check the roles
message.guild.member(user)
(might be incorrect)
did you define member?
how? if i am getting guild members
reaction.guild.members.get(user).roles.has(record['role'])
@spare goblet if you mean i need to get user id i did that to did not work too
@round ridge I'm asking what the variable user is defined as.
@round ridge Members returns a collection mapped by id
Do user.id instead
Or members.fetch(user)
In case it ain't cached
@\
@spare goblet
(node:15054) UnhandledPromiseRejectionWarning: TypeError: client.fetchUsers is not a function
let member = await client.fetchUsers(user.id)
console.log(member)
@round ridge stop. tagging. me. someone. will. respond. asap.
i didn't tell you to do that
okay sorry
Then it's fetchUser
^
You cant fetch multiple users with the discord API
Also you're trying to fetch MEMBER
const member = <guild>.members.fetch(user)
shuold be like this
Or: const member = guild.members.find(member => member.id == user.id);
ah
@dreamy breach that fetches from cache. if the user ISN'T IN CACHE somehow (e.g. user prolonged on offline) then it wouln't be in cache :')
and idk why you would do that when the collection is mapped with snowflakes, aka you could just do guild.members.get(user.id)
but you do you
Oh okay, didn't know that. Thanks for noticing me ^^
members.fetch() fetches the user directly from the api
But the guild object isn't fetched every minute?
not all members are cached
especially for servers with like 800-1000 members or above
oh okay ty
np
The cache updates based on presence updates, joins, leaves etc etc
And other factors such as Messages
i did what you sauid Dorian but i get error that guild is undefined
^
So depending on your situation
i better to reactions as message is message that user react
What's ur event?
so whwat i'd do is
const { guild } = reaction.message;
if(!guild) return; // failsafe in case it's not a guild
const { guild } = reaction.message.guild; ?
(e.g. is in a dm)
no,
if(!guild) return; // failsafe in case it's not a guild
same as
const guild = reaction.message.guild
same thing
i just prefer shorter code 
oh yeah, really need to learn nodejs deeper. x)
oh now its outputing user whole info
whats your long dsec atml
atm*
trying to mix atm + html together is
interesting xD
### my discord bot name
if you're going to use CSS to colour your Markdown text you'll need to wrap it in some sort of DIV or somthing to make it easier
ooof
You forgot the ; at the end of color
https://hastebin.com/joxafejomi.js Issues with playing playlists and I don't know why
Is var "video" the right type for the handle function?
It works with normal songs
Also is this right
client.user.setPresence({activity:c!help | ${client.guilds.cache.size} servers | ${value.toLocaleString()} users})
So i have a command called userinfo or as an aliases ui and when i mention to look at someone's ui it works but when others do it doesn't work (it only shows their own ui and not the mentioned user's ui)
What's the issue here?...
why are you coding on a phone tho..
Bruh you guys realize not everyone has a desktop or a pc?
(TRIGGERED NOISES)
the issue is because you're trying to check if useri is included in the string (message.content)
useri is an object (from user class)
you can't have an object within a string.
So how can i fix that?
it should be,
if(useri){
}
rather than,
if(message.content.includes(useri)){
}
Better yet, don't have repeated code
a lot of that code could be improved but ye
I don't need to include the:
message.content.includes()
?
Oh ok... Imma try that... Thx for the help...
np.
cool tip, dont code on a phone
another cool tip, dont complain if coding on a phone is hard™️
an even cooler tip, dont 
https://hastebin.com/joxafejomi.js Hi I have issues with handling playlists with this code with this error
(node:5936) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'videoId' of undefined
i swear everyone uses the same queue code
video is undefined, define it
It is tho
for (const video of videos) await handleVideo(video, message, voiceChannel, playlist)
And that too
and that ^^
For playlists is the only time it doens't worko
then whatever you're doing is wrong, because 'video' is NOT defined
also you don't need to await the slice function
the entire command is a mess and maybe if you cleaned it up and tabbed it properly, you might just be able to understand what's wrong with it in the first place and be able to read back on your errors
people might be able to help if they can read it™️
also that's not where your error is
Ik
then clean up your code and figure out why video is undefined by console logging a bit
You think I haven't tried
it's not rocket science
you're going to have a lot less problems if your code is cleaner
Look, I am not looking for snarky comments about cleaning up my code, I asked for some help. If you can't help me, then stop looking for things to complain about
It doesn't help in any way
What good does it do to any one?
well i can't help you because your code is a mess, if you cleaned up your code you wouldn't need to ask for help in the first place, at least if you asked for help, people would be able to read your code and help properly
What can;t you read bout my code??
I will clean it up then
ken toxic
also you should declare your functions before using them, they should be above the code you're running them with
- you shouldn't use var and you definitely shouldn't declare a var inside a try,catch (there is probably issues with that)
- you are setting a videoIndex of 1 and then selecting your video as videoIndex -1, just set it to 0 if you want the first result
- console.log playlist, videos, url.split('list=1')[1] and actually debug your issue a bit
mm, the code is quite messy / hard to read, there's some stuff you could definitely improve on ^^ ken is trying to be constructive with his comments altho a bit critical
- you're setting song = {} like it's a global variable, you should probably set it as a let or const, tbh the handleVideo function doesn't entirely make sense
all requires should go at the top of the document
you could just change the variable name 'message' to 'msg' instead of making a new const variable
okay, here's your issue
you need to put this in an if else statement
you're setting song = {} IF the playlist exists
and then right after you're trying to set it again with video.videoId
it makes no sense
Still didn't work
also you didn't make the code any cleaner, you just put most of the lines of code on the same tabbing
What???

I just spent ages cleaning it up
okay well i had already cleaned it up and all i did was paste it into my editor
ok
I don't get the issue
this works fine, because it's not throwing errors
your error comes from below that;
it should be if (playlist) {} else {}
you're just setting your global variable of "song" to something twice
what's the error? 
(node:5936) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'videoId' of undefined
what did you change
Even with the if(playlist)
if(playlist){
song = {
id: video.id,
title: video.title,
url: `https://www.youtube.com/watch?v=${video.id}`,
author: video.author.name,
request: msg.author,
thumbnail: video.thumbnail,
duration: video.duration
};
}
else {song = {
id: video.videoId,
title: video.title,
url: `https://www.youtube.com/watch?v=${video.videoId}`,
author: video.author.name,
request: msg.author,
thumbnail: video.thumbnail,
duration: video.duration.timestamp
};
}```
how long have you been coding for
Since December™️

give me a minute
shut mouf

Lmao
well it kinda is spoonfeeding
stop crying

It isn't a spoonfeed
It's a spoonfeed x)
I gave code
you don't know how spoonfeeding works
🥄
you might have given the answer but i basically did the hardwork for you
He helped fix a few errors
Isn't this a github code at first?
because i know you're not capable of fixing it
Well thanks
testing the code now
says cannot read name of undefined
@languid dragon js (node:8484) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'name' of undefined at handleVideo (C:\Users\t\Documents\app\commands\play.js:26:25) at Object.run (C:\Users\t\Documents\app\commands\play.js:141:11) at runMicrotasks (<anonymous>) at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:8484) 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: 4)
Try to find the issue, it's pretty self explained.
you have all the tools you need to find the issue yourself
video is not defined, console log it and find out why its not defined
video.author is also not defined
the reason that error is happening is because video is now set to an object by default
so video.author = undefined, but now you will get an error if you try to fetch a variable from something that is undefined, aka = video.author
and if video.author is undefined, clearly video isn't properly filling the data.
and try not to copy and paste code, then complain it doesn't work
I'm pretty sure this code is taken from github, already saw it x)
Async function
it's time for me to actually do work so please stop pinging for me and try use your head for these trivial issues
Yeah I'm tryna but it doens't work
I am so confused
so if no video is passed, or a video is not found, the function will still run and assume video is an empty object
O
then you try get video.author.name, but video is empty object and video.author is undefined
you need to check if a video is valid and exists
^
===
if(video === {}) return;
I don't think it's exactly the problem because he is entering a parameter in the function. I think it must checks if the supplied parameter "video" is really a video object as he wants and not null/undefined or just a string.
AAAA
https://hastebin.com/okixezodom.js This is the code
I am very confused
In comparison, the search command, which works https://hastebin.com/lewalinada.js
Pls help someone
@earnest phoenix There is no bot parameter on the message command. You need to collect the bot directly. So instead of:
Math.round(message.bot.ping)
put Math.round(bot.ping)
^
:p
@golden condor I cant figure what is the problem
Me either
Can you show the log of video: for (const video of videos) <- This line
who can help me
video?
No log?
@golden condor Just can you print the result. To see what's the video object.
It didn't log anything
Can you log videos so?
You have no log when you use the playlist command ?
For some reason, the search command works but this doesn't
@earnest phoenix I don't understand ur problem.
Did you make both commands?
Here:
const playlist = await ytpl(url.split('list=')[1])
const videos = playlist.items
for (const video of videos) await handleVideo(video, msg, voiceChannel, playlist, queue)
} else {```
Can you console.log(videos) ?
And playlist too
And send me the result
return console.log
Are u sure ytpl is working?
Idk
Lumap can u hel
I'm pretty sure you didn't make that code @golden condor, It's very strange that you know how to make a play command with audio system and you can't fix a small issue :/
I made the code but that code is the edited version
[] This is what video returned as
lumap, that's such a large flex
What's the playlist object and each video object?
?
The search command works
So I will remake music using the search
And implement playlists
Can you show the result of playlist.items ? ^^
playlist.items object contains videos, videos are stored like that https://canary.discordapp.com/channels/264445053596991498/272764566411149314/693755989412937789
wait no
Yeah but playlists are different
A solution is to take the url of each song of the playlist and do the same as default play command:
const video = results.videos.slice(0, 1)```
like calling the queue function for every video?
Do the same process as one video for all videos of the playlist.
Because he is saying that when you type one video and not a playlist, it works
{
id: 'PLlqiW6siyh8qnRuKraWx3yNgrvB6VEtwf',
url: 'https://www.youtube.com/playlist?list=PLlqiW6siyh8qnRuKraWx3yNgrvB6VEtwf',
title: 'MODERN FRENCH MUSIC PLAYLIST',
visibility: 'everyone',
description: 'Because french music is not only about Edith Piaf and Paris.',
total_items: 176,
views: 14622716,
last_updated: 'Last updated on May 27, 2016',
author: {
id: 'UCN8psZeZG7uMVrQOjlksTQg',
name: 'nowhere',
avatar: 'https://yt3.ggpht.com/a/AATXAJyn4j5znOC-fKcMBBTMIWHXVN2TOJbZfVDZzQ=s100-c-k-c0xffffffff-no-rj-mo',
user: 'ACiDDxHiME',
channel_url: 'https://www.youtube.com/channel/UCN8psZeZG7uMVrQOjlksTQg',
user_url: 'https://www.youtube.com/user/ACiDDxHiME'
},
items: [
This is an example of a video
an item
{
id: 'oiKj0Z_Xnjc',
url: 'https://www.youtube.com/watch?v=oiKj0Z_Xnjc&list=PLlqiW6siyh8qnRuKraWx3yNgrvB6VEtwf&index=2&t=0s',
url_simple: 'https://www.youtube.com/watch?v=oiKj0Z_Xnjc',
title: 'Stromae - Papaoutai (Clip Officiel)',
thumbnail: 'https://i.ytimg.com/vi/oiKj0Z_Xnjc/hqdefault.jpg',
duration: '3:53',
author: [Object]
},
@dreamy breach
OK
Change that:
for (const video of videos) await handleVideo(video, msg, voiceChannel, playlist, queue)
to:
const results = await yts(video.url) || { videos: [] }
const finalVideo = results.videos.slice(0, 1)
await handleVideo(finalVideo, msg, voiceChannel, playlist, queue)
}```
This should work for sure, but you can think of a more optimized way by directly getting the video with the ytpl.
It didn't work
(node:3280) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'name' of undefined
at handleVideo (C:\Users\t\Documents\app\commands\play.js:65:26)
There is no name attribute on line 65.
Video says it = []
Y’all need help?
.addField("Author", song.author)
Maybe one author of a video doesn't have a name
so check if the video is different than []
undefined is what video equals now
if (url.includes("list=")) {
const playlist = await ytpl(url.split("list=")[1])
const videos = playlist.items;
for (const video of videos){
const results = await yts(video.id)
const finalVideo = results[0]
console.log(finalVideo)
await handleVideo(finalVideo, msg, voiceChannel, playlist, queue)
}
}
{
type: 'video',
title: 'Angèle - Balance Ton Quoi [CLIP OFFICIEL]',
description: '"Brol la suite", inclus 7 titres inédits, écoutez-les maintenant : https://lnk.to/BrolLaSuiteYD Instagram ...',
url: 'https://youtube.com/watch?v=Hi7Rx3En7-k',
videoId: 'Hi7Rx3En7-k',
seconds: 266,
timestamp: '4:26',
duration: { toString: [Function: toString], seconds: 266, timestamp: '4:26' },
views: 69119899,
thumbnail: 'https://i.ytimg.com/vi/Hi7Rx3En7-k/default.jpg',
image: 'https://i.ytimg.com/vi/Hi7Rx3En7-k/hqdefault.jpg',
ago: '11 months ago',
author: {
name: 'Angèle',
id: 'UCiP2tOO8zRo47GFd5rc8rkA',
url: '/channel/UCiP2tOO8zRo47GFd5rc8rkA',
userId: '',
userName: '',
userUrl: '',
channelId: 'UCiP2tOO8zRo47GFd5rc8rkA',
channelUrl: '/channel/UCiP2tOO8zRo47GFd5rc8rkA',
channelName: 'Angèle'
}
}```
This is a normal video object
But using the code of yours Dorian, nothing comes up
Should I try search for the title?
all you really need is basically if(!finalVideo) return message.channel.send("video not found or invalid")
before using handleVideo
Or, if(finalVideo === []) continue;
Ideally needs to be out of the loop
Why?
So it doesn't spam
Is !finalVideo the same as finalVideo = [] ?
You can only check the length of the array to know if it is empty or not
if (url.includes("list=")) {
const playlist = await ytpl(url.split("list=")[1])
const videos = playlist.items;
for (const video of videos){
const results = await yts(video.id)
const finalVideo = results[0]
console.log(finalVideo)
if(finalVideo === []) continue;
await handleVideo(finalVideo, msg, voiceChannel, playlist, queue)
}
} This returned undefined in logs
if results[0] doesnt exist, then finalVideo will be undefined, not []
finalVideo = undefined
yes
if its undefined, then do if(!finalVideo)
doing !something works for undefined, false, null, 0 and ""
did all videos show undefined? or only a few?
if only one was undefined, the others should work
if they dont, then theres something wrong with your handleVideo function
Doesn't return end the loop
try console.logging some stuff inside it
return ends the loop, yes, where are you using return?
c-p <song name> works
if(!finalSong) return;
The playlist stuff worked when using simple-youtube-api
thats not in the code you showed
But I don't wanna go back to that
I got rid of that
Because of heavy rate limits
if(!finalVideo){} Should I do this
if (url.includes("list=")) {
const playlist = await ytpl(url.split("list=")[1])
const videos = playlist.items;
for (const video of videos){
const results = await yts(video.id)
const finalVideo = results[0]
console.log(finalVideo)
if(!finalVideo) return;
await handleVideo(finalVideo, msg, voiceChannel, playlist, queue)
}
}
didnt you put continue before?
This been going on for over 2 hours 👀
this has been going for several days
I am very stressed
why did you remove continue?
It continued with the handlevideo function
continue skips the current loop
O
if(!finalVideo) continue means if there is no video, skip this loop and continue with the next video
undefined
undefined
Is what finalVideo equals in the first two loops
This bot is killing me
how many videos does that playlist have?
and only 1 video is being added?
show your full code as you have it now
it would help if you properly indented your code lol
you know you can make it format on save
Can u?
search format
https://hastebin.com/deqipajega.js Indented version
im going over their docs, and it says yts("something") to search for a video and yts({videoId:"id"}) to get a video by ID
also, it says yts also supports playlists
Didn't say that on npm docs
Cxllm just some suggestions, only use brackets for multi lines and try combining if statements with &&
its all personal preference though
i prefer brackets even for single lines
ye its all preference
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
Returned undefined

because now there is no results[0]
because its not a search
use the video directly
let video = yts(...);
if(!video) continue;
handleVideo(video,...)```
It only loads 12 songs
(node:10024) UnhandledPromiseRejectionWarning: video unavailable
It's because of an limite
Oh
though Playlist works differently
like you do in single songs
How
try {
const results = await yts({ videoId: video.id })
const finalVideo = results
if (!finalVideo) continue;
await handleVideo(finalVideo, msg, voiceChannel, playlist, queue)
}catch(e){}
Like this?
for (const video of videos) {
try {
const results = await yts({ videoId: video.id })
const finalVideo = results
if (!finalVideo) continue;
await handleVideo(finalVideo, msg, voiceChannel, playlist, queue)
} catch (e) { continue;}
}
no need for continue there since its implied as there is nothing else to do
you can put a console.log there for example
to log errors
without interrupting the loop
How do you do this?
It just says some videos are unavailable
which was a ytdl error anywya
Basically it stops there being errors with ytdl
your client / bot object in what ever language should have a cached user and guild pool
Really?
No
hes just tryna log his stats
Yes
oh
i dont do discord.js but im guessing its somthing like client.guilds.cache.size or somthing similar depending on v12 or not
Ok
Which discord.js version you on?
Noooo
ok
Ok
users = client.users.cache.size
servers = client.guilds.cache.size
Ok
channels = client.channels.cache.size
Thank you so much @quartz kindle you are a real legend
amen
My best wishes for you, you explain everything so well and help as best you can ❤️
Stay safe :)
Is there a way to forward the dispatcher's audio in d.js?
I mean, I want to make a forward command for my music bot
it would be cool to implement something that let you chain commands, unix-style
Thanks guys
;-;
How can I make the status refresh so it can update the guilds it's in
what lib?
if d.js, in the on ready event, you can set it to repeat setting its status to the number of guilds
using a setInterval()
Okay, thank you
How can I do it
And post your server count
Thanks
How big is the src/ folder of most Java bots?
Mine is 5.29 MB
It's rather large
You've never seen node modules have you
How big are source folders normally
I wouldn't worry too much
for Discord bots?
average
node modules are like 80mb if you have a decent amount
wow
Not really
Just depends on how much code your write
Don't worry about the size of the folder
https://oliy.is-just-a.dev/3or0qa_3346.png node modules ftw
Thats just code and only the front end :P
https://oliy.is-just-a.dev/y6md7c_3347.png this is the size of my bot that uses a very large AI
https://oliy.is-just-a.dev/a5pfmn_3348.png just the bot folder
you're using AI dungeon arnt u
Oh wow
https://oliy.is-just-a.dev/ez8cnc_3349.png I wonder if I'm using AI Dungeon

But it's down right now
Can anyone tell me when is the bot coming online?
which bot
I couldn't ever write 5 GB of code all by myself
Takes way too much processing power that I don't currently have
Member count bot
Well I had to rewrite a lot of it
its massive because AI dungeon has some Massive tensors and datasets stored
it's mostly GPT-2 though
and @cinder umbra wrong server my friend
That's like, working on my bot for 100x as long
It would take me 33 years
Nope it is the right server
At least it what showed me
@modest maple 1.5 billion parameters 
Why is the member count bot offline?
you need to click "join support server"
we are not the support server for member count
in top.gg my bot's status is not changed. A guy said "Status will change tomorrow. Every day admins are updates site." but now still ??? help.
status only changes when your bot is approved
if you already added your bot in top.gg, then wait for approval, which takes 1-2 weeks
that is the WRONG server
that is 1) to go to the discord server list 2) the Join discord takes you here
you need to click "join support server"
we are not the support server for member count
probably be best to look it up on the site
do people never scroll down on websites?
Yea
sql is gonna be so EZ now
that file method is slow and inefficient af
Does MongoDB have nested collections?
idk
@modest maple
but i highly recommend sqlite
you litterally wouldnt even need that
I highly recommend mongo
you'd litterally have 1 db, 1 table with relative guild Ids, those tables can then pull off other tables
literally the entire point of how you should use DBs
i found mongodb very finnicky to me
Let's say I have a Guild
and it has data for multiple members
But I don't want to put the data for the members into the Guild-data document
yes
have a table named after the guild ID
use a sub table with each guild
Isn't MongoDB JSON-like?
How would I have tables?'
idk
All I can think of are Objects and Arrays
mongo has documents
but sql is kinda similar to json
each document is similar to a table, but also similar to a json object
sql isnt rlly
Yes
I need sub-collections
to store individual documents in
mongo uses bsons
@quartz kindle
afaik mongo does support nested documents, but i dont use mongo so idk
Yes
But I need nested collections
mongo is pretty easy OwO
you dont
Otherwise I get collections named "guilds-000-members"
mhm
would really recommend it
because youre using json
and yh mongo pretty G
personally i use SQL but thats just cuz my backend supports it better
discord is very suited for sql databases tho
just use mongo atlas if you think your database wont be larger then 512mb
its so easy to organize guilds and users into tables
if you are lazy to set it up
same goes for mongodb 😛
My current setup
I can have something like this
Within the data for a given channel
if you wanna go for json-like structures, mongo is more suited for you
pretty much with mongo:
Database server
-> Database 1
-> collections abc
-> data
-> Database 2
-> collections abc
mongo is really easy when migrating from JSON
my bot is migrating from json to sql but it shouldn't be a big deal
nah its pretty easy
I need
-> Database 1
-> collections abc
-> data
-> collections messages
->data
-> collections users
->data
you dont tho
why tho
thats just how youve done it with json to make it work with json
But if I put it all in one document
It will load too much data into memory at once
then dont
Then I need nested collections
use many docs in one collections
Converting from Json to a database: think of it like portal.
before you got the portal gun you had to take a walk 6 miles down the city
after you could put a portal at the start and at the end, and cut off 99% of the journey
What do you do, still take that 6 mile walk or use the portal?
@modest maple what code editor do you use?
i use atom too
what they're trying to tell you is that unlike json storage, there is a lot of repeated data that doesnt need to be repeated, but instead it can be linked/shared/referenced
so you dont need to keep different copies of user data inside each guild document for instance
I really need nested collections though
Otherwise, my data will look like this:
Guild 000 DB: {
prefix: "*",
users: "myguild-000-users",
messages: "Myguild-000-messages"
}
Or worse, like this (In which case it would run out of memory)
Guild 000 DB: {
prefix: "*",
users: {
"000": {
"xp": 1,
//More data
},
"001": {
"xp": 2,
//More data
}
},
messages: {
"000": {
"issb": false,
"pairdID": "001",
},
"001": {
"issb": true,
"pairdID": "000",
}
}
}
Unless there exists another thing I don't know
welp, time to go through the long process of converting my json oriented commands to sqlite
Your portal analogy made no sense
lmao
*GLaDOS intensifies*
What does sharing data from tables mean?
that analogy ment, rather than have repeated data that just doesnt need to be there
rather than having a seperate file for everything
through all that
you could just have a set of tables
one with members
one with guilds etc...
we query guild 12334, that guild has members [x, y, z]
Each user object is unique to the Guild object
Rather than each guild having the same data for each member
It can have different data per-member
can I explain my solution?
then dont use that system
this is the issue with json
when using it as db it forces you into bad habbits
I also have global user objects
I have global user objects, and also user objects unique per-guild
then just have another table...
in SQL i would do it like this ```
table GUILDS
guildID,guildname,guildetc,whatever
guildID,guildname,guildetc,whatever
guildID,guildname,guildetc,whatever
table guild1Members
memberxp,memberdata,etc
memberxp,memberdata,etc
memberxp,memberdata,etc
table guild2Members
memberxp,memberdata,etc
memberxp,memberdata,etc
memberxp,memberdata,etc
table users
userdata,username,etc
userdata,username,etc
userdata,username,etc```
@quartz kindle I'm doing exactly that
I don't use SQL
WE KNOW
My only idea was this
you can do the same thing in other databases
But it's ugly
YES
but you dont need to do that
I can emulate nested collections with naming
But it's ugly, and I would prefer actual nested collections
you are tunnel visioning my dude
because you dont need to access it like guild and guild.members.member.memberXP
you can access it like this guildmembers.member.memberXP and guilds.guildid and users.userID
ie: have them in completely different stores
you can access it like this guildmembers.member.memberXP
Where do I plug in the guild ID then?
So that I can have member data per-guild
make it part of the store name/id
wait are you moving to mongo?
create a new storage for each guild members, but not inside the guild
make it a collection of guildmembers stores
Can I just call my collection guild.<id>.members
Are Mongo collections iterable btw?
i mean, if you're using mongo, you can even do like this
this feels like a very heated argument
mongo is super easy because you can just define a doc with guildID and userID defined and find one with the userID and guildID
no need to structure it like that
So that was basically my one idea
Just without the actual listing for the collection name within the guild object
sigh
you are thinking too much like a JSON




