#development

1 messages · Page 1797 of 1

boreal iron
#

Nobody experienced with rewrite rules? oldEyes

Source https://test.com/xyz?key=123

Target /index.php?value=xyz&key=123

Where xyz can be anything (even an URL)

#

Got an issue with the query string transforming the first argument (starting with a ? to a &)

latent heron
#

are you working with PHP?

#

the target should be able to use $_SERVER["QUERY_STRING"] although all ? keys will be replaced with &, so you could just do:

$uri = $_SERVER["QUERY_STRING"];
print_r(explode("&", $uri));
#

if value is always at the first fragment of the query-string, then [0] will easily access it for you. @boreal iron

opal plank
#

kinda

#

i know how to do it

#

but im trying to replicate it

boreal iron
latent heron
#

where specifically lies the issue with the rewrite?

boreal iron
#

It seems impossible to append the query string (stating by an ? of course)

opal plank
#

@solemn latch ts const fetch = require('node-fetch'); fetch('https://755600276941176913.discordsays.com/api/authenticate', { headers: { 'accept': '*/*', 'accept-language': 'pt-BR', 'content-type': 'application/json', 'sec-fetch-dest': 'empty', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'same-origin', }, referrer: 'https://755600276941176913.discordsays.com/', referrerPolicy: 'no-referrer-when-downgrade', body: '{"code":"FKNvSQG1VHKlNrGC8zJs6u2BpMpvPf"}', method: 'POST', mode: 'cors', }).then(async (e: any) => console.log(await e.json()));

#

thats what i was using i think

latent heron
#

so you're saying the ?value=xyz is already instantiated but you're having issues already adding onto it?

#

uhh i mean you could just do like

opal plank
#

it needed 2 requests iirc

#

it uses the /invites api iirc

boreal iron
opal plank
#

the url must be made specifically for that

boreal iron
#

With rewrite rules, not PHP

latent heron
#

that's proper though

boreal iron
#

Quite a complicated rewrite rule if its even possible

latent heron
#

are you trying to take the query-string from /value and bring it to /index.php?

#

i'm super lost

#

i mean i get you're trying to rewrite

opal plank
#

@solemn latch and to top it off, im not sure i was even suppose to send that, cuz that was pre-release method of doing it

solemn latch
#

Whoops

latent heron
#

but it should be possible

opal plank
#

i had the idea of using the bot to queue in videos

#

but it was annoying to reverse engineer it

boreal iron
opal plank
#

it was using some sketchy shit to replicate

latent heron
#

alright, that much i get

boreal iron
#

I wanna rewrite the “fake path” plus the query string

latent heron
#

and by rewrite you quite literally mean copy off of it, correct?

boreal iron
#

In my case the fake path can be any value even an URL

#

Err huh?
If that’s the right term for rewriting URLs then yes KEKW

latent heron
#

well rewrite is generally a term for either refactoring something or dealing with an HTTP server

#

but if im guessing your definition of this, you're trying to copy the URL value and the query-string

boreal iron
#

Almost played around for 2 hours with rewrite rules and conditions and couldn’t get it to work

#

Rewriting the URL if the query string starts with an & works of course

latent heron
#

ohh

#

christ i know what you're talking about

#

you're talking about constructing the URL path into a query string right

#

?

#

That's the only other thing I can imagine this as

boreal iron
#

Since the target (index.php?lookup) has a valid query string behind already

latent heron
#

you want to literally rewrite the whole URL path into a query-string?

#

is that what you mean?

#

for example

from: localhost/endpoint/12345/keyval
to: localhost/endpoint?key=12345&key=keyval
boreal iron
#

Yes with the issue appending the already existing query string to the new rewritten variant

#

Source https://test.com/xyz?key=123

Target /index.php?value=xyz&key=123

Where xyz can be anything (even an URL)

latent heron
#

and you're trying to determine if the ? exists

boreal iron
#

That’s the example

#

Doesn’t matter if key exists or not

#

If not it will not be appended to the target

latent heron
#

gotcha

#

can you give me an example of the source you're trying to rewrite then?

#

because this example differs

#

there's 2 approaches i know to what i believe you're trying to do

boreal iron
#

Sure gimme 1 minute

#

    RewriteEngine On
    RewriteCond %{REQUEST_URI} index\.php [NC,OR]
    RewriteCond %{QUERY_STRING} lookup [NC]
    RewriteRule ^(.*)$ /$1 [R=401,L]
    RewriteRule ^(.*)$ /index.php?lookup=$1 [PT,L]

Requesting the URL including index.php… will end in a 404
This example does append any query things but not if it starts with a ?

latent heron
#

so it is apache..

#

great, i hate myself

#

you're better off using RewriteMap

boreal iron
#

Yeah will have a look at home later if I’m back at home

uneven estuary
#

waveybirb hello, im trying to use tenor to send gifs in an embed but it doesnt seem to work, if it was send as a normal msg then it works fine,
i read a while ago that tenor had some issues with sending gifs in embed, i wanna know if its still a problem? ive been trying to look it up but couldnt find anything ( using v12 )

pale vessel
#

You need to use the direct GIF URL

#

Discord embeds it for you if you send it but you can't do that on embeds

uneven estuary
#

pika so the only option i have is to use arrays not auto generated, or is there a way to make it get the url instead?

latent heron
#

How exactly does one return a JSON response for an endpoint in PHP? Would this be proper?

$endpoint = "https://test.com/api/endpoint";
$json = json_encode(file_get_contents("to_send.json"));

header(implode("\r\n", ["Content-Type: application/json", "Location: $endpoint"]));
echo $json;
pale vessel
#

It should be a string

#

and you tell the API that you're sending a JSON response/text (The content-type header does that)

latent heron
#

well right, I am making the API for that

pale vessel
#

So remove that json_encode

latent heron
#

don't you need to encode the JSON before sending a header request for it though?

#

because i need to actually return the JSON itself

pale vessel
#

Wait, does encode turn it to string or-

#

That's decode

#

Never mind

latent heron
#

yeah lmao

#

decode turns it into an array

#

encode turns it into a string

pale vessel
#

What's that location header for?

latent heron
#

for the actual endpoint

#

just like how top.gg has https://top.gg/api/bots

#

imagine bots for endpoint here

#

im trying to write the JSON content to that specific location

#

what should realistically be happening with my PHP is that the endpoints are regularly updated on a timed interval (because what I'm trying to accomplish is randomly-generated JSON for a specific endpoint)

#

and all it does is forcibly writes it to that location

slender thistle
latent heron
#

file_get_contents returns a string

#

i have to split it to get an array

pale vessel
#

Wait aren't you encoding a string?

latent heron
#

yeah, i was looking ironically at that Stack post specifically on this

slender thistle
#

What's preventing you from echoing that string?

latent heron
#

yes but it encapsulates b"" onto it

#

because of HTTP formatting

#

that's why I can't just directly echo the string itself

#

I essentially have to serialize the JSON content when I am returning it with the content-type header

#

which iirc is handled under the serialize_production: int parameter

lofty cedar
#

how can i send files in discord_buttons_plugin with ctx.reply? And how can I do that buttons could be pressed only by the command sender and how make buttons disabled after clicked

latent heron
#

isn't discord.Attachment the object that handles that automatically for you

slender thistle
#

Is it Attachment and not Component?

latent heron
#

for files, it's attachment

#

IDK a lot about the discord_buttons_plugin library

#

but I can give you help for the discord-interactions library

pale vessel
#

I don't know why you're encoding the string, it'll look like this

latent heron
#

that's proper

pale vessel
#

It's not

crimson vapor
#

"{"success":true}"

latent heron
#

the \ is just avoiding breaking the "" syntax

pale vessel
#

What

latent heron
#

yes

lofty cedar
latent heron
#

if you're trying to use " in a ""-existent PHP string you employ the backslash to avoid formatting break

latent heron
#

this server is where you can get the help for it

pale vessel
#

That's not what I meant

latent heron
#

wdym then?

#

it's not going to affect the way the JSON appears directly on the page

#

well, it should, it should type the JSON in the literal form it exists as, so it does but not with any presumptive flaws

pale vessel
#

It's just redundant

latent heron
#

i'm not keen to write a for loop to do it for me

pale vessel
#

It also makes the response ugly, but I digress

latent heron
#

that's also because you're printing out the format in an IDE

#

so ofc the response will look ugly 😅

#

my problem is, i'm trying to use the Location: header

#

but when you do a header like that esp. in PHP, it forces the location to change before the PHP echo is executed

#

because theoretically, the echo is going to display the JSON contents in your .php script before the location is executed

#

and i have no actual idea how to work around that

proven lantern
pale vessel
proven lantern
#

yeah, might as well skip encoding it into a string

#

that's usually a bug

latent heron
#

it has to be encoded because of serialization

#

at least that's my understanding.

proven lantern
#

JSON dont need that

#

it's just text

pale vessel
#

You're turning a string of JSON to a string that contains a string of JSON

latent heron
#

aight ill drop the encoding then

proven lantern
#

you'd use content-type:text/plain for the stringified version of the JSON. content-type:application/json for JSON

latent heron
#

Content type is not my problem

#

Its the location

#

Because the echo will likely execute before the location is changed

#

Refer to what I wrote above

proven lantern
#

lookin

#

are you using the location header to do a redirect?

modest maple
#

pithink reading through this im confused

#

now i may not know php

#

but im pretty sure there is some fairly serious miss information being given around here

modest maple
# proven lantern you'd use `content-type:text/plain` for the stringified version of the JSON. `co...

Mostly in this line KannaWhat because unless there's some special thing im missing. In the world of HTTP everything is serialised, you cannot just essentially just print the json straight to text and mark it as json content type, the JSON must be properly serialised to a string / bytes.

The content-type: application/json is what tells the server / client what it should do with the content, e.g. if it's json content type it knows it has to deserialize the content from a string / bytes back to the object.

what you dont do is mark serialised JSON as text/plain because technically that will lead to alot of clients and servers miss handling the request /response

boreal iron
#

You can’t send headers because they got sent already?

proven lantern
#

are you echoing out the HTTP headers?

stiff lynx
#

I want to do a website foto my discord bot, with express, but if I host the bot on a vps how can I see the Pages or access the website?

latent heron
modest maple
#

you do

latent heron
#

Sending serialized information as plain is bad

modest maple
#

and you should

latent heron
#

Okay, so I am keeping my encoder

#

Because i thought that was valid

modest maple
#

If they're telling you not to, ignore them, they're committing war crimes against http

latent heron
#

LMAO

#

My concern is about the location header though

modest maple
#

if you're sending JSON data it should be fully serialised and escaped

latent heron
#

Won't the echo be executed before the location changes?

#

How can I actually include the JSON with the headers ?

lyric mountain
#

who told u not to serialize before sending through http?

modest maple
#

Idk php so idk it's behaviour like that

latent heron
#

Uh I don't think they said not to

modest maple
latent heron
#

They just assumed since its a string there was no need to

boreal iron
lyric mountain
#

technically strings are already serialized

latent heron
#

I'm trying to define endpoints

#

I dont.. think they understand how strings have bit shifting values in php 😅

lyric mountain
#

like

#

what

#

who the hell sends json as text/plain?

modest maple
#

yeah welcome to my hell

latent heron
#

More importantly

lyric mountain
#

wtf

latent heron
#

why

#

That's improper

lyric mountain
#

because you're not sending text

modest maple
#

miss information is why we went up with web servers returning html content types for JSON encoded data

lyric mountain
#

like

latent heron
#

You always should use the correct content type

lyric mountain
#

imagine if I was selling a car

#

and published it as "big chunk of metal with wheels"

modest maple
#

and how we end up with people not escaping the strings correctly and leading to all kinds of foolery

lyric mountain
#

is it technically right? yes
should u use that way? hell no

latent heron
#

This is why I ask from people who actually use PHP in correspondence with the content type pepeMeltdown

modest maple
#

its not even that like

#

its a basic HTTP principle

latent heron
#

I try to study how HTTP responses work for a reason

lyric mountain
#

also, some browsers interpret the result differently depending on content type

boreal iron
latent heron
#

My highest role involves me making interactions with an API which is important for that

#

I have to use the correct headers

lyric mountain
#

here

#

favorite that

latent heron
#

Oh my

boreal iron
#

You expect the response being in the right format not just weird text

lyric mountain
#

it's the best lookup documentation for content types

latent heron
#

Can we stop talking about the content type and talk about the location header instead LMAO

#

That's my problem

limber mica
#

So when trying to shard, how do i get a user ID and dm them whilw doing it across all the shards?

latent heron
#

Ignore the fixation about the type right now

#

I actually need the content to be on the specified location

boreal iron
#

Where’s the issue with the header?

#

Or location…

latent heron
#

okay let me repeat it for the 3rd time then

#

Im currently specifying 2 headers, one for the content type as json and the location header so it redirects the contents to a page

#

but naturally, when you use Location: url you have url with an actual existent page

#

what im doing here is specifying the url as /api/endpoint which is what you should do

lyric mountain
#

inb4, you need to pass redirect status if u plan on using location

latent heron
#

but im using echo to display the JSON contents on the page before the Location: url is executed

#

so my issue is

#

My JSON contents are actually being displayed on the .php page itself

#

instead of the specified location

#

because it's not a proper URL type and instead an endpoint

lyric mountain
#

hmmm, now I'm confused

#

like

latent heron
#

let me show you

#

that's the only way it'll make sense

boreal iron
lyric mountain
#

location only specifies where the browser should take the user to (when status is of redirect type)

boreal iron
#

Looks like he wanna send the result to a different endpoint

proven lantern
#

screen share time

pale vessel
#

You can't mimic a fake location with the content you gave, if that's what you're trying to do

latent heron
#

precisely the issue.

lyric mountain
#

you can, however, make the api send a request to another url

#

like, the client calls the api -> the api calls another api

latent heron
#

that's a simple way of oversighting what i've essentially said haha

lyric mountain
#

but that's server side

latent heron
#

wait

#

no

#

that's horrible

boreal iron
#

Using curl for example

latent heron
#

why would i do that

lyric mountain
#

idk, that's what I understood

latent heron
#

hold on i'm mocking the example right now

boreal iron
#

We still don’t really know what You wanna do

latent heron
#

yes

#

that's why

#

i'm writing it

#

yeah, i can't figure out a proper way to do this

#

Location: url has to have the url have an existing page for a specified directory, regardless

#

So even if I made subdirectories /api/endpoint it's going to register it as a source that requires an existing page

lyric mountain
#

hmmm

#

look

#

Location: url is a redirect header

boreal iron
#

You wanna do the redirects via. PHP
Use the webserver instead and process the request at the location it’s supposed to be

latent heron
#

it won't be an actual /endpoint, then it'll be /endpoint/

#

and i'm not trying to turn it into an existing subdirectory

lofty cedar
#

how can I do that buttons could be pressed only by the command sender in discord_buttons_plugin? and how to make buttons disabled after clicked?

lyric mountain
#

php wont transform the url from endpoint to folder

#

actually, nothing will

boreal iron
lyric mountain
#

ohhhh wait

earnest phoenix
lyric mountain
#

I think I'm gettin it

lyric mountain
#

dropdown is in the next corner already

earnest phoenix
#

Oh really?

lyric mountain
#

yep

#

it's on nightly

earnest phoenix
#

That will be fun to mess with

#

I already have a plan on how I can use that

lyric mountain
latent heron
#

no, other way around

lyric mountain
#

then just don't add trailing /

latent heron
#

that's what i did

#

here

earnest phoenix
#

Oh php stuff

#

have fun

lyric mountain
#

the issue is that you can't have it that way

latent heron
#

yeah

#

there's no feasible method i can think of to make it happen

lyric mountain
#

you're not serving content, you're redirecting

latent heron
#

i'm trying to serve the content

lyric mountain
#

then don't use Location

latent heron
#

that's exactly the problem i have been trying to address

#

what do i use then?

lyric mountain
#

nothing

#

Location is a redirection header

latent heron
#

so, how am i actually supposed to create the endpoint then..?

lyric mountain
#

you basically trying to breathe and swallow at the same time

boreal iron
#

Why don’t you use the webserver to redirect the request for main.php to endpoint?

latent heron
#

that's what i'm trying to do here

#

but i'm being told to not redirect it

boreal iron
#

No that won’t work with PHP

lyric mountain
#

what do you use for the webserver? nginx or apache?

latent heron
#

apache

boreal iron
#

Yeah RewriteRules

#

Not an issue at all oldEyes

latent heron
#

please point me in the right direction then to establish the endpoint lmao

#

because im trying to get a PHP file to write content for an endpoint to display

#

exactly what i'm wanting to do here

lyric mountain
#

basically, what you need is to have the engine send the client to the right endpoint in the webserver

#

idk how to do it in apache, but I'll show u an example in nginx

pale vessel
#

What webserver are you using btw

#

Oh

#

Someone asked that

latent heron
#

yeah i have everything else i need for my API to work coded out and functional

#

except getting the endpoint to display my content

boreal iron
lyric mountain
#

wait

#

forgot to remove urls

#

so

#

the part I want to show is the highlighted in green

boreal iron
#

But I actually do a pass through not a redirect which will not change the URL in the browser

latent heron
#

right, not trying to do that

#

the endpoint should be inferring on a file to read off of anyhow

#

using ports would create the same dilemma im having

lyric mountain
#

basically, that's going to: if url is https://mydomain.tld/reaction, it'll send the request to http://localhost:8079 and append /reaction to it

#

which is the port my webserver is listening to

#

it'll receive the request, check for /reaction endpoint and, if it exists, process and return a response

latent heron
#

i see

boreal iron
latent heron
#

im not sure how to add this implementation in apache however

#

oop

#

spoke too soon

boreal iron
#

In the virtual host

latent heron
#

i'm prob gonna make it an index

#

but i want the /index.php to be dropped

boreal iron
#

If I wouldn’t drive I could send you an example

#

Yeah no problem

#

First redirect to /endpoint then pass through to index.php

lyric mountain
#

@earnest phoenix

#

just received on my server

boreal iron
#

Pass through means index.php won’t be written down in the URL

latent heron
#

could i just do /endpoint to /endpoint/ then?

#

since it'll automatically then registering it to index

boreal iron
#

You can also define an own DirectoryIndex

#

For example process.php as index

#

Whatever you won’t just for that folder

#

Or simply index.php

#

My endpoint mentioned in my example from before doesn’t show the index.php too it should acts as pass through

latent heron
#

gotcha

boreal iron
#

Brb

latent heron
#

will i need to define the apache http for /api or each specific endpoint though?

earnest phoenix
#

@lyric mountain Thanks

lyric mountain
#

else u can just use wildcard to match anything

latent heron
#

well since apache is .htaccess based on defining, i can just put it in each endpoint

#

and then make it simply redirect to the index.php

#

which then i'll have no issues at all with displaying the json content once i pass the content type header

#

and realistically would solve my problem, the downside being I have a bunch of rewrites in separate fucking paths blobpain

lyric mountain
#

or just use wildcard

#

also you can append headers from the engine

#

if all your endpoints will serve the same kind of content

earnest phoenix
#

Didn't know threads were out as well

slender thistle
#

@rustic nova scam

modest maple
#

@rustic nova give me hope

#

Damn shiv slow

opal plank
#

@rustic nova gives us freedom

slender thistle
#

Slow yeah

opal plank
#

@drowsy crag ur chance to yoink it

#

(again)

drifting wedge
#

if im getting user input and sending it to backend should i use request params?

boreal iron
#

I would put the rewrite rules into the virtual host as the htaccess refers to the directory it is in
Even defining the RewriteBase will not fix that

#

Which matters only if the files are in different folders (under the same host) to prevent creating multiple htaccess files

digital ibex
#

Quick question

#

Is me adding endpoints which updates the data in my db in my api more efficient than directly updating the db?

#

like bc it would take a bit of time for it to render and stuff if u get what I mean and for frontend frameworks it does make it simpler and faster

#

so I’m not sure if it like makes it faster overall or just a bit slower it’s taking that bit longer to get to the data if u get what I mean

earnest phoenix
#

That is essentially what a rest api is

digital ibex
#

It’s a private api*

#

Forgot to mention

sudden geyser
#

@digital ibex I'm not exactly sure what you're trying to compare. Do you have an API and deciding whether to make two separate endpoints—one for the public user request and one for the private database update? Or do you have a process and want to separate the database updates to the API?

If you're requesting the former, it really depends on your implementation. For the most part, it's not faster. You may be interested in the structure of your project and where you'll be making API requests as an alternative.

digital ibex
#

I answered my own question and forgot to let u guys kno f

#

I appreciate it though

lofty cedar
#

Anyone knows why it doesn't change the var 'turn' ?
(in place command)

lyric mountain
#

instead have a centralized manager

sudden geyser
#

What makes it "better"?

lyric mountain
#

less places to update code, easier to debug, probably more safety since you can focus all security in one spot instead of having it splattered all around

#

also you can profile performance easier since it'll not be affected by unrelated code

proven lantern
#

databases already have an api, why build another?

lyric mountain
#

not that

bronze gulch
#

Hello World!

sudden geyser
#

Goodbye, World!

proven lantern
#

world is gone

#

i can take a message

sudden geyser
bronze gulch
proven lantern
#

maybe like a graphql api that connects everything

sudden geyser
#

Yeah well if you manipulate the database in a GraphQL field you're just shooting yourself in the foot

proven lantern
#

graphql is kinda cool

#

even the mutation stuff

proven lantern
#

but it's still easier to just directly use the database

sudden geyser
#

Yeah it's nice

#

I like it a lot more than REST

proven lantern
#

graphql makes a rest api

#

GraphQL follows the same set of constraints as REST APIs, but it organizes data into a graph using one interface...

sudden geyser
#

Yes, but that's just for the single endpoint and if the developer felt like using some REST primitives rather than just sticking to what GraphQL gives you, like query, mutation, subscription vs. GET/POST/whatever

proven lantern
#

those (query, mutation, subscription) are part of the body of a post request

sudden geyser
#

Yeah

#

But some implementers choose to still add GET/POST

earnest phoenix
#

I have only used Graphql once and I didn't understand it

sudden geyser
#

Same when I used it once

#

But I like that it's structured (allows code generation), makes versioning easier, only gives me what I need, etc.

earnest phoenix
#

I plan on using graphql when I next use nestjs

proven lantern
#

nextjs?

sudden geyser
#

Some react framework I think

#

I'm not so sure about implementing a GraphQL API though.

#

I had some difficulties

proven lantern
#

it's not worth it

sudden geyser
#

Specifically resolving the N+1 problem.

proven lantern
#

recursion?

sudden geyser
#

It was because of the structure of fields.

#

Since there's no fixed order to how a user declares their query unlike REST, you may end up making too many backend requests for resources.

#

e.g. a books field with a titles field under it holding an array of strings

#

Which may make 1 SQL query for the book, and 10 SQL queries for each title.

#

I used Facebook's Dataloader to resolve this

proven lantern
#

that doesn't sound efficient

sudden geyser
#

Dataloader solves that issue by basically batching the queries (e.g. for each book you call .load(id)) and makes a single query with an array of the IDs

proven lantern
#

shouldn;t it be called the 1+n problem

sudden geyser
#

both work either way

#

But when I needed to model my queries with more details (e.g. when approaching pagination), it got difficult to model

proven lantern
#

if order of operations mattered for addition it wouldn't work both ways

sudden geyser
#

but this ain't division

proven lantern
#

but the 1 would be the initial call to get data and the + n part would be the part the fetch all the supplemental data

lyric mountain
#

if you splatter database access everywhere you'll have many code to update let a bug happen

sudden geyser
lyric mountain
#

I'm not saying to make a full lib for database transactions, but keep everything centralized

#

or at least CRUD ops

earnest phoenix
sudden geyser
earnest phoenix
#

Just use an orm mmLol

sudden geyser
#

I don't like ORMs.

lyric mountain
#

still, it'll become unbearable to debug or refactor once your code becomes big enough

earnest phoenix
#

I use am orm cause it makes my life easier in the long run

sudden geyser
#

It may actually do the opposite

earnest phoenix
#

How

#

I'd rather not risk sql injections where something like typeorm can help prevent that

#

Also makes it easier to query

#

Way easier to debug the situation

proven lantern
#

that framework uses an invalid version of javascript

#

into the trash

earnest phoenix
#

What

proven lantern
earnest phoenix
#

Those are called Decorators hun

proven lantern
#

those are not valid in javascript

sudden geyser
#

They're using TypeScript.

earnest phoenix
#

Nestjs is primarily used in typescript

proven lantern
#

Decorators are a type of annotation

earnest phoenix
#

So it is valid

proven lantern
#

annotation rejected from ecmascript

#

not valid ecmascript

earnest phoenix
#

You aren't the sharpest tool in the shed are ya

proven lantern
#

top 5%

#

sharpest

#

but you are right

#

not the sharpest

earnest phoenix
#

That is a decorator, typescript uses decorators, when the code is compiled it looks nothing like that it gets compiled down into valid javascript

#

So what you are saying is rather useless when you don't know what typescript even is

proven lantern
#

garbage script

#

ecmascript chose to reject annotations for a reason

#

ts people dont like reasons

earnest phoenix
#

What

sudden geyser
#

How
I'd rather not risk sql injections where something like typeorm can help prevent that
Also makes it easier to query
Way easier to debug the situation
The issue I have with ORMs is what I was explaining above: SQL is already a high-level, declarative abstraction for communicating with a database. Although its syntax is unmodern, it's still invaluable.

What ORMs often try and do is further abstract SQL to make it convenient and modern to use in programming languages. At the same time, that abstraction often results in loss of capabilities. As a result, ORMs give you an escape hole so you can execute a raw SQL query.

For me, I don't like ORMs because of that. Plus, they make me less productive, so I choose to use SQL. It's always happened that as I get further using an ORM, I grow irritated with its limitations and go back to SQL.

SQL injection is not a problem since you can usually prepare your queries or your language may have it built in (e.g. Postgres $1). I won't disagree that debugging ORMs can be easier, but they can also be difficult since they include a lot of stuff not related to your issue at hand and more about the ORM.

proven lantern
#

why cant typescript follow the rules?

sudden geyser
#

Abstraction is a wonderful yet ruthless weapon.

proven lantern
#

international standards exist for a reason

sudden geyser
#

I kind of agree with you, but at the same time, TypeScript is a programming language that doesn't need to follow the rules just because the people behind the standard rejected it.

proven lantern
#

they like their caveman stick

#

stick good

#

you can poke thing with stick

#

make thing ouch

sudden geyser
#

May I interest you in some ClojureScript

earnest phoenix
#

You can do things in ts that would be way more complicated to do in js

proven lantern
#

nope

#

you can make things more complicated with ts

earnest phoenix
#

Your opinion ig

#

Not my fault your brain is too small

sudden geyser
#

oh no

proven lantern
#

brain size doesn't matter

#

i write ts, js, and java all day and i use js when i need to solve something tricky

#

some scala too, but it's been awhile

#

a bit of kotlin

proven lantern
#

is that your buddy?

limber mica
#

Yo anyone know how to get a user ID and send them a DM while using sharding? Im trying to get it from the first ping so message.author.send wont work

#

im using discord.js

latent heron
#

annotations are existent in a lot of languages

proven lantern
#
const member = await msg.guild.members.fetch({user:userId})
const dmChannel = await member.createDM()
latent heron
#

there's nothing wrong with TS using them

limber mica
#

Im so damn confused

#

how do i do it

#

client.users.cache.get(member) works fine but only in that one shard

#

wait

#

wait wait wait

#

im so stupid

latent heron
#

d.js caching horrifies me

earnest phoenix
#

Why wouldn't message.author.send not work

limber mica
earnest phoenix
#

On any shard the author of the message should still be the same no?

proven lantern
#

i use tim's djs library

limber mica
earnest phoenix
#

Then how would the message be valid without an author

limber mica
#

So say I have 3 shards, user sends a message on shard 1 but the code runs on shard 2, how on earth is shard 2 going to know who sent the message?

limber mica
earnest phoenix
#

I see

#

Well discord.js server is probably a better place to ask

proven lantern
#

fetch them

#

dont rely on the cache

latent heron
#

^

limber mica
latent heron
#

replying on the cache is a bad idea

earnest phoenix
#

But fetching them from the api directly is a better option since the cache for whatever reason doesn't always get filled

proven lantern
latent heron
#

because cache is not reliable in the event the user event updates

earnest phoenix
#

fetch works as if its in the cache it will get it from there

#

else it wil lfetch directly from the api

latent heron
#

pretty sure its the latter route you take

limber mica
#

hmm

#

ok

#

ima try it

latent heron
#

you should only be using cache imo for things that you are trying to check doesn't change

earnest phoenix
limber mica
#

how do i send a DM in the dmChannel that is created?

proven lantern
#

i cache the custom prefixes for bot commands so i dont kill my db

earnest phoenix
#

When you create the dm channel just use it to send a message

latent heron
#

that's just a boolean parameter asking if you want to cache it

proven lantern
#

dmChannel.send("")

limber mica
earnest phoenix
latent heron
#

i know, just extending on the definition so Infinity knows

latent heron
earnest phoenix
#

Obtains a user from Discord, or the user cache if its already available

proven lantern
#

put that in try/catch so that it doesn't crash

earnest phoenix
#

It tries to fetch from the cache first if it doesn't exist it fetches from the api

latent heron
#

promise rejection error moment

#

this is why catching is important

proven lantern
#

discordjs thinks it's a good idea to throw an error when it cant fetch a user

latent heron
earnest phoenix
#

and yes

latent heron
#

i mean

#

it should

earnest phoenix
#

you always wanna catch the fetch

#

In case it doesn't exist period

earnest phoenix
latent heron
#

an error should always be thrown for anything it can't find

#

lmao

proven lantern
#

i'd be happy with no results when there is no member in the guild and having only having an error if it cant reach the api

earnest phoenix
latent heron
#

then make the exception state there are no results..?

#

that's why you also have finally

#

or well, don't know if you can use that with d.js

earnest phoenix
#

I forget finally is even a thing

latent heron
#

but it definitely exists as an option

#

yeah

#

i use finally a lot

earnest phoenix
#

Don't even remember what it does

latent heron
#

because my except is supposed to catch what isn't there and fix it for me

#

finally runs regardless of if try and catch are triggered

earnest phoenix
#

Ah

latent heron
#

it's like the "final" state of an operation as the name suggests

earnest phoenix
#

Gotcha

proven lantern
#

i dont like having to write code in the catch block that is normal code

limber mica
proven lantern
#

forces you into two different scopes

latent heron
#

show us your traceback stack

limber mica
#
Error: Value for argument "documentPath" is not a valid resource path. Path must be a non-empty string.
latent heron
#

is that the whole error traceback?

limber mica
#
throw new Error(`${validate_1.invalidArgumentMessage(arg, 'resource path')} Path must be a non-empty string.`);
              ^

Error: Value for argument "documentPath" is not a valid resource path. Path must be a non-empty string.
    at Object.validateResourcePath (N:\Desktop\ColdRP bot\node_modules\@google-cloud\firestore\build\src\path.js:414:15)
    at CollectionReference.doc (N:\Desktop\ColdRP bot\node_modules\@google-cloud\firestore\build\src\reference.js:1938:20)
    at Object.execute (N:\Desktop\ColdRP bot\commands\patremove.js:20:50)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
[STATUS] : Bot is online
latent heron
#

ah thank you, that's more specific

limber mica
#

it goes back online because of how i have it coded

#

wait

#

im so retarded

latent heron
#

careful with the word

#

but lmao there's your error

proven lantern
#

how are you liking firestore?

limber mica
#

How can I remove something from a database if it does not exist :)

limber mica
#

Its easier and faster

#

Better than mongo

#

;)

earnest phoenix
#

Firestore is bleh

limber mica
#

6/10

earnest phoenix
#

Most of googles products are a bit bleh

limber mica
#

True

latent heron
#

you could also be based

#

and not use mongo at all

earnest phoenix
#

Right

limber mica
#

i used it once

latent heron
#

because mongo was made for lightweight database management

proven lantern
#

mongo is too expensive

earnest phoenix
#

Postgres + prisma or typeorm is pog

latent heron
#

and mongo is also fucking stupid

limber mica
#

Lmao

#

Firestore is so much easier to use

latent heron
#

you see

limber mica
#

API calls are significantly easier to remember

latent heron
#

i prefer nosql database packages

proven lantern
#

mongo is if you dont want to think about how to store your data

latent heron
#

because anything with SQL makes my head retract inside my neck

earnest phoenix
#

fl0w what db do you use

latent heron
#

for my projects?

limber mica
#

wait, yall are forgetting about JSON

earnest phoenix
#

Yea

latent heron
#

TinyDB

limber mica
#

the god of storage

earnest phoenix
#

TinyDB?

latent heron
#

its a JSON NoSQL DB library for Python

earnest phoenix
#

Oh right

latent heron
#

I coded my own version of TinyDB for my PHP projects too

#

called Hook

earnest phoenix
#

you are mainly a python user no?

latent heron
#

i'm mainly a PHP user

earnest phoenix
#

Ah

#

PHP is eh

proven lantern
#

dynamodb is a nosql database that tries to be as annoying as rds databases

latent heron
#

My stack is PHP, Python, JS and C#

proven lantern
#

but it's free

earnest phoenix
#

I thought it interesting but a good bit of people convinced me not to learn it

sudden geyser
#

So like 2 people?

latent heron
#

if you learn PHP, learn PHP 8

earnest phoenix
#

My stack is Kotlin, TS, JS, and C#

earnest phoenix
latent heron
#

Kotlin's a pretty nice language

limber mica
#

IT WORKS

#

LETS GOOOO

sudden geyser
#

What's a "stack" in this context

latent heron
#

a set of languages you commonly work with

limber mica
#

now to apply it 5000 more times

earnest phoenix
#

I don't work with C# as much anymore

#

But I work a lot with Kotlin, TS and sometimes JS

#

The heck happened to top.gg for me

#

It went unavailable ahaha

latent heron
#

well anyhow

#

I'm brushing up on my C# skills right now because I'm trying to apply for a job that involves writing backend for it

#

👀 hoping I can get my foot in the door with at least a phone call

earnest phoenix
#

I was going to look for a job for the summer

#

but I don't know

#

I hate writing resumes

latent heron
#

also small flex but

sudden geyser
#

If you're in school, see if your school has options

latent heron
#

if anyone is looking for an experienced C#/PHP coder to hire

#

👀 cough DM me

sudden geyser
#

I'm working for the IT department at my school

earnest phoenix
#

Ahaha

#

I wouldn't trust myself with that much power

latent heron
#

oh cool you're the guy who helped me with some Rust stuff

limber mica
#

hey fl0w how do i get guild members but NOT from the cache

earnest phoenix
#

fetch

latent heron
#

fetch

limber mica
#

im working on it

earnest phoenix
#

use partials + fetch

latent heron
#

always fetch directly for something not from the cache

limber mica
#

ok

latent heron
#

don't let the elites tell you otherwise

earnest phoenix
#

partials + fetch pog

latent heron
#

fetch is the based way

earnest phoenix
#

the elites tell you to fetch

#

At least that is what everyone from the d.js told me to do

latent heron
#

nah

earnest phoenix
#

use partials + fetch

latent heron
#

seen some d.js coders go

earnest phoenix
#

its the only way

latent heron
#

"reee only use cache it's the most reliable method"

earnest phoenix
#

Those are the ones without proficient role

latent heron
#

LMAO

sudden geyser
#

Discord.js isn't that bad

earnest phoenix
#

It is and it isn't

latent heron
#

I like to view these languages in this order:

JDA - this is an Electric Shaver
discord.py - this is a razor
discord.js - this is a bowling pin

Now I like to try and get the best shave possible when I'm in the bathroom, but I always ask people: have you ever shaved with a bowling pin?

proven lantern
#

tim's verison isn't that bad

limber mica
#

;ticketconfig

#

wait

#

wrong server

earnest phoenix
#

JDA is also pretty bad

#

But its not the worst

proven lantern
#

java is pretty bad

earnest phoenix
#

Agree

latent heron
#

how?

earnest phoenix
#

Kotlin is way better

proven lantern
#

scala tried to fix it a bit

#

failed too

latent heron
#

Java is still pretty good

earnest phoenix
#

Java is alright

proven lantern
#

kotlin is trying, but java is just so bad

latent heron
#

the only sucky thing is compiling with JVM

earnest phoenix
#

but kotlin is better

proven lantern
#

it's a lost cause

latent heron
#

I mean, not really

#

Java is still fairly good in its current stage

earnest phoenix
#

Ben you think everything that isn't js is a lost cause

latent heron
#

plenty of companies still deploy it as their backend language

#

but Rust is slowly replacing Java

sudden geyser
#

No it's not.

earnest phoenix
#

You simplistic minded fool

proven lantern
latent heron
#

it is

sudden geyser
#

Rust and Java have separate objectives.

latent heron
#

there are a lot of companies using Rust now for backend

#

no Rust is just really fucking good at trying to make things work without errors

#

because stupid mozilla developers couldn't handle their shit

earnest phoenix
#

Rust is becoming widely popular

#

Deno uses rust

latent heron
#

ofc they have separate objectives, they're intentionally designed differently on the fundamental aspect

sudden geyser
#

Rust is popular and growing (I use it often), but Rust is not the reason Java is losing popularity all of a sudden.

latent heron
#

it's a good contributor to it though

limber mica
#

message.guild.channels.fetch is Not A Function

#

BRUH

latent heron
#

I never said Rust was the only language replacing Java

#

some JS frameworks are contributing to that as well

earnest phoenix
#

Nestjs is pog

#

Super useful

limber mica
#

i hate js right now

sudden geyser
#

It's really an ecosystem of tools and technologies I'm trying to say

#

but even with that

earnest phoenix
#

It would be better if it used Koa instead of express

#

but shrug

sudden geyser
#

I doubt Java is losing all that much popularity.

earnest phoenix
#

Oh java will run until the end of time its just that kind of lang

proven lantern
#

remember when Java tried to replace JavaScript in the browser and failed horribly

latent heron
#

i don't really think there are any specific technologies, but more so languages leading to Java's downfall

proven lantern
#

java applets

#

lol

#

garbage

earnest phoenix
#

I think java will not die out completely for years to come

latent heron
#

it won't

sudden geyser
#

It'll take a long time before Java dies out.

latent heron
#

Java is on the same page with that as PHP is

#

both languages are going to take a long time to die

proven lantern
#

they are dead to me

sudden geyser
#

Plus, with languages like Kotlin and Scala running on the JVM, they're bundled with that Java ecosystem

latent heron
#

PHP is probably closer to dying right now than Java is

#

and they're still long shots away from that

proven lantern
sudden geyser
#

And, in return, they enter Java's science experiment and further contribute to the ecosystem

lyric mountain
#

Javascript came as a client side script to be the middleman between browser and Java

sudden geyser
proven lantern
#

python is mainly ai stuff

#

not real programming

#

jupyter notebook stuff

sudden geyser
#

I could also write AI in C but no one would do that except for Google maybe

lyric mountain
#

You can write ai in any lang

#

Python is overrated tbf

#

All it has is very easy IO operations

limber mica
#

message.guild.channels.fetch is not a function how do i fix this

lyric mountain
#

And is very high level

sudden geyser
#

any language is really the point. Sadly too many people try to dismiss tools and technologies just because of what it's associated with

sudden geyser
proven lantern
#

ai is awesome

limber mica
#

oh

#

durr

proven lantern
#

just not really programming

limber mica
#

dont change

latent heron
#

sounds about right

lyric mountain
#

Even making a web page is programming

proven lantern
#

modeling and training stuff

#

kinda programming

#

idk

lyric mountain
#

Someone has to find tune the ai

latent heron
#

wait

#

Perl is hated more than PHP?

lyric mountain
#

And someone has to develop it

latent heron
#

Isn't Perl supposed to be the better PHP language?

#

The fuck?

sudden geyser
#

It's probably up there because their employers won't move to modern approaches or can't bother

lyric mountain
#

Perl is too new

proven lantern
#

Perl likes to use all the symbols on the keyboard and have them all mean different things in different scopes

lyric mountain
#

That's the issue

latent heron
#

too new?

#

it came out in 1987

lyric mountain
#

Well, relatively

latent heron
#

surely you're memeing

#

PHP came out in 1995

#

if anything is new it's PHP

lyric mountain
#

I might be mistaking langs then

latent heron
#

the newest language that came out is TS

proven lantern
#

microsoft messed up on that one

earnest phoenix
#

I am kinda wondering what I should be working on rn

sudden geyser
#

learn clojure

earnest phoenix
#

No thanks

sudden geyser
#

sadge

lyric mountain
#

Learn groovy

earnest phoenix
#

My brain can't handle learning anything else

#

I am wondering if I should do something different with my bot.

#

Moderation is just too common

sudden geyser
#

how about trying something other than a bot

earnest phoenix
#

I could yea

#

but what

#

I had plans on making a social media platform I could do that again, but doing that alone is just broing

sudden geyser
#

A CLI? A web server (backend and frontened)?

earnest phoenix
#

boring*

lyric mountain
#

What lang u used for your bot?

earnest phoenix
#

Typescript

latent heron
#

CLI is just some sysadmin shit

#

and i cant be assed to bother learning different CLIs

sudden geyser
#

"learning"?

proven lantern
#

microsoft made typescript for internet explorer 7

lyric mountain
#

Hm, what about making a text-to-jsfuck converter?

latent heron
#

yes

#

people make their own CLIs

#

and it's fucking stupid

earnest phoenix
#

I wanna do something fun

lyric mountain
#

Oh ho ho

#

It is

sudden geyser
#

I don't understand.

#

You're criticizing people who make a CLI utility? Like grep?

earnest phoenix
#

a cli is cool

lyric mountain
#

![]+[] = "false"

earnest phoenix
#

I use a cli made in go for downloading manga

#

Super useful

latent heron
#

no, I criticize people who are making CLIs for very small-scaled development

earnest phoenix
latent heron
#

because it's a weight to me to personally use different CLIs for numerous purposes

earnest phoenix
#

I wanna do something that will be fun and useful

sudden geyser
#

It's usually for learning/convenience. Just like writing a bot.

latent heron
#

grep is widespread in use though

#

I understand the convenience in making those that are used on a large level

#

but personally making one for really small stuff bothers me a little

earnest phoenix
#

personal opinion

sudden geyser
#

It really depends on the target user

latent heron
#

i'd be the perfect candidate of who to not look for when working in an office

earnest phoenix
#

Some things people just make cause they are cool

#

can't blame em for that

sudden geyser
#

For example, I like anime -> I use AniList (site for tracking anime & manga) -> site has API -> I'm bored -> I'll make a CLI to interact with the site for fun

latent heron
#

there's a difference between making something for understanding why it works and understanding its fundamentals over doing it purely for small tasks

earnest phoenix
#

A cli isn't just for productivity

#

or completing tasks

sudden geyser
orchid sail
#

does anyone know how to create a website on a .tk domain? or .mu

lyric mountain
#

You can't really own a tk domain

boreal iron
#

.tk is just a free TLD nothing else
You can create and host your website somewhere and redirect the .tk domain to it

#

That’s it

silk elbow
#

How does the Ip Logeter works?

#

?

orchid sail
#

I didn't ask for information if I own or not I just want to know how to create a website

lyric mountain
boreal iron
lyric mountain
#

You can't set a dns for freenom domains, only mask urls, which they achieve by embedding the whole website in an iframe

#

Which effectively breaks most sites with external connections since they blacklist freenom

waxen fog
#

yo so im trying to do an iframe as my bots long description on top.gg

some of its getting cut off as seen in the picture above is there anything that i can do?

im doing

<iframe height="1250px" width="100%" src="URL">
</iframe>```
boreal iron
lyric mountain
lyric mountain
#

Like, idk how to explain

boreal iron
#

Wrong message I answered

#

Wanted to answer the one before

lyric mountain
#

Oh

boreal iron
#

Discord mobile sucks

#

U know

lyric mountain
#

But really, freenom is very shitty

orchid sail
#

I just came to know how to make that type <body> test </body> appear on the site.

lyric mountain
#

Hmmm, you mean the base html structure

orchid sail
#

Wtf

boreal iron
lyric mountain
#
<html>
	<head>
		preload stuff
	</head>
	<body>
		visible stuff
	</body>
</html>
boreal iron
#

lmao

#

That’s a real basic form okeh

lyric mountain
#

Well, he said he just learnt how to show a text on body

boreal iron
#

Yeah KEKW

gaunt ermine
#

Hey is there a way to get the top voted users in an html leaderboard

earnest phoenix
#
  <rejected> Error [VOICE_JOIN_CHANNEL]: You do not have permission to join this voice channel.
      at /src/user/app/node_modules/discord.js/src/client/voice/ClientVoiceManager.js:78:15
      at new Promise (<anonymous>)
      at ClientVoiceManager.joinChannel (/src/user/app/node_modules/discord.js/src/client/voice/ClientVoiceManager.js:76:12)
      at VoiceChannel.join (/src/user/app/node_modules/discord.js/src/structures/VoiceChannel.js:134:30)
      at Object.run (/src/user/app/commands/connect.js:23:17)
      at module.exports (/src/user/app/events/message.js:36:13)
      at Client.emit (events.js:375:28)
      at MessageCreateAction.handle (/src/user/app/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
      at Object.module.exports [as MESSAGE_CREATE] (/src/user/app/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
      at WebSocketManager.handlePacket (/src/user/app/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31) {
    [Symbol(code)]: 'VOICE_JOIN_CHANNEL'
  }```
#

how setup probleam of this error

#

cn any one pls help

earnest phoenix
#

pls any one help

plain talon
#

Catch the error using a try catch statement

earnest phoenix
#

how make a message

#

when user cnt give

#

permission

oblique minnow
#

Hii

plain talon
#

Yes, catch the error and send a message

earnest phoenix
#

so bot reply

earnest phoenix
#

ok wait

#

i send one thing

#

it is work

#

i make it now

#

is it work

#

i just make i t

#

is it right

plain talon
#

Only way to find out is to try it

earnest phoenix
#

error comes

#

can you come in dms @plain talon pls

earnest phoenix
# plain talon <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises>
    at Object.run (/home/container/commands/connect.js:18:5)
    at module.exports (/home/container/events/message.js:29:13)
    at Client.emit (events.js:376:20)
    at MessageCreateAction.handle (/home/container/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (/home/container/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
    at WebSocket.onMessage (/home/container/node_modules/discord.js/node_modules/ws/lib/event-target.js:132:16)
    at WebSocket.emit (events.js:376:20)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:58) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:58) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
#

@plain talon what happen here

plain talon
#

Read your errors and they may tell you

earnest phoenix
#

to you

long crow
#

(/home/container/commands/connect.js:18:5) Go look at this line

plain talon
#

I don’t develop in discord js so I can’t help you other than basic language common sense

long crow
#

Somewhere on that line you're not defining error

earnest phoenix
long crow
#

tbh, it not really djs error, it is basic js error

earnest phoenix
#

pls comes in

#

dms

#

ayeven

#

i am really stupid kid

long crow
#

Thing is I'm not confident enough to look at others code. I look at my own, I understand. If you can't event understand your own, I cannot help you

earnest phoenix
#

dude

#

accept request

long crow
#

NO
BIG NO

earnest phoenix
#

i need show some thing

errant flax
#

just define error

earnest phoenix
long crow
#

I disabled dm on any server I join mostly, wih all the ads and scams and well...

earnest phoenix
#

I disabled dms on all servers

#

Then friend requested some mods

#

Bryh

#

I want to evaporate from my bed after reading that

lucid prawn
#

???

earnest phoenix
#

Why is the role name some random shit

lucid prawn
earnest phoenix
#

Try adding role id

gaunt ermine
earnest phoenix
lucid prawn
earnest phoenix
#

Oh

gaunt ermine
#

I am actually finding this on yt and google but could not find anything

earnest phoenix
#

@gaunt ermine is the leaderboard on the bot description?

gaunt ermine
#

No

earnest phoenix
#

or are you using it somewhere else

#

oh

#

This method might work on the bot page too:

gaunt ermine
#

Ok...

lucid prawn
#

can someone help me?tlRemHeart

earnest phoenix
#
Boot description
<iframe src="myserver.pog/leaderboard"></iframe>

Server
when you get a request
fetch the leaderboard data
and send it over in an html format
earnest phoenix
#

you said why it's adding a role to you when you run member.roles.add

tight trail
#

hey

#

how do u get the bot developer role?

lucid prawn
earnest phoenix
#

Time for a quick lesson on SSR or Server Side Rendering
Basically your server designs and sends the raw html instead of reading from an html file
It is safer if you need to do database calls or stuff

gaunt ermine
earnest phoenix
#

In your leaderboard you need to setup an http server that sends the leaderboard data

gaunt ermine
#

How to do that?

#

I actually am pretty new to it

earnest phoenix
#

Try using express package for your server

#

It is very beginner friendly

gaunt ermine
#

Like how

#

Like i have done vote rewards....? Does that help

earnest phoenix
#
Start the server:
const express = require("express");
const app = express();
earnest phoenix
gaunt ermine
#

So but how do i get votes and set them in a leaderboard

earnest phoenix
#

All that stuff happens on the server

gaunt ermine
#

How

earnest phoenix
#

ummm

earnest phoenix
#

i honestly dont know how to get topgg votes

#

never used the api

lucid prawn
#

so are you trying to put it on a bot?

earnest phoenix
#

anyways after you figure it out you should listen to a route ("/some/stuff/after/.com") and respond with the html