#development
1 messages · Page 1666 of 1
where you do client.commands = ????
nope sorry
oof ok then
`client.commands = new Discord.Collection();
fs.readdir("./commands/", (_err, files) => {
files.forEach(file => {
if (!file.endsWith(".js")) return;
let props = require(./commands/${file});
let commandName = file.split(".")[0];
client.commands.set(commandName, props);
console.log(Comando cargado: ${commandName});
});
});
`
and what are your command files called
So, that should definitely log that your commands have loaded, does it do that?
like, is it saying Comando cargados: help or something, when you start the bot?
wait
yes
$ node .
: ) evento cargado: message
: ) evento cargado: ready
Comando cargado: avatar
Comando cargado: invite
Estoy listo para ayudar a 191 en 4
Ok, great. So you have 2 commands that are working, and you're saying, neither avatar nor invite run when you call them with the prefix?
none works
sounds to me like you have the wrong prefix then
but when I put them with the vsc they work
if (message.author.bot) return;
if (message.content.indexOf(client.config.Prefix) !== 0) return;
const args = message.content
.slice(client.config.Prefix.length)
.trim()
.split(/ + /g);
const command = args.shift().toLowerCase();
const cmd = client.commands.get(command);
if (!cmd) return;
cmd.run(client, message, args);
};``` you need to figure out where you are going wrong try like if there isnt a command make it log no command and make it log what "command" is to see fi thats correct too or if the prefix isnt the bots prefix
So what's the difference between your local environment and the one on glitch? Maybe your config isn't the same?
Not that you should host on glitch - it's not appropriate to host a discord bot application.
yeah glitch isnt that great
I mean it was fine before they added the paid plan and told everyone "you're not allowed to host here anymore, fuck off", basically.

If it didn't work, it would be weird for it to show up, right?
oops
"it went online" doesn't mean it's properly working
the only reason it would work locally and not on glitch is that you messed up your file copy.
from discord.ext import commands
client = commands.Bot(command_prefix="prefix")
@client.event
async def on_ready():
@client.event
async def on_message(message):
if message.author.id == 712027036511633429:
await message.delete()```
is the second client.event correct or no? if so can you help
The chop chop eggplant emoji, where is it? 
dude no one knows what you're talking about and this is #development
does anyone know how i can make it so after my bot has joined a server, that person will get redircted to my website. I tried in the discord redirect and it didnt work 😦
you need oauth2
wdym
the user has to go to your website and "login with discord"
at MessageStream.messageHandler (C:\Users\\Desktop\Stats\node_modules\mongodb\lib\cmap\connection.js:268:20)
at MessageStream.emit (events.js:315:20)
at processIncomingData (C:\Users\\Desktop\Stats\node_modules\mongodb\lib\cmap\message_stream.js:144:12)
at MessageStream._write (C:\Users\\Desktop\Stats\node_modules\mongodb\lib\cmap\message_stream.js:42:5)
at writeOrBuffer (internal/streams/writable.js:358:12)
at MessageStream.Writable.write (internal/streams/writable.js:303:10)
at TLSSocket.ondata (internal/streams/readable.js:719:22)
at TLSSocket.emit (events.js:315:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:14812) 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:14812) [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.```
ive seen it on other bots
I am beginning to doubt do not understand this error
"0.27" is a string, not a number. you'd need to convert it to a number, with Number() or something
Want to see the code
?
Yes but I do not understand it bought this bot back then
Lol
Its a voice stats bot
you... "bought this bot", as in, you paid for it?
Bought src
Can you please help me before I cry :((
is it one of these for login?
So you paid for it. Well, talk to the person that programmed it and tell them to fix it
on websoite
it's not up to us to fix someone else's shoddy craftmanship
Bought it a long time ago
That's great! It means you would have had time to learn programming since you bought it and you could fix it yourself. I'm guessing you didn't do that, but there's not much we can do. We're not here to fix other people's broken code, only to guide them.
Yeah you should learn to code and how everything works and you'll have a better understanding!
If you know absolutely no programming, your best bet is to go pay someone on fiverr or freelancer to fix it for you for cheap.
you need to implement the OAuth2 flow, its not as simple as switching something on. you need to code your website to redirect the user to discord for authorization, then receive the authorization code
(Ref: #general message )
But I seriously doubt because no one can help me for days :/
Like said, your asking for us to just fix someone else's broken work
You're going to keep waiting if your entire conversation is "Fix it for me"
you can easily fix that yourself if you learn some basic programming
for example, google "what is a string"
Can you give me some tips? then do my best
can someone send a guide of embeds with python
here's some tips. #development message
lol
it was literally the command that was poorly structured
xddddddd
no matter, thanks for the support you have given me people

see u later guys
yo
what
i have a dev helper but he had to go i think im finishing off but idk if i should ask someone to help
what do u need help with?
You can certainly ask for help but we can't guarantee we can help you until we've heard your question
im a beginner so i think last dude was trying to get the bot online
embed.set_author(name='requested by {0}'.format(msg.author.name),
icon_url=msg.author.avatar_url_as(size=128))
``` why does the size not work? it shows a different size for different people
oh wait
i did it as author lol
not image
im dumb
all i have is an error in the terminal that says invalid syntax
Maybe because there are 2 )
ill try remove end 1 idk
Oh nvm
ok
Declan, we can't really help with syntax errors. You need to know programming before you can code bots, and doing simple syntax is pretty much a basic thing you need to be able to do on your own.
Nope I’m actually right
Start by learning javascript a programming language, it might help.
Ok great, well, maybe you should wait for that helper to guide you then.
he only gives me like 10 mins per day lol
You get what you pay for.
If you want to learn on your own, https://codecademy.com/ is great.
lol
can someone help me with something
I think you might want to consider learning python in general in between what he teaches you
what is discord.ext.commands?
i guess im getting no help BYE then

the commands framework that comes inbuilt with d.py
can u send a tutorial on how to use it
rn ive done my commands like this
if len(args) == 1:
await msg.channel.send('missing message')
else:
text = ' '.join(map(str, args[1:]))
embed = discord.Embed(description=text,colour=0xE5E242)
embed.set_author(name='{0} says'.format(msg.author.name),
icon_url=msg.author.avatar_url)
await msg.channel.send(embed=embed)
if command == 'avatar':
member = None
if len(msg.mentions) == 0: member = msg.author
else: member = msg.mentions[0]
embed = discord.Embed(color=discord.Color.dark_teal())
embed.set_author(name='requested by {0}'.format(msg.author.name),
icon_url=msg.author.avatar_url)
embed.set_image(url=member.avatar_url_as(size=128))
await msg.channel.send(embed=embed)```

thanks
You may look at the py example above
that's not really gonna solve his issue with the language syntax itself
Not that we even know what he did cuz he never shared the code
ffs discord mobile and edge oof
forget it u guys are confusing bye
Programming is, indeed, confusing.
If you think what we're saying is confusing you're gonna really struggle with async python
Especially for those that don't want to take the time to learn
Alright we’re the ones being confusing
real bad idea
clear names 
I might just quit soon lol bye
quit what


coding and tell my friend to f off
First 500 people will get 2 months of Skillshare free: https://skl.sh/polymatter4
Patreon: https://patreon.com/polymatter
Twitter: https://twitter.com/polymatters
Reddit: https://reddit.com/r/PolyMatter
Discord: https://discord.gg/polymatter
It’s become popular to encourage anyone and everyone to code. But there simply won’t be unlimited deman...
it isnt that hard
Great, you go do that, we don't need the drama 😛
na bye
ok baiiiiii!

Theres somebody that know hot to create a invite to a guild? I have the id of the guild
Little question how can i check how many voice connections my bot has? "Client.voiceConnections.size" doesnt work
client.voiceConnections.size
doesnt work
In the ChannelManager class, there is a property .cache that returns a collection of channels, so I suppose you can loop through the collection and count every channel that is a voice channel, every Channel object has a property .type which returns a string.
okay thanks
im using discord.ext.commands now but
how would i go about
making the bot send an error message if they didnt give any arguments
like
@bot.command()
async def say(ctx, *, args):
await ctx.send('{0} says: {1}'.format(ctx.author, args))```
is there some way of creating subdomains in express.js
wdym by subdomain
lile
*like
apache or nginx
like support.google.com ?
yeah
idk if there is
Just add a subdomain on your DNS Provider and then set it in your default file
something like test.example.com
I wanna add subdomains using code
and those subdomains get managed by the same code
lol
by the same Webserver
Idk how you could do that..
yeah
Which DNS software are you using?
Do you host the DNS server yourself?
oh
making subdomains and stuff
I have one of those lul
you know
You said you wanna add subdomains
That means you have to edit a DNS zone file
^
Some providers have APIs for this
Don't remember if cf does
Or you have to host the DNS server yourself
We dunno either
Just depends on your dns
No matter the OS, each DNS Server can be edited via command prompt
hello i have an error in my event handler
Client.on(event_name, event.bind(null, Client, Discord))
TypeError: event.bind is not a function
If there’s no API by your provider you can actually create a backend doing it for you
Only if you can access the name server or zone file of course
can someone help me with a command
What is event?
defined as
wait i send all the event handler code
@bot.command()
async def avatar(ctx, *, user: discord.User):
embed = discord.Embed(color=col)
embed.set_author(name=f'requested by {ctx.author.name}',
icon_url=ctx.author.avatar_url)
embed.set_image(url=user.avatar_url_as(size=128))
await ctx.send(embed=embed)
@avatar.error
async def avatar_error(ctx, error):
if isinstance(error, commands.BadArgument):
await ctx.send('You didnt mention a user!')``` when they don't mention a user the error message doesnt send any ideas what i did wrong
If I knew py maybe I would be able to help
Good for you I guess
If you wanna deal with the DNS in general make sure to read docs before using it
Especially speaking about creating or changing subdomains you should have a look at the TTL and the size of your provider
?
You can set the DNS Route for your domain to be *.domain.com and check the URL in the body request that is sent
in the req
and split it before the .
how doe lol
Like I said in your DNS where you set the domain and the IP it points to do *.domain.com
And when there is a GET on your express, in the headers it should send you the URL the page is
so basically a wildcard sudomain
then you can parse that
The wildcard as entry will point to all non-existing hostnames (subdomains)
Yeah and just search a db for the ones that = a name
yeah I can get the url and stuff
yea
exactly!
lol
big brain
just cancel the request
instead of fucking with your dns for each new one
big brain plays
lmao
np
once its done
ayo pog
btw
Oh god
its a pretty nice domain
That name
what was the cost
github student
ohhh
I github student
lol
I applied as github student and got accepted
they give you a free .me domain
I need extreme-is.me
if you have github student privileges
it does
any school counts
as long as you can verify ur part of the school
aka
student id
can you link it
and so on
nice
btw
if you do have a school issued email the process is faster
but its not required
for md
since I had a gmail
like idk
some weeks
for you it should take a few days
lol
which is pretty fast
lets see
this should be it
just apply there
you should be able to find ur way through the site without much help
from me
lol
as a github student you get a lot of shit
namecheap .me domain
Yeah I see
even a jetbrains license
for many ide's
like
Intellij IDEA Ultimate
lol
or pycharm professional
crazy ik

also github pro too
for free
ofc
also azure 100$ credit
and you can make an azure account without having a credit card as a github student
for free

pretty cool ik
lots of cool stuff you get for free
I got accepted first try
I am looking into it rn
it basically feels like getting the adobe sweet for free
kekw
oh digital ocean credit too
POG
how do i set a category for a command with discord.ext.commands
me?
python
sorry
Got it
can't help idk python
Gotta apply
ah
if ur school isn't the list you have to provide extra info about it
like website etc
lol
but otherwise the process isn't really hard
you just give them an image
fill out some fields
and ur done
@blissful coral btw once accepted make sure to visit https://education.github.com/pack/offers this page
it makes it easy to claim ur uh
goodies
lol
also you need that site I sent you in order to claim ur namecheap domain
so make sure to save that site for later use
uwu
the site I sent is also where you get all the redeem codes for stuff like namecheap or digital ocean
lol
so remember it
ok
Yeah prob won't use it lul
same
I have a galaxygate vps already
at least azure is free
lol
and doesn't cost anything to use
also you will have access to stuff like educative
which does have courses for stuff
time to check my email
so you even get free learning material
imagine it happened already lulw
OOOOOOO do we get a jetbrains sub?
LETS GO
pycharm webstorm and so on
I have been wanting to use a paid IDE
many many ides
Just to see how it is
ur github student status lasts for a year or so
you have to verify again next year I think
lol
and you still have to be in a school too
ofc
im a sophmore so
oh
lul
and you get a data dog Premium too
it says
Pro Account, including 10 servers. Free for 2 years.
yeah this is pog
I didn't know it worked for highschoolers I thought it was college only
it works for any school
of any kind
as far as I know
yea
I mean how else would they have accepted my school
the only thing you need to be is 13+ years old
kekw
what does
github students
am i a student lol
15
depends on your age and if you are enrolled in a school
you just apply
high schools?
yes
ok
where do i apply
thx
slow

kekw
kek
does it notify my school or something
you litterally get jetbrain ide's for free
don't think so
ok cuz dont want them snooping on my business
most people in my school are too dumb lol
you just have to provide info about ur school and you have to give them an image of a student card or simmilar that verifies ur part of the school
thats it
or school email
if you have a school issued email that you can use just use that
lmao all I did was add my school account to my email list on github and verified it and ez
wat does github pro give ya
not much tbh
just more storage for github packages
(whoever uses that)
and more workflow stuff
and extra features

It doesn't matter unless you have over 4 contributors on a private repo
pro just gives in general
yeah
more features
thats how to describe pro in 2 words
it is kinda cool doe
considering its free as a github student
I will take any free shit they throw at me

azure 100$ credit? hell yeah
some developer tool that I never heard of? sure I will take jt
lmao
the coolest thing
in my opinion
is the fact they also have courses for github students
educative for example gives github students access to 60 courses
about many programming languages and topics
which is pretty cool
the github student pack is mainly intended for programming stuff anyways
Github student is probably the craziest thing a developer can apply for
github students is not just "here have some free shit"
its meant for you to learn with real world tools
shouldn't just be seen as a Marketplace
lol
yes
things that actual devs use in jobs that you can use too
uwu
I like that a lot
how github supports junior devs
how they give you so many Tools worth hundreds of dollars for free
kinda crazy
to think about
that they give it for free
not even requesting a payment for applying
or something
github best thing to exist ngl
I should be writing a love letter by now for github lol
a lot of it is thanks to microsoft
lol
i remember when ms first bought it, everyone though github was going to shit
so they went to gitlab
then ms made github the perfect platform
no they made github great
they made github perfect
they made github how it is now used by pretty much every dev that exists
litterally every dev has heard about github at least once
yeah lmfao
Github is the best resource for anybody making packages, wrappers, anythinfg
want open sourcing sites easy issues or suggestions and pull requests
microsoft loves open source
literally has everything a dev needs for any project
laughs in thier os being not
imagine windows open source
like the calculator app 
but microsoft does indeed love open source, they open sourced the whole .net environment
.net 5 is one of the most powerful frameworks right now
thanks to it being open source
and various devs being able to contribute
they also use Linux for azure
lol
probably because not a single big company would ever run a windows server in production
this tbh
there's literally not a single reason to use winserver except a) you're a linux virgin or b) your app is running on .net framework which requires windows
my mom
this
anyone getting into it should know linux
it is almost a requirement these days
yeah lol
since like almost all servers run Linux
windows ubuntu + wsl is the best way to test on a windows system
and the fact that sooooo many distros are extremely modular
anyone in it should have at least touched a distro like Ubuntu or simmilar before
install only what you need
or debian
No forcing to update
this
i got used to linux so much that i stopped navigating my main pc (running on windows) with file explorer and instead started navigating with powershell lol
kekw
I mean
technically you don't need a gui
or any visual shit
in linux you can do pretty much everything in the command line
that + rendering takes time sometimes
installing software?
sudo apt install nodejs
you wanna edit a file?
nano index.js

having a problem with your mongo db?
the power to install Software with a command is amazing
That just belongs to non-server versions and to people without the knowledge to edit the registry and group policies
sudo service mongo restart```
sudo apt uninstall mysql```
just don't uninstall nodejs and use typescript
ez fix
lol
I forgot what I wanted to say
fuck
😩
oh yeah
whats yall favorite linux distro
I have 2 actually
nah wait
its actually only 1
kali linux
I like how it has many hacking tools pre installed
arch

arc arch
I use arch btw
but do you actively hack? 
else it's a secret minecraft base in singleplayer
Honestly kinda wanna setup a modded minecraft server but nobody will play prob
sad
Is it possible to show total amount of users " not total cached users"??
If I remembered the methology yes
Okay i will search it up! Thanks
Tip search for a property called memberCount
Found it,thanks!!
Lol
Well yeah i only asked if its possible i can do my own research and do it my self😂
Nah offical discord.js doc
That’s in some blocklist of my pihole for some reason
lul
That’s always the best place to search if you work with it lmao
True
Guys
How to make like when someone vote my bot
I see who voted him and hos many times he voted like the pic
anyone know why your bot would become unresponsive when it's on a server after a few days
Webhooks
That sounds like a problem with your hosting service
really?
.
i am using a thing to make it run forever called pm2
Where
and my hosting service is vultr which i got for free
why
prob goes down a bunch
oh
here
K
the bot shows online though it just dont respond
after a few days of inactivity and i have to restart manuallty
Use repl it..
maybe
Because using repl is actually against there terms
no why
- its free 2. its not good 3. its against there terms
what terms
i need to hop on the replit train

i have 1 year hacker plan
seems popular
And i code on it
Just buy a vps
yes
but i dont think i will continue using this service if it keeps going down like dis -.-
whats a good vps
- OVH: https://www.ovh.com/us/vps/
Starting at $3.35/mo for 1 core, 2GB RAM, 20GB SSD - DigitalOcean: https://www.digitalocean.com/
Starting at $5/mo for 1 core, 1GB RAM, 25GB SSD - Linode: https://www.linode.com/
Starting at $5/mo for 1 core, 1GB RAM, 25GB SSD - Vultr: https://www.vultr.com/
Starting at $2.50/mo for 1 core, 512MB RAM, 10GB SSD - Amazon(AWS) Lightsail: https://amazonlightsail.com/
Starting at $3.50/mo (first month free) for 1 core, 512MB RAM, 20GB SSD - Time4VPS: https://www.time4vps.eu/
Starting at €3.99/month for 1 core, 2GB RAM, 20GB SSD - VIRMACH: https://virmach.com/
Full Windows and Linux Desktop VPS starting at $7/mo and $1/mo respectively
i dont wanna pay if i dont gotta tho
ill look in my student github for more free trials
const db = require('quick.db');
const config = require("../config.json");
exports.run = (client, message, args) => {
if(message.author.id === "517495640020746250") {
db.set(`USER_BANNED_SUGGESTIONS_${args[0]}`, { id: `${args[0]}` })
message.channel.send(`:white_check_mark: Banned userid: ${args[0]} `)
client.channels.cache.get(config.devlogchannel).send(`UserID: ${args[0]} was banned from suggestions by ${message.author.username}`)
}else{
return;
}
}```
Some quickdb work I did today, works well, any suggestions on improvement?
But migration™️
Mongo DB, No SQL Database
Its faster with more data than SQL and its not relational.
Alternative to Discord.js
I'm seeing some python slander and i'm not liking it
what would i have to change to this to make it idle
@client.event
async def on_ready():await client.change_presence(status=discord.Status.online, activity=discord.Game("status goes here"))
print('{0.user} Is Online And Ready To Go'.format(client))
@client.event
async def on_ready():
await client.change_presence(status=discord.Status.idle, activity=discord.Game("status goes here"))
print(f'{client.user} Is Online And Ready To Go')
just change the discord.Status to .idle
oh thank you
guys, can i set the embed color to the bot's top role color?
i'm using discord.py btw...
ok i'll try it, thanks.
ah.. finally did something that is extremely possible
Share Objects Online with the power of websockets
as in someone can serve and clients can connect and it would be one shared object
different authTokens you can give with different authLevels so like one token can mean someone can view only and stuff
oh oh he’s back 👀
what
lmao... and Erwins wallet is growing again
yo legit my dude
i just put voice for detritus
holy shit
5h trying to figure out how it works
not that hard
mainly me being a bork
they removed the notable role
like, the role itself
nobody has notable anymore
You won’t get rid of it
That has become a running gag 
Even if you may be a poor sheep 
haha lmao
Well gtg, need to get at least 2h of sleep
tadano sweat
for my bot I host it on heroku and i have per server prefixes and I am not using any databases for my prefixes.json so heroku keeps resetting the prefixes every time I launch the bot, could anyone tell me how to create a database using heroku postgresql for my per server prefixes
I have no clue about databases at all
alright
auctions = auctions.reduce((acc, cur) => ((acc = {auctioneer: cur.auctioneer,item_name: cur.item_name,price: cur.starting_bid,category: cur.category,id: cur.uuid,rarity: cur.tier}),acc),[]);
it only applies to the first object in the array. and the rest of the array gets deleted
im stupid nvm
I need to use .push()
@misty sigil pog
$resp = match(200) {
200, 300 => "Poggers",
400 => "Not found",
500 => "Internal Sever Error"
};
die($resp);
Poggers
[Finished in 0.054s]
i already like this new match method
this is my status on my bot rn
await client.change_presence(status=discord.Status.idle, activity=discord.Game(name=f"on {len(client.guilds)} Servers | d/help"))
atm and it love it but i want it to say "watching" instead of "playing" bc it would sound better
what would i change to make it say "watching" this is discord.py btw
@soft glade
from discord import Activity, ActivityType
await client.change_presence(activity=Activity(name=f"on {len(client.guilds)} Servers | d/help", type=ActivityType.watching))
Try that
I don't think so
Could you enable people from sending you texts? I'd like to add something and I don't think I should spam here
Ok
is there a way to make reaction roles work after a bot restarts
You would need to store the message IDs, reactions, roles etc. in a database and load them whenever your bot starts
oh alr
@twilit geode js what? using raw http or you got a lib going?
discord.js? eris.js? detritus.js?
axios? fetch? got?
White? Blue? Nachos? Coconut?
hotel?
Raid?
I meant trivago
but my ads arent trivago
Which is sponsored by Raid: Shadow Legends™️
i dont get paid to ad trivago
pat
how do I make multiple api requests at a time?
like if an api is 500ms average, and I need to make 5 requests, I will need to wait average 2.5seconds
how do I make them run simultaneously to save time?
I have an array, the array is full of objects, and inside the object is a boolean, either true or false. I want to separate them. What is the most efficient way to do it?
[{"bin": true, "id": 1},{"bin": true, "id": 2},{"bin": false, "id": 3},{"bin": true, "id": 4},{"bin": false, "id": 5},{"bin": true, "id": 6}]
[{"bin": true, "id": 1}, {"bin": true, "id": 2}, {"bin": true, "id": 4}, {"bin": true, "id": 6}]
[{"bin": false, "id": 3}, {"bin": false, "id": 5}]
I have a solution, is to use filter() two times. But that is very inefficient
What means separating them?
Removing the value of the key bin entirely?
Maybe I’m blind but I don’t see a difference between your examples except a space
separating the "bin": true from "bin": false
Loop through the array and check if array[index] Object.key == bin, if true Object.value = !Object.value
Should work
wdym?
oof I’m driving hold on
for(i = 0; i < array.length; i++)
if(Object.keys(array[i] == "bin") Object.values(array[i]) = ! Object.values(array[i]);
If the array is larger than what your example was add an else continue;
value = !value should negate the boolean
so youre basically moving the object by deleting it then moving it to the new array?
Should work in JS too
What tf nope
Im just editing the Object in the Array
Not creating a new array
its not what I meant
If you need a new array then copy it then run the code on the copy as I wrote
If you wanna get be as specific as possible what you want
let array2 = array
Then work with array2
So you want to sort them basically, the first elements in the obj should be with bin: true, the rest with bin: false?
oh different arrays
Wtf
Sorting != separating
Why is it so difficult for people to actually tell exactly what they want 
Moving all true‘s to a new array maybe?
And let false‘s in the array?
That’s even more easier
Here's what I would do:
entries.reduce((res, current) => {
res[Number(current.bin)].push(current);
return res;
}, [[], []]);
You can also use a normal loop ofc
If think the default loop is faster and more efficient for this example
Since he said he’s doing 2x filter and looks for a more efficient way
But yeah we still don’t even know if that’s what he want
Maybe he just wants to sort the array which would mean to loop through and insert each object value which is true at the beginning of the array
[{"bin": true, "id": 1}, {"bin": true, "id": 2}, {"bin": true, "id": 4}, {"bin": true, "id": 6}]
[{"bin": false, "id": 3}, {"bin": false, "id": 5}]
He wants 2 different arrays
All these mentioned methods are easy but yeah no glue what he wants
Oh okay I see
oof I’m driving hold on
That may be the issue
Well then looping through and adding the objects to a new array is faster then reduce firing a callback on each items I guess
probs
But that’s micro optimization I guess
Didn’t fucking see it’s two arrays on mobile
Code blocks are horrible on mobile
Like embeds
just as an excuse for not reading carefully enough lmao
yeah we know, you used that driving excuse countless times already
lol
I just find it cleaner
const [notBinned, binned] = entries.reduce((res, cur) => res[+cur.bin].push(cur) && res, [[], []]);
Aye but actually doesn’t matter, we both didn’t read carefully enough in the first place and it can’t be difficult to say moving all objects containing false into a new array
But who cares
what does that mean
That's straight up nonsense though 
Aye
time to stare at this code until I find out how this works :D
[+cur.bin] what does this do?
turns the bool to a number
why would you turn it into a number
So we can put it in it's respective array
ohh I kinda get it
if it is false
it is 0
and will get directed to notBinned
but if it is true
yup
why does it have to be &&
because that's how the operator works
you can also use return but then the function will take up more space
so I could use .push(), return res, [[], []]??
no, you would have to put the code in the callback in curly brackets
But using && is better
so if I wanted to use return I would have to make a function inside the reduce function
but if I use && it will just like substitute return
const [notBinned, binned] = entries.reduce((res, cur) => { res[+cur.bin].push(cur); return res }, [[], []]);
Same function with return
&& res is cleaner
[notBinned, binned] = entries.reduce((acc, cur) => (res[+cur.bin].push(cur), acc),[[], []]);
you also don't create a new scope
why does this work aswell
yeah
no clue tbh but if use it if it works ig
only booleans work on +??
strings too
in the first one you're creating a new scope
in the second one you just group expressions
so its possible to create functions with multiple expressions without having to scope them ?
mhm
hi
And apparently the last expression is also returned, didn't know that
why doesnt if () () work
ok
¯_(ツ)_/¯
it only works on functions. ok
is there a way to get folders only from fs?
how do I make multiple api requests at a time?
like if an api is 500ms average, and I need to make 5 requests, I will need to wait average 2.5seconds
how do I make them run simultaneously to save time?
never again
this is the total amount of time that i took to fully implement voice on detritus


What is this detritus btw
best discord library for javascript/typescript
I mean you can use lavalink I suppose
Hello i have an error in my event handler, can someone help me ? :
const fs = require('fs');
module.exports = (Client, Discord) => {
const load_dir = dirs => {
const event_files = fs.readdirSync(`./events/${dirs}`).filter(file => file.endsWith('.js') );
for (const file of event_files) {
const event = require(`../events/${dirs}/${file}`);
const event_name = file.split('.')[0];
Client.on(event_name, event.bind(null, Client, Discord))
}
}
["client", "guild"].forEach(e => load_dir(e))
}
The error code is :
Client.on(event_name, event.bind(null, Client, Discord))
TypeError: event.bind is not a function
Or do you mean coding voice support for the lib
Ah oki
9 hours though? Basic usage or a full music system
so i had to write semi-pristine code
mid way
im working on it in a radio-type of deal
so i got a master serving all connections simulaneously
Do you have IPv6 though
I see
not dealing with ratelimiting
fuck that shit
youtube quotas
spotify ratelimits and quotas
fuck all that garbage
thats what i meant with scalable
i do have some ipv6 blocks
but not planning on using api's for the music bit of my bot
so theres not really much need
And Spotify's ratelimiting is pretty big, I haven't hit a single 429 the past few months
how many servers?




