#development
1 messages · Page 2032 of 1

node 18 or djs 18?
node
easy
is timhack still needed or does replit officially supports node 18 now?
yes
or other hacks
i think nix only goes to node 16
but the bash method works for any version
weird
ayo jdk 18 will have a webserver added by default
and they finally made utf-8 default
So hey, I have a mongodb db where I have a list in the value of a key like "key":["dis","dat","den"] and I want to get like all the collections with a specific element in that list, like I want all users with "dat" in their list , so how do I do it?
is there any way to get the this on the constructer rather than on the function?
without a variable outside the class
Can you give an example of what you mean
I believe this will always point to the enclosing class (unless inside an arrow function)
?
a parameter on the function ?
no, I mean, what exactly are u trying to do?
this.player = new Player(c);
this.x = c.width / 2;
this.y = c.height / 2;
that's valid
yes, aaaaand
lul
the parser works as expected
Nice
this is how it was declared
it was a pain to create the linter but damn, having syntax-checking and intellisense was well worth it
@earnest phoenix
New error
3:35 pm for me
i am free now
@earnest phoenix
Ping me when you're back
@slender thistle
ok....
Hmm
I took it from an video https://www.youtube.com/watch?v=ymEuiHY7__k
In this video I'll show you, how you can create an All in One Bot Discord Bot without coding or downloading anything!
Repl.it link/Bot Link: https://replit.com/@NotLAZER/All-in-One-Bot-Discord?v=1
Hosting: https://uptimerobot.com/
server.js codes: https://pastebin.com/wcdypYmD
Time Stamps:
0:...
Can u show a screenshot of the entire thingy
Even better: stop following discord bot tutorials on YouTube
A SyntaxError: Unexpected end of input error typically means either you are missing a closing parenthesis, brace, bracket, or similar character somewhere in your code or you are trying to JSON.parse() a string that is missing such characters.
Run your code/JSON string through a javascript linter (e.g. jshint) to find syntax errors.
What are u doing in #development if the video states code without coding
next time try putting it in google before asking someone
Looking up SyntaxError would’ve given you a ton of information too, just so you know
I have started one so i am desparate
got my first ever actual programming job interview in 20 minutes. any pro tips? 😛
It has coding
Like @lyric mountain just did for you, he literally just googled it and got a ton of answers
Clearly
Yeah
without coding
Read docs instead
Lmao
Googling is a big thinf
tbh even if that's a meme it's a very important thing to know lul
tbf, googling is a full skill. if you are aware of how to 'dork'
“I can type 1000wpm into Google and skim through irrelevant search results faster than any of your other devs”
i forked it
what good it is to have
- Master in Computer Engineering
- 90 years of experience with NASA
- Invented Assembly
if you miss
- Knows how to Google
Don’t fork projects you have no idea on how they work
I will complete this bot and then start learning
You’re setting yourself up for failure
i mean programming is about utilizing resources so googling might actually be a thing
At this point just start with a fresh bot man, learn the basics of JS as well. You're struggling with very basic issues you could have avoided had you taken the time to learn JS itself.
Yes
If you’re struggling with SyntaxErrors then you need to learn js first
someone pin this please
intext:"index of /"
Nina Simone intitle:”index.of” “parent directory” “size” “last modified” “description” I Put A Spell On You (mp4|mp3|avi|flac|aac|ape|ogg) -inurl:(jsp|php|html|aspx|htm|cf|shtml|lyrics-realm|mp3-collection) -site:.info
Bill Gates intitle:”index.of” “parent directory” “size” “last modified” “description” Microsoft (pdf|txt|epub|doc|docx) -inurl:(jsp|php|html|aspx|htm|cf|shtml|ebooks|ebook) -site:.info
parent directory DVDRip -xxx -html -htm -php -shtml -opendivx -md5 -md5sums
parent directory MP3 -xxx -html -htm -php -shtml -opendivx -md5 -md5sums
parent directory Name of Singer or album -xxx -html -htm -php -shtml -opendivx -md5 -md5sums
filetype:config inurl:web.config inurl:ftp
“Windows XP Professional” 94FBR
ext:(doc | pdf | xls | txt | ps | rtf | odt | sxw | psw | ppt | pps | xml) (intext:confidential salary | intext:"budget approved") inurl:confidential
ext:(doc | pdf | xls | txt | ps | rtf | odt | sxw | psw | ppt | pps | xml) (intext:confidential salary | intext:”budget approved”) inurl:confidential
what ungodly tarnation is this google search
It's fine to ask for help, but you're fucking everything up and wasting your (and our) time with every error you encounter (or create, rather)
i found that via google, guess i should add googling to my cv too 😛
const fs = require("fs");
const emojis = require("./config/emojis.json")
const config = require("./config/config.json")
const keepAlive = require("./server");
// require('canvas').registerFont("Genta.ttf", {
// family: "Genta"
// }); //loading a font
// client define
const client = new Client({
messageCacheLifetime: 60,
fetchAllMembers: false,
messageCacheMaxSize: 10,
restTimeOffset: 0,
restWsBridgetimeout: 100,
shards: "auto",
disableEveryone: true,
partials: ["MESSAGE", "CHANNEL", "REACTION"],
presence : {
status : "dnd",
}
});
module.exports = client;
const mongoose = require("mongoose");
mongoose
.connect(config.mongo, {
useNewUrlParser: true,
useUnifiedTopology: true,
useFindAndModify: false,
useCreateIndex: true,
})
.then(console.log(
.............................................................................. ........................ Mongo DB Connected .................................. ..............................................................................
));
client.setMaxListeners(50);
require('events').defaultMaxListeners = 50;
// //Loading discord-buttons
const dbs = require('discord-buttons');
dbs(client);
// Global Variables
client.commands = new Collection();
client.aliases = new Collection();
client.events = new Collection();
client.cooldowns = new Collection();
client.category = fs.readdirSync("./commands/");
client.db = require('quick.db')
function requirehandlers() {
client.basicshandlers = Array(
"command", "events", "distube"
);
client.basicshandlers.forEach(handler => {
try { require(./handlers/${handler})(client); } catch (e) { console.log(e) }
})
requirehandlers();
keepAlive();
client.login(config.token);
module.exports.requirehandlers = requirehandlers;
This is my index
Or
```js
code
```
you should use a site like pastebin or some jkunk for sharing large code snippets
or the backtab thing
My man stop copying off of the internet, it’s not going to help you lol
I started with quickdb 😂 😂
But i don't know coding :c
And
i try to learn
But its complicated
wooops
okay
Watch this JavaScript tutorial for beginners to learn JavaScript basics in one hour.
🔥 Want to master JavaScript? Get my complete JavaScript course: http://bit.ly/2KZea52
👍 Subscribe for more tutorials like this: https://goo.gl/6PYaGF
⭐️ Want to learn more from me? Check out these links:
Courses: https://codewithmosh.com
Twitter: https://twi...
okay
Read documentation, maybe follow a w3schools tutorial on javascript or something
Do ANYTHING but copy paste
if 1 hour is too large a time investment: https://www.youtube.com/watch?v=DHjqpvDnNGE&t=78s&ab_channel=Fireship
JavaScript is the the programming language that built the web. Learn how it evolved into a powerful tool for building websites, servers with Node.js, mobile apps, desktop software, and more https://fireship.io/courses/javascript/
#js #programming #100SecondsOfCode
🔗 Resources
History of JavaScript https://youtu.be/Sh6lK57Cuk4
How JavaScript W...
okay
That’s the worst mistake you can make when starting off with learning something
@earnest phoenix Sincerely
Write one from scratch. Better yet, start off wit smaller projects.
A Discord bot is not that simple as you may think it is
tbh, discord bot is easily the most complex thing ive written, and ive been coding for a decade
has anyone worked with firecracker microvm?
it lures you in with a false sense of ease, but its really just not.
idk Scratch
coding
Not Scratch
i just know blocks
I mean from literal 0
?
lol
i'm impressed by how many people who make bots don't know how CLI works
An empty program that you write YOURSELF
from square 1, from scratch, from the start, in your own words, without copy paste, etc
square 0 u mean
😂
Code
im out
Visual Studio != Visual Studio Code
remember this so u don't become reason for jokes later on
We call it vsc
VS is for VSC what Java is for JavaScript
lol, i remember the day my lecturer was trying to explain the vs and vscode difference
💀
Java and js same thing why make such a big deal out of it
ik i used it but it took so much space
andd
i deleted it
vs code took too much space?
Vsc
vs is gonna take way more./
Oh
That takes some space depending on what tools u use
IT TOOK 30 GB
Vsc is just an editor
I donwloaded all of them
Downloaded
until you add extensions 😛
Yep
I'm quite nervous for my interview 😰
can anyone tell me where to learn html?
I’m sure you’ll do great!
GL
Even if you don’t make it, you’re learning for your next ones too
So it’s a win-win situation
Yea, tbh i dont expect to get it, but it will be good to know how a pro interview actually goes
i do have almost all requires skill tho, so there is a chance 😛
guess i better pause my rap music while iw ait for them to join the teams meeting lol. dont want them to join and hear folks talking about 'trapping' and junk 😄
lmao this guy again
I’m not gonna bother helping with it
He just forked it off of replit somewhere so he’s gonna have a lot more issues than that if he doesn’t know js
yo tim look
I made my first piece of shit
On My own without copying
<h1>Hello world!</h1> 🙂
Just remember, html and js have very different functions in terms of what they do
So if you learn html don’t expect to be an expert at js right away
It takes some time
I learnt a lil when i was 6th standard
Just gotta persevere
i am obviously not 6th standard now so kinda forgot some things
You’d be surprised
Also
@wheat mesa
i TYPED IN THIS CODE
Like in the video
Cool
Then you didn’t write anything in index.js
I did but its not working for some reason
Looks like you didn’t save it
i did it
What console are you looking in
i- Ohh wait do you have to save for each file?
Yes
oh ok
Got it
@wheat mesa how do i open my folder using command prompt?
Like this
cd yourFolderDirectory
?
Or go to the folder in your file explorer and at the top type cmd and it’ll open that directory in the console
If you’re in vscode you can do CTRL+~
ok
~ interview flopped 😄
they were looking for a senior dev, i have no 'professional' experience. stupid job posting didnt mention any senior requirement lol
pretty much yea 😄
ahh its all good. the actual interview wasnt too bad, guys were nice enough 🙂
Good experience!
for sure!
Now you have a better idea of what to expect in the future
yep, and can prepare more for the tricky questions 😄
Exactly
shame tho, job was right up my street: writing backend api's using node js for a game dev company
Damn
"I have 20 years of experience as a dev"
"Sorry, we are currently looking for junior devs"
wish i lived in la. the wages those fools get for programming is insane
senior js dev average
uk: £60k ($74k)
la: £94k ($117k)
like, how is there even that big a difference? 😄
cost of living
i checked already, la is around $200 more on average per month without housing, and housing costs are maybe 20% more expensive than here
20% increased cost (rough average) doesnt translate to 50%+ increased wages
i guess demand plays a big part. la has a lot of big startups etc
You're comparing a city to a country tho
whats your tax situation also lol
yea i guess thats fair. ill have to find out the best place in the uk for programmers 😛
a lot of banks and facebook still have big offices out there o:
yea, i have a mentor guy from jp morgan, apparently they have a large office in my city
ayoo
those kinda places all want degrees and junk tho 💔
not necessarily true! especially for like frontend/fullstack type roles in banks, youd be surprised
its always worth applying
fwiw i got a bank job without a degree so im basing it on that
to be fair MOST people in those places are actually piped right into the company via internships at the colleges anyway
yea i guess that is quite fair
iirc that was like 80% or some other absurd high number of new hires. really strong intern systems
but they gotta hire people from the outside who actually know what theyre doing sometimes 😪
especially the banks that are trying to work like tech companies!! the big ones all pretty much split their tech divisions out from the pure banking side
so theyre much more like, accepting of non traditional backgrounds
i mean, it certainly cant hurt to apply, worst they could say is no 😛
you should give them all tries tbh even if the job postings require degrees, its just a line item they like to check off while doing the screening
yeah exactly!
banks are good money if you dont mind selling your soul for a while
but rent is rent
lol
i do like my soul, but yea, bills need billin'
what i find amazing, is these stories you hear of people who started to learn coding and 6 months later had a high paying dev job
and im just like~ how?!
lol
it really is just about luck
yea probably, or just knew a guy, and in the right place etc
connections go a really long way
yea for sure
make friends with the right ppl, don't burn bridges
I try not to burn bridges, but I tend to just, lose touch with people over time 😦
happens
no doubt. I recently made a linked in which i now realize i should have done years ago lol
got like 5 connections 😂
I personally try to think I have full control of my success/career but acknowledge it's really more about being in the right place at the right time and less about pure skills
yea that seems fair
Happy
sad
is there a way in js to make that only whitelisted user ID's can use certain commands? like ```js
if(user.id === "USER_ID") {
doSomething()
}
yes
i'd be set for life if i made anything remotely close to that
gg bronzil (jobs here pay like 15k/ usd yr)
it'd be like R$ 589k
which is a stupid amount of money
like not even the president's salary is that much
(hence why politicians steal instead)
well you get paid a lot in the US cuz inflated salaries but also you have so many more expenses. Gotta dish out hundreds for an insurance plan that will do nothing for you, housing is nightmare in LA etc etc
lol literally the life I'm living rn
lol nice
hospital
gotta get paid 6 figures so you can afford to use the ambulance one time 🙂
mozambique and indonesia are awesome places to live in according to a few people i've met
also thailand
stupid cheap cost of life, great weather, beautiful places
really, I have no idea how the country of suing and protests didn't get upset with health bills
because they hate socialism and they hate the idea of having to pay taxes for someone else's health care
¯_(ツ)_/¯
oh hey i didnt even take into account health insurance and that kinda thing, that would really raise the average cost of living as we dont really have to pay for shit here
basically you go to a restaurant, instead of splitting 500 so each pay 50, they prefer to each pay their own 500
like imagine, you lost everything, got so broke that your wallet shows negative money, you attempt suicide but fail and get rescued only to have a thousand dollars bill added to your situation
that's beyond fcked
theres this whole controversy about people who forbid the hospital from attempting to save them in case anything happens
and the hospitals do it anyway
some guy divorced his wife so that his hospital debt wouldnt affect her after he dies
there was a site that people would post their insane american hospital bills on. one woman got charged like 2k usd for 'skin to skin contact' after she gave birth to her baby... they literally charged her 2k to hold her kid after it was born...
heard that too
and if you ask them to send you a detailed "itemized" bill, it gets 10x cheaper
basically they are skyrocketing the prices hoping you wont double check, but if you ask to check it, they suddenly lower the prices to hide it
such a scam
its basically a money laundering scheme between hospitals and insurance companies
huh
also, patients have the option to pay cash (assuming they have it) and not go through their insurance, which works out about 60% the price, but they tend not to mention that when your there
tbh the entire american economy is rekt, and most other countries too lol
america is pretty bad though
I mean from what I’ve seen though, it’s a bit more difficult to live in places like that if you’re not native to it. The culture shock would be insane for people that didn’t grow up in that type of environment, but I’m sure you can adjust to it
Eh, not so sure about that. Went to the ER for two hours, got a $6k USD bill, asked for an itemized list, got the itemized list full of a shit ton of tests we never asked for but were deemed “medically necessary” (which I understand the doctors are just doing their job). Despite being medically necessary, our insurance has paid less than 20% of the total bill (probably around 1.5k ish? 6k was after insurance). I think that both hospitals and insurance companies are to blame for this sort of thing
The hospitals intentionally overcharge because they expect the insurance to fight the costs a little bit, so it evens out to what the hospital technically wants for it
It’s ridiculous
that was the same logic i heard for why paying in cash was cheaper
there are reports from hospitals charging basic items like cotton tips for 500x more than pharmacies
yes, but medical grade cotton tips! 😛
lmao
there are reports also of nasa contractors charing thousands per nut and bolt for crap that you can get for near pennies
tbf, if nasa calls you to write a discord bot, your gonna chuck a few extra 0's on the bill 😛
companies supercharging each other so that the ceo's get a larger slice
gotta have big bills to launder big sums 😛
they're gonna come to me with an negociation offer thats gonna be basically like this:
"hey so you build this for us, and you charge us 20x the normal amount, and we split the extra money between me and you"
thats when you counter for 40x and a 60/40 split to you 😛
xD
and they gonna accept because 40% of 40x is more tha 50% of 20x
and they dont care, they just want to make more money
exactly!
rich people business 101
https://twitter.com/briantylercohen/status/1522267881412562947?s=20&t=GyC0SaWHaKARTHs6f2hXTw
https://twitter.com/joshmusgrove4/status/1522246776039763968?s=20&t=GyC0SaWHaKARTHs6f2hXTw
Holy shit. Louisiana Republicans have voted to advance a bill out of committee making abortion from the moment of fertilization a crime, in which the mother can be charged with homicide.
11453
4972
@shivaco_ @MayapplePawl @g_rootResister @StrikeDebt @AOC Yeah,how many immigrants are you willing to sponsor,,really, invite them to your home, feed and pay medical costs, quit asking others to support your virtue signaling pipe dream,really,we have citizens who need help now,,how about stepping up?🌎👍🇺🇲✝️
I really don't understand Americans
Nobody does
people on twitter rarely ever make sense
we live in an idiocracy where idiots were given too much voice and too much power
lmao
to have voice and power
remember when stephen king said that covid is not even close to being as bad as some virus in one of his books
which book
and some idiot on twitter said "how the fuck would you know? did you even read the book"?
the stand
one of the books I don't have
imagine having the time to read books
someone on twitter said that "elon musk could have used those 40 billion to end world hunger, 40 billion dollars to 8 billion people, thats 5 billion dollars for every person, imagine how your life could have changed"
In this state of the world global hunger can't be fixed
There'll always be suffering
That’s how capitalism works
You better throw stuff away than giving it to somebody for free
And literally nobody cares about 3rd world countries
Seriously the amount of food that gets wasted every day...
roughly 50% of all food produced world wide gets wasted
We only care in terms of where to produce goods as cheap as possible
If not even way more than that
I just noticed how cursed that math is
Man wants to give 7 billion people a dollar
That would be fun
:v
thats a lot of bytes is that even correct
thats 1.6gb thats definitely not right
lmao
i think its not stopping for some reason
might ask on the os forum about that
i ported the parser library from c to c++ so that mightve caused some issues
Can I transfer ownership of one of my bots to a different account?
tfw i sit down and start coding with the intention of finishing the missing stuff on my api, and instead i end up reworking the existing features for the 6th time
btw turns out fetch in node 18 is shit
much better to install nodejs/undici and use undici directly
prove it
its 1:1 the browser fetch, stripped out of all sorts of cusomizability that node-oriented libraries have, like tweaking timeouts, keepalives, agents, it has locked/unremovable headers and its also slower than all other fetch implementations
nah just use undici directly
npm i nodejs/undici
theres a proposal for exposing undici in node, hopefully it will be approved
then you can just do require("node:undici")
but right now its unaccessible, so you need to install it separately, which is dumb af
these proposals 💀
i swear if you want to get something approved you have to go through blood sweat and tears
SPEEDY OS ANNOUNCEMENT - speedyos now supports compilation of C files which are all linked together at the end alongside the C++ files
lmao nice
also
this is the kind of errors you get if a fetch fails, while using the node 18 fetch
10/10
The most helpful error ever
call it SpeedOS
it's giving
Something happened
I think something happened
something happened
did something really happen though?
when u put a global exception catch
this is like a browser copy
Number 2, right after SQL errors
i think i know why sql errors are so vague
at least node 18 reports the error without silently failing 💀
its because it would take ages to write out a specific error message for every little error
It's better for it to take more time to give out proper errors instead of letting the user spend hours trying to figure why the error occured
Who thought just telling the user where the error occurred right next to a character was a good idea rather than making proper errors
idk what makes me think this, but I think something happened
SQL standard committee's nightmares must be proper errors then
the dude that created javascript did so in 10 days
they have spent since like 1995 trying to fix his bugs 😄
JS by itself is pretty darn good
ngl, i'd be stoked if i was the dude that whipped up an entire programming language that runs the world in 10 days
Imagine telling the user what he did wrong, that wouldn’t have any learning effects
Well I can't blame him with making a lot of bugs, he was literally kinda forced to make it in 10 days or less
Imagine telling FakE that I strapped bombs onto his car, it wouldn't be fun without him finding it out himself!
is there a link to the livestream of him getting in the car? 😛
👀
Threatening the outlandish statements of FakE with his fake news 

just askin', what are the differents objects existing in js ? can't find any list
like arrays, dates, json objects...
Probably in GTA V
regexps...
I do realize i linked the guide for like, classes, but on the left panel there is a list with some default classes and examples
a class is basically a namespace for data, they can be constructors for data objects
they can also be 'static' where no object is created and just methods are called
Btw if you didn't know, arrays are just actual objects with indexes as keys and elements as values in JavaScript
okay thx !
And probably also the same concept in other programming languages
there are tons of js features and classes i forget about, or learn about every day
recent ones are: Intl class for handling times in zones etc, and # for private class functions/variables
There's also Reflect
(some of this is for websites, not node)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference & https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
this is a bit easier to see what actually exists
I somehow like https://devdocs.io/javascript/global_objects/date
devdocs is a nice site
oo i like that
It’s a bit easier to use than the Mozilla docs
their doc works offline too which is hella nice
Yeah
They also seem to show internal symbols, nice
Well made docs tbh
devdocs pulls docs from other sources and just formats them/stores them for offline use iirc
I actually do use them, they're pretty useful especially at times when debugging or working with large array buffers
atomics especially for SharedArrayBuffer
i've used them a bit when i was working on a shared memory prototype
currently in my abandonware shelf
exdee
the idea is if you have a buffer that is shared between two workers, lets say you do something simple like this
if(buffer[0] === 120) {
buffer[0] = 125;
}
``` between the time you read the buffer, and you write the new value, the original value might have been changed by another worker. its a stupidly small fraction of time where it can happen, but it can happen
Atomics are a way to prevent that
they can execute a read and a write at the exact same time by only writing if the read matches the expected value, which ensures atomic safety
waiting for the day worker threads share the same module require cache
memory usage go brrrrr
likely never
Here's how it's made btw (if you understand C++ of course)
https://chromium.googlesource.com/v8/v8.git/+/refs/heads/main/src/runtime/runtime-atomics.cc
i can read c++ but i cant read v8 code
lmao
i swear people just love to overcomplicated code
just like the source code for C standard library the person that wrote it cant be human
also a way to prevent certain countries from starting a world war

At least that’s what we hope
lmao too soon man
https://www.toptal.com/developers/hastebin/vuduquyuse.typescript So right now I am handling passing the presence to the gateway pretty poorly in my own opinion, so I am wondering if someone can give me some advice on how to do it better
Right now it goes
Client -> WebsocketShardManager -> WebsocketShard -> Gateway (On Identify)
Gamer answer
gaymer
what on earth is crosspost()
wow okay that's a real thing
you need to await sending your message
.send() returns a Promise<Message>
no
(await client.channels.cache.get("id").send("sss")).crosspost()
that outside await only applies to the final function call
it might be helpful for you to learn some js async/await syntax
^^^^^
what does it do?
shouldn't that be called "publish" then?
djs should be called "dumpster fire" but unfortunately names are weird sometimes
I'm sorry I couldn't understand because my English is not very good. thank you.
👍
const sent = await client.channels.cache.get(...).send(...);
await sent.crosspost()
``` or ```js
await (await client.channels.cache.get(...).send(...)).crosspost();
THIS IS WHAT I'VE BEEN TELLING EVERYONE ABOUT
like if you wanna have a bad indentation, do it on every line dont be an asshole and just do it on 1 line
ok python user
smh
one indent and I can fuck ur whole program up
god bless u misty and your indentation
good
out of curiosity what is crosspost
From my understanding it just lets you send across all channels that follow the news channel the message is sent in
Have you ever sent a message in a news channel and it asks if you wanna broadcast it to all the channels following it?
It essentially does that
Yea, it is cool
(await channel.send("...")).crosspost()
Flazepe would scream when seeing all that parenthesis
Discord.on("message", function (message) {
var boolean = true;
if (!!!!Boolean(boolean) !== false && Boolean(boolean) === true) {
{
{
{
{
{
{
{
{
{
{
if (!!!!Boolean(message.content.includes("discord.gg")) === true && Boolean(message.content.includes("discord.gg")) !== false) {
message.delete();
message.reply("No Invites!!1! You will get baned soon.")
}
}
}
}
}
}
}
}
}
}
}
}
});
what the fuck
this is cursed on so many levels
@sharp geyser you should design your lib like this
invent a brand new syntax checker for js that forces you to write like that
lowkey based
yes thats where i copied from :^)
mfw this has more stars than my projects
for some reason my github desktop's updater started using 100% cpu
did i do something dumb or the number from a for in loop is always a string
A for loop with the in keyword iterates through the keys of an object, so if you're iterating through an array with it, the iteration value will be the index of the current element as a number, for objects however, it iterates through the object's keys, which can be a string, number, or a symbol
i see
bitch I am struggling enough as it is
why do more suffering
Looks pretty on mobile

I somehow like that statement
Idk why
"pretty"
hi tim
wtf
By chance, does anybody know what I'm doing wrong here? It always returns the 401 status error.
const axios = require("axios");
return await axios.post(`https://discord.com/api/v8/channels/805844980337475636/invites`, {
headers: { 'Authorization': `Bearer ${process.env.TOKEN}`, 'content-type': 'application/json' },
body: JSON.stringify({
max_age: 0,
target_type: 2,
target_application_id: "880218394199220334",
})
})
I can confirm TOKEN exists.
I'm aware. I'm just not sure why it won't work.
Are you using a bot token?
what is process.env.TOKEN?
Yep.
My bot token.
If you are using a bot token it has to be BOT ${process.env.TOKEN}
this
Bot tokens are not bearer tokens
Alright. Thanks guys.
Also I think you can just do Bot instead of all caps
Still the same error.
Hm
Axios is killing me lmao.
I doubt it is axios
Yeah, I just meant Axios doesn't have a clear documentation on how to authorize.
It is the same with just about any library you will use
no need to really specify how the header should look when it will be the same no matter what lib you use
try just setting the token without Bot or Bearer
should be Bot token
Any bot devs ? DM me
Mmm, I am wondering how i should do the rest api stuff, should i just make a 'RestClient' that gets attached to the client itself and in that rest client I just have methods to fetch from the api or should I do it differently?
Cause if I do it that way I think I will be limited on how well I can fetch different things like channels, users, members, guilds, etc
yeah
ye to what
that I should do it differently or?
I was thinking of somehow attaching a rest client to all the classes like Guild, User, Member, etc
Yeah I think you should probably have a base rest client
Mmmm
Wdym by "base rest client"
in your mind what would that do? I am unsure if we are thinking of the same thing here
you could attach it to the client, but you don't have to make it rely on the client
just think of it as a separate class
This in terms of "base"
You'll have a client, a RestManager and then all your actual managers (channel, message, etc) that all extend off the rest client in some way and implement their respective methods and then the client has all of those managers on it.
Yea that is how I was going to do it but then I thought like, how would I efficiently do requests for different things unless I just did smth like
export class RestClient {
constructor(){
}
get(url: string){
request(url)
return theDataGotten
}
}
and just provide the rest api url for the current thing I need
oh, dylan, what do you think of discord possibly killing reaction role bots?
MY BOT D:
Mmm, I see what you're saying yea
Kill in what way, how customizable would their implementation be
oh, did you see the datamining screenshot?
Send it, I haven't
literally my bot and it's category system, gg
it looks quite customizable ngl, yeah
welp was nice having a 3k bot
I'm already working for guilded.js :p
damn
😔
been like this for awhile now 😔
guilded suck
but ye nah
I gotta figure out this rest stuff
I like your idea of everything being a manager
Gotta be modular
Yeee
Actually I think I might have to make RestManager take in the client
it is the only feasible way I see to be able to get the token they set to be able to do the rest api requests
manager->client->rest->routes->method
wait what
// (channelManager)
this.client.rest.routes.getChannel(id);```
routes being a large collection of all api endpoints or something
That's why you have a design phase
Yoo how do you get that menu?
Help i am getting an error
nvm
fixed it
Cannot be a reserved keyword
Should be meaningful
Cannot start with a number (1name)
Cannot contain a space or hypen (-)
"should be meaningful" 
its sooo hardd
error
uh a lil help?
bruh did your really just pinged me out of nowhere 💀
🥷🏻
im stuck in traffic jam 
thats a punishment worse than death
Just can u tell me how to fix this error
// Performing a task
function greet(name, lastName) {
console.log('Hello'+ name + ' ' + lastName);
}
// Calculating a value
function square(number) {
return number* number;
}
let number square(2);
console.log(number);
no im not in the mood
okay..
My brain is dying?
idk
hmm
In line 12 i think theres a problem
is that right?
In the square text
I don't have an bracket
idh a bracket
is that rightt?
I finished Java script tutorial
basiscs
now i'm learning html
most ez language
?
HTML Tutorial for Beginners - Learn HTML for a career in web development. This HTML tutorial teaches you everything you need to get started.
🔥 Get the complete HTML/CSS course (zero to hero): https://bit.ly/3rUpjG4
👍 Subscribe for more HTML tutorials like this: https://goo.gl/6PYaGF
⭐️ Want to learn more from me? Check out these links:
Course...
?
yes
alright
gimmie a min
typing
Like
I saw like that in the video
oops
No
...
..
why does it change the first item aswell?
this.activeItems.push(this.availableItems[5]);
this.activeItems[this.activeItems.length - 1].x = 1280;
this.activeItems[this.activeItems.length - 1].y = this.height / 1.4;
..
this.availableItems is an array full of Items
virus.exe 💀
let number = value
okay
I am bored
i learnt java script for 4 hourss 
Nope
:c
I frogot
The video is complicated
can you just tell me?
and teach?
i'll pay you nitro 
@earnest phoenix
You already have but you're not using?
fiverr is a thing you know
Okay
their scams
most of the time
yk
I'll pay nitro to the person who teaches me coding and how to make a bot 🙂

I am reaalyyyyyyyyyyyy bored
so ima play some minecraft 

minceraft 
slow down then
Then it becomes too slow
;-;
and low qaulity
Try a book then and read it as fast as you want to
idh a book ;-;
ive got a javascript book lol
Not that the internet is full of documentations…
u wanna play with me?
I found coding books to ramble way too much about the wrong things
//Summon Items on chance
if (this.timeElapsed !== 0) {
let chance = 1000 / this.conveyor.velocity;
let rng = Math.floor(Math.random() * chance);
//0
if (rng === 0) {
console.log("SPAWN"); //spawn
let rng = Math.floor(Math.random() * this.availableItems.length);
this.activeItems.push(this.availableItems[rng]);
this.activeItems[this.activeItems.length - 1].x = 1280;
this.activeItems[this.activeItems.length - 1].y = this.height / 1.2;
console.log(JSON.stringify(this.activeItems));
}
}
8:05 am just had my bath and stuff
nic
nice
//LOOP EVERY ACTIVE ITEM get invaid spaces then move every item until invalid space
if (this.availableItems.length !== 0) {
for (let i = 0; i < this.activeItems.length; i++) {
//dont move if on edge or next to an object
if (this.activeItems[i].x < 50) continue;
if (i !== 0 && this.activeItems[i].x < this.activeItems[i - 1].x + this.activeItems[i - 1].img.width + 50) continue;
//move
this.activeItems[i].x = this.activeItems[i].x - 1 * this.conveyor.velocity;
}
}
i'll pvp 
go laugh at my poor quality code
Is that inside a loop?
My code is worse bro..
That answered my question
yes, but rng so actually no

yeaah
yeah its fine
its main goal is to get a random item from the pool to put it in the active array
how can we spawn a particular shard
this.availableItems is an array full of Items
ew book
Yeah I know 
thats a bad suggestion fake im dissapointed in u
I’m just here to harass people and annoy them, you know?!

_but don’t tell anybody about it _
Can someone help me with 2.0.0a0?
More or less help has arrived, what's up?
I had an old version of discordpy and now changed to new and stuff dont work how do i make server count posts work again and how to make webhooks workagain
from quart import Quart, render_template, request, session, redirect, url_for
from quart_discord import DiscordOAuth2Session
app = Quart(__name__)
app.config["SECRET_KEY"] = "test123"
app.config["DISCORD_CLIENT_ID"] = ######
app.config["DISCORD_CLIENT_SECRET"] = "#########"
app.config["DISCORD_REDIRECT_URI"] = "###########"
discord = DiscordOAuth2Session(app)
@app.route("/")
async def home():
return await render_template("index.html")
@app.route("/login")
async def login():
return await discord.create_session()
@app.route("/callback")
async def callback():
try:
await discord.callback() <===error here
except:
return redirect(url_for("login"))
user = await discord.fetch_user()
return f"{user.name}#{user.discriminator}"
if __name__ == "__main__":
app.run(host='0.0.0.0',port=8080)
can anyone help ?
Traceback (most recent call last):
File "/home/runner/Dashboard-1/venv/lib/python3.8/site-packages/quart/app.py", line 1489, in handle_request
return await self.full_dispatch_request(request_context)
File "/home/runner/Dashboard-1/venv/lib/python3.8/site-packages/quart/app.py", line 1514, in full_dispatch_request
result = await self.handle_user_exception(error)
File "/home/runner/Dashboard-1/venv/lib/python3.8/site-packages/quart/app.py", line 964, in handle_user_exception
raise error
File "/home/runner/Dashboard-1/venv/lib/python3.8/site-packages/quart/app.py", line 1512, in full_dispatch_request
result = await self.dispatch_request(request_context)
File "/home/runner/Dashboard-1/venv/lib/python3.8/site-packages/quart/app.py", line 1557, in dispatch_request
return await self.ensure_async(handler)(**request_.view_args)
File "main.py", line 23, in callback
await discord.callback()
File "/home/runner/Dashboard-1/venv/lib/python3.8/site-packages/quart_discord/client.py", line 160, in callback
token = await self._fetch_token(state)
File "/home/runner/Dashboard-1/venv/lib/python3.8/site-packages/quart_discord/_http.py", line 68, in _fetch_token
return await discord.fetch_token(
File "/home/runner/Dashboard-1/venv/lib/python3.8/site-packages/async_oauthlib/oauth2_session.py", line 242, in fetch_token
self._client.parse_request_uri_response(
File "/home/runner/Dashboard-1/venv/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/clients/web_application.py", line 220, in parse_request_uri_response
response = parse_authorization_code_response(uri, state=state)
File "/home/runner/Dashboard-1/venv/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 272, in parse_authorization_code_response
raise InsecureTransportError()
oauthlib.oauth2.rfc6749.errors.InsecureTransportError: (insecure_transport) OAuth 2 MUST utilize https.
its the error
Github Copilot can't do math 😐
nevermind
heres the solution
import os
os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1'
hii people, so how can i make my bot to automaticly change this "server counter" when it is added or removed from server:
throw err;
^
Error: Cannot find module 'colornames'
Require stack:
- C:\Users\maxim\OneDrive\Bureau\REAPER-2.0-master\Commands\Utility\createrole.js
- C:\Users\maxim\OneDrive\Bureau\REAPER-2.0-master\handler\loadCommands.js
- C:\Users\maxim\OneDrive\Bureau\REAPER-2.0-master\index.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Users\maxim\OneDrive\Bureau\REAPER-2.0-master\Commands\Utility\createrole.js:2:15)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at loadCommands (C:\Users\maxim\OneDrive\Bureau\REAPER-2.0-master\handler\loadCommands.js:13:23)
at Object.<anonymous> (C:\Users\maxim\OneDrive\Bureau\REAPER-2.0-master\index.js:52:1)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\maxim\\OneDrive\\Bureau\\REAPER-2.0-master\\Commands\\Utility\\createrole.js',
'C:\\Users\\maxim\\OneDrive\\Bureau\\REAPER-2.0-master\\handler\\loadCommands.js',
'C:\\Users\\maxim\\OneDrive\\Bureau\\REAPER-2.0-master\\index.js'
]
}```
lang?

help me pls
discord.js
..
help me
!
its obvious
Hiring a person who can make me a bot or anything you will get nitro in return.
Dm. Me
Sooo something like
client.on("guildCreate", guild => {
const status = ` Watching ${client.guilds.cache.size} Servers`
client.user.setActivity(status)
})
Alright tnx a lot man <3
But i also have "arrayofstatus"
So my bot have interval and xhange status every x Seconds.
Owner
Bot tag
Number of servers
Number of memebrs
Number of channels
Website
Supoort
...
So now i should create variables for every of these, xreate listeners for server number, channel number, memeber number
Then xreate interval and inside that call theese every x sexonds.
I think this is Right.
Well it change status
And it loop
But server status dosent update
It stays same
you have to define the array inside the loop, not outside
so that its redefined on every loop
-needdev
You seem to be asking for something you don't have experience for or something that hasn't been done yet, but really need for your bot/server.
You can hire developers from Fiverr or Freelancer to code the things you need for your bot/server.
gave up already?
it's not that ur bad, it's that u started at the worst possible way
< eval.js >```
```js
const { SlashCommandBuilder } = require("@discordjs/builders");
const clean = require("../../../clean").default;
const { MessageEmbed: Embed } = require("discord.js");
module.exports = {
data: new SlashCommandBuilder()
.setName("eval")
.setDescription("Evaluate a javascript expression")
.addStringOption((option) =>
option
.setName("expression")
.setDescription("The code to evaluate")
.setRequired(true)
),
execute: async (interaction, client) => {
const string = interaction.options.getString("expression");
if (interaction.member.id !== interaction.client.config.ownerId) {
return interaction.editReply({
content: "This command can only be used by the developer of the bot!",
ephemeral: true,
});
}
try {
const evaled = eval(string);
const cleaned = await clean(interaction.client, evaled);
const emb = new Embed()
.setTitle("Evaluation | Success")
.setDescription(`\`\`\`js\n${cleaned}\`\`\``)
.setColor(`AQUA`)
.setFooter({
text: `Evaluated by ${interaction.member.displayName}`,
iconURL: interaction.member.user.avatarURL({ dynamic: true }),
});
return interaction.editReply({
embeds: [emb],
});
} catch (err) {
const emb = new Embed();
emb.setColor(`RED`);
emb.setDescription(`\`\`\`js\n${/*clean*/ err}\`\`\``);
emb.setTitle("Evaluation | Error");
emb.setFooter({
text: `Evaluated by ${interaction.member.displayName}`,
iconURL: interaction.member.user.avatarURL({ dynamic: true }),
});
return interaction.editReply({
embeds: [emb],
});
}
},
};```
< clean.js >```
```js
/**
* @param {Object} client
* @param {String} text
* @return {String} text with all the cleanups applied
*/
const clean = async (client, text) => {
// If our input is a promise, await it before continuing
if (text && text.constructor.name == "Promise") text = await text;
if (typeof text !== "string")
text = require("util").inspect(text, { depth: 1 });
text = text
.replace(/`/g, "`" + String.fromCharCode(8203))
.replace(/@/g, "@" + String.fromCharCode(8203))
.replaceAll(client.config.botToken, "T0$&N^");
// Send off the cleaned up result
return text;
};
module.exports = clean;```
Please do the following:
State your issue
State what you're trying to do
Just posting code and an error does not help
i'd recommend using something like https://hst.sh (hastebin) when sharing code like this
so it doesn't floooood chat
TypeError: Cannot read properties of undefined (reading 'guilds')
/eval expression: client.guilds.cache.size;
Read above, not just post code

you do interaction, client and i think it should be client, interaction
Ah yes $5 for multiple hours of work, sounds worth it
lmao
^
Ik
I did not give up
i just want a bot
paying nitro? since when was nitro a currency? 😂
then make one
really, IT IS NOT hard, you just need to start from the base
complex yes, but not hard
After youtubers started giving away anime soul and karuta currency
They would buy those currency from people with nitro and people who wanted to flex nitro now just have to collect card 🤭
how would I go about implementing a map where 2 keys point to the same value?
map.put("123", "456", objA);
map.get("123"); // -> objA
map.get("456"); // -> objA
map.remove("123"); // removes both mappings
I thought abt making a custom key class, but then hashcode wouldn't match
additional details:
- both keys are always the same type
- there shouldn't be desync (as in, either both keys exist or neither do)
- a key cannot be repeated, even within another pair (key count will always be twice the value count)
- the value MUST be acessible by supplying either key, not both
one option would be to store a copy of the keys in the object itself, so when you remove one key, you read the other keys from the object and delete them as well
the object can be anything btw
some kind of mapping then
put(a,b,val) {
const obj = {
keys: [a,b],
val: val
}
this.store.set(a, obj)
this.store.set(b, obj);
}
get(k) {
return this.store.get(k)?.val
}
remove(k) {
const obj = this.store.get(k);
if(obj) {
for(const key of obj.keys) {
this.store.delete(key);
}
}
}
to make visualization easier
a for would be an option, but then it'd not be O(1) anymore
if its always 2 keys then you dont need the for
yes, always 2 keys guaranteed to be the same type
just ```js
this.store.delete(obj.keys[0]);
this.store.delete(obj.keys[1]);
of instead of storing them inside an array, you can have 2 props: key1 and key2
oh wait, no it's not in that sense
btw is this js or another lang?
the map can have any amount on entries, and each entry will be mapped by 2 keys
java, but I can convert any example to it later
like, for some context:
because js has a weakmap thingy where you can invalidate the value and make all keys to it disappear
"Let's say we have a trade between user A and user B. The trade information will be stored among N other trades, and need to be accessed supplying either user ID (not both)"
yeah my example should work
but then there's the hashcode issue
a hashmap stores based on the hashcode instead of checking for equality
so ```java
map.put("123", "456", objA);
map.get("123"); // null
map.get("456"); // null
map.get(key("123", "456")); // objA
can the same 2 user ids be used to store more objects?
no, all keys can only exist once
^
alright then shouldnt be an issue
It's still O(1) because N isn't changing.
basically what i was suggesting is to store each key independently
basically you have two copies of the same data stored in 2 different keys
can you store references in java?
Yes
ye
so you store the same reference using 2 different keys
and this reference points to an object that contains both keys along with the data
but how would I remove the other sibling key without looping and comparing each?
you access the object
a remove operation will first get the object, then read the keys from the object, then remove each key
<store>
"a" -> obj1 { key1: "a", key2: "b", value: {...} }
"b" -> obj1 { key1: "a", key2: "b", value: {...} }
"c" -> obj2 { key1: "c", key2: "d", value: {...} }
"d" -> obj2 { key1: "c", key2: "d", value: {...} }
remove(k) {
const obj = this.store.get(k);
if(obj) {
this.store.delete(obj.key1);
this.store.delete(obj.key2);
}
}
so basically have a wrapper on the value instead of the key
HashMap<K, Pair<K[], V>>
this?
K being key and V being value
yeah you could use a pair
a get operation will use any of the keys to obtain the pair itself, from which you then need to get V
ic
a put operation will put both keys and reference the same pair
I'll give it a try, thx tim
a remove operation will get the pair with any of the keys, read the K[] array and remove both keys
is bool = bool || other equal to bool |= other?
like, ik |= is bitwise OR assignment, but does it work for booleans?
instead of 0b1/0b0 (whyyyyy)
isnt that the same thing? lmao
like, 0xF would be 0b1111 in java
i wonder, from those bots i found on top.gg, do they scan redirects or only use public Phising.database on github
iirc most use anti-fish which is made by bytealex
the anti-fish.bitlow.dev rite
i see
cuz one time theres a raid on my server and multiple people sent a redirect, to be exact Meta refresh redirect
Phish.Surf is more trusted and has less false-pos and Phishing.Database has a ton of false-pos but anti-fish has its own whitelist/blacklist which overrides both
only cause people actively report new domains + false pos's
i also use it, but these new link is considered "safe".
you can report them in the support server
so i make a new bot for tracing the redirect, and i wonder, if its gonna be useful or not
if i made it as a public bot
Anti-fish follows domains
it follows link-shortners
hence why I said you should report it lol
yea, i did, it was a meta refresh to ip logger website and then redirect to image attachment
Can you send the domain in the flags channel in the support server
the meta refresh domain or the original link?
The domain where the scam/ip logger starts
We should move
yeah
Oh you left the support server
yea, i just report and leave lul
Anyone knows what could cause my code font color to go from this to this?
looks the same?
The color of the () isn't.
did you install the brackets extension?
.. and the {} are rainbows every stage.
oh i believe the brackets extension was integrated into vsc
Ohh.. that.
Many thanks, it's turned off.
By the way, is the guildScheduledEventCreate working for you by any chance?
idk i dont use that event
Not going to lie, it doesn't even run the file of the event.
The first console.log(1) doesn't even output.
djs v13?
I mean, I am creating the event correctly, ain't I?
https://cdn.hamoodihajjiri.com/EY10XJPbUO
I do use that version, v13.6.0.
A raw event?
I decided to try bot.on('guildScheduledEventCreate', console.log) for now, going to check if it will work or not.
client.on("raw", raw => {
if(raw.t === "GUILD_SCHEDULED_EVENT_CREATE") console.log(raw)
})
yes
I did exactly that and nothing in the logs.
then yeah you're not receiving anything
Oh, wat. What is the cause of this?
ask discord
ye ik, that's why idk why they use a whole 0xFF instead of 0b1
never made sense to me tbh, granularity? it's either true or false goddamit



