#development

1 messages · Page 71 of 1

lyric mountain
#

and go down the dependency road

sleek marsh
#

oh lemme try

sleek marsh
lyric mountain
#

it's just a manner of speech

#

since you run a couple dozens of pip i something

sleek marsh
#

which to choose

#

@lyric mountain do u know which one we use ?

lyric mountain
#

not sure, but what lib are u using for discord?

outer crater
#

Replit will do automatically

lyric mountain
sleek marsh
lyric mountain
outer crater
#

Oh

#

Sad

lyric mountain
#

try following d.py install instructions again

sleek marsh
#

i am too smart right ? 😎 i deleted the venv 😂

lyric mountain
#

discord is probably something that comes together with it

sleek marsh
outer crater
sleek marsh
outer crater
#

Or download all of them

sleek marsh
#

Select one to run (or press Ctrl-C to cancel):

python39Packages.pip.out
python39Packages.bootstrapped-pip.out
python38Packages.pip.out
python38Packages.bootstrapped-pip.out

#

u know which to choose ?

outer crater
#

Apt install pip3

sleek marsh
#

bash: Apt: command not found
~/radion-fixing$
~/radion-fixing$

earnest phoenix
#

Small a

sleek marsh
#

apt install pip3

outer crater
#

Yep

earnest phoenix
#

Do they even let you use apt on replit

sleek marsh
#

~/radion-fixing$ apt install pip3
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
~/radion-fixing$
~/radion-fixing$

outer crater
#

Sudo apt install pip

lyric mountain
#

sudo on replit?

earnest phoenix
#

Yeah that will never work

#

Can already tell you

outer crater
#

s*

#

Try

#

It doesn't cost anything

earnest phoenix
#

It will never work

sleek marsh
#

didnt work

earnest phoenix
#

No need to be sherlock

sleek marsh
#

lemme just try uploading my files

earnest phoenix
#

Otherwise you can do the shit way by executing

import os
os.system("pip install discord.py")
#

Eventually the shell you have is different than the one they use to execute 🤷‍♂️

earnest phoenix
wide herald
earnest phoenix
#

No reason to use pycord aPES_Giggle

sleek marsh
#

can we code the friking folder from our pc in replit ?

#

i will code in vs studio for the time being

#

it will be easy there

earnest phoenix
#

Replit is just wack

lyric mountain
earnest phoenix
#

Complete madness

fervent moss
#

Heya how do i get all custom emojis from a string like what is regex for it?
I tried 4 regex from https://google.com/ none seem to work

lyric mountain
#

also it represents really well how fucked up some replit projects are

earnest phoenix
#

LMAO

earnest phoenix
#

Though that will match in different groups

#

So you won't be able to get the name of the emoji with that

lyric mountain
earnest phoenix
#

With the different groups

lyric mountain
#

damn I love coding in sqlite

earnest phoenix
#

sqlite yikes

fervent moss
lament rock
#

I mean, SQL is compiled and it can be pretty powerful

fervent moss
earnest phoenix
#

Probably not how you should use regex

real rose
earnest phoenix
fervent moss
earnest phoenix
#

Well, a regex most likely goes in a string

#

And not randomly in your code, as it's not valid JS syntax CatJAM

fervent moss
#

Maybe mb

earnest phoenix
#

I am setting up a tent in this channel for the next few months bongoSushi

sleek marsh
#

installing vs code is it better than replit ?

fervent moss
#

Returns null after converting it to string

lyric mountain
earnest phoenix
lyric mountain
#

wont make ur code better, but is more QoL for coding

sleek marsh
lyric mountain
#

like uh...a terminal

earnest phoenix
#

It's not used for hosting

#

It's a normal terminal from your system

earnest phoenix
lyric mountain
#

like, a terminal is just somewhere u execute commands

#

u can use it to run your bot, but it'll go offline as soon as u close the window

sleek marsh
#

hm and can we open a whole folder in vs ?

lyric mountain
#

for sure

earnest phoenix
#

Thankfully, yes

sleek marsh
#

ohk thanks

boreal iron
#

It's like literally any tool can do that

earnest phoenix
boreal iron
earnest phoenix
#

@sharp geyser how's cpp going CatJAM

#

need to bring the gigachad cpp users

fervent moss
earnest phoenix
boreal iron
brave stump
earnest phoenix
#

It works

#

Regex is already madness itself

boreal iron
#

Isn't even a valid regular expression

lament rock
#

You should almost never use the . character class.
[^:] would be better

lyric mountain
#

I'd use <a?:\w+:\d+>

lament rock
sleek marsh
#

@lyric mountain does the .replit and the nix file work in vsc ?

lyric mountain
#

\w includes underscores

lament rock
#

that's stupid

boreal iron
#

lol

earnest phoenix
lyric mountain
#

well, it's a valid alphanum character

lament rock
#

I'd still rather use [^:]

earnest phoenix
#

The .replit file will be useless though

lyric mountain
surreal sage
#

@languid raft Just ask how to make a websocket here

lyric mountain
#

and anything else that wouldn't be valid in an emote's name

lament rock
#

Then it wouldn't be an emote

lyric mountain
#

someone could have some fun tricking the bot

lament rock
#

You say that, but arbitrary input go brr

boreal iron
#

Soon bot token released due to a broken regular expression

lament rock
#

ong

lyric mountain
#

ain't that how people crashed cloudflare some time ago?

earnest phoenix
#

ReDoS is just cool

lament rock
#

No, that was excessive backtracking

slender wagon
#

anyone knows a thing for this yet?

sleek marsh
#

@lyric mountain @earnest phoenix what to select here ?

languid raft
#

how would I make a C# websocket to print a response on local IP

lament rock
#

. can include excessive backtracking so you should never use it

earnest phoenix
#

You press ESC

sleek marsh
earnest phoenix
#

And then open folder

#

You open the terminal and run it

lyric mountain
#

vs code includes a button in context menu yes

sleek marsh
#

@lyric mountain @earnest phoenix

earnest phoenix
#

Now you wait for windows to take its time to load

sleek marsh
earnest phoenix
#

Because windows and speed doesn't go together

earnest phoenix
#

Now you can tell us why you have like 3 config files, main files, etc.

sleek marsh
#

whats the command to run ?

earnest phoenix
sleek marsh
earnest phoenix
sleek marsh
earnest phoenix
#

I'd recommend to learn first before pasting a bot from github randomly

lyric mountain
sleek marsh
#

its a incomplete skided bot

earnest phoenix
#

Won't be of any use

sleek marsh
#

and i fixed more than half of the code

lyric mountain
#

also jsondb...isn't realiable

#

I'd suggest using a real database

earnest phoenix
#

And then you ping us for the most basic questions because you've never learned anything about coding krShrug

earnest phoenix
#

Definitely recommend to use Google, learn and make your own bot

sleek marsh
#

i am a lowly skider not coder

earnest phoenix
#

Pasting is not useful at all and will mostly lead to you asking the most basic questions

surreal sage
#

Anybod know how to make a web socket server in C#?

earnest phoenix
#

@real rose can you delete that ^, it's just being a clown and making people run unsafe things

earnest phoenix
#

mozarella

lament rock
#

Trying to understand http 103

earnest phoenix
#

Not such things, use your grown up brain and get better "memes"

fervent moss
#

From <:lol: 1045020386464636988> How do i get the emoji id?

earnest phoenix
#

Split

fervent moss
#

Wait its not just :lol12:

lament rock
#

What text comes to your bot? Literally just that?

fervent moss
#

It's like classic form which i can't send for some reasons

lament rock
#

If so, there's no way to know the ID

earnest phoenix
#

Yeah as said, you split at : or another character

fervent moss
#

Hmm...

lament rock
#

Or if you're already matching with a regex, include a capture group at the part which matches the ID

#

splitting by a string compiles a regular expression on every use iirc

lyric mountain
#

js keeps compiled literals in cache

#

but yea, if ur already are running a regex there's literally no reason not to use it for capturing groups too

north nymph
#

trim clears the whitespace, replace clears the >

lament rock
#

bad idea

tulip ledge
#

Any idea what I'm doing wrong? I have no clue what this error is and why I'm getting it

app.post("/sendMail", (req, res) => {
  const body = req.body;

  res.status(200).send({ message: "test", name: body })
});

Content-Type in the header is set to application/json

north nymph
# lament rock bad idea

he should just get the id as there is a method in the role object anyways. But i'm just answering his question on "How to get it from this string"

lament rock
#

he's already running it through a regular expression. You're just wasting cpu cycles

fervent moss
#

Oh next message mb

lyric mountain
tulip ledge
#

app.post("/sendMail"

lyric mountain
#

ah wait, it's ur endpoint

#

hm, are u typing the url correctly?

tulip ledge
#

ye

north nymph
#

There'll be an extra space

#

I ain't a js dev so got no idea if it's handled or not, but it should be

tulip ledge
#

Figured it out

lyric mountain
#

replace wont add a space where the char was

tulip ledge
#

I'm not using nodemon

#

x)

north nymph
#

in the second replacement array of :

lament rock
#

don't ask why I did it

#

Wanna make my own FormData implementation to go practically depless, but pain

quartz kindle
#

formdata is easy

lament rock
#

it was easy to do it with strings, but I have to do it with Buffers and allocating/concatting buffers is so much fun I don't want to deal with

#

stuff like payload_json no problem

#

but Buffer encoding to string doesn't have raw iirc

quartz kindle
#

wdym?

lament rock
#

The default encoding of coercing a Buffer to a string is utf-8, but when I tested, a png file was sent, but had missing characters so it was invalid png

#

Why I coerced it to a string is just for convenience in writing the HTTP requests and form body layout

surreal sage
#

What does in and of do in a for loop

wicked pivot
#

how do I set the permissions to see the orders that certain roles have? (slash command)

module.exports = {
    name: 'clear',
    description: 'Allows you to delete a number of messages in a channel.',
    options: [{
        name: 'number',
        description: 'Number of messages to delete',
        type: 'NUMBER',
        required: true,
    }],
    run: async (client, interaction) => {}
}```

(v13)
surreal sage
surreal sage
quartz kindle
lament rock
#

just conveniences of IterableIterators

quartz kindle
#

in only works for objects

lament rock
#

of doesn't work on object values though right?

wicked pivot
lament rock
#

yea

quartz kindle
#

yeah of is only for arrays

#

or iterators

lament rock
#

wouldn't in work on arrays and provide indexes as the keys

#

since they are just objects

surreal sage
lament rock
#

anyways. For my http client, I'm mostly just looking for places where I can improve performance, like I used to pass chunks to an Array and then concat at the end, but I have gotten word that a linked list would be far more efficient than an Array

#

which seems to be the case

#

Also streaming chunks directly into a Buffer if Content-Length is supplied

quartz kindle
#

i never tested array vs linked list

#

but i did test that creating a new buffer and writing chunks to it is faster than concat

quartz kindle
lament rock
quartz kindle
#

yes you can do that for binary responses

lament rock
#

thats what im doing

quartz kindle
#

for text responses it shouldnt make much of a difference compared to toString then concat the strings

lyric mountain
lament rock
#

if Content-Length is supplied, I'm just streaming chunks

surreal sage
lament rock
#

What annoys me is that headers can be sent over multiple chunks it seems

lyric mountain
lament rock
#

Discord constantly sends me CF array info after the initial response is already received

quartz kindle
#

you need to wait for the newline delimiter that separates headers from body

lament rock
#

Yeah \r\n\r\n

#

I need to fix the logic in another update

#

For now I only assume first chunk

surreal sage
#

I have an input in html and I want a button on the right side it
Those 3 dots are the button I wanted added

#

What would be the best way

#

The input is in what you could call a div*

lyric mountain
#

Nest both components inside a div, make the "3 dots" position absolute

#

Then just do right: 0

surreal sage
#

How would I nest it?

lyric mountain
#
<div>
    nested
</div>
surreal sage
#

🤯

quartz kindle
#

@lament rock btw do you ever profile your stuff?

#

like using node's profiler or using the chrome inspector

lament rock
quartz kindle
#

i like using chrome inspector sometimes

lament rock
#

I can't really say I like it too much

quartz kindle
#

i really like how it shows the time taken by specific lines of code (even if it gets it wrong sometimes)

lament rock
#

I wish node callsites provided that info

#

I already abuse the fuck out of call sites

#

I also wish they provided src map info but nope

quartz kindle
#

i often use this

#

sometimes the timings are a bit inaccurate, but its pretty useful

#

then i hyper-optimize the hell out of the most time consuming lines lel

lament rock
#

Not at the point of micro optimizing yet. Like iirc, I heard someone say Object.prototype.hasOwnProperty.call is more efficient than double unary negating an access

#

but I haven't tested

lament rock
#

oh probably something like gc or thread pauses

quartz kindle
#

or the pic is fake

lament rock
#

or that

quartz kindle
#

also thats probably 5 seconds out of several minutes of runtime

lyric mountain
#

Ah, I'm too late

lament rock
#

Thats literally what I asked CVRchanDerp

quartz kindle
boreal iron
quartz kindle
#

those things always break my benchmarks and introduce non-sensical results

lyric mountain
#

I'd be worried if gc paused my code for 5s KEKW

lament rock
#

I'm un-acquainted

boreal iron
quartz kindle
#

i had this problem when testing my serializer, that the size of the function's body was affecting the performance

#

even if i simply added/removed comments

#

it would massively affect performance

#

like from 20m to 200ms

lyric mountain
#

20ms right?

#

...right?

quartz kindle
#

i found out there is a function body size limit in v8

#

that it stops inlining functions if the stack gets too big

lament rock
#

what's the size?

quartz kindle
#

and there is a v8 option --stress-inline

#

which forces aggressive inlining

#

no idea what the size is

#

or how the size is even calculated

#

probably using the bytecode somehow

#

but it was the strangest thing i've ever seen

#

like literally adding and removing a comment line, would cause a performance difference of 10x

lament rock
#

I've started to use tsup, could probably help since it minifies a ton

earnest phoenix
#

Generally the idea of inlining something depends on the amount of instructions or bytecode that specific part of code is going to generate, it does approximate calculations of that and decides whether or not to inline

#

It's present in almost every compiler or JIT engines

quartz kindle
#

ah another thing i noticed

#

probably something with v8 code paths

#

the order of the functions influenced the benchmark

lament rock
#

that's dumb

quartz kindle
#

running function A then running function B would produce different results than running function B first

#

because running function A beforehand would cause function B to deoptimize some code paths

#

or something like that

lament rock
#

doesn't that only happen when the JIT encounters something it guessed incorrectly on

quartz kindle
#

because my functions involved variable input types, for example run it once with strings, then run it with numbers, so v8 loses the optimization it did for a string code path

earnest phoenix
lament rock
#

oh yup thats it

quartz kindle
#

and it relegates a fixed-type function back to a multi-type function

tulip ledge
#

I have this button component inside a form (react) and it's triggering the onSubmit function from the form, anyway to not make it do that? or to like check if the submit button is the one triggering the onSubmit function?

quartz kindle
#

event.target should have the element that activated the event

raven drift
#

how can me make if someone vote in top.gg take a coins or something?

quartz kindle
#

which gives you an event when someone votes, then you can use this event to do what you want

raven drift
#

oh ok thank you i got it

coarse topaz
#

Hi there, I've run into a bit of trouble
I recently added axios' packages to my project, and when I tried to import the library to my code (by doing const axios = require('axios');), it displayed this error in the console:


       ^^^^^

SyntaxError: Unexpected identifier```

I've made a research and I'm still not pretty sure about what could be wrong. May you please help me out?
quartz kindle
#

that means axios is now ESM only

earnest phoenix
earnest phoenix
coarse topaz
quartz kindle
#

possibly both issues then

#

old node that doesnt recognize it

earnest phoenix
coarse topaz
earnest phoenix
coarse topaz
earnest phoenix
#

You're probably still running an old Node.js version

#

What does node -v output for you?

rigid maple
#

Voltrex

#

Thank you very much for your help
i made things even easier and combined pcm files and decoded like that

earnest phoenix
#

You're welcome

#

Sadly there's no starboard on that server

coarse topaz
#

Wtf lmao

tulip ledge
tired jacinth
#

how can I make bot add his role for all guilds channel for some special perms as external emoji or send messages

earnest phoenix
# coarse topaz Wtf lmao

Then your older Node.js installation is hoisted over the one you just installed, uninstall the older one

#

Also what platform are you on?

coarse topaz
#

I tried to create a new project, to see if it had got a more updated version of node, and when I checked the version of that new server it was 14.x

tulip ledge
earnest phoenix
quartz kindle
#

inside the submit event

tulip ledge
#

its react

tulip ledge
quartz kindle
#

👍

coarse topaz
#

I think I'll have to work on my bot's code rewrite, was being too lazy to update it to v13 from the very beginning, lol

earnest phoenix
#

But no worries as Glitch supports it, although you shouldn't use Glitch or Replit or any free hosting platforms, just buy a VPS and use it

#

There are various cheap VPSs out there

sterile lantern
#

I'm assuming data in mongodb is stored chronologically from oldest-newest. now, i want to create a queue-like system that uses #'s, is there a way to find the position of a document in a database

#

or if its not stored like that, any way to incorporate a queue system

#

that i can easily change #'s if someone leaves (shifts to the left)

rigid maple
#

Is there a similar function in node.js?

lament rock
tired jacinth
lament rock
#

Don't use external emojis then CVRChanPadoru

slender wagon
#
Error: Client has already been connected. You cannot reuse a client.
const { Client, Collection, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });

those are the only clients i am seeing what did i do wrong exactly

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

slender wagon
#

i don't tho

#

🤔

tired jacinth
#

it so hard not to ^^

lament rock
#

if you're having issues from using them because you aren't allowed to and server staff won't give your bot permissions, then you can't give it to yourself and you can't use them

tired jacinth
#

the bot have external emojis

#

but can't post them

earnest phoenix
# slender wagon i don't tho

Search for login() throughout your source code (you can use your IDE's search functionality, or some text search utility in the terminal like grep), if there is only one instance then something is calling it twice

tired jacinth
#

cuz we webhook inharite permission form the everyone role that why

#

what I want to do is like the muted role to config in all guild channel

lament rock
#

use
POST /channels/:channel_id/messages
instead of
POST /webhooks/:webhook_id/:token/callback

surreal sage
#

A div in a li element, not showing up

#

min height and width property are set

#

background-color property set

#
<li id="cinput-carrier" style="display: block;"><input id="cinput" class="form-control input-field new-input-field" placeholder=">" autocomplete="off" autocapitalize="off" spellcheck="false" data-np-checked="1" style="height: 28px;"><span style="position: absolute; right: 0px; top: 1px; cursor: pointer; color: rgb(189, 190, 190); opacity: 0.5; width: 14px; height: 25px; text-orientation: sideways-right; writing-mode: vertical-rl; line-height: 5px; font-size: 16px; font-weight: 600; border-left: 2px solid rgba(255, 255, 255, 0.2); text-align: center; margin-top: auto;">...</span><div style="transform: translate(calc(100% + 20px), 0px); width: 170px; min-height: 28px; background-color: rgb(25, 27, 29); position: absolute; top: 0px; right: 0px;"></div></li>```
#

Javascript injected html*

#

It's because of the transform

#

It doesn't want to display what's outside of it's own bound

surreal sage
quartz kindle
#

transform with absolute position doesnt really make sense

#

absolute position basically does the same as transform translate

#

no idea why you would want to use both at the same time

#

position absolute will align itself with the closes relative positioned parent, if none is found, it will align itself with body, so your top 0 right 0 may be aligned with the wrong element

#

if the position is correct but it doesnt show when out of bounds, then you need to check if one of the parents has a hidden overflow

#

else you need to set a higher z-index

surreal sage
#

Z index does the job ThumbsUp

lyric mountain
#

you should consider using css files btw

#

or at least styles header block

quartz kindle
#

so i have a math question

#

lets say i have a coordinate xyz, and the equivalent spherical longitude latitude and distance. i can calculate between them no problem.
now i have some speed values, for example longitude speed, latitude speed and distance speed, which translate to an object's current motion. im trying to convert those speeds in spherical coordinates to their equivalent speeds in cartesian/rectangular xyz speeds.
my first idea was to calculate a new xyz point from the spherical coordinates plus their speeds, and subtract the difference between the old xyz and the new xyz, but im getting invalid results

#

actual example:

#
{
  longitude: 304.6524478037449,
  latitude: 4.776131102165254,
  distance: 0.0024832595879139487,
  longitude_speed: 14.190215417307753,
  latitude_speed: -0.4010145636843335,
  distance_speed: -0.0000252558145892265
}
``` equivalent xyz:
```js
{
  x: 0.0014070710472908051,
  y: -0.002035676385474145,
  z: 0.00020676291366062392,
  x_speed: 0.0004906801111389582,
  y_speed: 0.00036799689246692853,
  z_speed: -0.000019422911006822898
}
``` im trying to get those x_speed, y_speed, z_speed values from the above spherical values (i already have the result, i just need to find the correct math behind it)
#

using the mentioned method of creating a new xyz point and subtracting the difference im getting the following results instead, in which the speeds are wrong

{
  x: 0.001407071047290805,
  y: -0.0020356763854741454,
  z: 0.0002067629136606237,
  x_speed: 0.0004360229457238661,
  y_speed: 0.0004245921599656075,
  z_speed: 0.000015035871073111612
}
#

this is my code

function ecl2cartspd(long, lat, dist, long_spd, lat_spd, dist_spd) {
    const t = deg2Rad(long);
    const p = deg2Rad(90 - lat);
    const sinp = sin(p);
    const x = dist * sinp * cos(t);
    const y = dist * sinp * sin(t);
    const z = dist * cos(p);
    const t2 = deg2Rad(long + long_spd);
    const p2 = deg2Rad(90 - lat + lat_spd);
    const sinp2 = sin(p2);
    const dist2 = dist + dist_spd;
    const x2 = dist2 * sinp2 * cos(t2);
    const y2 = dist2 * sinp2 * sin(t2);
    const z2 = dist2 * cos(p2);
    return {
        x,
        y,
        z,
        x_speed: x2 - x,
        y_speed: y2 - y,
        z_speed: z2 - z
    };
}

EDIT found the issue: 90 - lat + lat_spd should have been 90 - (lat + lat_spd). the final result is still not the same as thought, but much closer

radiant kraken
#

tim i don't think everyone in Top.gg has got the mathematical skill to do that

quartz kindle
#

😩

radiant kraken
#

they probably don't even know what sin means

quartz kindle
#

neither do i

#

i just follow formulas

icy burrow
#

Is there a way to use the top.gg api to display the number of servers my bot is in on my website?

quartz kindle
#

nop

#

i mean, why would you want to do that?

#

the top.gg api requires you to send it the number of servers your bot is in

#

so if you're already sending it to topgg, just send it to your website as well

quartz kindle
#

for example i just found these two are equivalent (no idea which one is faster, they seem equal in my benchmarks)

const latitude = 90 - atan2(sqrt(x2 + y2), z) * RAD2DEG;
const latitude = 90 - acos(z/distance) * RAD2DEG;
earnest phoenix
#

Pretty interesting, although yeah I don't see how those speed values could be converted to Cartesian speed values

quartz kindle
#

i managed to somewhat fix my issue, 90 - lat + lat_spd should have been 90 - (lat + lat_spd), so now i get much better values, although they are still not the same as the ones given

#

i've also discovered that the values im using for comparison themselves are not exactly what i though they would be lol, there are some inconsistencies

sleek marsh
#

do i nedd to install python3 to run in vs code ?

earnest phoenix
earnest phoenix
quartz kindle
#

astronomy stuff, adding different coordinates support for objects not supported/included by the original libs

earnest phoenix
#

After installing the Python interpreter you can just click the "Run code" button in VSCode or open up the terminal and run python3 path/to/your/program.py

earnest phoenix
#

Yes

sleek marsh
#

dosent that work ?

earnest phoenix
#

That would work

earnest phoenix
sleek marsh
#

alright

#

@earnest phoenix do u know a way to upload a folder to replit ?

#

since i find easy to run on replit

quartz kindle
#

no idea what most symbols mean

#

but i'll get there

#

g2g sleep now

earnest phoenix
earnest phoenix
sleek marsh
#

something like that comes

earnest phoenix
#

Show it

sleek marsh
#

ok just a sec

#

@earnest phoenix

earnest phoenix
#

I think it's trying to say that the directory you're uploading has too many files

sleek marsh
#

its a multipurpose bot code so ofc it would be very lengthy and have many files and folders

earnest phoenix
#

Then don't use Replit, use a VPS

#

There are various cheap VPSes out there that you can easily spin up and run

earnest phoenix
icy burrow
fervent moss
lament rock
#

you should really learn regular expressions

crisp tusk
#

is it possible for a bot to edit a github repository

#

ive been looking through API for forever and I cant find anything on it 🥲

snow urchin
earnest phoenix
#

you fucked up

#

what the fuck is that

snow urchin
#

10/10 good response

#

🤷 thats what axios/discord is returning

earnest phoenix
#

could you try console logging the entire response

fervent moss
crisp tusk
#

or pastebin doesnt have to be github

lament rock
#

Or maybe handle that stuff yourself because the Buffer to string coercion encoding matters

snow urchin
#

axios is definitely set to return it as json, and it works with any other api, but as soon as I try discord, it returns like that... using postman with the same auth and headers returns a json

lament rock
#

axios just sucks then I guess

#

I wrote my own http client so I wouldn't know

radiant kraken
#

imagine

#

just use fetch()

radiant kraken
sharp geyser
#

Its definitely some kind of encoded data of some sort by the looks of it

#

Also undici is better

#

🥱

radiant kraken
#

no need to install any http client dependency

sharp geyser
#

no

radiant kraken
#

just use fetch()

#

ezpz

sharp geyser
#

never

radiant kraken
#

why

#

node.js v18 is LTS now

tired jacinth
lament rock
#

yes

sleek marsh
#
Traceback (most recent call last):
  File "/home/runner/Radion/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 178, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/runner/Radion/venv/lib/python3.8/site-packages/discord/ext/commands/help.py", line 858, in command_callback
    return await self.send_bot_help(mapping)
  File "/home/runner/Radion/cogs/help.py", line 66, in send_bot_help
    cog = command.cog
NameError: name 'command' is not defined

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/runner/Radion/venv/lib/python3.8/site-packages/discord/client.py", line 377, in _run_event
    await coro(*args, **kwargs)
  File "/home/runner/Radion/cogs/errors.py", line 35, in on_command_error
    raise error
  File "/home/runner/Radion/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 347, in invoke
    await ctx.command.invoke(ctx)
  File "/home/runner/Radion/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 950, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/home/runner/Radion/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 187, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'command' is not defined
#

what to do here ?

#

@tired jacinth @lament rock can u guys help pls ?

tired jacinth
#

sorry I don't know much of python:3

sleek marsh
radiant kraken
#

not defined

#

the error message is clear enough

earnest phoenix
#

infact this line

#
NameError: name 'command' is not defined
radiant kraken
#

that's what i said

earnest phoenix
#

you only said not defined

#

not what wasn't defined

radiant kraken
#

it's obvious in the error stack

earnest phoenix
#

rust lets be friends

#

bc I got nothing better to do with my life

#

correction null

lyric mountain
lyric mountain
#

it's highlighted in the whole message

surreal sage
#

Unrelated but...,
How do I bring this notepad window full screen or up?

#

did it

#

shift right click on task bar window

lyric mountain
surreal sage
lyric mountain
#

the taskbar can be unlocked anytime, then just drag it somewhere else

#

some people like to use it on the top or on the sides

sleek marsh
#

@lyric mountain i was waiting for u

sleek marsh
lyric mountain
#

Ur trying to access command somewhere it doesn't exist

sleek marsh
lyric mountain
#

Well, you define it

#

Your code is, not wanting to insult, a complete mess

#

You copied a lot of it from others didn't you?

sleek marsh
lyric mountain
#

Doing this is the same as grabbing random junk from a dump and trying to assemble a car

sleek marsh
#

it has to run fine untill my friend came and messed it up

lyric mountain
#

You'll get a car, yes, but it'll be barely holding together

sleek marsh
lyric mountain
#

Did you code that command?

earnest phoenix
#

Nothing was coded, everything was downloaded from GitHub

earnest phoenix
lyric mountain
#

What an oddly specific url

sleek marsh
earnest phoenix
#

You go on hastebin, you paste your code, you save and you share the url

#

Nothing easier

sleek marsh
#

untill a friend came and deleted some of owner ids credits fotters and core from it

lyric mountain
sleek marsh
#

cogs or lib

earnest phoenix
#

Well, where the error occurs..

sleek marsh
#

uh

earnest phoenix
#

And that is exactly what happens when you never coded and paste code very_sadge

lyric mountain
#

Please, restart from zero

#

It'll be easier for you, trust me

earnest phoenix
#

Already told them yesterday

sleek marsh
sleek marsh
lyric mountain
earnest phoenix
#

Delete all the code and make your own bot from zero

sleek marsh
lyric mountain
#

No

earnest phoenix
#

No you stop cloning

lyric mountain
#

Start from scratch, and code it entirely yourself

earnest phoenix
#

You create a new project, and code from zero

sleek marsh
earnest phoenix
#

No cloned code, your code

lyric mountain
#

Skider?

earnest phoenix
#

skidder*

sleek marsh
sleek marsh
lyric mountain
#

You...you know what skid means right?

#

And that it isn't exactly a compliment

sleek marsh
sleek marsh
solemn latch
#

A skidder is any type of heavy vehicle used in a logging operation for pulling cut trees out of a forest in a process called "skidding"

#

👀

lyric mountain
#

You like being called a kiddie?

earnest phoenix
sleek marsh
lyric mountain
#

Tf

#

To each their own ig

earnest phoenix
#

No need to try to understand some people

lyric mountain
#

But anyway, cloned code is almost always unmaintainable, unless you really study the project in depth

sleek marsh
#

uh i could explain if anybody would be here from apolex or astroz bot support srvr ppl

lyric mountain
#

If you manage to

sleek marsh
#

i am a pro skidder

#

ultra pro skidder

lyric mountain
#

Do note that this is only the start, you'll face many more bugs along the way

sleek marsh
#

and i hv my brain and friends brain to help

#

anyways a question

#

@lyric mountain

lyric mountain
#

...no need to ping

sleek marsh
#

why does some problems get fixed when typing kill1 in shell ?

lyric mountain
#

Because it's probably a bug that breaks the runtime

#

Kill 1 kills the process, making it restart in replit

sleek marsh
lyric mountain
#

No

#

It's nowhere near solved

sleek marsh
#

😑

lyric mountain
#

You're just killing the process and restarting it

sleek marsh
#

@earnest phoenix ur username reminds me of a bot dev named krypton

#

dev of flantic

earnest phoenix
sleek marsh
earnest phoenix
#

no

lyric mountain
earnest phoenix
#

Once you restart it, it comes again

#

And it will restart

lyric mountain
#

It's like throwing your car off a cliff because it ran out of gas

#

Then buying a new car

sleek marsh
#

what if i pay someone $6 and make them pay for fixing the code

lyric mountain
#

They'll deny

sleek marsh
#

why ?

lyric mountain
#

Nobody will fix a mess for only $6

earnest phoenix
#

Because they don't want to fix messy and horrible old code, they will make a new bot for you

lyric mountain
#

Hiring devs is costly, expect AT LEAST a few dozen dollars

earnest phoenix
#

-needdev btw

shell echoBOT
#

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.

gilded plankBOT
#

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.

sleek marsh
lyric mountain
#

That for minor issues

earnest phoenix
#

Who cares if the code is the same

#

You can't even read the current code

#

Features, you can request them and they will do it

sleek marsh
#

not the lib ones

#

but the cogs one

lyric mountain
#

Coding is expensive, nobody will do it for change cash

sleek marsh
#

no

#

in my hand sorry

lyric mountain
#

Well, that's how capitalism works

sleek marsh
#

whats that

lyric mountain
#

You either do it yourself, or pay someone to do it for you

#

But different tasks have different costs, if you can't pay, too bad

#

Just start a course and learn programming the right way

#

Don't try to use shortcuts

sleek marsh
#

i am in 8 bro my school teaches python in 10 class and coding in 12 class

lyric mountain
#

💀

#

There they go

sleek marsh
sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

You know programming can be self taught?

#

I've never learned anything from school itself

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

Now you know it can

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

sleek marsh
#

yt ?

earnest phoenix
#

Book, websites, online courses, articles, projects, etc.

#

I hate youtube videos, they are mostly misleading or outdated

lament rock
#

I'd like to think I became insanely smart by just regularly messing around with stuff and being proactive about optimization.

The only downside are now all of my problems are really complex and require really low level solutions like raw interaction with the network sockets or audio processing (which rarely exists for js)

#

im at the point of reading the rfc papers for http

#

if you aren't a masochist yet, you will be

quartz kindle
#

likewise my friend, likewise...

knotty quartz
#

I've got an error

#

V14 - Discord.js

client.commands.set(command.data.name, command);

Error: index.js

                                         ^
TypeError: Cannot read properties of undefined (reading 'name')
    at Object.<anonymous> (/home/container/index.js:16:35)
    at Module._compile (node:internal/modules/cjs/loader:1155:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
    at Module.load (node:internal/modules/cjs/loader:1033:32)
    at Function.Module._load (node:internal/modules/cjs/loader:868:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:22:47```
#

It's not done this for the last 6 months I've been hosting it

earnest phoenix
knotty quartz
#

Found it (Turns out the command file did not have a text input however I don't get why, when i uploaded it from my PC, it was saved with the code inside.)

#

Its online now, thank you Voltrex.

earnest phoenix
#

You're welcome

rigid maple
#

Can we unsubscribe from the user in discord.js/voice?
I want to unsubscribe events before starting a stream for the user so that it doesn't loop if more than one stream is started

raven drift
#

guys is there anyone know a good free website make my bot 24/7 turn on?

raven drift
surreal sage
#

You can rent one

#

But yeah

raven drift
#

and thank you for your help

surreal sage
#

You could do Heroku, replit or such things but 24/7 online doesn't really exist is what I believe

earnest phoenix
# rigid maple Can we unsubscribe from the user in discord.js/voice? I want to unsubscribe even...

Once the voice connection or receiver subscribes to the user, it returns a PlayerSubscription instance, which has an unsubscribe() method that you can use
https://discord.js.org/#/docs/voice/main/class/PlayerSubscription?scrollTo=unsubscribe

rigid maple
#

Is there a way to find out if the bot is already subscribed?

#

receiver.speaking.removeAllListeners();

#

i used this

#

aah created 2 stream, problem not solved

#

😃

lyric mountain
#

not anymore

surreal sage
lyric mountain
#

well now that's certain

#

heroku is no longer free

earnest phoenix
#

oracle and google cloud both have free tiers i think

lyric mountain
#

just keep that in mind

earnest phoenix
#

yes

#

free is free though

lyric mountain
#

idk, having your vps held at gunpoint kinda defeats the advantages of it being free

#

imagine losing all your data overnight

earnest phoenix
#

your better off buying one, free will always be unreliable

#

galaxygate has 1gb vpses for a few bucks

#

also replit is very bad theres almost a 100% chance you'll get ip banned

#

shared ip

lyric mountain
#

yes, all free options have a major drawback

#

but any will be better than losing all your data

surreal sage
#

An input element has 2 children instead of 1

#

One of those children does not have pointer events on none, and so blocking clicking/selecting

#

The empty div

lyric mountain
#

I believe all elements have a pointer events attribute

surreal sage
#

I know

#

But there's an empty div blocking the input

lyric mountain
#

Point events it

surreal sage
#

How would I?

#

It's inside the input

lyric mountain
#

Same way u did for everything else

surreal sage
#

What?

#

I did not put that div in there

#

I cannot access it via css

lyric mountain
#

Access via js

surreal sage
#

And how would I?

lyric mountain
#

Navigate the tree until you reach the div, or get by id if it has one

surreal sage
#

@languid raft It's there magically

#

(he doesn't have html experience)

lyric mountain
#

Just delete the div then

surreal sage
#

How would I?

lyric mountain
#

Backspace

surreal sage
#

..?

lyric mountain
#

...

#

Tell me, how is that div there?

surreal sage
#

That I do not know

#

Nothing in my code is adding it

lyric mountain
#

Do you use any framework?

surreal sage
#

No, all raw

lyric mountain
#

Then it's 100% impossible that u didn't add it

#

Double check your code, it's definitely there

surreal sage
#

@languid raft I didn't dickhead

lyric mountain
#

Use find in files to look for an empty div

surreal sage
#

The input was created via javascript

#

I checked the code, no input.appendChild or similair

lyric mountain
#

Did u try to reload the page?

#

Perhaps u added it on the browser

surreal sage
#

Nah doesn't do it

#

How would you access shadow root?

lyric mountain
#

well, what exactly is it?

surreal sage
#

I seem to have found the problem

#

input.style.height = "25px";

#

That breaks it

#

oh well hello

#

all g

surreal sage
#

Best way to add spacing on horizontal edges in a span?

quartz kindle
#

inline-block + padding?

wheat mesa
#

This is going to be a very broad question, but since I'm pretty new to frontend, how would I make a 3d piece of geometry that you can interact with in React? I'm not looking for any sort of a camera system or anything, I just need a way to animate 3d rectangles and use them as hyperlinks essentially

#

Basically I have some isometric rectangles (viewed from the corner) that are going to need to be animated as well as clickable

lament rock
#

What if you wanted to go to heaven but god said [object Object]

round cove
#

Where my europe GDPR smart homeis at

quartz kindle
#

finally found a formula that does what i want

#

was way more complicated than i thought

lament rock
civic scroll
neon leaf
#

is there a more elegant way to write version.version in js?

sleek marsh
#

@lyric mountain i fixed half code bro

#

just watching some tutorials

quartz kindle
radiant kraken
#

@wheat mesa

quartz kindle
radiant kraken
#

yes

quartz kindle
#

god bless

radiant kraken
#

because you'll do anything to worship implement something in js

boreal iron
quartz kindle
#

accurate

flat copper
#

how can i do tts in android in javascript without browser

true beacon
#

I have this problem in discordjs where a .fetchReply() function on a CommandInteraction does not return a Message object but a standard JavaScript object.

This only happens in private messages with the bot but not with interacting with it in a server.

Any idea why?

surreal sage
#

I have an input that my client wants to have the value (font size) auto scale, aka no overflow
How would I do this?

vivid fulcrum
surreal sage
#

This isn't an element in viewport

#

This is an input element

vivid fulcrum
#

oh, got it

true beacon
#

No

#

v12

earnest phoenix
#

Why are you using v12?

solemn latch
#

👀

true beacon
#

Bot wasn't updated in a while :), but it still worked

earnest phoenix
#

Your bot will keep crashing as v12 doesn't know how to handle much of the newer requests

#

Update to v14

true beacon
#

Ah okay. What are some things that will likely be broken when transferring to V14?

solemn latch
#

everything

#

or well, a lot

quartz kindle
#

almost everything

#

lmao

solemn latch
frosty gale
#

nodejs is laggy

earnest phoenix
winter pasture
#

Node.js got to get better FPS

#

That’s why I switched over to use HTML

radiant kraken
#

Node.js just not as blazingly fast as Zig

#

i mean look at those benchmarks

earnest phoenix
#

Node.js ResidentSleeper

earnest phoenix
earnest phoenix
radiant kraken
#

Switch to Rust 🚀🔥💪

winter pasture
#

Tru. The plug-in system for HTML sucks, it only got like this weird CSS and JS thing

winter pasture
radiant kraken
#

blazingly fast discord bot!!!!! 💪

winter pasture
#

It literally has no good reason to be in rust other than I wanted it to be KEKW

earnest phoenix
#

Rust developers trying to not say "blazingly fast" for 5 minutes

winter pasture
#

Blazingly fast 🥵

radiant kraken
#

blazingly fast and memory safe!!!!!!!!!!!!!

floral shell
#

ok so im using this hosting site "something.host", and everytime someone uses the bot in a server where it hasn't gotten it's perms yet, it does this and shuts down, any workarounds?

#

and then i have to go through the entire process again lol

#

And another thing where would I find the status of my bot for the site?

near ether
#

Are custom rich presences against TOS?

earnest phoenix
near ether
#

I would like to download some for games I play or make my own but I want sure

#

Ahhh okay

#

Thank you!!

earnest phoenix
#

You're welcome

near ether
earnest phoenix
#

Yeah that's absolutely fine, Discord even provides an SDK to do exactly that, it's called GameSDK

near ether
#

Oh perfect, thanks again for the help! 🙏

earnest phoenix
floral shell
#

isnt there a different way to get the link lmao

floral shell
#

got it all set

lyric mountain
#

It's not even a workaround, it's the proper way of doing it

#

Ah ok

floral shell
#

just tryna get the mf active dev badge lmfao

#

i even swapped all the commands over to "/" instead of -

surreal sage
#

How do you make objects in C#?

#

all good

radiant kraken
#

new Class();

lyric mountain
#

I think that was a brainfart moment, given they solved a second later

radiant kraken
#

actually, it was 4 minutes 🤓☝️

floral shell
#

Where do I go

eager latch
floral shell
#

Dunno how to so no lmfao

eager latch
#

then u go no where

#

your bot has to be verified to even apply for the thing

floral shell
#

How do I verify it

eager latch
#

and to get verified your bot needs to be in 100+ servers

floral shell
#

Bruh

eager latch
#

they are not going to just put on some random bot man

floral shell
#

But it’s idot cmon

eager latch
#

gl

floral shell
eager latch
#

oh ur on about the badge not the app directory

floral shell
#

Yeah

#

just dont know how to add it to its server is all

#

to be able to do the badge

#

i think i have to let it run for a day then itll work

north nymph
floral shell
#

now my fuckin slash command wont work

#

it worked before lmao

north nymph
#

That's not how slash commands are made bro

floral shell
#

it worked literally 10 minutes ago

north nymph
#

you need to register a global bot command

#

that's just a message event

earnest phoenix
floral shell
#

then how do i do that

earnest phoenix
#

look at djs guide please

north nymph
#

it's a method at the client object, not a js dev

digital swan
floral shell
#

i know the js guide

#

id rather have live help atm then read a document i cant talk to

digital swan
#

all people are gonna say is stuff thats in the guide

north nymph
#

If you're really willing to be a developer, you need to read documents

digital swan
#

if all you want is the badge and youre not willing to learn a little code at all then there is tools you can use to do the code for you

earnest phoenix
#

^

#

also tbh that badge is useless and shit

north nymph
#

I don't find why would someone want a developer badge if he ain't at least willing to be a developer

digital swan
#

cause they want the super cool awesome badge of course

earnest phoenix
#

discord shouldnt have made an another badge

north nymph
#

yeah, pointless

digital swan
#

im sure the hype around it will die down in a month or something when people cba to maintain it

north nymph
#

but who knows, maybe it makes someone start messing up with programming languages or something then turns into a dev, who knows...

digital swan
#

yeah i think that was the whole point of it

floral shell
#

i also changed the prefix but yknow

digital swan
#

thats not a slash command though

#

thats just a normal message command with a / prefix

floral shell
neon leaf
floral shell
#

ok well time to read that doc ig and hope i understand it lmao

#

been ages since ive worked on this bot so

#

is deploy-commands.js its own "command"

neon leaf
#

no

floral shell
#

so like i can put it here

neon leaf
#

idk how you setup your command handler so could be yes

floral shell
#

prefix for one

#

and then this i believe

neon leaf
boreal iron
#

Hasn't been updated since the internal built in methods exist

#

Also doesn't mention and explain a registration is a one time process

digital swan
#

oh shit my bad

floral shell
#

also doesnt help i have reading comprehension issues 🫠

boreal iron
#

After creating your array of commands simply register them once after the client is ready

#

Do not register them on every startup

floral shell
#

i can read i just dont know what the fuck that means

boreal iron
#

Take a look at the examples

#

I feel like you're lacking the basics of the language you're working with then

floral shell
#

its been over a year so yes

neon leaf
#

how do I resume?

#

got it, fg

#

is this correct usage?

lyric mountain
neon leaf
#

sadly no

lyric mountain
#

is that your own code?

neon leaf
#

yes

lyric mountain
#

mind to tell me why tf that still exists?

neon leaf
#

idk, how do I make it better then?

earnest phoenix
#

use something like i18n

#

thats like hell

lyric mountain
#

may I say, if this bot lived long enough it might be too late to start implementing i18n

#

localization is something you need to implement right at the beginning

neon leaf
#

is your problem the switch statement or the fact that translation is hard coded?

lyric mountain
#

because the work to adapt an existing codebase grows exponentially the bigger it gets

lyric mountain
#

I mean, translation will be hardcoded anyway, but in a locale file

wheat mesa
#

i18n is essentially just a map so you don’t need a giant if statement for EVERYTHING you want to translate

earnest phoenix
#

but if else hell is

#

the localizations

lyric mountain
#

switch is equally as bad if u have more than 10 branches

neon leaf
#

that was actually a if else hell like 10min ago

lyric mountain
#

an example of how to implement i18n:

File: locale_en.properties ```properties
example-1=Hi this is a test
example-2=Hello world
example-3=How are you


File: `locale_es.properties` ```properties
example-1=Hola este es un teste
example-2=Hola mundo
example-3=Como estás

Function: ```js
function getString(key, locale) {
return somethingToReadTheFile(locale_${locale}.properties)[key];
}

#

I have no idea how to read a props file in js, so ignore that part

wheat mesa
boreal iron
#

Throw that away, now!

lyric mountain
#

as you can see, with my example u just do getString("example-1", "en") or getString("example-1", "es")

wheat mesa
#

I mean it’s pretty standard as far as lexers go

earnest phoenix
#

That's the best way to go about it

lyric mountain
#

it'll get the text from the correct file for you

#

so you don't need to treat each case individually

earnest phoenix
#

Switch and match clause amount does not matter as the JIT or the compiler will optimize it anyway

lyric mountain
neon leaf
lyric mountain
#

case-break switches on the other hand...yikes

wheat mesa
#

Rust >>>>

earnest phoenix
#

Pattern matching is nice

boreal iron
lyric mountain
wheat mesa
#

Rust has a lot of modern features that I think should be brought to other langs tbh

lyric mountain
lyric mountain
#

and python doesn't even have switches

boreal iron
#

Depends I personally use a mix of both

#

Depends on where I have to use em

lyric mountain
#

you concat locale strings?

#

...fake?

lament rock
#

This is what I do

lyric mountain
#

with formats like yaml or properties you can stream the file and get a specific line

boreal iron
lyric mountain
#

if you order the keys by alphabetic order (or some other predictable order) you can also make a custom index so the lookup function doesn't need to read line per line (not a i18n file btw, just the entire portuguese dictionary to exemplify what I mean)

lyric mountain
boreal iron
#

I feel like we're speaking again about different things

lyric mountain
#

we were talking abt implementing i18n in his code

boreal iron
#

I don't use any library

#

Literally implemented it the same like you and Papi

lyric mountain
#

the topic was that he needed a way to use template strings in js

#

idk what js has that can replace String.format

boreal iron
#

Looks like im somewhere else

lament rock
#

as well as possibly streaming the file many times at the same time

lyric mountain
#

I use a cache layer obviously, so I dont need to stream the file every time I need a key

lament rock
#

Then your caching issues are the same

lyric mountain
#

not really, since I'd not have everything stored all the time in memory

#

hm, now that makes me want to make a heatmap of my locale file, to see what strings get used the most

#

would be a fun project