#development
1 messages · Page 1743 of 1
(Again)
it is
^^
Then you’re missing a }
expected = missing
can you show the code?
You'll need to paste your code again as you have it now
I might be blind
but ok
`client.on("message", async message => {
if(message.author.bot) return;
if(message.channel.type == 'dm') return;
if(message.content.startswith(prefix)){
const args = message.content.slice(prefix.length).trim().split(/ +/);
const command = args.shift().tolowerCase();
const commandToRun = client.commands.get(command)
if (!commandToRun) return;
try {
commandToRun.run(client, message, args);
} catch(error){
console.log(error);
}
}
}`
client.on("message", async message => {
if(message.author.bot) return;
if(message.channel.type == 'dm') return;
if(message.content.startswith(prefix)){
const args = message.content.slice(prefix.length).trim().split(/ +/);
const command = args.shift().tolowerCase();
const commandToRun = client.commands.get(command)
if (!commandToRun) return;
try {
commandToRun.run(client, message, args);
} catch(error){
console.log(error);
}
}
}
how tf
We told you how to do that many times.
3 backticks, not 1
There you go
but
ig
three backticks with js after the first 3
May I?
you're missing a parenthesis
The following trick is a lifesaver, so pay attention: Your code editor is trying to help you. Whatever editor you're using, clicking on any (and I mean any) separator token such as parentheses, square brackets, curly braces, double and single quotes, will automatically highlight the one that matches it. The screenshot below shows this: the bottom curly brace is selected, and it shows the one on top by surrounding it with a square. Learn this, and how different functions and event handlers "look" like. Even in long bits of code, this works. If you don't have a proper editor, here's a guide: https://discordjs.guide/#/preparations/setting-up-a-linter
good ^ example
@glad cobalt you should probably consider the possibility that making bots with little to no javascript experience is like trying to make a Salmon Soufflé with zero kitchen experience having never opened an oven in your life. It's hard. So unless you're exceedingly autonomous (which you're clearly not, sorry), you're going to just keep stumbling through like a drunk sailor.
Please, take the time to learn the language first.
Resources: #development message
or pick up python which is practically english
I don't like python
Python and JavaScript are about as equal as you can get in terms of complexity.
Meh I don’t like python either
I like python
If you want to say you like JavaScript, then please go learn it.
Good for you, but this isn`t a religion, you don't need to try to convert people to it 😉
I understand js some what but I'm very tired and i want to sleep but i want to get this done
The language is intuitive, but I just don’t like the idea of indentation controlling behavior of all of your code
A wild shiv is speaking.
they're both well documented though so either is a good choice
Seems easy to mess up
I agree, it's annoying
It can be annoying sometimes lol
Ok but no. Stop. Tired programmers are dumbass programmer, and if you're really tired....
Go to bed.
I've been up for 16 hours
ok
Programming is not very easy to do sleep deprived
Computers are very picky
Messing up small things means 1 or more errors usually
', '.join([', '.join([str(m) for m in n]) for n in [[1,2,3], [4,5,6]]])
Ew
2D arrays in list comps ftw lmfao
making a nice string there
Indeed 😛
list and dict comps are pretty nice though
can anyone help me with noumenon please
They really are
5d array brainf_ck when
2d array - square, 3D array - cube, 4d array - I have no idea what’s going on anymore and my brain breaks down
4d = cube with little lists inside each tiny cube, 5d = cube with little tables in each tiny cube, 6d = cubeception
too much thinking for me
https://www.a1k0n.net/2011/07/20/donut-math.html
epic thinking
Agh
I’ve seen that before
Elegant, yet a lot of effort put into a simulated ASCII donut
lmao, best kind of code
Art
time consuming and functionally pointless
I love code like that but I would never be able to dedicate that much time and thought to something functionally pointless like that
kill it with fire
Should be 5D?
AH
Error means what?
Exactly what it says
The npm module “node-fetch” is not installed
Make sure it’s in your dependencies in your package.json file
Do npm install node-fetch
That too
let arr = [1,2,3,4];for (let i = 0; i < 5; i++) oneMorePlease(arr);function oneMorePlease(array:Array) { let _temp = []; for(let e of array) _temp.push(new Array(e)); array = _temp;}
burn it
One-liners ftw

upto_10_until_100 = [x for x in first_list[:10] + second_list[:100 - len(first_list[:10])]]
lmao java syntax ftw

python uses 4 spaces per tab. Can we change it to 2
Literally just have your IDE convert tabs to 2 spaces?
PEP8 suggests 4 spaces though
that's what I was thinking
but y
so it looks nice
Because if there's no standard to follow, shit's gonna go downhill with people trying to come up with their own styling
LMFAOOOOOOO
That doesn't seem to make the class JSON serializable, unfortunately
just wondering, but couldn't you use pickle for python serialization?
Extra dependency
okay, that's a fair reason
I guess I'm making my own encoder
lol
It's either the fact that I'm dumb as hell or this crap is more complicated than differential equations for me
yup I don't want to look at that
-upto
I guess a deployment is fine if you only need 1 replica.
But if you want more redundancy you would need to switch to a stateful set.
Yes you will have to upgrade to a stateful set.
whats a good way to store python functions with certain parameters until i want to use them later (whenever that happens to be)
I know you can store them separately but id like to store them together if possible
u mean together in same file?
?
during runtime
i want to store a collection of different functions
with specific parameters depending on the user
then have them run in a specific order
so i want to know what the best way to store a function and its parameters if possible
can we return a function from a function? in python.
if yes, then u can learn about currying
you can return a blank one
but id like to keep my parameters in there without actually running the function till i need it
if possible
just want to know if it is or not
python do support higher order functions. So you can call a funciton with the parameters u want to save. and return another funciton with the save parameters
https://javascript.info/currying-partials here is a js example. I'm not into python much.
cant say this is what im looking for
The functions im storing dont return anything, they simply all edit the same collection of information
function saveA(a) {
return function (b) {
return a+b
}
}
const fun = saveA(10);
const result = fun(20)
But im putting them in a queue so that they dont try to edit at the same time
Here I'm saving the number 10, for later use.
later I can call, fun with some other number
here, the result will have the sum of 10 and 20
do tell
wdym
what do those do?
I've been trying out different ways so ill be glad to try to implement anything better
a lock is an object that a thread needs to acquire before executing, so you can lock a function until it acquires the lock and when it's done it'll release it for the next thread that needs the lock
how does that retain order?
the order of threads trying to get the lock is the order
is that hilichurl working on mcdonalds?
:^)
good choice
I'm still not sure about what you're trying to achieve in the first place
hey i am about to switch my application to either mysql or mongodb as i was using json at first
tho, would this require me to change the whole code structure?
FUCKING FINALLY
im using mongo DB rn. Pretty simple stuff. I changed over from a differnt DB so i had to change a bunch but also took the time to restructure my code to make it neater and more consistent
#development message
going from .txt to a database
yes, most of it
database calls are completely different from fs.reads/writes
id say its simplifying it
which is best, postgres, mysql, or sqlite?
but i dont think theres anyone here with a need for 500k+ ops/s
im truthful
i dont give false hope
@sudden knoll

damn
postgres + keydb

postgres for what needs to be accessed only once or twice, and keydb for memory
storage / memory, respectively
would not recommend unless you have a need for it
time for some rewrites
going overkill isnt always the best option
well, project is relatively small, so I think postgres'll be fine for storage
i say that even though i've futured proof my bot to fucking coorporation levels
redis is an absolute god
no need to step up with keydb
though personally, overkill good

just get a dual Socket Epyc System with 128 Cores and 2TB ram and use it to Host a Discord Bot that is in 5 Guilds
my bad, i actually use localstorage to save balance info of casino constants
reduce in database calls in exchange for having a fast memory db
i got a 128gb ram 32 core 2Tb and gigabit internet rack just for my bot

does that count as overkill?
nah its reasonable depending on the Bot
if you run like 50 Shards its fine
or use AI to classify images
i run 4 shards

i still need to add the shard status ngl
been in the back burner for a long ass time
for the size of my bot ive also run a bit Overkill hardware, but who cares, you have space to grow
this ^^
how would i link my localstorage to another bot instance?
localstorage? wat
wdym?
localstorage is for browsers
i am using localstorage to save info in a particular folder
use a database

cuz thats what its meant to be used for
aint gonna do some janky ass things as trying to fs.readFile() on an ssh tunnel
if you cant afford a database, MongoDB is aviable for free
i can afford one.
well free hosted
But i will have to rewrite everything and holy shit i am not in the mood for it
galaxygate
but i do not recommend it, Atlas is overpriced. to get the same features as Self hosted you pay like 60$/Month
okay i will have a good look at the docs and try mongodb
bUt TIm ITs NoT OVErkiLl
anything else is overkill
postgres looks sexy, atleast the comparison to Mysql ive read.
nah just use a Cassandra Cluster to store Guild Configs
scaling that youll never need
a dev that doesnt plan ahead will likely be doomed
well one reason why Discord uses it now, after they hit the limits of MongoDB
KeyDB is pretty cool ngl
told ya
yeah just go ahead and pay for 128gb of ram for a 50 servers bot
yeah

i mean code wise tho, not actually specs
sharding/databases/etcs
i pay for a 64GB Ram Server for a 270 Guild bot, so i guess im close
client.user.setActivity("PUBG MOBILE", { type: "STREAMING" })```
This is not working for me. It is showing playing instead of streaming.
chosing your db software doesnt fall into code-wise
i have to check if my boy has some permissions on a discord server
its specs
sqlite is nice and easy to setup
discord isnt that active to make sqlite be limited by query's calls/
i recommend
tell that to the guys who are using .txt and .json db's
but now that I see KeyDB.....
when ive started with js and discord bots, ive used Enmap as a sqllite wrapper, worked but ate a lot of ram
i started with a basic json db for channel configs to test out, but was shot down 2 days after by a friend(same one that's allowing me to use their servers) to use proper dbs
its good to get scolded by veteran devs
text and json is not database software :^)
I agree
tell them that, not me 
the thing is, most bad but somehow popular guides out there suggest a json db from the start
bcs its "easy and cheap"
it's for beginners I assume
popular =/= good
its bad practise
i used a json db until i hit 2500 servers
fortnite is popular for example, and we all know its rep
wtf?
first: you know a bit how to code
the thing with fortnite is the playerbase not the game
Epic Games is big brain tho
second: would you still tell people who know jack shit about coding, not even how if's, else's and functions work to use a json db?
marketing-wise at least
yes, i like watching them suffer
ppl probably use json dbs so they don't have to learn another language
back when i started the json db i didnt know shit either, i was asking for specific questions without context.
such as: How do i save a file locally? and not Whats the best way to save channel settings?
which lead to me start using json as a db. Luckily i had some veterans to gimme a hand and put me in the right path, i cant thank them enough
ive started making bots with some knowledge about databases prior and the power behind them. also used to make small Addons for Gmod in Lua. so i knew pretty much at the beginning i want a Database, and not some stupid file storage
so i wasted about a week at most using json
but that was a good experience to learn how fs works
cant say it was a complete waste of time either
but its much better to listen from experienced devs rather than waste the time yourself to eventually learn it
its like skipping school and going for a try-and-error approach
i never thought my bot would ever grow, so i dindt care much at the beginning
this is how ive learned js, trial and error, and reading github repos
becausebof how niche it is
i've had both, i started by being quite lenient, but started getting my own footing afterwards. Searching is a skill to learn
my larger bot is also quite niche, also havent grown in like 7 or 8 Months.
tried to get ideas for other bots, but what i came up with for now is sort of already there
reading github then: holy shit this is so advanced, i dont understand anything...
reading github now: holy shit this code is so bad, what an idiot...
im creative like a Brick
i keep on getting a shitton of amazing ideas that would take a long time to put
but for some reason im not bad in CAD
you mean like autodesk?
as example
but im more used to Solid Works
i wish a license would not cost 3k€/Year
i was just confused at the jump from coding to CAD
blender >
lmao
but it can be used as such
yesnt
you could, but you could also use a json db to store info

proper CAD software gives you stuff like calculations for mechanical Stress, flow simulations and other fancy stuff
this is all i gotta say for licensing
lel
doesn't mean you should
take it as you will
this

but i sort of want to get into Machine Learning, already know a real world use case i could use it. but then again, im not sure if the efford for it would be worth it
just add more if elses
fax
neural networks are overrated
more binary
although that is what it is at the core
hey is there any way to migrate localstorage to mongodb?
nah its for detecting damage on Plastic parts produced with Injection Molding. my idea would be that the Part will get taken out of the Injection molding machine by a robot (already happens in my Company) and then exposes it to a camera, from there just some machine Learning hackery to see if there are defects, like the mold where not entirely filled, damage on the Mold, maybe the part broke apart while getting ejected.
when i migrated from mysql to mongo ive wrote myself a script for it
ohh so image processing
ye
very nice
also it would be relatively cheap to make, a nvdia Jetson is like 40€
why not 3d scan it?
I'm about to write a script that'll write my getters and setters for me
because aghghgh
to slow, bcs you have to do it every 30 seconds
wouldnt a camera or OCR be almost as slow?
why?
the only downside it'd see would be the initial cost of a 3d scanner
we got a 3d scanner last week lol
1 image would be faster than a 3d scanner
or multiple images
but for making a 100% check using a camera is cheaper
alright, that is good of you! Is there any online guideline or something on how to do it
well yeah, thats what i said
also we would then need like 20 3D scanner to cover every production line
the only downside is cost
the issue is dealing with reflections and accurace with a normal camera
so suggesting to buy 20 10k€ 3D scanner vs buying 20 Nvdia Jetson for 40€ each and a Camera
you'd prob want something cheap like an infrared camera to make sure it gets depth
why did you migrate from SQL to NoSQL btw?
got bored
fair point
was wondering if there were any speed reasons or smthn
yeah ik
Mongo is easier to scale tho, also you might get better Read I/O if you set it up correctly
prob best to stick with redis then
?
docs
for now i have a single MongoDB instance that gets cached by redis.
just trying to push out something functional before I get reviewed
if i were you, i'd stop relying on bot guides
but i could run 3 Mongo instances in a replica set and use the secondary nodes for reading and the primary for writing
owh yeah you are right, I will just randomly start slamming my keyboard to get my localstorage > mongodb to work
did you even bother reading the docs of whatever db you chose?
english here
did you have it installed?
def not
transferring to a SQL database is pretty simple if you know what your columns'll be
yeah i've checked it
then whats the question?
and which db did u choose
just make a loop and read the stuff in your old db and write it in the right format in the new DB
atleast this is how i did it with my migration
the only different is if you're using a document or relation based db
don't know how else you'd do it
lmao

being stupid, dumping the Old DB, opening the file in Notepad and then copy/paste it into the new DB
its not my time being wasted, so i really wouldnt care if someone did that
THOUGH
speaking of idiocy
i did copy over 500 numbers manually
lmao
to convert a Buffer response to see wtf was the error cominbg from
it was on console
and i didnt have access to the error anymore
that is highly unfortunate
guess who opened console and copied the numbers one by one into an eval command to convert that buffer into json object

not you
100% not me
yep

Not Erwin

You got your intern to do it?
definitively
now that's big brain
the most satisfying thing ive did in a while, Automatic offsite Backups for my Database, once a week i run 2 scripts on my server. 1 Dumps my MongoDB into a file. the 2nd Script uploads it to a Google Drive
i did a smarter move later down the line tho
i made VSC full screen and changed the output port to 20%
so i could copy the whole BufferArray in one go
also have automatic managing of old files, if the backup is older than 14 days it gets deleted
imagine using a db that isnt acid compliant
Lol. Backups are for people who don't want to mess with Murphy's Law
all 3 servers are in the same center either way
not gonna backup over 15gb of data locally
Imagine using non-redundant setups
lol just pay google 3€/Month to get 200GB offsite Backup space
with murphy's law, the backups'll get corrupted too
bold of you to assume i have money for that brain
or get google enterprise stuff and create 5 accounts to get 1PB of storage

idk if you know the game Robocraft, but they got almost entirely nuked by the OVH fire, luckly they had a offsite backup
all 3 are in the same center though
why?
why wouldnt it?
For my day job I run a kubernetes cluster with 100s of workloads. I have learnt the hard way that you need to cover your ass.
sure better latency, but the risk would be way to high
theres a server for the database, one for the bot, and one for another thing
same center, not same machine
each one of those is a physical rack
not a vm
dude if the center catches fire every machine is toast in there
just spend like 3$ or so on cloud storage to have some sort of offsite backup
get fireproof ssds
this
they wont withstand the hell
the whole room is ventilaed and cooled down iirc
my company burned down back in 2013 and the fire managed to melt 0.5mm thick steel
they will if you coat them with nasa grade anti heat material
actually, water without any minerals is the best insulator, so maybe
put tbe entire datacenter underwater
yeah
loke a nuclear reactor
i where inside a relatively modern Datacenter in Germany (Cologne) sure they have fire Prevention measures, but they dont stop a full blown fire, the doors are only rated to withstand 3 Hours
pure water
the cloud server can also catch on firez, nothing is safe, everything will get destroyed at some point
Google did it, and it got attacked by Sharks
gotta live 3 hrs away then
an offsite backup is still better than no backup
lmao
and the risk that both catch fire the same day is relatively low
never mess with murphys law
it's the same as getting killed by a cow, it's low but never 0
https://srcb.in/nD7Rje1YbG
Why this code doesnt add roles?
Is a reaction role code
this is also an argument to make backups lol
In my opinion it doesnt work because I put the role name and not the role ID
nice i see nested events
I haven't checked that code yet, but istg, if find out you just copied and pasted some random code off of the internet I'll be mad
youtube video for the explanation
I should add them into the events folder?
const codm = message.guild.roles.cache.find(role => role.id=== '<roleid>');
Will work?
all dead :/
If you have the role ID already, you can use the get method.
youre talking about the const of the role or directly in the reaction?
I'm talking about this code.
const codm = message.guild.roles.cache.get('<roleid>'); ?
Urgh, I'm not a fan of discord.js. It feels over engineered.
And then you take at look at their source code, and it feels like spaghetti.
its not a lib for scaling, its a lib for new devs imo
most of the stuff is unoptimized and it tries to wipes people's ass for you
nope it doesnt work
OBV
ok, I'm not the best at coding and I'm actually dumb, but not this dumb
just making sure, we do get those people here quite often
that would work if there was a role with that id there
if its returning undefined it means theres no role with that id
const minecraft = message.guild.roles.cache.get('841574598969655347');
.get() returns either a <role> or undefined
Have you tried console.log ing the variable?
but I have a question
that syntax is correct
you can just console.log() that
I put the id directly when it gives the role?
console.log(message.guild.roles.cache.get('841574598969655347'))
best anti nuker bot
again
read this
instead of minecraft I put the ID
imagine if get() returns undefined (aka theres no role with that id there)
should work?
I'll try
check if it exists before continuing
},
2021-05-11T08:31:51.509277+00:00 app[Worker.1]: id: '839900642722185248',
2021-05-11T08:31:51.509277+00:00 app[Worker.1]: name: 'CODM',
2021-05-11T08:31:51.509277+00:00 app[Worker.1]: color: 1002225,
2021-05-11T08:31:51.509277+00:00 app[Worker.1]: hoist: false,
2021-05-11T08:31:51.509277+00:00 app[Worker.1]: rawPosition: 10,
2021-05-11T08:31:51.509277+00:00 app[Worker.1]: permissions: Permissions { bitfield: 103927361 },
2021-05-11T08:31:51.509278+00:00 app[Worker.1]: managed: false,
2021-05-11T08:31:51.509278+00:00 app[Worker.1]: mentionable: false,
2021-05-11T08:31:51.509278+00:00 app[Worker.1]: deleted: false
2021-05-11T08:31:51.509278+00:00 app[Worker.1]: }
it is all right
most stupid thing I've ever said
what exactly is the error tho?
this whole time you asked "will this work"
and not what the actual error you're encountering
it doesnt assign the role
does the user exist in the server?
the embed, the reactions works, but no role
idk if d.js allows for you to pass a role
how it is possible that the user doesnt exist?
just pass an id
if the user left? idk if you are collecting reactions on the go or not
But does the server log an error?
nothing
pass in a string instead
or na ojbetc
ugh, let me check the shitty djs docs
1 sec
Then you are probably short circuiting in one of those if statements.
nope
what does short circuiting means?
If the add operation was failing, then you would see an error. Because there is no error, it is likely not even being executed.
Tried putting console.log("adding role") right before you add the role, and see if it prints.
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'guild' of undefined
then theres ur error
with the ID instead of variable it give me this
this is the whole code
if(!reaction.messsage.guild) return;
there is the error line
either message or reaction.message is undefined
add this ontop of ur code
if(!message || !reaction?.message) return console.log('Something was undefined, canceling')```
right below async execute?
Where is execute being called from? Is it even the right arguments?
UnhandledPromiseRejectionWarning: ReferenceError: reaction is not defined
lol
if(!message) return console.log('Message was undefined, canceling')```
change it to this
and then
if(!reaction?.message) return console.log('Reaction.message was undefined, canceling')```
and then this here
quick recap, one under the param at the top and the second one there?
yeah
Go learn typescript lol. The compiler would have warned you by now.
THIS ^^^^^^^^^^^^^^^^
1000000% this
typescript is javascript, but better
and use detritus.js instead of that shitty ass discord.js lib
theres the "use this"
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'guild' of undefined
When I add the reaction
did you restart the bot?
also
you did add it ABOVE where i said right?
it should be under user.bot
also also
@stiff lynxread this after #development message
@stiff lynxu added the first but not the second
i sent you 2
even got an arrow showing where you wanted to put that in
if(user.bot) return;
if(!reaction?.message) return console.log('Reaction.message was undefined, canceling')
if(!reaction.messsage.guild) return;
i dont see that in what u sent here
I copied it from there lol
I would first console.log all the arguments passed to execute to figure out exactly what you are dealing with.
u r right, I added it only in the first one
i see the first but not the bottom one
also
someone fucking slap me
what is this my dude
you're creating a new listener on every command?

wdym?
you're literally making a memory leak in ur code
use that command 25 times
see what happens
jsut trust me
trigger that 25 times
tell me and not make me try lol
everytime you run that command, you add another listener to your client, not only ONE, but 2
you should only EVER make ONE listener
this is oversimplifying, but for the sake of simplicity, im saying that
I'm sorry, maybe I'll trigger u, but what is a listener?
You will need to track the state of each message somewhere.
basically it'll likely crash and error with a error 1 when you clçick that reaction 25 times
or command
because u create 25 x 2 of addrole and removerole?
you'll get this
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 event listeners added. Use emitter.setMaxListeners() to increase limit
actually
its 11 not 25
you only want ONE
never put listeners in ur commands
Unless you use once
useless here
But that won't work here, because the reaction could be for another message
once() is not guaranteed to be the reaction from the message they're expecting
if someone told you to do what you did, feel free to tell them they are dumb
best approach would be attaching a map to your client
and checking for active messages
or, better yet
use discord.js collectors
a youtuber lol
never watch youtube videos
How do I get the version of discordjs?
too lazy to copy paste
I see
this Is the truth
tl;dr, rely on docs
not on videos/guides
guides can also be on that lower end of the spectrum
for example
you using discord.js
therefore you should be using this
holy shit its 6am
To make your code work, you will need either a database to track state between restarts, or the simple option is put something in the embed to track it.

In Italy Is 11 am lol
uh my code is saying syntax error with this line even though i didnt change anything
bot = commands.Bot(f"{pre}", case_insensitive=True)
then go fuck off to bed
my problem with this Is to understand
big people
if you want to be a dev, you'll need to slowly but surely learn how to read docs
yeah
I'll tell u that here in Italy i'm doing the "Dev" university, Better IT university and no One teaches me this
I'm doing JS
years ago I did C++ and C#
and the teacher never said to read docs
Docs are big important
ur teacher sucks then
I totally agree
How the hell u gonna understand how an API works thrn?
Or how to communicate with it
clearly by watching a youtube video with 300 views from 5 years go
i dont even know what an Api Is
sarcasm
I'M TELLING THE TRUTH, NOT SARCASM
I
Im baffled
I self taught myself to code in 4 languages and even i know what thr fuck an api is.
@stiff lynx i think you gotta demand a refund ftom that school man
this Is not the problem, the problem Is the teacher, the teacher says to you
"do this this and this"
but I agree that u never learn
Google is a great teacher
the most difficult program that I did Is sum of every Number before an input Number
No offence, but like, coding also comes from learning by doing stuff ureself and exploring what you can do.
So something tells me u didnt code outside of that class
I code the discord bot and a man asked me to add the bot in a 3k members server
my bot isnt trash
I never said that?
no, Just saying
My bot is getting added to a server with 10k members tje moment it gets verified by discord but u kno
This is the secret behind every professional in software BTW
Stackoverflow
Google shows results from stack overflow lol
@stiff lynx u know what a cog is right?
Oh oof
but I tryied to read the docs, but for example, when I have to do reaction.message.guild.members.cache how can I get the order from the docs
Nvm then
users outside of py wont generally know what a cog is
you only look at the last bit
^^
guild => members

in order of what you're looking
Me rn
starting with reaction
thgen we go to message
see where im going with this?
you follow the chain
but you are stuck in the last part
which is members
so It Is All connected by a gerarchy
which is here
yeah
@stiff lynx in all seriousness, you should give Typescript a go. A type system is actually useful for learning.
guys he barely knows js
lax ts
will likely help
so he doesnt need to learn how to deal with interfaces/typesa
just abuse the intellisense
ty for the support lol
fucking
@stiff lynx
check this one
look at all the errors it gives you
and the auto complete
I've whatched also a 8h yt video for coding Java
learning comes from putting ur hands on code
You darn lazy boy...
getting it dirty
typescript ftw
Speaking about auto complete
Nothing wrong with auto complete
Imagine using npp and have to type each letter yourself... that’s hard work 
@opal plank but now, my question Is, how I fix my reaction role HAHAHAHA
Well, if you want to type more stuff, then go for it lol
JavaScript has auto completion too, so this is a moot point for typescript.
The coding language doesn’t matter...
The app supports auto completion because it can interpret the language
Knows it’s syntax and reads your opened files, defined functions etc.
message.member.roles.add('roleid');
this could work, without the client.on
Best thing about type systems is saving your ass from null and undefined.
They are the devil in disguise.
Literally available for each shitty app, probably even notepad (not plus plus)
undefined... well then switch to PHP
I spent a couple years wasting away my life with WordPress. That stuff haunts you. Never again.
Well that’s your own fault wasting time with trash like that, don’t blame PHP for it
Hah yeah. It paid the bills.
Just remember all the hours I spent to remove malware and try to improve the security just for the next WP update adding 100 new vulnerabilities
Only because that dumb retard I helped wasn’t able to setup a new forum or choose a different software for his community 
Laravel doesn't seem half bad. But yes. Once you have been burned by the PHP CMSs like WordPress and Drupal etc. You don't go back.
You said it yourself yesterday i'm just informing the others 😔
Been trying to improve memory usage in a Discord client I have been working on. Turns out upgrading node from 12 to 14 makes quite a big difference! Before / after:
U r hosting in Google clouds?
Yeah, that's on our company cluster.
Not sure if this is the right channel sorry, but i'm writing an API for webhooks there doesn't seem to be any well defined guide on authorisation, can you tell me if there's a good RFC you use or a guide which states that all webhooks use an auth header by standard?
anyone that know a bot that gives roles after reaction? IDK how to do this by myself
There is heaps of bots that do this: https://top.gg/search?q=Reaction role
https://stackoverflow.com/questions/52210855/give-role-when-a-user-add-reaction-discord-py found this on google
There is some pretty good docs on webhooks on the developer site: https://discord.com/developers/docs/resources/webhook
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Thank you, but i was more on about receiving webhooks like the ones from top.gg when someone upvotes your bot
Have you read this? https://docs.top.gg/resources/webhooks/
This is good i just want to know if it follows a universal standard
Yeah... you create you webhook service and receive a JSON string
Every implementation differs a little.
The industry standard is usually to sign the payload with a shared secret, then the signature is sent in the headers.
17mb for roles cache? wtf
In the docs I can find how can I send a message with the bot everytime a youtuber uploads a video?
you'd need to check youtube and if they have webhooks
what is a webhook?
google it
like i said, i could answer it
but you need to grab a bit of independence
You’re just too lazy... that’s the truth 
feel free to answer them then 
I appreciete it
webhook is a connections between discord and another platform?
Damn I thought I got you and didn’t expect that... I’m quite
in a way, yes, kinda
webhooks trigger whenever a service pings them
and then you process it as you need it
as they come basically
just look up youtube webhooks
but the question is:
I have to create the webhook on IFTTT website and after that connect to my code?
you're looking at the shitty way
you dont need to use IFTTT
you CAN
but youtube should have some webhooks by themselves
ok
not sure thats a thing to be proud of, but okay
Stop being lazy... code the stuff for him and let him copy and paste it Erwin
tag, you're it
now u help em

lul
Need to google first what YouTube is
Never heard of it 
guys, they asked me to add my bot but them want a message every time they upload an video
but it really worth it?
because u can do this with webhook directly
or not?
up again
So you know about the attribute-key support stuff
I just want to make my DataDicts serializable so that people can use them as dicts
And why I don't want to just make my own encoder for it is because it seems pointless if I can make the class serializable for the json module
Make it serializable so people can use it as if it was a dict object? Aren't those 2 different things to achieve?
Dumb me
guys how can I do an advanced command handler? the one with commands oredered by category in different folders?
Correct, that's a letdown to my English language. What I meant is that if users wanted to serialize an instance of DataDict, they can do that without extra shenanigans
Like dd.dict or custom encoder
2021-05-11T11:03:07.095857+00:00 app[Worker.1]: (node:4) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
2021-05-11T11:03:07.095874+00:00 app[Worker.1]: (Use node --trace-deprecation ... to show where the warning was created)
info about this?
I've been going over Google for a long while and got no real answer that really assisted my question at hand: "How to make a class JSON serializable without implementing any additional methods like to_json"
bot.user.setStatus(“idle”) isn’t working for me, any ideas?
So, in short, you wanted to make an object subscriptable as if it was a dict? Didn't the implementation we've talked in #topgg-api suffice? Why does this need to be serializable? To get passed on as the body when sending requests?
Mostly, but also to work with, say, json.dumps
And I mean being able to do json.dumps(dd) instead of accessing __dict__
hey
i am trying to connect my vsc to mongodb
which connection method should i use?
bot.user.setStatus("idle")
Try this.
Ah, then you can't subclass a UserDict since it doesn't subclass a dict, rather, MutableMapping. You can subclass a dict ig, implement __getattr__, __delattr__, and __setattr__. __getattr__ will do something like self[key], __delattr__ will do del self[key] and so on. So, anything else like get should work. It's also json serializable, but depends on its values obv.
Didn’t work
You need to paste it in ready event
What it is showing in console?
Oh I do?
You can’t change the status anywhere but there?
You can change with eval command
I set the status in the ready event and nothing changed
Still says online
It’s not a big deal don’t worry about it
Yeah ik lol
Actually it just changed never mind lol
NVM😅
hey
const economy = require('../economy'). I am calling economy which is in my /schemas folder:
why can't it reach the economy.js?
you are trying to get a file only, and the code cannot detect it inside the file
const economy = require('../schemas/economy')
has anyone used fastify?
yup, thanks!
@opal plank can you help me with some ts?
show the schema file?
If I enable "guilds.join" in my bot invite link. Then users will automatically join the support server when they try to invite, right?
"enable guilds.json in your invite link"? what does that mean
Oh you mean guild.join scope?
You can't get someone to join directly from an invite link. You would have to go through an oauth system.
However, you can redirect them to a discord invite after, using the redirect_uri system
Oh Ok Ty!
Why didn't you update to djs 12.5.1?
So if i will change discord.js to 12.5.1 its will work ?
Well some will work and some will not
thx
np
absolutely not. There r so many breaking changes in djs12.
u hv to rewrite ur whole bot in djs12. which will take some time
But v11 is broken lol
I am having trouble with CSS
<style>
body {
background: url('https:// i.imgur.com/Uqdu35r .png ')
}
</style>
That doesnt work for me
try .entity-wrapper
uh no
Okay thx tho
there's a space before .png
May we see how it exactly looks like?
Sure
Give me a min
Site doesnt always show updated version to me
@earnest phoenix
<style>
.body {
background: url('https: //i.imgur.com/Uqdu35r.png')
}
</style>
background: url(...) no-repeat
I fixed my error and the bot runs fine but when I do my command it says
So like background: url('https: //i.imgur.com/Uqdu35r.png') no-repeat
(node:163) UnhandledPromiseRejectionWarning: TypeError: message.content.startswith is not a function
(node:163) 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:163) [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.
Try it, Crystiq
.startsWith
Use the Preview button
._.
StartsWith()
Preview doesn't show any image at all
oh right, JavaScript
ToLowercase
So its correct
toLowerCase?
Flaze it doenst work
Nope
SHEEEEEEE
Im talking about the CSS lol








