#development

1 messages ยท Page 2036 of 1

crystal wigeon
#

i cant make it a square lel

quartz kindle
#

you can go up a bit more, for example 1000x

#

you dont need to make it square

crystal wigeon
#

well 750x1000 seems good enough?

lyric mountain
#

I draw my stuff in HD because people can "Open original image" it

quartz kindle
#

you make the biggest side that much, then you scale the smallest size to fit it

#

and keep the aspect ratio

quartz kindle
crystal wigeon
#

so i keep the original reso, and resize the image to a smaller size before drawing on canvas yea?

quartz kindle
#

make it like 720p or 1080p max

crystal wigeon
#

gotcha

lyric mountain
crystal wigeon
#

any idea what max size discord scales it down to?

#

it depends on device i assume? cause images are smaller on mobile

quartz kindle
#

also there is a HUGE difference with drawing full images on canvas, and only drawing text and shapes

crystal wigeon
#

yep

#

i got your point, i'll try stuff ig

#

is there an alternative to canvas tho, i wanna avoid this completely xD

quartz kindle
#

because canvas works pixel by pixel, it scales linearly with the number of pixels it needs to draw

crystal wigeon
#

is canvas theo nly way

#

to draw

#

haha

quartz kindle
#

for image compositing you can try a library like sharp or imagemagick

crystal wigeon
#

play my bot, you'll find all 9 stars

quartz kindle
#

since you dont need the graphical drawing features tjat canvas has, you just need image compositing

crystal wigeon
#

i use sharp

#

gotcha

quartz kindle
#

also, back to the async question

#

the only way to draw on a separate thread is to use worker thread or child process

crystal wigeon
#

yeah makes sense, i tried that before but it was kinda slow. didnt have much optimizations at the time tho

quartz kindle
#

using async doesnt magically make the code run in parallel

crystal wigeon
#

it atleast wont cause event loop block right

quartz kindle
#

it will

crystal wigeon
#

using new Promise() to draw the canvas

#

that's all i need for now

#

i'll try the resizing thing. need to figure out the magic numbers

lyric mountain
#

\/ why I need high res

crystal wigeon
#

2250x2000 isnt gonna work (lesson)

crystal wigeon
quartz kindle
#

async still blocks the event loop if you use sync code inside it

crystal wigeon
lyric mountain
#

it doesn't redraw the whole thing everytime tho

quartz kindle
#

nice

lyric mountain
quartz kindle
#

yeah there are many games who use canvas

crystal wigeon
#

nah nah cant fool me

quartz kindle
#

they can draw at 60fps just fine

crystal wigeon
#

so do you know the magic number

lyric mountain
#

69?

crystal wigeon
#

lol

#

the reso

quartz kindle
#

because they use multiple small canvases and/or draw small images separately and never redraw the whole thing

lyric mountain
#

somewhere around 750

#

since my image gets downscalled to that unless I open original

crystal wigeon
#

is there a way i can check to what reso its being downsized to?

quartz kindle
#

dev tools

crystal wigeon
#

ah you on the web

lyric mountain
lyric mountain
crystal wigeon
quartz kindle
#

if you open original? but the it show original size, not discord scaled size

lyric mountain
#

nono, if u open the image in a new tab

crystal wigeon
#

yea

quartz kindle
#

ah

crystal wigeon
#

if you open in new tab it'll show the original full image

lyric mountain
#

opening in a new tab will show the downscalled image, opening original will show the original image

crystal wigeon
#

ah

lyric mountain
#

this is only possible in desktop tho

crystal wigeon
#

im supposed to do this on chrome no?

lyric mountain
#

ye

crystal wigeon
#

alr lemme give that a shot

quartz kindle
#

another thing you can do

#

dont create a new canvas every time

#

keep one canvas of that specific size always loaded

#

and when a command is run, draw the images in it and send

lyric mountain
#

doesn't that hold resources hostage?

quartz kindle
#

yes but its faster

crystal wigeon
#

width=709&height=630

#

found the magic numbers

quartz kindle
#

typical use more ram to make it faster

crystal wigeon
#

i tried using clearRect() to redraw the image

#

but it kept loading old images some times

#

cause multiple users

#

and end up showing wrong images

lyric mountain
#

don't use clearRect() if ur working with jpeg

#

just draw on top of it

quartz kindle
#

with that method you need to consume the image imediately, ie convert it to buffer

crystal wigeon
#

not gonna work cause i need to change the height of the canvas accordingly

quartz kindle
#

before anything else can draw on it

crystal wigeon
#

oh im doing canvas.createJPEGStream()

quartz kindle
#

yeah if you use streams you cant do that

crystal wigeon
#

can i create throw away buffer and like not have it stored anywhere

#

hmm

quartz kindle
#

buffers will be garbage collected like everything else

crystal wigeon
#

so ike if there are multiple calls coming in and the current canvas is still yet to be converted to buffer it will still persist old image no?

quartz kindle
#

buffer conversion is sync right?

#

so nothing else can run util it completes

crystal wigeon
#

so its gonna wait until the entire func finishes?

#

damn

#

its gonna block stuff cause like imagine 1k calls coming in

#

buffer takes 500ms. its gonna bubble up no

quartz kindle
#

if you have that many calls, you def need to multiprocess

crystal wigeon
#

multiprocess the canvas drawing

#

?

quartz kindle
#

draw each canvas on a different process

lyric mountain
quartz kindle
#

not multiprocess the same canvas

crystal wigeon
#

less than 500ms ofc, worst case would be 500ms

crystal wigeon
lyric mountain
#

aren't u just overlaying images?

crystal wigeon
#

not rn

#

im doing createCanvas everytime the func is called

lyric mountain
#

no, I mean, what is the operation ur doing?

#

like, it's just composition no?

crystal wigeon
#

im not drawing shapes, im doing context.drawImage

lyric mountain
#

composition then

crystal wigeon
#

then i position the image accordingly

#

yeah ig thats what its called

lyric mountain
#

that shouldn't take more than a couple ms

#

if all assets are pre-made

crystal wigeon
#

it doesnt actually, but worst case i saw was 500ms+

#

yep. just the star and border are different

#

which are drawn in the func

#

but they finish in 1ms

lyric mountain
#

are u using the gpu to draw it?

quartz kindle
#

depending in the situation, i would use an external program to do that, like imagemagick, then the OS will take case of resource management for you

quartz kindle
lyric mountain
#

mine is contabo and has a gpu

#

not anything fancy, but it has one

#

for graphic-related stuff gpu is faster than cpu

crystal wigeon
#

yea

#

mines not too intensive, i just need to optimize it correctly

#

and im getting there i hope

quartz kindle
#

you said you also use sharp, what do you use it for?

crystal wigeon
#

to resize it, its kinda 1 time thing when i upload an image i resize the image to the reso i need which is 750x1000 in current case

lyric mountain
#

here's a tip, if your image is big try breaking it into smaller chunks, modifying them then re-attaching the parts

quartz kindle
#

you know sharp can also do compositing right?

crystal wigeon
#

yeah

quartz kindle
#

yoi dont need canvas at all, you can do everything on sharp

crystal wigeon
#

hmm

quartz kindle
#

and it should be faster

lyric mountain
crystal wigeon
#

no lilke i can draw border and stuff to where i want?

#

im like using 3 images

lyric mountain
#

wait, they aren't?

quartz kindle
#

yes sharp can do compositing from what i remember reading their docs

#

i never used it tho since i draw shapes not images

lyric mountain
#

also try not to upscale images

#

have the source asset at the right size before starting

#

upscalling is an expensive operation since it needs to calculate pixels for every pixel in the image

quartz kindle
#

if you want absolute max performance, store 3 versions for your images

#

one version with the size of showing 1 image

#

another version of the same image for when the bot shows 2-4 imahes

#

another version for when the bot shows 5-6

#

all it their respective final sizes

#

so you dont need to resize anything when compositing

crystal wigeon
quartz kindle
#

youre using one version for everyhitng, thats why you made the canvas bigger

crystal wigeon
#

tho i have 2 different extensions, webp and jpeg to show on the web.

crystal wigeon
#

thanks EMJ_pray

quartz kindle
#

np

crystal wigeon
#

also is RTX 2060 worth it? EMJ_jerrycri

#

im going for a budget gpu

#

forgaming

quartz kindle
#

another thing you can do is offer a resize option to your command

crystal wigeon
#

is it better than 1660

quartz kindle
#

thats what i do

crystal wigeon
#

gotcha

#

well i assume discord is down scaling to its maximum, so thats all the info i need

quartz kindle
#

my default size is 800x800 but if the user wants to, they can use a --size option to go up to 4000x4000

#

its slow as fuck, but almost nobody uses it

#

so my bot still runs smooht even on 9k servers

crystal wigeon
#

also if sharp supports compositing like canvas does with drawing 1 image on top of another, i'll try out sharp

#

damn nice

quartz kindle
#

i used to allow up to 8000x8000 long ago

#

that was a disaster lmao

#

would randomly crash the bot

#

took like 5 seconds to draw

sharp geyser
pallid zinc
#

im trying to run a onclick function in html but the problem is my mouse double clicks a lot which makes the function run 2 times, i tried making a isrunning variable and set it value to true and before running the function check if its value is true, but that did not worked at all its still running the function 2 times

quartz kindle
#

show the code you tried and didnt work

pallid zinc
round cove
#

==

pallid zinc
#
let isRunning = false;
pallid zinc
#

lol

#

i was stupid enough

#

thanks

cinder patio
#

Let's pretend you never posted that screenshot

pallid zinc
#

๐ŸŒ

lyric mountain
#

u can also do if (!(isRunning = !isRunning)) return; mmLol

earnest phoenix
#

ae

split hazel
#

any react expert know how to pause a form submit, do some processing then submit it?

vivid fulcrum
#

what do you mean by pause

split hazel
#

I have an invisible recaptcha and I need to get a token and apply it to the body before the form can submit but the problem is the form doesnt wait for the onSubmit to finish (promise) and just continues

#

so you need to hit submit twice since by then the token will be applied

#

dont know if this is intentional behaviour

cinder patio
#

just don't use a <form> tag ez

#

or at least make the request via JS

vivid fulcrum
#

unironically the best solution

#

if you're going js, go js all the way

split hazel
#

yeah i could but that would defeat the point of the framework im using

cinder patio
#

what framework?

split hazel
#

of eliminating the need for javascript processing before submitting a form

#

remixjs

vivid fulcrum
cinder patio
#

Does remix.js use a <form> under the hood to make the request? Are you sure there isn't a onBeforeRequest or a similar prop

vivid fulcrum
#

react's major gig is controlled inputs, there must be something the framework exposes

split hazel
#

i could probably ask on their github they have an active community

#

i tried using a prevent default at first but dont really know how to emit the submit event properly again, i tried once but the page just refreshes

#

or i can always fallback and stick to the v2 captcha "im not a robot" button if it doesnt work out

split hazel
#

i did try using prevent default but I dont think react/remix supports stopping propagation then starting it again programatically

split hazel
#

okay

#

turns out I was right all along with the prevent default

#

but remixjs has a special hook called useSubmit which you can use to submit it properly

#

the people in the github answer fast

boreal iron
#

Is there a native JS function that can loop an array of objects with a dynamic amount of nested objects inside?

split hazel
#

seems rather specific so probably not

cinder patio
#

you can do it yourself though? I don't understand the question

boreal iron
#

Well I have a dynamic amount of nested arrays (with objects as items) I wanna loop

proven lantern
#

recursion is what you want

boreal iron
#

yeah the question still remains if JS has prebuilt functions for this

#

(spoiler PHP has)

cinder patio
#

I mean you could use .flat to flatten the arrays

proven lantern
#

why?

cinder patio
#

php is shit sorry

#

or maybe the functions name is .flatten

boreal iron
#

You have the right to have your own opinion KEKW

cinder patio
#

That's an objective fact but this is a discussion we're not ready to have AND not for this server ๐Ÿ˜‰

boreal iron
#

ah I see, flat is a thing

#

good to know

#

ty

proven lantern
cinder patio
#

flat seems to be appropriate here if the depth doesn't matter to them

boreal iron
#

Oh even better... I see flatMap exists

#

nah flat doesn't work here

#

gonna give you an example

#
const arr1 =
[
    {
        search: 5,
        volume: "abc",
        options:
        [
            {
                search: 4,
                volume: "bcd",
                options:
                [
                    {
                        search: 3,
                        volume: "cdf",
                        options:
                        [
                            {
                                search: 2,
                                volume: "dfg",
                                options: null
                            }
                        ]
                    }
                ]
            }
        ]
    }
];
#

the amount of nests is dynamic

#

options can contain another nest but doesn't have to

#

I have to loop each possible nest to compare search and volume to my input

quartz kindle
#

dafuq is that structure

#

cursed

proven lantern
#

looks a lot like the data discord sends

boreal iron
#

well you mean application options, aren't you?

#

unfortunately not no, it's the structure I have to deal with

#

better don't ask why

proven lantern
boreal iron
#

hmm I see

#

I need to change it a little bit

#

instead of concating the object if options is null it should be ignored

#

but that seem to do it's job

proven lantern
# boreal iron but that seem to do it's job

this will get rid of the last duplicate js const unnest = (arr1) => arr1.reduce((acc, opt) => acc.concat(...[{search: opt.search, volume: opt.volume}, opt.options ? unnest(opt.options) : undefined].filter(a=>a)), []);

#

not the most efficient thing

boreal iron
#

well not the "best" structure I could get

#

but it's how it is

#

like I said

#

better don't ask why

cinder patio
#

Using a for loop sounds faster

#

The amount of arrays you're creating in that in that function

proven lantern
cinder patio
#

There's nothing wrong with mutations as long as they're limited

proven lantern
#

yep, as limited as possible

cinder patio
#

I'd say in this case it's acceptable

#

You're mutating it to initialize it so does that even count

#

you can freeze it afterwards

proven lantern
#

good idea

proven lantern
#

but assignment is also bad

#

Cross posted from http://channel9.msdn.com/Shows/Going+Deep/Hewitt-Meijer-and-Szyperski-The-Actor-Model-everything-you-wanted-to-know-but-were-afraid-to-ask.

At Lang.NEXT 2012, several conversations happened in the "social room", which was right next to the room where sessions took place. Our dear friend, Erik Meijer, led many interesting conve...

โ–ถ Play video
cinder patio
#

yeah but the array is technically initialized, just not with the data you want. Is it really mutation to put the data in it ๐Ÿค”

#
const arr = []; // Technically already initialized...
for (const item of things) {
   arr.push(do something with item idk);
}
return Object.freeze(arr);
proven lantern
#

push isn't pure

cinder patio
#

What I'm saying is, IMO this shouldn't count as truly mutating the array since you're still filling it with the data you want it to contain. While you're doing this nothing else can mutate it

quartz kindle
#

last time i checked array.concat was slow af

quartz kindle
#

fek off with your v8 source

#

:^)

proven lantern
#

concat code looks so pure

quartz kindle
earnest phoenix
quartz kindle
#

mjolnir?

lament rock
#

Halo

earnest phoenix
boreal iron
#

When ever I ask something complex things in here quickly escalating

#

interesting

quartz kindle
boreal iron
#

IS THERE ONE DAY WITHOUT A BENCHMARK IN YOUR LIFE

quartz kindle
#

no

boreal iron
cinder patio
#

well concat and push are doing different things

#

concat creates a new array

#

push doesn't

quartz kindle
#

ye

cinder patio
#

you could level it out by creating a new array in the second snippet and pushing to it instead

earnest phoenix
quartz kindle
earnest phoenix
#

Spread operator is usually more readable if you know what it does, although methods are usually for more functionally or verbosity, or both at once

#

Extended functionality/verbosity -> functions/methods
Performance -> operators

proven lantern
#

pls dont take concat away from me

quartz kindle
proven lantern
#

no concat

let unnest = arr => arr.reduce((acc, opt) => opt.options ? [...acc, {search: opt.search, volume: opt.volume}, ...unnest(opt.options)] : [...acc, {search: opt.search, volume: opt.volume}], []);
boreal iron
#

hmm, good job

#

not really a fan of one liners but yeah... preferences are different

#

gonna rewrite that

cinder patio
#

Good job npm for killing my entire workflow for your stupid 2fa

split hazel
#

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbm

#

i swear web dev frameworks are always like this

#

they make a lot of shit easy but sometimes you get stuck on something for hours that you would setup in minutes in js

cinder patio
#

like what

split hazel
#

LIKE SUBMITTING A FORM PROGRAMATICALLY

#

i am going insane

#

the solution the guy gave me works but doesnt work with async

cinder patio
#

That's pretty easy and framework-independent

split hazel
#

yeah it is easy

#

but my framework has a custom form

#

so its not as easy as prevent default and emit event

cinder patio
#

just don't use it ez

#

oh my god npm and your dumb 2fa

#

fuck you

split hazel
#

deserved

cinder patio
#

wtf windows is forcing me to use USB for the security key

#

omg

#

who thought of this bullshit

lyric mountain
#

Well u gotta *put sunglasses* insert the key

cinder patio
#

publishing a package also requires

#

what a joke

cinder patio
#

nah the npm site asks windows to download a key securely and the only option they're giving me is via USB

split hazel
#

o

#

if you have a tpm and a recovery partition it shouldnt ask you that

cinder patio
#

yeah 2fa is now mandatory unless you want to enter your password to login every single damn time

quartz kindle
#

i have 2fa on npm but it never asked anything about a usb key

cinder patio
#

To get a security key

quartz kindle
#

ah you're using this?

cinder patio
#

๐Ÿ˜ฉ I don't think it even asked me if I wanted to use that

quartz kindle
#

F

woeful pike
#

what's a FastJSArray? packed smi elements?

#
    GotoIf(IsElementsKindGreaterThan(kind, HOLEY_SMI_ELEMENTS),
           &object_push_pre);

oh I guess so

#

this is crazy tho I can't believe v8 people abstracted the concept of gotos into classes and macros. Sounds like it'd be a nightmare but it's almost neatly organized

boreal iron
#

In which case can it be missing?

earnest phoenix
cinder patio
#

it must really be worth it

#

to be maintaining another language to minimize effort lol

woeful pike
#

everything in v8 seems crazy overengineered

#

but seeing it runs like half the javascript in the world or something so

cinder patio
#

yeah but it is really fast

lament rock
boreal iron
lament rock
#

probably linking back to the definition for create application command endpoints

boreal iron
#
<ref *2> ApplicationCommand {
  id: '973061310646476820',
  ...
  options: [],
  ...
}```
lament rock
boreal iron
#

according to the API docs that would be inconsistent

earnest phoenix
boreal iron
#

oh

earnest phoenix
#

For example there's no icon hash returned for guilds that don't have actual custom icons, returned as null instead though

boreal iron
#

lol I missunderstood that then

#

Well I see I'm stupid

#

I mixed the djs output with the raw API response

#

djs this.options ??= [];

#

while the API would returns null

#

my bad

boreal iron
#

I feel stupid today

(async () => { await checkSomething().catch(() => process.exit(1)); })();

initClient();
#

Why is initClient() being called before checkSomething() is awaited?

#

checkSomething() returns a promise ofc

earnest phoenix
#

It returns a promise to the global scope, or whatever scope you're in, but it's not resolved

#

If it's not resolved it'll just continue the code execution

boreal iron
#

It gets rejected in my test

earnest phoenix
#
await checkSomething().catch(...);

initClient();

or

checkSomething()
  .then(() => initClient())
  .catch(...);
boreal iron
#

(and yes the scope is global)

earnest phoenix
#

If you want TLA (Top-Level Await), I'd recommend using ESM (I recommend using ESM over CJS anyway)

boreal iron
#

oh well I see

#

Is there any "trick" I could do?

earnest phoenix
#

Well the second one as I showed

boreal iron
#

nah to keep the checkup in the self executing function

earnest phoenix
#

Or

(async () => {
  await checkSomething().catch(...);

  initClient();
})();
#

Why not just use ESM though?

boreal iron
#

meh don't wanna rewrite anything again

#

should have done that before

earnest phoenix
#

It shouldn't really take much time, it's just replacing the usage of the global require() function with the import statements (import ... from ...) or dynamic imports (import()), and changing exports from module.exports.foo = ... to export ... and module.exports = ... to export default ...

boreal iron
#

hmm haven't used it so far

#

but I like the top level await

#

do functions still need to be async when awaiting something or is the entire code async?

quartz kindle
#

the async keyword is function scoped

#
async function() {
  function() {
    await x // invalid syntax
  }
}
#

should work the same with top-level await

boreal iron
#

yeah I know it has been a stupid question

#

ok one last question

#
try
{
  code1
  code2
  log
}
catch...
#

Would log be called if let's say code1 would already throw an error?

quartz kindle
#

nop

boreal iron
#

๐Ÿ‘

proven lantern
lyric mountain
lament rock
#

which is why I stick to cjs

lament rock
#

import thing from "module"

thing.something(); // cannot read property something of undefined

#

I have to use the require statement a lot in my code because of default imports

#

import just screwing me over

sharp geyser
#

won't import * as thing work tho?

lament rock
#

It would, but why

#

why would I have to do that

sharp geyser
#

you make a good point i was just wondering if that'd work

lament rock
#

add a flag to totally disabled attempting to import default

#

in fact, add a flag to remove module.default

#

or just remove it entirely

earnest phoenix
#

What exactly is the concern here?

lament rock
#

I do not export default in that mod, but the import statement tries to read module.default.something

sharp geyser
#

So, say I am making a method for a class and the method will return basically the data of the class, so instead of doing

public async edit(): Promise<Message>
// Could I do
public async edit(): Promise<this>

It doesn't matter how you do it really I am just wondering if it is possible

lament rock
#

this is better to use

#

and yes that works

sharp geyser
#

Mmm, is there areason why it would be better?

lament rock
#

in case you rename classes or people extend your class

sharp geyser
#

Mmm, very true

earnest phoenix
# lament rock I do not export default in that mod, but the import statement tries to read modu...

It shouldn't if you just import the thing you need, for example

In this case I'm exporting the something() method in an object

// foo.js
function something() {}

export default { something };

And here I'm importing the default, which should be available

// bar.js
import baz from 'foo.js';

baz.something(); // works

But your concern seems to be headed towards this:

// foo.js
export function something() {}

// Or
function something() {}

export { something };

And import the function without importing the default export, as we didn't define a default export

// bar.js
import { something } from 'foo.js';

something(); // works
sharp geyser
#

Mmm, so I am noticing an issue off whenever I do something like

message.channel.send(...).then(msg => {
    // use one of the props on the Message class
})

msg is no longer an instance of Message it becomes an object

#

so therefor it cries that the method that does exist on the Message class is not a function

#
      msg.edit({ content: 'Fuck off' });
         ^
TypeError: msg.edit is not a function
lament rock
#

also, I cannot destructure a lot of my modules for hot reload purposes

boreal iron
# lyric mountain U can use finally if u want log to run regardless of errors

Iโ€™m aware about that, but nice tip tho but in the example I wrote log after code1 and code2 is debug message meaning the try/catch clause was successful
If code1 or code2 would throw an error, the success log (inside try) will not be called while finally would always call log if I would use it in there

real rose
#

ew .then

boreal iron
lyric mountain
#

Fun fact: delphi cannot have try-catches with more than one of either except or finally

#

It's so fckin awful that you can't even concat non-string with strings

#

Also string-related arrays start at 1, while every other a array starts at 0

#

And for-loops are inclusive

#

That was my daily rant about this shitty language I'm stuck with at job

lament rock
#

wow that sounds god awful

lyric mountain
#

The IDE freezes if you press ctrl + space

#

In fact, you also cannot receive bugfixes or update it unless you pay a monthly fee

#

Also sometimes the debugger gets high and start considering code from unrelated projects into your current project

#

Or even worse, it forgets what code is in each line

#

Did I say you also don't get DB components unless you purchase the second most expensive plan?

#

Ye, because small startups clearly don't need to use databases

boreal iron
#

lol

lyric mountain
#

I wish I was joking, but the scenario is just sad

boreal iron
#

Aye they can still use a pen and a piece of paper

earnest phoenix
boreal iron
#

instead of a database

lyric mountain
#

Btw don't look up delphi prices

quartz kindle
#

i tried to reverse engineer a delphi program once and failed miserably

lyric mountain
#

The bloat that's added during asm compilation is insane

sharp geyser
quartz kindle
#

show code

#

for the edit method

sharp geyser
#
    public async edit(options: MessageEditOptions): Promise<this> {
        return this.client.rest.patch(`/channels/${this.channelId}/messages/${this.id}`, options);
    }
quartz kindle
#

thats the problem

sharp geyser
#

What is the problem

quartz kindle
#

this.client.rest.patch returns the response from the api

#

which is an object

sharp geyser
#

Mmm, yea I thought that was the issue to which is why I tried making the data be typed as what is going on with the request but that didn't work it remained as an object

quartz kindle
#

typings dont do anything

sharp geyser
#

Mmm

quartz kindle
#

they only affect intellisense, not the actual code

sharp geyser
#

Yea true

quartz kindle
#

you need to take the response object, update the props for the message and then return this

#
    public async edit(options: MessageEditOptions): Promise<this> {
        const response = await this.client.rest.patch(`/channels/${this.channelId}/messages/${this.id}`, options);
        this.content = response.content;
        this.etc = response.etc...
        return this;
    }
#

thats why djs has ._patch() methods

#

which is called on class instantiation, on edit call, on send call, etc

sharp geyser
#

I see, that makes sense

#

ty

bright thorn
#

bot have the send message perm

#

but its not working

#

why?

#

if i give permission to client role then it will be work

austere surge
#

channel permissions maybe do something

lament rock
#

why is the npm registry full of literal garbage and so many packages depend on it

earnest phoenix
#

I kinda wonder the same, it's littered with the most easy to make and unnecessary NPM packages that shouldn't exist, but there are no limits to what you can make so ยฏ\_(ใƒ„)_/ยฏ

#

Especially packages like https://npmjs.com/package/true

dry imp
#

8 years ago damn

lament rock
#

bro?

spark flint
whole mica
#

what shall be the webhook url for listening votes via replit

#

using @ancient bloomgg/sdk

boreal iron
#

Itโ€™s your endpoint topgg will send the (vote) requests to

#

Your hostname/IP (and port) and path

split hazel
#

everyone so serious

small prairie
#

dis is the best package

radiant kraken
spark flint
#

debatable

#

question is

#

who will use it

radiant kraken
#

i asked the same question to my packages too so iaraShrug

quartz kindle
#

nice package indeed

small prairie
#

indeed

#

with 200 dependents

sharp geyser
# spark flint debatable

I got a question via an email on a package I made years ago and deleted from my github and it was shit so I think you'll be fine

spark flint
#

lmao

ancient nova
#

@quartz kindle what's the name of the functions that use module in JS?

#

for example something like this

Function: function() { }
quartz kindle
#

wdym?

ancient nova
#

I used that for my npm package

#

I just want to know the name of those functions

quartz kindle
#

i still dont know what you mean

ancient nova
#

basically using module you can only request the library and use multiple functions

module.exports = {
    FunctionName: function (variable) { },
    FunctionName2: function (variable) { }
}
``` do you know the name of this syntax?
jovial sparrow
#

pls help me

ancient nova
#

it's a cool way to do it because it also works with variables themselves and all you do to call it is a simple require("name").FunctionName()

quartz kindle
#

thats just exporting an object

ancient nova
#

that's it?

#

I thought it was something fancier

quartz kindle
#

yea, you export an object, ie: module.exports = {}

#

you can put whatever you want inside the object

ancient nova
#

okay that's good to know then

lyric mountain
#
import { functionName } from "./name";

...
functionName()
near stratus
lyric mountain
ancient nova
#

wait I just realized something terrible

#

if you have 2 obfuscated Js files

#

calling a function from an obfuscated file is impossible because it's all scrambled, right?

cinder patio
#

why'd you wanna do that anyways

lyric mountain
#

you usually obfuscate on production not on development

#

unless u code in malbolge

ancient nova
#

well no but how would that work? even if I obfuscate both of them at the same time after finishing it still wouldn't work right?

cinder patio
#

The obfuscator has the context it needs to detect what you're importing and sync the obfuscated names

#

unless you're obfuscating the files separately... which is something you shouldn't do

quartz kindle
#

obfuscate
open file
look for the exported names
change your import code to those names
???
profit

dry imp
#

so profitable

boreal iron
# proven lantern did you desecrate the one liner?

Since you mentioned yesterday my would look like something the Discord API would return, I was actually thinking about to improve my command handler, too
And yeah for this specific use case (command handler) I don't even need to rewrite the function
Looks like that now:

let flat = (array) => array.reduce((previous, current) => (current.options) ? [...previous, { name: current.name, description: current.description, description_localizations: current.description_localizations }, ...flat(current.options)] : [...previous, { name: current.name, description: current.description, description_localizations: current.description_localizations }], []);

if(JSON.stringify(flat(fetched_command.options)) !== JSON.stringify(flat(local_command.options ?? []))) // command update

Stringifying the entire array (of objects) actually seems to be more effiently than looping through it and comparing each item

#

Even if that wasn't the intented use case, it's still a nice addition to the command handler

quartz kindle
#

lmao

boreal iron
#

yeah, that actually solved two problems

#

lol

lyric mountain
#

you forgot space after if

quartz kindle
#

no

boreal iron
#

shut up java user

lyric mountain
#

unacceptable

sharp geyser
#

You forgot to slap your java user friend today

boreal iron
quartz kindle
#

xDDDD

sharp geyser
#

Tim benchmark it and send the results with a ping to FakE

#

become his worst nightmare

boreal iron
#

leaving topgg discord server

sharp geyser
#

better yet

#

anything FakE sends just benchmark it

boreal iron
#

Quiet!

sharp geyser
#

:)

quartz kindle
boreal iron
#

Where's the comparable?

#

4s doesn't look that bad for me

sharp geyser
#

Now watch tim cut that down to 1s

#

:^)

boreal iron
#

(regarding the fact the actual command limit is 200 anyway, not 999999)

quartz kindle
#

added description_localizations

split hazel
sharp geyser
#

makes sense

split hazel
#

tim while you're at it can you find me an easy to use and optimized/fast json parser for my database

#

im using nlohmann json but its not the fastest :c

proven lantern
#

use bson

sharp geyser
#

use tson tim json

#

fast asf boi

proven lantern
#

calling the accumulator previous?

split hazel
#

it also uses std::string for strings which for performance is ๐Ÿ’€

boreal iron
#

Hey @quartz kindle why tf is the description_localization property missing when it's undefined?

console.log(JSON.stringify(flat($command.options)), JSON.stringify(flat(command.options ?? [])));
[] [{"name":"enforce","description":"Force updating all global and guild commands"}]
#

when flat is pushing it to the array

[...previous, { name: current.name, description: current.description, description_localizations: current.description_localizations }
quartz kindle
boreal iron
#

shouldn't even undefined as current.description_localizations be psuhed to?

#

Ahh lol

#

lmao didn't even think about that

#

well the result will always be wrong then

#

It needs to be [...previous, { name: current.name, description: current.description, description_localizations: current.description_localizations ?? null } then

#

As the name and description are of course required anyways but description_localizations not

#

damn... it's actually good we're talking about it, I wouldn't have noticed yet

quartz kindle
#

xD

sharp geyser
#

this is why you let tim benchmark all ur code

#

:^)

boreal iron
#

But I feel like I'm running straight into the next issue, lemme check

#

oh no I'm about right

bright thorn
#
0|Real     | Response: Internal Server Error
0|Real     |     at RequestHandler.execute (/home/ubuntu/Real/node_modules/discord.js/src/rest/RequestHandler.js:357:15)
0|Real     |     at runMicrotasks (<anonymous>)
0|Real     |     at processTicksAndRejections (node:internal/process/task_queues:96:5)
0|Real     |     at async RequestHandler.push (/home/ubuntu/Real/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
0|Real     |     at async TextChannel.send (/home/ubuntu/Real/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:175:15) {
0|Real     |   code: 500,
0|Real     |   method: 'post',
0|Real     |   path: '/channels/963796432727461929/messages',
0|Real     |   requestData: {
0|Real     |     json: {
0|Real     |       content: undefined,
0|Real     |       tts: false,
0|Real     |       nonce: undefined,
0|Real     |       embeds: [Array],
0|Real     |       components: [Array],
0|Real     |       username: undefined,
0|Real     |       avatar_url: undefined,
0|Real     |       allowed_mentions: undefined,
0|Real     |       flags: undefined,
0|Real     |       message_reference: undefined,
0|Real     |       attachments: undefined,
0|Real     |       sticker_ids: undefined
0|Real     |     },
0|Real     |     files: []
0|Real     |   }
0|Real     | }

#

What is this error

#

i got first time

sharp geyser
#

Something went wrong internally

bright thorn
#

mean

quartz kindle
#

did i do anything wrong?

boreal iron
#

djs doesn't return the raw API command object, fuck

    options: [
    {
      type: 5,
      name: 'enforce',
      nameLocalizations: undefined,
      nameLocalized: undefined,
      description: 'evil text here',
      descriptionLocalizations: undefined,
      descriptionLocalized: undefined,
      required: true,
      autocomplete: undefined,
      choices: undefined,
      options: undefined,
      channelTypes: undefined,
      minValue: undefined,
      maxValue: undefined
    }
  ]

descriptionLocalizations and description_localizations aren't the same keys ffs

#

AAAAAAAARRRRRRRRRRRRGGGGGGGGG

quartz kindle
#

lmfao

#

djs always converts everything

#

because they hate snake case

boreal iron
#

And I hate them

quartz kindle
#

likewise

sharp geyser
boreal iron
#

lemme see if I can actually fetch the raw API object

#

oh there's no fetch option to return the raw API object

bright thorn
boreal iron
#

omg nooooo... why

quartz kindle
sharp geyser
#

500 errors aren't typically things you can solve yourself unless you're just doing something so wrong that even discord can't respond with nothing else but 500

boreal iron
#

I feel like you

sharp geyser
#

I guarantee if tim benchmarked my incomplete lib rn he'd find so many problems

#

:^)

split hazel
#

with speedydb it couldnt be easier

quartz kindle
sharp geyser
#

jk

split hazel
#

:c

sharp geyser
#

Speedy can I ask your opinion on smth

split hazel
#

i have a USP you can iterate a data set backwards

split hazel
boreal iron
# quartz kindle did i do anything wrong?

The thing is you would need to check if the properties (name, description, ...) for c1 and c2 exist as both arrays can be completly different (the amount of nested options), means it would throw an unknown property of undefined error

sharp geyser
#

Alright so with this lib I am wondering what would be best, to be user friendly or more efficient/performant

boreal iron
#

I mean you would simply need to return true if c1 or c2 is undefined in that case

#

so yeah, yours is faster

#

But yeah GoogleFeud mentioned yesterday already a for loop would be faster anyway but hmm... doesn't really matter in that case tbh

boreal iron
#

well tbh I actually prefer reduce here

#

even if it performs worse

#

I mean look at the amount of code and lines

#

not that I'm lazy but in this case I prefer the compressed style

quartz kindle
#

the above method is even faster

boreal iron
#

omg... why are you like this

quartz kindle
#

lmao

quartz kindle
#

and for some reason

#

their getMany method is like 20x slower

#

than running get multiple times

#

go figure

boreal iron
#

that sounds like something you should benchmark and find out why

quartz kindle
#

its a c++ lib that uses v8 stuff

#

@_@

boreal iron
quartz kindle
#

speaking of which, @earnest phoenix explain the v8 fast call api, from what i understand it cannot be used to return data to js? only to run cpp code from js that doesnt return anything? or am i understanding it wrong?

boreal iron
#

man... editing the flat function now the 5th time

#

adding djs stupid camel case key names instead of the API ones

#

my gosh

#

smh

#

wow now that I'm thinking of...

#

I have to expand the function with a few more properties

#

required, autocomplete, choices are a thing to I need to compare

#

once there's a command using it

cinder patio
#

Wait what are you doing anyways

#

what's this for

boreal iron
#

fetching the application commands on a startup to register/update/delete them to the API if anything has changed

#

I don't like putting them manually

cinder patio
#

๐Ÿคช Detritus does this by default

boreal iron
#

wow... now we're back to detritus

#

I mean they're actually doing the same like I do

#

fetching comamnds and comparing them to the loaded commands

cinder patio
#

yes but it does it for you

boreal iron
#

it's not that much of work tbh but I need to consider to THINK of each possible case

cinder patio
#

Idk I think you've wasted at least an hour in this channel for a solution to problems caused by this so I'm just saying

boreal iron
#

yeah true but don't get me wrong, even if I use djs as framework I still like to do things myself

#

since I'm not earning my money with coding, wasting time let's say as hobby is acceptable

#

to gather some experience

quartz kindle
#

i put all my command registering stuff in a separate script that i run manually when i edit it lol

boreal iron
#

well and I like to create a handler for doing it

#

might be non-sense as I'm the only one updating commands but hmm

#

but yeah changed the object keys to djs stupid camel case now and changed undefined properties to null (as json doesn't support them) and it should be okay now

#
let flat = (array) => array.reduce((previous, current) => (current.options) ? [...previous, { name: current.name, description: current.description, descriptionLocalizations: current.description_localizations ?? null, required: current.required ?? null, autocomplete: current.autocomplete ?? null, choices: current.choices ?? null }, ...flat(current.options)] : [...previous, { name: current.name, description: current.description, descriptionLocalizations: current.description_localizations ?? null, required: current.required ?? null, autocomplete: current.autocomplete ?? null, choices: current.choices ?? null }], []);
#

just takes 3 lines on a 4K display, my gosh

#

good thing I don't even need to be consistent to add the properties other than name and description to my command modules

#

as they get null if they don't exist

#

which is exactly what the API returns if they don't exist

#

let's say I can live with that, even if it's not the most effient thing

#

have fun benchmarking it

cinder patio
#

literally unreadable

boreal iron
#

In Discord, yes, not so in the code editor

quartz kindle
boreal iron
quartz kindle
#

xD

boreal iron
#

don't forget 200 iterations are the maximum

#

(max amount of app commands)

boreal iron
#
let flat = function(array)
{
    return array.reduce((previous, current) =>
    {
        if(current.options)
        {
            [
                ...previous,
                {
                    name: current.name,
                    description: current.description,
                    descriptionLocalizations: current.description_localizations ?? null,
                    required: current.required ?? null,
                    autocomplete: current.autocomplete ?? null,
                    choices: current.choices ?? null
                },
                ...flat(current.options)
            ]
        }
        else
        {
            [
                ...previous,
                {
                    name: current.name,
                    description: current.description,
                    descriptionLocalizations: current.description_localizations ?? null,
                    required: current.required ?? null,
                    autocomplete: current.autocomplete ?? null,
                    choices: current.choices ?? null
                }
            ]
        }
    }, []);
}
#

Even I would say that's horrible

#

but readable

cinder patio
#

{ on new lines

#

despicable

cinder patio
#
let flat = array => array.reduce((previous, current) => {
        if(current.options) {
            [
                ...previous,
                {
                    name: current.name,
                    description: current.description,
                    descriptionLocalizations: current.description_localizations ?? null,
                    required: current.required ?? null,
                    autocomplete: current.autocomplete ?? null,
                    choices: current.choices ?? null
                },
                ...flat(current.options)
            ]
        }
        else {
            [
                ...previous,
                {
                    name: current.name,
                    description: current.description,
                    descriptionLocalizations: current.description_localizations ?? null,
                    required: current.required ?? null,
                    autocomplete: current.autocomplete ?? null,
                    choices: current.choices ?? null
                }
            ]
        }
    }, []);
}
#

Looks SO much better now

boreal iron
#

eww my eyes

#

shooo

cinder patio
#

there even better

boreal iron
#

I see... we will never agree on that

#

the fact that I was doing something completelly different and ended up here is just funny

boreal iron
#

Has anyone yet actually worked with localizations for command names or descriptions?

#

The API seems to accept and save my registered/edited command as well as localizations object.

#

Running and testing the command by changing the language in my client works and returns the right language

#

But fetchรญng the command from the API always returns undefined for name and description localizations of the application comand

lament rock
#

its possible that field when fetching is user account only

boreal iron
#

oh lemme check if it actually requires a fetch option

#

to fetch localizations

#

yikes

#

it does

#

didn't even notice

#

well ty for the tip

split hazel
#

for my email admins will be treated nicely

#

it looks cooler than making it infinite

quartz kindle
#

lmao

split hazel
#

javascript/web dev is so nice

#

no segmentation faults

#

no unsafe memory access

#

no pointers

#

no structs

quartz kindle
#

no null pointer exception

#

no compilation errors or warnings

#

has undefined

boreal iron
#

null functionality for clients disabling javascript by default

split hazel
quartz kindle
#

imagine having to write 3 versions of a website

split hazel
quartz kindle
#

desktop, mobile and nojs version

#

:^)

boreal iron
#

that's why noscript exists, print fuck you and that's it

split hazel
#

null in c/c++ is just a macro for 0

#

longer way to type 0 essentially

#

my internet is pooping rn

whole stream
#

can i have some assistance on making a !name and response command, please.

boreal iron
#

what sort of issue do you have?

whole stream
#

Just unqualified. I want to make a !link command that responds with a link

boreal iron
#

Ok? So ... you respond with a message including that link

#

That's it.

#

No matter it's a DM channel or text channel

whole stream
#

Yup I want maybe a minor embed.
Were you looking for this?
Link

boreal iron
#

You wanna send an embed? Well which language do you use?

whole stream
#

.js

#

sorry for late reply.

boreal iron
#

So I'm assuming you're using discordjs

whole stream
#

yup

#

sorry for my lack of knowledge

wicked pivot
#
class Bot {
    constructor(test){
        this._test = test
    }

    async example(){
        exemple2()
        function exemple2(){
            console.log(this._test)//not working how to do ?
        }
    }
}```
boreal iron
boreal iron
#
class Bot {
    constructor(test){
        this.test = test
    }

    async example(){
        exemple2(this.test)
        function exemple2(param1){
            console.log(param1)
        }
    }
}
#

But this function inside a function inside a class somehow is very weird

#

example2 should be a method of your class bot when calling it from example()

quartz kindle
#

or use an arrow function

boreal iron
#
class Bot {
    constructor(test){
        this.test = test
    }

    async example(){
        this.exemple2()
    }

       exemple2(){
            console.log(this.test)
        }
}
#

that would work

quartz kindle
#

5/7 indentation

boreal iron
#

wow discord fucked it up

quartz kindle
#

also function keyword

boreal iron
#

oh

#

my bad

#

I hate editors using spaces as indentation instead of tabs

quartz kindle
#

this would work too as arrow functions dont have a this ```js
class Bot {
constructor(test){
this._test = test
}

async example(){
    const exemple2 = () => {
        console.log(this._test)
    }
    exemple2()
}

}

#

but yeah its weird to do it like that

boreal iron
#

oof that hurts my eyes

wicked pivot
#

thx

subtle fiber
#

how to get member object from user id (python)

lyric mountain
boreal iron
#

the universe will explode

split hazel
#

i keep writing unsafe code and i cant stop

#

its because of my os

#

just like drugs on an impressionable mind

boreal iron
#

lol

lyric mountain
#

DrugOS

#

or WackOS

vivid fulcrum
lyric mountain
vivid fulcrum
#

tyyy

lyric mountain
#

I hate any kind of slow animations, unless it's a one-time epic intro

boreal iron
#

yeah fast

#

totally fast

lyric mountain
#

ig that's why w11 and iOS feels so weird to me

#

like, things used to be snappy, now you can notice the transitions

vivid fulcrum
#

i changed animations on my samsung to .5 scale

#

lmfao

lyric mountain
#

and ik iOS is famous for slowing down stuff for the sake of noticeable animations

vivid fulcrum
#

samsung has slow ass animations by default

boreal iron
split hazel
vivid fulcrum
#

LMFAO

#

it's just because of the recording

lyric mountain
#

when internet was made in ActionScript and GIF

vivid fulcrum
#

there's actually no stutter

boreal iron
#

but still the fast one is what you want, trust me, we know what you want

split hazel
#

the button looks kinda out of place

#

very lonely

#

just like the average developer

vivid fulcrum
#

very monotone

boreal iron
#

have you moved away from developing an OS to hosting a mail service?

lyric mountain
split hazel
#

yeah im not focusing on the css too much

lyric mountain
#

like, the entire body is right, but the face... ._.

vivid fulcrum
sharp geyser
boreal iron
#

tbh I'm also not really good when it comes to colors and design

split hazel
#

actually just gave myself an idea

#

ima make sure everyone knows its powered by my database

sharp geyser
#

Lmao

#

Double the advertisement

vivid fulcrum
#

Native apps often feature transitions between states that both look great and help communicate the type of navigation to the user. The bad news: creating transitions between pages on the web is impossible. In-page transitions are possible, but complex. The good news: new APIs are coming to simplify this process, building on top of CSS animations...

โ–ถ Play video
#

2hrs ago

boreal iron
#

I like gray tones, too

sharp geyser
#

I like it black

#

light hurts

boreal iron
#

I mean I have a dark mode

split hazel
#

i added the "x new emails" just so people get depressed when they see 0 new emails

boreal iron
#

dunno why, but I somehow prefer light mode on websites

split hazel
#

:o

#

what if i add browser notifications

lyric mountain
sharp geyser
#

speedy is this service live or is that being locally ran?

boreal iron
split hazel
#

in the middle

#

its on the server but its not locally hosted

sharp geyser
lyric mountain
boreal iron
#

handcrafted, no theme

split hazel
#

once i finish it i'll actually thow it onto the domain

lyric mountain
#

although jetbrains has a slightly blue tint

boreal iron
#

I got some blue, too :D

split hazel
#

some mf said hes gonna sign me up to email spam ๐Ÿ’€

lyric mountain
boreal iron
#

there you go, blue

split hazel
#

little do they know im gonna use a forum spam prevention service

boreal iron
#

oh you meant the background

lyric mountain
#

ye

#

the pallette, reminds me of jetbrains' darcula

boreal iron
#

well actually not a pallette but randomly picked colors I like in photoshop lol

lyric mountain
#

tbh, it is closer to delphi's darcula

boreal iron
#

which fit good to the theme color

lyric mountain
#

since it's grayscale

boreal iron
#

yeah I know what u mean but still just randomly picked

#

only gray without a blue touch in it looked weird

lyric mountain
#

set the B value 1 or 2 points higher than the rest

#

makes it feel smoother for some reason

boreal iron
#

it has become so big and complex I'm aint touching anything anymore :D

lyric mountain
#

actually, do the same for green so it pulls closer to cyan than deep blue

boreal iron
#

I like them how they are tbh

lyric mountain
#

bold the text

split hazel
#

i think it looks fine

boreal iron
#

took me a while to figure out the right color for dark and light mode you can see good enough on mobile and desktop

#

because a mobile screen usually doesn't 100% screen brightness

split hazel
#

this is my error notis

#

i stole the oops something went wrong from xenforo

cinder patio
# boreal iron

That blue doesn't work well with the background color. You can use the dev tools to check if the color has enough contrast with the background

boreal iron
#

they have become way darker on light mode for example

cinder patio
#

oh fuck maybe I'm colorblind

boreal iron
#

huh what sort of dev tools?

cinder patio
#

chrome dev tools

boreal iron
#

not aware of something like what u mentioned

#

well im not using chrome

#

and never will

cinder patio
#

the colors are fine though

#

what browser are you using

quartz kindle
boreal iron
#

firefox

cinder patio
#

It probably has a similar tool as well

#

no way it doesn't

boreal iron
#

yeah anyways, not really important tho

#

tbh I have no trouble reading it on desktop and mobile

#

made the blue a lot more brighter than before

cinder patio
#

This has helped me a lot

boreal iron
#

hmm firefox doesn't seem to have something like that

quartz kindle
cinder patio
#

The select element button

boreal iron
quartz kindle
lyric mountain
#

what's the max score?

#

like, white in black shows what value?

quartz kindle
#

probably 10?

lyric mountain
#

...the print clearly shows 12 tim

quartz kindle
#

lel

cinder patio
#

21

boreal iron
#

oh nvm firefox has that feature, too

lyric mountain
#

I wonder why such arbitrary value instead of 0-100%

boreal iron
#

it's somehow disabled because of my privacy settings

#

wtf

#

i have literally no clue how to enable it, lmao

#

not even the faq tells me how to

jovial sparrow
#

hello

#

i how to use dbl api?

quartz kindle
#

honestly the feature set of dev tools never ceases to amaze me

#

its amazing how many super complex but super useful features it keeps dishing out

cinder patio
#

yeah it's really great

#

does firefox have similar dev tools?

lyric mountain
quartz kindle
#

i dont use it much, but yea their dev tools is also pretty good

#

it probably has almost everything chrome has

lament rock
#

it's similar to chrome dev tools

cinder patio
#

Lighthouse is also great

lyric mountain
jovial sparrow
spark flint
jovial sparrow
#

and php

spark flint
#

djs and php??

jovial sparrow
#

separate php and djs

lyric mountain
#

just call the endpoint, this is universal (requires no specialized lib at all)

jovial sparrow
#

pls example to dbl api djs

#

docs are not for me

lyric mountain
#

...

jovial sparrow
#

because im a idiot

boreal iron
#

Ok so, for anyone using Firefox, you can enable it by changing the config manually

jovial sparrow
#

...

boreal iron
#

about:config

#

Set to 0

lyric mountain
#

yk it's never too late to start learning how to use docs right?

jovial sparrow
#

yes

#

but im a idiot

lyric mountain
#

then just don't be

jovial sparrow
#

my brother taught me he has a bot here but he doesn't teach me how to use dbl

lyric mountain
#

you'll eventually reach a point where you have an issue so specific that noone except you can solve

#

there aren't examples for every use-case

lyric mountain
#

like, by fetching

boreal iron
jovial sparrow
#

I know and I'm trying to learn to read docs but I don't know where to start. can you guide me

boreal iron
#

good to know that exists

jovial sparrow
cinder patio
#

np

boreal iron
#

never ever heard before of the wcag guidelines

#

lol

lyric mountain
#

start here then

jovial sparrow
#

thank you

lyric mountain
#

and here for php

jovial sparrow
#

I will not forget you

#

wait a minute

boreal iron
jovial sparrow
#

im know how to call api

lyric mountain
jovial sparrow
#

but im dont call dbl api

lyric mountain
#

then all you need is the top.gg url

#

it's the same thing for every single api in the internet

boreal iron
#

he wants to send a curl request in php? missing the context

lyric mountain
#

you send a request, it answers you

lyric mountain
jovial sparrow
lyric mountain
#

just fetch the api in js

quartz kindle
#

what do you want to do with the api?

#

post server count?

jovial sparrow
#

no

#

vote system

lyric mountain
#

ah, that's webhooks then

boreal iron
#

webhooks

quartz kindle
#

you want to check if someone voted? or you want to receive realtime vote events/notifications?

lyric mountain
boreal iron
#

:P

quartz kindle
#

also, do you have an approved bot on top.gg? you cannot use the top.gg api if you dont have a bot that is already approved

jovial sparrow
#

my brother has an approved boot i want to try on it

lyric mountain
#

it will only work for his bot tho

quartz kindle
#

the realtime vote notification system only works on one target at a time, if your brother already uses this system, you cannot use it without disabling his

#

you can use the endpoint to check if someone voted tho

boreal iron
#

You simply create a webhook listener (which is a webserver listening for post requests) and let topgg send these requests to your endpoint