#development
1 messages · Page 1797 of 1
Nobody experienced with rewrite rules? 
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 &)
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
Doing it in PHP isn’t the issue.
The rewrite rules are an issue as they are supposed to redirect the request not PHP.
where specifically lies the issue with the rewrite?
It seems impossible to append the query string (stating by an ? of course)
@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
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
/value?key=123
/index.php?id=value&key=123
the url must be made specifically for that
With rewrite rules, not PHP
that's proper though
Quite a complicated rewrite rule if its even possible
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
@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

Whoops
but it should be possible
i had the idea of using the bot to queue in videos
but it was annoying to reverse engineer it
In this example value is NO query string but ?key=… is
it was using some sketchy shit to replicate
alright, that much i get
I wanna rewrite the “fake path” plus the query string
and by rewrite you quite literally mean copy off of it, correct?
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 
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
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
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
Since the target (index.php?lookup) has a valid query string behind already
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
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)
and you're trying to determine if the ? exists
That’s the example
Doesn’t matter if key exists or not
If not it will not be appended to the target
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
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 ?
Yeah will have a look at home later if I’m back at home
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 )
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
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?
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;
It should be a string
and you tell the API that you're sending a JSON response/text (The content-type header does that)
well right, I am making the API for that
So remove that json_encode
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
What's that location header for?
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
Does file_get_contents return an array? Seems like json_encode requires an array https://stackoverflow.com/questions/4064444/returning-json-from-a-php-script
Wait aren't you encoding a string?
yeah, i was looking ironically at that Stack post specifically on this
What's preventing you from echoing that string?
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
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
isn't discord.Attachment the object that handles that automatically for you
Is it Attachment and not Component?
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
I don't know why you're encoding the string, it'll look like this
that's proper
It's not
"{"success":true}"
the \ is just avoiding breaking the "" syntax
What
yes
Does it implement buttons?
if you're trying to use " in a ""-existent PHP string you employ the backslash to avoid formatting break
yea we have buttons in our library
this server is where you can get the help for it
That's not what I meant
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
It's just redundant
i'm not keen to write a for loop to do it for me
It also makes the response ugly, but I digress
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
you'll need to JSON.parse that to turn it into JSON. That's a string
It works without encoding it (it's already a string)
You're turning a string of JSON to a string that contains a string of JSON
aight ill drop the encoding then
you'd use content-type:text/plain for the stringified version of the JSON. content-type:application/json for JSON
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
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
Mostly in this line
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
What’s the issue?
You can’t send headers because they got sent already?
are you echoing out the HTTP headers?
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?
Right, so I figured I need to serialize it first before sending
you do
Sending serialized information as plain is bad
and you should
If they're telling you not to, ignore them, they're committing war crimes against http
if you're sending JSON data it should be fully serialised and escaped
Won't the echo be executed before the location changes?
How can I actually include the JSON with the headers ?
who told u not to serialize before sending through http?
Idk php so idk it's behaviour like that
Uh I don't think they said not to
They just assumed since its a string there was no need to
Why would you do this?
technically strings are already serialized
I'm trying to define endpoints
I dont.. think they understand how strings have bit shifting values in php 😅
errr....what???
like
what
who the hell sends json as text/plain?
yeah welcome to my hell
More importantly
wtf
because you're not sending text
miss information is why we went up with web servers returning html content types for JSON encoded data
like
You always should use the correct content type
imagine if I was selling a car
and published it as "big chunk of metal with wheels"
and how we end up with people not escaping the strings correctly and leading to all kinds of foolery
is it technically right? yes
should u use that way? hell no
This is why I ask from people who actually use PHP in correspondence with the content type 
I try to study how HTTP responses work for a reason
also, some browsers interpret the result differently depending on content type
You always set the correct content type.
My highest role involves me making interactions with an API which is important for that
I have to use the correct headers
Oh my
You expect the response being in the right format not just weird text
it's the best lookup documentation for content types
Can we stop talking about the content type and talk about the location header instead LMAO
That's my problem
So when trying to shard, how do i get a user ID and dm them whilw doing it across all the shards?
Ignore the fixation about the type right now
I actually need the content to be on the specified location
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
inb4, you need to pass redirect status if u plan on using location
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
Not only you
location only specifies where the browser should take the user to (when status is of redirect type)
Looks like he wanna send the result to a different endpoint
screen share time
You can't mimic a fake location with the content you gave, if that's what you're trying to do
precisely the issue.
you can, however, make the api send a request to another url
like, the client calls the api -> the api calls another api
that's a simple way of oversighting what i've essentially said haha
but that's server side
Using curl for example
why would i do that
idk, that's what I understood
hold on i'm mocking the example right now
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
You wanna do the redirects via. PHP
Use the webserver instead and process the request at the location it’s supposed to be
it won't be an actual /endpoint, then it'll be /endpoint/
and i'm not trying to turn it into an existing subdirectory
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?
That’s exactly the issue mentioned before
ohhhh wait
What exactly was it again discord is planning to release with its api. I think you said it was menus right?
I think I'm gettin it
yes, and they will
dropdown is in the next corner already
Oh really?
basically you want to redirect to /folder/ instead of /endpoint, right?
no, other way around
then just don't add trailing /
the issue is that you can't have it that way
you're not serving content, you're redirecting
i'm trying to serve the content
then don't use Location
so, how am i actually supposed to create the endpoint then..?
you basically trying to breathe and swallow at the same time
Why don’t you use the webserver to redirect the request for main.php to endpoint?
No that won’t work with PHP
what do you use for the webserver? nginx or apache?
apache
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
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
yeah i have everything else i need for my API to work coded out and functional
except getting the endpoint to display my content
That’s how I build my API, too
But with the exception the request URL is an imaginary folder redirecting to a file
wait
forgot to remove urls
so
the part I want to show is the highlighted in green
But I actually do a pass through not a redirect which will not change the URL in the browser
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
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
i see
Yes so you gonna need two RewriteRules
One redirecting you from main.php to /endpoint
And the second redirecting /endpoint to /endpoint/file.php
(only needed if it’s not an index.php)
In the virtual host
If I wouldn’t drive I could send you an example
Yeah no problem
First redirect to /endpoint then pass through to index.php
Pass through means index.php won’t be written down in the URL
could i just do /endpoint to /endpoint/ then?
since it'll automatically then registering it to index
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
gotcha
Brb
will i need to define the apache http for /api or each specific endpoint though?
@lyric mountain Thanks
depends, normally you only need to define multiple endpoints if you have multiple ports
else u can just use wildcard to match anything
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 
or just use wildcard
also you can append headers from the engine
if all your endpoints will serve the same kind of content
Didn't know threads were out as well
@rustic nova scam
@rustic nova gives us freedom
Slow yeah
if im getting user input and sending it to backend should i use request params?
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
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
That is essentially what a rest api is
@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.
Anyone knows why it doesn't change the var 'turn' ?
(in place command)
it's better not to directly manipulate the db anywhere
instead have a centralized manager
What makes it "better"?
no
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
databases already have an api, why build another?
not that
Hello World!
Goodbye, World!
But a centralized manager is an API

maybe like a graphql api that connects everything
Yeah well if you manipulate the database in a GraphQL field you're just shooting yourself in the foot
anyone knows?
but it's still easier to just directly use the database
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...
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
those (query, mutation, subscription) are part of the body of a post request
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.
I plan on using graphql when I next use nestjs
nextjs?
Some react framework I think
I'm not so sure about implementing a GraphQL API though.
I had some difficulties
it's not worth it
Specifically resolving the N+1 problem.
recursion?
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
that doesn't sound efficient
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
shouldn;t it be called the 1+n problem
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
if order of operations mattered for addition it wouldn't work both ways
but this ain't division
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
I mean, yes but not in that sense
if you splatter database access everywhere you'll have many code to update let a bug happen
It could be 1+N, but people chose to call it N+1.
I'm not saying to make a full lib for database transactions, but keep everything centralized
or at least CRUD ops
No nestjs
I can't think of an easy way to model a centralized manager without resulting in an ORM design. SQL databases, for example, are already high-level, declarative abstractions. Though an example may help.
What I've done in my project is store the query in a separate file (which can be reused) and make the database query in the API call.
Just use an orm 
I don't like ORMs.
still, it'll become unbearable to debug or refactor once your code becomes big enough
I use am orm cause it makes my life easier in the long run
It may actually do the opposite
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
don't use that framework. they use annotations which were rejected from ecmaacript for good reason
that framework uses an invalid version of javascript
into the trash
What
Those are called Decorators hun
those are not valid in javascript
They're using TypeScript.
Nestjs is primarily used in typescript
Decorators are a type of annotation
You aren't the sharpest tool in the shed are ya
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
garbage script
ecmascript chose to reject annotations for a reason
ts people dont like reasons
What
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.
why cant typescript follow the rules?
Abstraction is a wonderful yet ruthless weapon.
international standards exist for a reason
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.
they like their caveman stick
stick good
you can poke thing with stick
make thing ouch
May I interest you in some ClojureScript
oh no
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
Samuel George Morton (January 26, 1799 – May 15, 1851) was an American physician, natural scientist, and writer who argued against the single creation story of the Bible, monogenism, instead supporting a theory of multiple racial creations, polygenism.
He was a prolific writer of books on various subjects from 1823 to 1851. He wrote Geological ...
is that your buddy?
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
annotations are existent in a lot of languages
const member = await msg.guild.members.fetch({user:userId})
const dmChannel = await member.createDM()
there's nothing wrong with TS using them
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
d.js caching horrifies me
Why wouldn't message.author.send not work
im getting the ID from the first mention
On any shard the author of the message should still be the same no?
i use tim's djs library
Also what if the user who sent the message was not registered on the shard the code was running on
Then how would the message be valid without an author
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?
But im not getting the author, im sending the message to who I ping first
^
how?
replying on the cache is a bad idea
But fetching them from the api directly is a better option since the cache for whatever reason doesn't always get filled
because cache is not reliable in the event the user event updates
fetch works as if its in the cache it will get it from there
else it wil lfetch directly from the api
pretty sure its the latter route you take
you should only be using cache imo for things that you are trying to check doesn't change
how do i send a DM in the dmChannel that is created?
i cache the custom prefixes for bot commands so i dont kill my db
When you create the dm channel just use it to send a message
that's just a boolean parameter asking if you want to cache it
dmChannel.send("")
that is what i thoughht
I am talking about its description
i know, just extending on the definition so Infinity knows
did you try it..?
Obtains a user from Discord, or the user cache if its already available
put that in try/catch so that it doesn't crash
It tries to fetch from the cache first if it doesn't exist it fetches from the api
discordjs thinks it's a good idea to throw an error when it cant fetch a user

and yes
That is exactly what it should do tf
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

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
I forget finally is even a thing
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
Ah
it's like the "final" state of an operation as the name suggests
Gotcha
i dont like having to write code in the catch block that is normal code
its erroring
forces you into two different scopes
show us your traceback stack
Error: Value for argument "documentPath" is not a valid resource path. Path must be a non-empty string.
is that the whole error traceback?
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
ah thank you, that's more specific
how are you liking firestore?
How can I remove something from a database if it does not exist :)
I like it alot
Its easier and faster
Better than mongo
;)
Firestore is bleh
6/10
Most of googles products are a bit bleh
True
Right
i used it once
because mongo was made for lightweight database management
mongo is too expensive
Postgres + prisma or typeorm is pog
and mongo is also fucking stupid
you see
API calls are significantly easier to remember
i prefer nosql database packages
mongo is if you dont want to think about how to store your data
because anything with SQL makes my head retract inside my neck
fl0w what db do you use
for my projects?
wait, yall are forgetting about JSON
Yea
TinyDB
the god of storage
TinyDB?
its a JSON NoSQL DB library for Python
Oh right
you are mainly a python user no?
i'm mainly a PHP user
dynamodb is a nosql database that tries to be as annoying as rds databases
My stack is PHP, Python, JS and C#
but it's free
I thought it interesting but a good bit of people convinced me not to learn it
So like 2 people?
if you learn PHP, learn PHP 8
My stack is Kotlin, TS, JS, and C#
Kotlin's a pretty nice language
What's a "stack" in this context
a set of languages you commonly work with
now to apply it 5000 more times
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
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
I was going to look for a job for the summer
but I don't know
I hate writing resumes
also small flex but
If you're in school, see if your school has options
I'm working for the IT department at my school
oh cool you're the guy who helped me with some Rust stuff
hey fl0w how do i get guild members but NOT from the cache
fetch
fetch
im working on it
use partials + fetch
always fetch directly for something not from the cache
ok
don't let the elites tell you otherwise
partials + fetch pog
fetch is the based way
the elites tell you to fetch
At least that is what everyone from the d.js told me to do
nah
use partials + fetch
seen some d.js coders go
its the only way
LMAO
Discord.js isn't that bad
It is and it isn't
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?
tim's verison isn't that bad
java is pretty bad
Agree
how?
Kotlin is way better
Java is still pretty good
Java is alright
kotlin is trying, but java is just so bad
the only sucky thing is compiling with JVM
but kotlin is better
it's a lost cause
plenty of companies still deploy it as their backend language
but Rust is slowly replacing Java
No it's not.
You simplistic minded fool
that was decided in 1995
it is
Rust and Java have separate objectives.
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
ofc they have separate objectives, they're intentionally designed differently on the fundamental aspect
Rust is popular and growing (I use it often), but Rust is not the reason Java is losing popularity all of a sudden.
it's a good contributor to it though
I never said Rust was the only language replacing Java
some JS frameworks are contributing to that as well
i hate js right now
It's really an ecosystem of tools and technologies I'm trying to say
but even with that
I doubt Java is losing all that much popularity.
Oh java will run until the end of time its just that kind of lang
remember when Java tried to replace JavaScript in the browser and failed horribly
i don't really think there are any specific technologies, but more so languages leading to Java's downfall
I think java will not die out completely for years to come
it won't
It'll take a long time before Java dies out.
Java is on the same page with that as PHP is
both languages are going to take a long time to die
they are dead to me
Plus, with languages like Kotlin and Scala running on the JVM, they're bundled with that Java ecosystem
PHP is probably closer to dying right now than Java is
and they're still long shots away from that
Actually it was the inverse
Kotlin and Scala are just to give Java developers a taste of some absolutely needed features.
And, in return, they enter Java's science experiment and further contribute to the ecosystem
Javascript came as a client side script to be the middleman between browser and Java
Though, if you guys really want to measure languages, you should check out Stackoverflow's annual surveys (https://insights.stackoverflow.com/survey/2020#technology-most-loved-dreaded-and-wanted-languages-wanted)
I could also write AI in C but no one would do that except for Google maybe
You can write ai in any lang
Python is overrated tbf
All it has is very easy IO operations
message.guild.channels.fetch is not a function how do i fix this
And is very high level
any language is really the point. Sadly too many people try to dismiss tools and technologies just because of what it's associated with
You shouldn't need to fetch a channel.
ai is awesome
just not really programming
dont change
Ai is programming
Even making a web page is programming
Someone has to find tune the ai
And someone has to develop it
It's probably up there because their employers won't move to modern approaches or can't bother
Perl is too new
Perl likes to use all the symbols on the keyboard and have them all mean different things in different scopes
That's the issue
Well, relatively
I might be mistaking langs then
the newest language that came out is TS
microsoft messed up on that one
I am kinda wondering what I should be working on rn
learn clojure
No thanks
sadge
Learn groovy
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
how about trying something other than a bot
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
A CLI? A web server (backend and frontened)?
What lang u used for your bot?
Typescript
CLI is just some sysadmin shit
and i cant be assed to bother learning different CLIs
"learning"?
microsoft made typescript for internet explorer 7
Hm, what about making a text-to-jsfuck converter?
That doesn't sound interesting at all
I wanna do something fun
a cli is cool
![]+[] = "false"
no, I criticize people who are making CLIs for very small-scaled development
Doesn't seem worthwhile
because it's a weight to me to personally use different CLIs for numerous purposes
I wanna do something that will be fun and useful
It's usually for learning/convenience. Just like writing a bot.
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
It really depends on the target user
i'd be the perfect candidate of who to not look for when working in an office
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
there's a difference between making something for understanding why it works and understanding its fundamentals over doing it purely for small tasks
As long as the CLI is of use to a target market, it shouldn't matter if it's for completing "small tasks".
does anyone know how to create a website on a .tk domain? or .mu
You can't really own a tk domain
.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
I didn't ask for information if I own or not I just want to know how to create a website
Won't work for most dynamic webs, not for tk
Best source is to google how to create a website
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
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>```
Hosting somewhere doesn’t automatically result in a dynamic IP
There are tons of free web space hosters
Combined with the free TLD …
They work by not making one since that's against discord tos
I don't mean that
Like, idk how to explain
Oh
But really, freenom is very shitty
I just came to know how to make that type <body> test </body> appear on the site.
Hmmm, you mean the base html structure
Wtf
If you just came here to get to know that you should think about actually ask exactly what ur looking for
<html>
<head>
preload stuff
</head>
<body>
visible stuff
</body>
</html>
Well, he said he just learnt how to show a text on body
Yeah 
Hey is there a way to get the top voted users in an html leaderboard
<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
how make message that bot send message in discord server when this happen
pls any one help
Catch the error using a try catch statement
i mean
how make a message
when user cnt give
permission
Hii
Yes, catch the error and send a message
so bot reply
yup
ok wait
i send one thing
it is work
i make it now
is it work
i just make i t
is it right
Only way to find out is to try it
no
error comes
can you come in dms @plain talon pls
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
Read your errors and they may tell you
cn i share my codes in dms
to you
(/home/container/commands/connect.js:18:5) Go look at this line
I don’t develop in discord js so I can’t help you other than basic language common sense
Somewhere on that line you're not defining error
you know djs
tbh, it not really djs error, it is basic js error
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
just comes in dms
dude
accept request
NO
BIG NO
i need show some thing
this is the reason they're on my block list
I disabled dm on any server I join mostly, wih all the ads and scams and well...
I disabled dms on all servers
Then friend requested some mods
Bryh
I want to evaporate from my bed after reading that
???
Anyone
Why is the role name some random shit

Try adding role id
Pls help me
Try having an iframe on your page that points to a page on your server and your server will send the raw html
Wdym
how can I grab the id on every server like 134 guilds use it
Oh
I am actually finding this on yt and google but could not find anything
@gaunt ermine is the leaderboard on the bot description?
No
or are you using it somewhere else
oh
This method might work on the bot page too:
Ok...
can someone help me?
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
i really didnt understand what your question was
you said why it's adding a role to you when you run member.roles.add
Still did not understand
I'm trying to give a member the mute role I did milmute @/user test it gave it to me
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
@earnest phoenix
In your leaderboard you need to setup an http server that sends the leaderboard data
Start the server:
const express = require("express");
const app = express();
Exactly
So but how do i get votes and set them in a leaderboard
All that stuff happens on the server
How
ummm
Can u show like this
so are you trying to put it on a bot?
anyways after you figure it out you should listen to a route ("/some/stuff/after/.com") and respond with the html





