#development

1 messages · Page 2029 of 1

lyric mountain
#

"big scary math symbols are just for-loops"

quartz kindle
#

xD

lyric mountain
#

the other that looks like a giant E is an add-loop

#

that pi one is a multiply-loop

split hazel
#

yeah honestly the symbols just complicate it for people who don't understand them completely

lyric mountain
#

the number above is the limit, below is the starting value

#

and the formula in front is what's inside the loop scope

quartz kindle
#

i'll ask you to translate formulas for me the next time i need it

#

xD

#

also, rip formulas that uses constants that js doesnt support

#

like this one, eslint screams at me that the number is too big for double precision lmao

austere surge
#

thats a lot of numbers

lyric mountain
#

in an alternate universe:

quartz kindle
#

you even inverted the text

#

lmfao wtf

lyric mountain
#

I forgot to change the phrase damn

#

anyway

quartz kindle
#

exdee

tidal nymph
#

my bot does hit the rate-limit at some points 🤔 what should I change restGlobalRateLimit in Client option to prevent it

lyric mountain
#

nonono

#

don't modify the safeguards

sharp geyser
#

just dont spam the api

#

smh

lyric mountain
#

instead try to fix what's causing the ratelimit

quartz kindle
#

or regular rate limits?

tidal nymph
#

I think global since I even used proxy but I still hit it I think

quartz kindle
#

are you using djs?

#

log the rate limit event

lyric mountain
#

"global" just means account-wide limits, not ip related

quartz kindle
#

client.on("rateLimit", console.log)

tidal nymph
lyric mountain
#

that's another thing

tidal nymph
# quartz kindle

im trying to get my bot online first since it wont go online on my host, still work on local tho

tidal nymph
sharp geyser
#

Usually when hitting ratelimits it is cause you are requesting a resource too many times in x amount of time

tidal nymph
#

its a youtube,twitch notification bot so it does send quite amount of messages to a lot of servers

lyric mountain
#

usually if u hit a CF ban something went VERY wrong

#

usually it happens when discord api crashes and ur bot spams it trying to reconnect

#

any other reason is a serious logic issue

tidal nymph
tidal nymph
quartz kindle
#

so your library will handle the rate limits for you

#

however you should still help it by running proper code

#

for example dont create 350 requests concurrently, instead do it sequentially

tidal nymph
#

ok let me send my example code so you guys can judge it

dry imp
#

laplus

pallid zinc
#

Do we have to care about the rate limit even if we are using discord.js-light 🌚

quartz kindle
#

depends on what your bot does and how big is it

dry imp
#

the only time i get hit by a cf ban is when i use replit

quartz kindle
#

for smaller bots you generally dont need to worry about it

tidal nymph
# quartz kindle for example dont create 350 requests concurrently, instead do it sequentially
const promises = data.map(async (data) => {
            //do some thing here
            const promises = client.guilds.cache.map(async (guild) => {
                // do something here
            });

            await Promise.allSettled(promises).catch((err) => {
                console.error(err);
            });

            return;
});

await Promise.allSettled(promises).catch((err) => {
            console.error(err);
            return null;
});

This is what im doing, I think I've done it the wrong way

quartz kindle
#

yeah thats creating multiple concurrent requests

#

djs should execute them in sequence for you, but i wouldnt trust the library to handle that

tidal nymph
#

yea it does but sometimes it just breaks

#

what's the better way to refactor this to sequentially

quartz kindle
#

i would do it with for loop and await every request

tidal nymph
#

so im gonna for loop both data array and guilds array?

quartz kindle
#

yes

rose lance
#

shouldn't this validation always fail? or did I miss understand onsubmit somehow? because the page is reloading anyways

async function search(args) {
    return false;
}```
```html
<form name="search-form" class="bg-slate-100 dark:bg-slate-600 flex justify-between items-center p-2" onsubmit="return search({{ raw_veh_list }})" action="" method="get">
  <button class="bg-slate-300 dark:bg-slate-50 p-1 m-1 text-slate-900 rounded font-medium">Submit</button>
</form>```
quartz kindle
#

dont you need to use preventDefault()?

#

or try <form onsubmit="search(...); return false;" >

#

ah wait, its an async function, pretty sure you cant use async functions in an onsubmit

#

since an async function returns a Promise, which is a truthy value

rose lance
#

the function does get executed, tho the result might have to be awaited or something?

quartz kindle
#

yes

#

try onsubmit="await search(...)"

rose lance
#

await is only allowed in async functions and top level bodies of modules 😬

quartz kindle
#

so then you have to use <form onsubmit="search(...); return false;" >

rose lance
#

ok perfect, that worked 👍

split hazel
#

plans to work on os aborted power went out and my laptop lasts about 2 hours on full charge

quartz kindle
#

rest in peperoncinos

split hazel
#

I need to implement a power and log function before I can use the geo average but I have no idea how

#

the fpu doesn't support powers or logarithm

#

I mean an integer power function is easy but a float one is tricky

#

and reading c function source code is like reading Hebrew without knowing it

#

worse case scenario I'll rip the implementation off someone else's os on github

pale vessel
#

won't be a speedy os then

lyric mountain
#

log can be done with division, but don't remember the formula

fathom sonnet
#

hii guys, so I made channel which is basicly like a decoy, so If hacked account join a server and send message there, bot should ban it...but rn, i dont have idea on how to make that to work

#

so for fun i tried with this code: ```js
client.on("messageCreate", message => {

let memebrBan = message.author
if(message.channel.id === "970724218352316426") {
  if(message.content) {
    memebrBan.ban()
  }
}

})
``` and got an error on the: memebrBan.ban() : index.js:140
memebrBan.ban()
^

TypeError: memebrBan.ban is not a function

wheat mesa
#

It’s not a function

#

message.author is a User object, which is not associated with a guild

#

Use message.member instead

fathom sonnet
#

tnx man

#

work ❤️

rocky hearth
#

can I code svg in html, and use it like a background-image for a div

fathom sonnet
#

no

fathom sonnet
#

but why not use photo

#

do some photoshop

#

add svg there, export as jpg or png

#

and use as bcg

tidal nymph
rocky hearth
#

na, its a dynamic svg code

quartz kindle
#

you can code it in js yes

#

and then add it to an html element

rocky hearth
#

yes, then I want this svg to be background-image of a div

split hazel
rocky hearth
#

coz I want to use background-blend-mode on that div

split hazel
#

I know it has something with rooting but other than that I'm stuck

quartz kindle
#

but even if they do, they shouldnt be blocking other tasks

#

async code is non-blocking

slender thistle
#

@oak cliff Delete messages?

oak cliff
#

thought i got them all

slender thistle
#

xd Smh

split hazel
#

I did too

#

I've seen easier to read obfuscated JavaScript code

quartz kindle
#

lmao

#

hey single character variables use less memory :^)

tidal nymph
# quartz kindle async code is non-blocking

when I converted to for loop for all of my tasks. 2 of my tasks just sit still I think? They all just sent the first message and then they stopped, the tasks took more than normal duration to finish

#

like from 30s duration to 2mins

earnest phoenix
tidal nymph
#

show I think they were blocked

quartz kindle
split hazel
#

only lead I have so far is 2^0.5 is the square root of 2

lyric mountain
#

this explains it pretty easily

tidal nymph
quartz kindle
#

indians on youtube

lyric mountain
quartz kindle
tidal nymph
#

even though they were saved in DB ( which is the previous code before sending msg)

#

yea i wonder what i did wrong

quartz kindle
#

well you can always showcode™️

#

or showcod™️ if you like bacalhau/codfish

compact pier
#

any good lib that allow hashing and dehash?

#

like encrypting und decrypting

lyric mountain
#

ok, let's clarify a thing

#

hash != encrypt

#

the former is a one-way procedure, the latter is supposed to be reversible

#

there's no thing such as "dehash"

compact pier
#

my false

#

like encrypting and decrypting

tidal nymph
quartz kindle
#

why in the gods name would you do this

#

lmao

compact pier
#

Tim

#

any encrypting and decrypting lib for suggestion :<

tidal nymph
#

tell me which one

quartz kindle
#

pastebin/hastebin/hatebin/etc

#

whichever

quartz kindle
tidal nymph
#

ok I sent new one

#

no theme tho

compact pier
#

there are many

lyric mountain
#

all options have pros and cons

#

what are u encrypting?

tidal nymph
#

is cryptojs even good

#

I think I've used that one

quartz kindle
#

node itself has it already

compact pier
quartz kindle
#

you dont use encryption for passwords

compact pier
#

i want to encrypt the hashed password

wheat mesa
#

Hashes

compact pier
#

double layer

#

:))

quartz kindle
#

why

compact pier
#

i dunno

quartz kindle
#

that does not increase security

wheat mesa
#

I’m by no means an expert, but hashes are definitely secure enough

compact pier
#

cause I fell unsafe transfare the raw password via Graphql

split hazel
#

guys

#

how do I calculate roots above 3:(

#

is it just root x multiplied by the level

wheat mesa
#

root^3(27) is 3 for example

#

Unless you meant computing wise

compact pier
#

should I compare the hash vs password in frontend or backend

#

where should i

wheat mesa
#

It’s just input / x / x / x = 1 @split hazel

#

But computationally I have no idea how to do that efficiently

compact pier
#

but how u know the root number

#

like

#

x is 27

#

the 3 won't fall from the sky tho

wheat mesa
#

3 * 3 * 3 is 27

compact pier
#

yes

quartz kindle
compact pier
#

but computer doesn't know

wheat mesa
#

Like I said, no idea how to do that computationally

quartz kindle
#

you dont need to encrypt anything before sending it

compact pier
quartz kindle
#

do it via https

compact pier
#

yes but still

#

:<

#

or https is safe enough

quartz kindle
#

its safe enough

compact pier
#

mhmm ok

quartz kindle
#

https is literally encrypted http

compact pier
#

then no encryption

wheat mesa
compact pier
#

I watched yt and learned about the III Quake root or smth

#

3 Quake Root

#

they use it very often in Game Dev

wheat mesa
#

That’s different

tidal nymph
#

review my code before im going to sleep pls tim😭

wheat mesa
#

That’s the quick inverse sqrt algorithm

sage ridge
#

How can add my bot

lyric mountain
lyric mountain
#

it's like putting butter in margerine

compact pier
#

just for every case

sage ridge
wheat mesa
#

I don’t see how it would even increase security

lyric mountain
#

no no, you see, you'll be sacrificing performance for 0% increased security

compact pier
lyric mountain
#

maybe even -1%

compact pier
#

well yeah

#

but for a safer mind

#

like "omg, the password are safe"

wheat mesa
#

Pointless

#

The passwords are already safe in hashes

quartz kindle
wheat mesa
#

Hashes are designed to be indecipherable without large amounts of computational power

#

Like a one way mirror

#

Sure, you can break it, but when you do are you really gaining anything after all that?

tidal nymph
quartz kindle
tidal nymph
#

all other tasks also looks that file

quartz kindle
#

therefore creating concurrent promises and then resolving them using Promise.allSettled

wheat mesa
#

You could have a queue of promises that get resolved at a set ratelimit

lyric mountain
# compact pier but for a safer mind

to put in perspective, the odds of someone breaking a sha-256 are lower than if you grind a glass cup down to dust, threw it in a beach then a year later tried to pick all particles that once belonged to the original cup to rebuild it

tidal nymph
quartz kindle
#

@_@

lyric mountain
#

it's so insanely low that the universe would die before u manage to accomplish it

#

if u want to be extra insane, hash in sha-512

quartz kindle
tidal nymph
#

I mean the code is still quite similar, I just want you to review why they block eachother

wheat mesa
#

Stupid question, if you have access to the hash (say through a db leak or something of that sort), wouldn’t you be able to hash tons of passwords using the same algorithm until you find one that matches?

wheat mesa
#

(Assume you know the algorithm and the salt)

lyric mountain
quartz kindle
lyric mountain
#

like "cake"

wheat mesa
#

I see

lyric mountain
#

that's why most sites enforce 1 letter, 1 uppercase, 1 number and 1 symbol

wheat mesa
#

So that’s why password hashes are still useless against brute force attacks if you have a shitty password

compact pier
#

it is like the crypt tokens right

lyric mountain
#

tokens are base64 mostly

compact pier
#

only a quantum machine can brute force it

quartz kindle
#

brute forcing takes thousands of years if your password is long enough
a dictionary attack is faster but you need to be lucky that the password exists inside the dictionary

wheat mesa
#

Quantum computers are a whole new thing lol

lyric mountain
tidal nymph
compact pier
#

yeah, watched that on yt. I dunno haha

lyric mountain
#

a quantum computer is basically a computer that guesses

tidal nymph
#

like I seperate them to chunks?

wheat mesa
#

Quantum computers are still very very very very early/experimental

compact pier
#

on the theori

wheat mesa
#

Some things

lyric mountain
wheat mesa
#

It’s like trying to run hades on a nasa supercomputer though, some things it’s good at, others it’s not

quartz kindle
lyric mountain
#

like, if I input "is duck an animal?", a conventional computer would do expensive operations, master hacks and whatnot to say "it's 100% an animal"

wheat mesa
# quartz kindle

Little do they know I’ll have access to their minecraft account after the heat death of the universe 😈

lyric mountain
#

a quantum computer would say "I'm 90% sure it's an animal" and give the answer right away

compact pier
lyric mountain
#

it's obviously more complex than that, but u get the idea

#

for insane math, a quantum computer would be faster because it'd guess the answer, work in probabilities

#

while a normal computer would calculate it to the end to reach a 100% certain answer

split hazel
#

I've looked at the video you've sent me but it doesn't really explain how to calculate it in code

lyric mountain
split hazel
#

it talks about nth roots of x but calculating that is another story

lyric mountain
#

first u need to implement root

#

then u implement pot

split hazel
#

only thing I have is square root since that instruction comes with pretty much all modern cpus

quartz kindle
split hazel
#

don't think the float processors are able to compute nth roots

lyric mountain
#

you probably can use square root to calculate nth roots

split hazel
#

looking at how to do it in c people say to use the power function but that isn't really possible since my power implementation would use nth roots

lyric mountain
#

well yes you'd usually use power

split hazel
lyric mountain
#

nth root can be accomplished with x ^ (1/root)

#

iirc

quartz kindle
#

this is the table for bcrypt hashes

tidal nymph
#

I sent the right one in dm to u tim

#

😭

#

my bad

lyric mountain
#

I'm curious abt this case tho

split hazel
lyric mountain
#

aren't all execution times going to be integers btw?

tidal nymph
#

also it only hits the ban when it sends around ~20 messages concurrently to all servers. If its like less than that to all servers, its still fine tho even though ratelimit event warns

#

🤔

lyric mountain
#

how much is "all servers"?

tidal nymph
#

350

lyric mountain
#

that's 7000 requests

tidal nymph
#

yea thats why im finding the way

#

to prevent this

lyric mountain
#

put one second between each 500 requests

tidal nymph
#

so just timeout every 500 ?

#

i mean sleep

quartz kindle
lyric mountain
#

ye, although djs should have some kind of request delayer

#

or was supposed to have

tidal nymph
#

it does but some how my bot still exceeds it

compact pier
#

ok window

#

👌

tidal nymph
#

how does restGlobalRateLimit option in clientOption of Djs work?

quartz kindle
tidal nymph
#

its default infinity

#

oh

quartz kindle
#

can you show which ratelimit you're getting?

quartz kindle
#

you cant copy paste them between different computers

tidal nymph
#

uhh im actually on bed rn lmao but it usually hits the global

lyric mountain
compact pier
#

I didn't

lyric mountain
#

sha-256 is enough

tidal nymph
#

mostly by sending messages

compact pier
#

ok

quartz kindle
#

the install logs should show the error

lyric mountain
#

crypto.createHash('sha256').update(pwd).digest('hex');

compact pier
#

I will use the built-in lib

feral aspen
#

Which one of those would be considered Internal Network?

lyric mountain
#

lan?

quartz kindle
#

host-only?

feral aspen
#

Which one?

#

Lan or host-only.

quartz kindle
#

host-only is connection between pc and vm

#

lan is connection between other pcs in your house

feral aspen
#

Oh, so for something like this...

#

I could use host-only.

quartz kindle
#

what are you trying to do?

feral aspen
quartz kindle
#

you want the vm to be able to connect to the internet?

lyric mountain
#

btw, why dont u use windows' built-in hyperv?

feral aspen
feral aspen
quartz kindle
#

you want the vm to be able to connect to the internet?

lyric mountain
feral aspen
quartz kindle
#

...

feral aspen
#

Alright, I mean, yeah.

lyric mountain
quartz kindle
#

then do bridge or NAT

feral aspen
#

As long as hackers (from who knows where) can't have my computer vulnerable.

lyric mountain
#

if ur going to do malware testing u cant have any kind of network enabled

feral aspen
#

I'm downloading a vulnerable machine to try hacking in so the video I'm following tells me that I need to switch to internal network to be safe.

quartz kindle
#

if by internal network you mean the vm will not be connected to the internet at all, then yes use host-only

compact pier
#

@lyric mountain how I can compare it?

lyric mountain
compact pier
#

that is?

lyric mountain
#

...hash whatever the user types in the password field

#

and check if it matches the one saved on database

feral aspen
tidal nymph
#
{
timeout: 745,
limit: 50,
method: 'get',
path: '/channels/912492265614770226/messages/918753513436229662',
route: '/channels/912492265614770226/messages/:id',
global: true
}
{
timeout: 721,
limit: 50,
method: 'patch',
path: '/channels/854030382587314218/messages/897099667786059807',
route: '/channels/854030382587314218/messages/:id',
global: true
},{
timeout: 513,
limit: 50,
method: 'post',
path: '/channels/915272476190208061/messages',
route: '/channels/915272476190208061/messages',
global: true
}
quartz kindle
#

bridge = vm sees internet, internet sees vm
NAT = vm sees internet, internet sees host
host-only = vm does not see internet, it only sees host
custom/LAN = advanced configuration

tidal nymph
#

the bot usually hits these

fossil bone
#

is there something wrong with this code?
msg = message.content
word=['*,-,/,+']

if any(word in msg):
   await message.channel.send('sup')
#

it's in python

tidal nymph
#

I set the global limit to 50 but since you said it wont work in this case

lyric mountain
#

yes, there's something wrong with that code

fossil bone
quartz kindle
lyric mountain
quartz kindle
#

but if you dont wanna see them, you can add a delay in your for loop for every 50 messages

#

or so

lyric mountain
#

I have no idea what that code should do

tidal nymph
fossil bone
tidal nymph
#

or what ever caused the bot to stop responding

quartz kindle
#

that should not be causing cf bans

#

where is your bot hosted?

tidal nymph
#

railway

quartz kindle
#

is that a vps or an app host like replit?

tidal nymph
#

its like heroku

lyric mountain
quartz kindle
#

is it popular for hosting discord bots?

lyric mountain
#

what is this supposed to do?

tidal nymph
#

yea it is

quartz kindle
#

then that may be the reason for the cf bans

tidal nymph
#

but someone said using proxy would work and I set up one and still got banned I think

#

🤔

quartz kindle
#

which proxy did you use?

tidal nymph
#

tailscale

quartz kindle
#

and how many other people are using the same proxy?

fossil bone
tidal nymph
#

only me

#

its hosted on an ec2 aws

quartz kindle
#

and its not shared by other customers?

lyric mountain
fossil bone
#

i think the problem is that it returns true while the code doesn't take bool so it crashes there

tidal nymph
#

nope

fossil bone
lyric mountain
#

but that's a single string

fossil bone
#

it doesn't work anyway wether it's a single str or a char

#

the code keeps crashing

lyric mountain
#

you see, it's not a single string, it's a single string inside an array

#

it'll not check if the message contains any of those char, it'll check if the message contains that entire string

fossil bone
#

i thought that first but the problem here that it returns nothing

tidal nymph
split hazel
#

@earnest phoenix last ditch effort but do you know how js does Math.pow (source code)? is it manually written or does it use the standard library implementation

fossil bone
#

even if i put the whole str

tidal nymph
#

since it triggers global ratelimit alot

fossil bone
quartz kindle
tidal nymph
#

oh, but you said to not really trust djs handling

#

if so the theory is maybe my proxy didn't work or it wasnt connected 🤔

feral aspen
quartz kindle
feral aspen
#

Lmao, fair.

quartz kindle
#

or remove the network adapter from its hardware

fossil bone
#

if any(word in msg):
TypeError: 'bool' object is not iterable

split hazel
#

where is this implemented? extern macro Float64Pow(float64, float64)

quartz kindle
#

for example every 10-20 messages sent, add a 1-2 second delay

feral aspen
quartz kindle
#

i used to add my own delays on reactions, because their handling of rate limits for reactions is terrible

#

but since we use buttons now, it doesnt matter anymore

feral aspen
#

👍

tidal nymph
#

ty for helping ❤️

#

maybe i'll back here tmr lol

#

💀

lyric mountain
fossil bone
lyric mountain
#

I can assure it didn't, not in the way u expect

#

you're declaring a single string

fossil bone
#

except that it worked for *,-,/,+ as a whole str not char

lyric mountain
#

yes, that's EXACTLY what I've been trying to tell you from the start

#

putting comma in a string doesn't automagically make it a char array

slender thistle
#

*,-,/,+ works

  • doesn't
#

Because you're LITERALLY checking for *,-,/,+

lyric mountain
#

chars = ['*', '-', '/', '+'] <- correct declaration

slender thistle
#

Not ANY of those

lyric mountain
#

note it isn't a single string

slender thistle
#

'a,b,c' is NOT the same as 'a', 'b', 'c'

feral aspen
# quartz kindle remove its network adapter

Now, what's the benefits of having a virtual machine not having a network adapter, and why should it have no wifi when attempting to ethically hack into a vulnerable machine?

#

And, in addition, should I always have it not connected to the wifi when it comes to doing so?

fossil bone
#

using the contain class

quartz kindle
#

or you just want to crack hashes?

feral aspen
quartz kindle
#

locally as in inside the vm?

#

and then hacking it via localhost?

feral aspen
whole stream
#

just trying to remember how to code bots
whats the format for prefix and token config.js

lament rock
#

use slash commands

quartz kindle
fossil bone
quartz kindle
#

any what? any of * - / + ?

fossil bone
#

yup

quartz kindle
#

you need to put it in a list

#

list = ["*", "-", "/", "+"]

#

then you should be able to do something like
if any(x in string for x in list):

quartz kindle
#

or using a regular loop, for char in list: if string contains chart return message.channel.send()

quartz kindle
whole stream
#

what's the format for prefix and token config.js
{
"prefix":"!",
"token": "Token here"
}

lyric mountain
#

you dont need internet to bash someone with a wrench KEKW

lyric mountain
#

put ur token in an env file

#

not in the actual code

quartz kindle
#

nah, hardcode the token as base64

sharp geyser
quartz kindle
#

hardcode an aes encrypted token and decrypt it on the same file

sharp geyser
quartz kindle
#

via 7 proxies

sharp geyser
#

ye

#

Wanna know what I need to do

#

I need to actually properly learn js

#

My entire js career has been me just going with the flow :^)

#

I also lack problem solving skills and the ability to come up with solutions on my own

#

:p

whole stream
quartz kindle
# whole stream .js
const object = {
  prefix: "!",
  token: "weouhwoeut2n3uv023u0v92"
};

module.exports = object;
quartz kindle
#

¯_(ツ)_/¯

whole stream
sharp geyser
#

I feel like to really grow as a programmer I need to actually learn how to code properly to the point where my "solutions" actually work

#

without needing other's help every step of the way

quartz kindle
#

read docs, lots of docs

split hazel
sharp geyser
#

see I always loved reading but that just seems to bore me I never actually comprehend what is being done in the docs

quartz kindle
split hazel
#

yeah I don't bother reading the entirety of docs I only read parts i need this second

split hazel
quartz kindle
split hazel
#

I sit for 10 minutes debating in my head

quartz kindle
split hazel
#

💀

quartz kindle
#

i already rewrote the entire spec for my binary serializer like 5 times

sharp geyser
#

Mmm what should I work on tho

#

my biggest issue is always finding a project to put my time into

#

Mmm I should try and come up with something that I can use socketing on

quartz kindle
#

do you enjoy making things more efficient/performant?

sharp geyser
#

I wanna understand websocketing

split hazel
#

lmao

sharp geyser
#

:^)

quartz kindle
#

xD

split hazel
wheat mesa
#

Make a discord library

#

4head

quartz kindle
#

i learned websocket from reading the rfc document lol

sharp geyser
wheat mesa
#

I’m at school

quartz kindle
sharp geyser
#

lawl

#

I skipped today

wheat mesa
#

loser

split hazel
#

loser

quartz kindle
#

laser

sharp geyser
quartz kindle
#

not all, just the important parts

#

and whenever i had a doubt, i go there to double check

split hazel
#

tim can you read the whole usb specification for me

#

I need it for my os 💀

quartz kindle
#

no ty

#

:^)

split hazel
#

usb support is so complicated

quartz kindle
#

usb is probably 100x times worse than websocket

split hazel
#

I want to write a gist of what you have to do

#

it really is

#

it's the most complicated piece of useful tech

quartz kindle
#

see you guys think so highly for me, yet you do things that are 100x more difficult/advanced than the shit i do

#

im not awesome, you guys are

split hazel
#

💀 I just have high expectations of you

quartz kindle
#

high expectations lead to disappointment

split hazel
#

anyways from what I know from a brief look you need to write a parser for a language called YAML which is used by the ACPI which controls the power and discoverability of connected devices where you then extract data from it and write some fancy code to interface with the USB hub

sharp geyser
#

:^)

split hazel
#

I honestly don't know why they couldn't just use structs

#

the table which you have to scan the whole memory for to find which contains a number which allows you to activate manual support for the ACPI uses structs

#

it's so complex I asked about it and some guy just told me "please just use a library someone wrote to interface with it"

quartz kindle
#

lel

split hazel
#

On top of that YAML opcodes and features also aren't documented very well so it's mainly guess work

wheat mesa
#

That has a lot to do with websockets

#

If you want to learn about it

split hazel
#

your best bet for restarting the computer is to disable interrupts and divide by 0 to cause a triple fault causing the cpu to reset

earnest phoenix
#

Not as difficult as stopping Speedy from being as NFT

split hazel
#

nfts are the future

#

not as hard as reading c source code tho

#

seriously the dude that wrote it could probably read obfuscated js without a problem

boreal iron
split hazel
#

he is the obfuscator

split hazel
#

send it to the IO port 82

boreal iron
split hazel
#

that means send it to nowhere

boreal iron
#

That’s all for today

split hazel
# boreal iron That’s all for today

before you shut your computer down make sure to thank the person that wrote the AML parser for your computers ACPI in order to shut the machine down

#

otherwise hold the power button

whole stream
#

can I request a mini collaboration for someone to write two basic commands? -DMs

split hazel
#

yeah

#

if (message.content === "!help") {
message.channel.send("Pong");
}

#

there you go

whole stream
#

funny, but i was serious.

lyric mountain
#

Why not yourself?

#

It's a basic command now, but what when it breaks? What if you want to change something? What if suddenly A becomes B?

#

It's never "just a basic command"

boreal iron
split hazel
#

I was going to suggest that too

#

you are the dumb

boreal iron
#

Shhh

#

im not the one with nft in my name

fathom sonnet
#

soo guys, i have this code: ```js
module.exports = {
name: 'msg',
execute(message, LineSplit) {
try {

        if(!message.member.permissions.has('BAN_MEMBERS')) return message.reply('You cant use this command...')
        let title = LineSplit[0]
        let description = LineSplit[1]
        let guild = message.mentions.channels.first()


        if(!title) {
            message.reply('This message need to have a title.')
            return
        }
        if(!description) {
            message.reply(`You can't send an empty message, please give it description.`)
            return
        }
        if(!guild) {
            message.reply('Please mention channel where you want to send this message')
            return
        }
        guild.send(message)

    }
    catch(err){
        console.log(err)
    }
}

}

` !msg -- Title -- Message Content -- Channel where i want to send message `

But problem is: if i create message structure like this, it literaly send the whole command in the tagged channel. Anyone have idea on how to fix  this?
solemn latch
#

that seems to be what your code asks for.
guild.send(message)
message being the command message.

#

its hard to say with just this part of the code(we are missing how LineSplit array is defined), but what you probably want to do is send the description variable.

fathom sonnet
#

Well it should send title and description in the mentioned channel, and line split is basicly this: ( -- )

solemn latch
#

anyway, if you want to send the tital and description you would want to just send those variables which you defined in code

fathom sonnet
#

const LineSplit =
message.content.slice(prefix.length).split(' -- ')
const LineCommand = LineSplit.shift().toLowerCase()

#

Here is line split

#

And yea i think i figured it out

#

I just added title and description inside brackets at guild.send

whole stream
#

how do i start bot .node?

solemn latch
#

do you mean how to run node programs?

whole stream
#

i have a bot i want to start it through terminal

solemn latch
#

node filename.js

whole stream
#

i want to start the whole bot do i do node index.js

solemn latch
#

if thats your main file yes

#

its most often index.js, but its whatever you named it to.

whole stream
#

it just wont come online

#
const Discord = require('discord.js')
const { prefix, token } = require("./config.json")

client.on("ready", () => {
    console.log("Hey wg your bot is online")
    const actitvites = ["A Mythical Tale", "! Prefix"]

})


client.login(token)```
#

is it due to index itself

earnest phoenix
#

You don't have client defined anywhere

solemn latch
#

doesnt djs need more than that these days? 👀

#

like intents and stuff

#

(and client)

earnest phoenix
#

Client and intents yes

whole stream
#

this is me pasting things i copied two years ago

solemn latch
#

dont use old code

#

djs has changed a ton in the last 2 years

whole stream
#

i have no idea how to use a basic js index bot is online code

earnest phoenix
#

I don't recommend copy pasting stuff, read the documentation and the guide before diving in

fossil bone
#

anyone good with python?

spark flint
#

it changes weekly i swear

earnest phoenix
fossil bone
#

hmm

#

guess it's too late to bother .-.

dry imp
earnest phoenix
#

Ask your question or tell us the problem, if someone knows about it they'll answer

fossil bone
#

if any(x in string for x in list):

#

i need to lear about the any() method

earnest phoenix
fossil bone
#

i can definetly use loops likke for

#

but i need to learn that one

dry imp
#

so the question?

fossil bone
#

but it didn't work so ineed to know why

#

list =["*", "-", "/", "+"]

#

x= message.content

#

string=str

dry imp
#

wait

earnest phoenix
#

Are you trying to check if the content of the message starts with any of those prefixes?

dry imp
#

x is prefix or content?

fossil bone
#

not startswith() contains()

#

x is basically the content

#

the user message

dry imp
#

then why there is string?

#

oh wait

fossil bone
#

idk that's why i wanted to learn

#

i never used the any() method

dry imp
#

so uhh what are you trying to achieve?

earnest phoenix
#

They're trying to see whether the content of the message contains one of the strings in the list

fossil bone
#

so i thought it's part of it's iterarion and thought i should learn it as it shortens the numer of lines used to work a code and is simpler as well

dry imp
#

then x should be the prefix right? and string is the message.content?

#

wait

fossil bone
#

idk how it should work but that line of code definetly didn't work

dry imp
#

nvm

earnest phoenix
#

What you're doing already achieves what you want to do, the global any() function in Python accepts an iterable, which the expression of x in string for x in list you're passing to it is a generator which is an iterable, so it should work

dry imp
#

also what do you mean by not working? any error?

fossil bone
#

it should in theory but in praticaly it didn't

earnest phoenix
#

Show us more code I guess?

fossil bone
#

it shows this error

#

TypeError: argument of type 'type' is not iterable

#

i tried chr

#

didn't work as well

dry imp
#

string shouldnt be str

#

string is the string

#

str is a type

fossil bone
#

idk if i don't divide the string in list like i.g. word = ['*,-,/,+'] it works fine

quartz kindle
#

as multiple people pointed out, '*,-,/,+' means a single word, and not 4 different characters

fossil bone
#

but it zorks zhen you send '*,-,/,+' qs q full sting not as one char

earnest phoenix
#

Btw, you're assigning a global function to a list, list is a global function in Python which you're reassigning

fossil bone
split hazel
#

lmao you see Tim you're peoples last hope

quartz kindle
fossil bone
#

went to eat then came back to test the code but it didn't workout

split hazel
#

I think I need expedite the development of my scam website

quartz kindle
#

lmao

boreal iron
quartz kindle
#

tell him, "yes i have 100 bitcoins"

boreal iron
#

I knew it

quartz kindle
#

:^)

fossil bone
quartz kindle
#

thats not nearly enough to be a billionaire

#

100 bitcoins is only 4 million

dry imp
fossil bone
#

i had 10 bitcoins back in 2014 but i lost the codes 😂

#

RIP

boreal iron
quartz kindle
#

@boreal iron bearhuggo run bearcop ExcusemeWtf 200iq beeg_yoshi bonk blobcatban

split hazel
boreal iron
#

Arararrararaggggg

fossil bone
boreal iron
#

You aren’t better at all

quartz kindle
#

in zimbabwe you'd have 400 quadrillion dollars

earnest phoenix
#

And there was the guy who spent 100 bitcoins years ago to buy a single pizza

boreal iron
#

lmao

split hazel
#

and there was a guy who had a bitcoin wallet worth millions but lost the password

quartz kindle
fossil bone
#

🙂

earnest phoenix
#

Oh yeah it was 10k

boreal iron
#

Well shit happens

earnest phoenix
fossil bone
#

anyway i keep getting this error
TypeError: argument of type 'type' is not iterable
what am i doing wrong?
@quartz kindle

quartz kindle
#

show code

#

did you read what voltrex said about the name list being a reserved keyword?

fossil bone
#

yes

#

if any(x in string for x in list):

#

await message.channel.send('sup')

earnest phoenix
#

Rename your list to something else, list is a global function

fossil bone
#

i did rename it word

#

but then i thought we should stick with list till we figure something out first

#

i changed string to str btw

earnest phoenix
#

You're not supposed to name it list, since you said you renamed it, replace the list in the if statement expression to the renamed list

fossil bone
#

because it keeps showing error for string

lyric mountain
#

string is reserved too no?

earnest phoenix
#

For example

content = message.content
chars = ["/", "-", "+", "&", "$"]

if any(x in content for x in chars)):
  print("Passed")
lyric mountain
#

like, isn't the code editor SCREAMING for u not to use those words?

earnest phoenix
#

string is not reserved in Python, str is however

fossil bone
#

whats x here

quartz kindle
#

x is the name of the item being iterated on

#

its literally any name you want

fossil bone
#

so i need 3 names?

quartz kindle
#

do you know how a for loop works?

fossil bone
#

x, message.content and list

quartz kindle
#

when you use a for loop, you create a variable that will represent the current item being worked on

#

its the same thing

fossil bone
quartz kindle
#

i literally copied it from stackoverflow

#

i dont use python

fossil bone
#

it seemed better, shorter in code and more practical when the code gets more complicated in the future

earnest phoenix
#

Let me explain what x in content for x in chars does

for x in chars is executed first, iterating through the list called chars and naming the list item as x, then x in content is executed, and when the in keyword in Python is used on a string, it checks if x (the list item) is contained in the string called content

quartz kindle
#

btw voltrex am i right in assuming the above code does a char-by-char comparison? like for each character in the string compare it with each character in list

earnest phoenix
#

Perhaps, just explained it

fossil bone
#

it should yes by logic

quartz kindle
#

if so then in js it would be slow af

#

xd

sharp geyser
#

Why does it seem like making your own discord lib is so annoying...oh wait cause it is

fossil bone
#

it's python so not same speed lol

sharp geyser
#

😔

solemn latch
#

👀 would regex be faster here, since you can have messages with 4k chars

#

Im good at english

#

and putting thoughts in words

quartz kindle
#

in js i would do for each character in list, use string.indexOf(char)

#

regex is also an option yes

earnest phoenix
#
content = message.content
chars = ["/", "-", "+", "&", "$"]

if any(x in content for x in chars)):
  print("Passed") 

Is the same as

const { content } = message,
  chars = ['/', '-', '+', '&', '$'];

if (
  chars.some((char) => content.includes(char))
)
  console.log('Passed');
#

Shouldn't be slow much either way

fossil bone
#

yesterday i was building a calculator in python it literraly took me like 20 lines of code then one dude just showed me one line of code in c that did exactly the same calculator i built IN JUST ONE EFFin line of code

dry imp
#

one liner moment

#

just make that 20 lines into a long one line

fossil bone
#

could be that * won't let the code work somehow idk

fossil bone
#

i know

lyric mountain
sharp geyser
#

So what is the dffierence between the get gateway and get gateway bot endpoint for discord?

earnest phoenix
lyric mountain
#

like, it's fast cuz it's always less or equal to O(n)

quartz kindle
sharp geyser
#

So when making a discord library I should use the get gateway bot?

quartz kindle
#

the speed does not increase linearly with the number of characters

#

1000 chars is not 10x slower than 100 chars

lyric mountain
#

maybe the chars are backed by something?

quartz kindle
#

i guess technically it is o(n), but its very efficient

split hazel
earnest phoenix
dry imp
#

damn dude you hit all of the py discord bot dev bingo

#

replit + on_message

fossil bone
#

i want to move on pls i have other things to life to live for :' )

earnest phoenix
#

list = [...] -> chars = [...]
any(x in content for x in list) -> any(x in content for x in chars)

#

Try it

fossil bone
#

ok chars i'll try chars

earnest phoenix
#

It still says list in the error stack trace

dry imp
#

run it

quartz kindle
#

@_@

dry imp
#

also that one fucking indent annoys me so much

quartz kindle
dry imp
#

ive developed ocd since using py

fossil bone
#

i'm dying :<

#

what evil have i done to deserve this torture

sharp geyser
#

using python

#

that is the biggest sin

fossil bone
#

welp

#

guess i deserve it then

#

T^T

#

but plssssss i still have alot to do

dry imp
#

why cant people be normal and use commands instead

#

why on_message

fossil bone
#

can't believe i got stuck there

sharp geyser
fossil bone
royal portal
fossil bone
#

that one works btw

earnest phoenix
# fossil bone i'm dying :<

I have no idea how or why in God's name that error even occurs, because it doesn't make any sense, generally running the same thing outside just works fine

fossil bone
#

but...

fossil bone
#

the ''' is like ##

earnest phoenix
#

That's just a specialized comment

fossil bone
#

it's a comment

royal portal
dry imp
#

"' is for comment so it is fine

fossil bone
#

tha code works btw but only for a sting

quartz kindle
#

it definitely should work

#

what is your python version?

fossil bone
#

so like i have to write these lines 6 time for each charachter

fossil bone
earnest phoenix
#

Replit is not a Python version

fossil bone
#

-_-

#

i mean i can't control replit

#

it gives me a version

#

i use it

dry imp
#

it will work regardless should work atleast

earnest phoenix
#

Run python --version in the Replit console

fossil bone
quartz kindle
#

google says the default is 3.8

fossil bone
#

ok different plan

#

i give up

#

we try a different approach

earnest phoenix
#

Log this

import sys

print(sys.version)
sharp geyser
#

god there is so much to read on the topic of gateway on discord's docs

#

😔

quartz kindle
#

been there done that

sharp geyser
#

lmao

fossil bone
sharp geyser
#

so far I am on tracking state

quartz kindle
#

its not that terrible tho

sharp geyser
#

and I still have no idea where to start with this discord lib

quartz kindle
#

their docs are pretty good

sharp geyser
#

oh yea no they are wonderful

#

just very extensive

earnest phoenix
quartz kindle
#

are you using a websocket library?

fossil bone
#

oh sorry ok

sharp geyser
#

I am just reading the docs to learn what I need

#

no idea what websocket lib to use tho when I actually start

quartz kindle
#

basically you start with an http library and a websocket library

#

are you using nodejs?

fossil bone
sharp geyser
#

indeed

quartz kindle
#

for http there ae dozens of them, but if you feel like it, give undici a try

#

for websocket ws is pretty much king, not sure if there are any good alternatives

earnest phoenix
fossil bone
#

XD

dry imp
fossil bone
#

it's past midnight my brain started lagging

sharp geyser
quartz kindle
#

its a zlib stream

earnest phoenix
quartz kindle
#

you can use node's built in zlib, although its not that good because its async

#

there are alrenative zlib libraries for that

#

like zlib-sync and fast-zlib (im the author of fast-zlib)

sharp geyser
#

I noticed you made one called fast-zlib

earnest phoenix
#

Tim it's time to show off your Zlib implementation

#

Ah there it is

quartz kindle
#

lmao

#

its basically just a hack into node's zlib

sharp geyser
#

I am started to get demotivated with this discord lib idea

quartz kindle
#

i dont actually implement it

sharp geyser
#

so much shit I have no idea how to do

#

😔

quartz kindle
#

you dont need zlib to start with

#

you can start without compression

fossil bone
sharp geyser
#

Mmm but didn't they mention something like they will sometimes compress data and I will have to recognize and decompress it?

quartz kindle
#

only if you enable compression

dry imp
sharp geyser
#

Ah, I didn't notice that part

fossil bone
#

i had to make another bot just incase

#

idk

#

to not touch the already wasted one

quartz kindle
#

potato patata jr

sharp geyser
#

wtf

fossil bone
#

🙂

#

mucha lucha

dry imp
#

try printing the msg @𝑀𝓇. 𝒫𝑜𝓉𝒶𝓉𝑜-𝑀𝒾𝓁𝓀#1409

#

fuck

fossil bone
#

fuck

sharp geyser
#

fail

fossil bone
#

'-'

dry imp
#

mobile moment

sharp geyser
#

momeny

fossil bone
#

print('fuck')

dry imp
#

stfu misty MumeiSui

sharp geyser
#

:^)

earnest phoenix
# fossil bone it's 3.8

I saw, I think something else is happening here rather than just failing on the way to execute it properly, either your indentation is fucked up, the msg variable is not a string, or the chars variable is not what it seems to be

sharp geyser
#

print the type of all of those ez

earnest phoenix
#

I'm gonna ask you to do print(msg, chars)

dry imp
#

try printing msg

fossil bone
#

the msg variable is not a string

#

hmm idk

#

msg= message.content

dry imp
#

just... print it

fossil bone
#

idk what else should i do

sharp geyser
#

@quartz kindle So what do you recommend I do first when making this lib? Should I just try and establish a connection with the gateway or is there anything else I should research on before making a connection?

fossil bone
sharp geyser
#

Alrighty

dry imp
fossil bone
#

print(msg)??

dry imp
#

yea

fossil bone
#

.-.

#

it needs some time to run sorry

#

bare with me a little more

#

i can sing if that helps w ur anxiety '-'

earnest phoenix
fossil bone
#

ok i feel stupid 😄

dry imp
#

bro

fossil bone
#

print(msg)
is basically the message i send in chat to check on the bot

earnest phoenix
#

Ugh

#

print(type(msg), type(chars))

fossil bone
earnest phoenix
#

We have logged in as Fuckery

fossil bone
#

that(s my bot's name 😄

earnest phoenix
#

Anyway try printing their types as I showed

#

This is the longest time I've spent trying to help someone about a specific thing

fossil bone
earnest phoenix
#

I didn't think you're actually printing them, it seems to get stuck at some point

#

Show code?

fossil bone
#

bro it's your code

earnest phoenix
#

You're printing it in that if statement, print it outside

sharp geyser
#

Am I supposed to be receiving this when connecting to the discord gateway?

<Buffer 7b 22 74 22 3a 6e 75 6c 6c 2c 22 73 22 3a 6e 75 6c 6c 2c 22 6f 70 22 3a 31 30 2c 22 64 22 3a 7b 22 68 65 61 72 74 62 65 61 74 5f 69 6e 74 65 72 76 61 ... 68 more bytes>
#

I thought it'd be a json response?

wheat mesa
#

Discord sends opcodes through the websocket from what little documentation I’ve read

fossil bone
#

it will show error

earnest phoenix
#

...

sharp geyser
#

Which is not at all what the docs say it should return

quartz kindle
fossil bone
quartz kindle
#

just use .toString() and then JSON.parse()

earnest phoenix
sharp geyser
#
{
  t: null,
  s: null,
  op: 10,
  d: {
    heartbeat_interval: 41250,
    _trace: [ '["gateway-prd-main-qj3j",{"micros":0.0}]' ]
  }
}

Ah I see yea it did respond

fossil bone
#

it works ey '-'

#

the important thing is that it works

dry imp
#

mood

earnest phoenix
#

Sometimes I want to explode when I'm in this channel watching as brain cells go poof

quartz kindle
#

ikr

fossil bone
#

did i mention that i love u 🙂

#

literrally same conv w my father when he's done with me

quartz kindle
#

@fossil bone just to explain something, when people ask you to print something, just do it, and show whatever comes up, even if its an error. saying that something "didnt work" or "it errored" without showing the actual error does not help anyone, if it errors, we ALWAYS need to see the error, because it contains clues to solving the problem

fossil bone
#

i'm sorry guys i'm doing my best idk

dry imp
#

print it OUTSIDE of IF statement but INSIDE of the function

fossil bone
earnest phoenix
#

What

fossil bone
#

python logic

#

i swear

dry imp
#

i found the answer

earnest phoenix
#

That's not what it's doing... God

fossil bone
#

😅

dry imp
#

i found the answer and it works beautifully

#

damn

quartz kindle
# fossil bone the error is pretty simple it doesn't identify the msg so i have to identify it ...

thats not the problem, when we troubleshoot something, we have a checklist of things that we need to check, to narrow down the problem. often that checklist involves seeing/confirming something specific like seeing something being printed or seeing a specific error happening. if you hide those things from us it only confuses as and we cant be sure whether that specific checkbox can be safely ticked or not.

#

thats why you see peope here being frustrated with you

#

because they dont know whether you did something or not, whether something was successfuly checked or not

fossil bone
quartz kindle
#

and unfortunately experience tells us that we cannot trust what the person is saying because they are often doing something wrong or they are misunderstanding what we tell them. not saying you are doing this, but it has happened a lot in the past

fossil bone
#

this is rplit btw not some ide

quartz kindle
#

we dont need to see a recording of you typing, we just need to see the code and the output of that code

#

like you did before, a screenshot of the code on the side, and the output on the other

fossil bone
#

that's what im trying to say nothing shows up

#

like the code print isn't there at all

dry imp
#

replit is an ide

quartz kindle
#

we still need to see it

#

we need to see the code to see why its not printing

fossil bone
#

it only shows up when i put it under if user sends a message print(msg)

dry imp
#

okay.. where do you put it when it is outside the if statement?

fossil bone
#

everywhere

dry imp
#

define everywhere

fossil bone
#

under every class method

quartz kindle
#

you see how what you're saying is not being helpful?

#

one image is worth a thousand words

fossil bone
#

ik how u feel

dry imp
#

just screenshot

#

and send

fossil bone
#

but idk where else to put it

#

ok

sharp geyser
#

Hey tim any idea on how I can make a basic implementation of the ready event so I can see if my indentify actually worked?

dry imp
fossil bone
#

it will only work here