#development
1 messages ¡ Page 2002 of 1
What do you mean by shift enter?
Your paragraph elements have a margin by default
You gotta remove the break entirely
Or remove the margin of your paragraph element
Or remove the paragraph element around your name
I didn't understand.
aa
<p>
i see what you're trying to do
aka paragraph
Why do you want me to remove the paragraph element around my name?
as in for the individual title or the text? if the text that absolutely contradicts what i've been told by other people lll
they do?
How about <p>Regards<br />Mohammad Hajjiri</p>?
-->TAG <p> TAG <-- Your Name --> TAG </p> TAG <--
Does also work
Let me try.
That only creates one line break
This doesn't feel aligned
The title.
it's more aligned in the entire page but sure we can wing it
I thought you wanted that ignored
got'em
you can also change line height.
that is better to do, imo
Hey guys, someone know how get file input (html) with Ajax?
Explain further, please
How so, as I found the document online. 
Okok, so i have a forms in HTML and i don't want use PHP but with Jquery and Ajax i get the value put by the user (serialize) but i can't get the file
Yep
I need to get the file to push him in specific folder
( i have php file in my Ajax url)
$.ajax(
{
url: "/dir/my_destination",
method: "GET", // or POST
cache: false,
data: { field1: element.value.of.your.form.field1, field2: ... }
});
Which should be triggered by submitting the form
And if you don't wanna send the user to a different site, dont define an action attribute in your form tag and/or use element.preventDefault() on your submit button
well using PHP, POST makes more sense here
even if it doesn't really matter
Well you need to refresh the page
You can POST the request to your PHP file which handles the call, then returns the result for you
You can fetch the request result when using the ajax request
one second
Yes i know its because a big part of my front end is made with Ajax like getting generate forms etc to put them in the same page
I would rather use PHP to validate forms on the server side than JS on the client side
no, i wanted that commented on, i wanted the emojis ignored
You can use a callback function to get a response from your PHP file when validing your POST data
At the beginning i was using PHP but its because i can't get back to my forms if it is not valid so i tried to use Ajax but i got the problem to get my file and send it in post request with Ajax
$.ajax(
{
...,
success: function(data)
{
// data is your response
}
});
Also sorry i'm very bad in English 
For example validate your input via. PHP then return it as JSON back to your ajax request
Of course you.
You put the validation code on the same site your form is
And
Selfphp
As form field value, your $_POST['field']
Yes but it will refresh the page no?
When hitting the submit button, yes, as that's the default html behavior
Mmh
I don't see any issue with that
I don't need to get back the data after they go in the php file
I use this file to edit my CSV
Ok well, no problem then
So i just need to get a "Result" to know if its ok or not
Then do the ajax request as I wrote above, and edit the CSV with your PHP code
I mean you need to validate the input in any way
But not and never on the client side
Okok i'll try when i get back home
Yes i don't want validate on the client side
Just get the data from the input txt/file to put them in Ajax post
how do i blur background?body { background-color:#181818; background-image: url('/static/dababy.png'); background-repeat: no-repeat; background-attachment: fixed; background-size: cover; background-position: center; filter: blur(8px); }
Anyone here using RoundCube?
yes
Hai. 
I have made an email template, and I used it on my RoundCube by inputting the source code. The HTML Template applied, I was able to edit it and send it to a test email.
Although, I thought I was going to see the template when I read it from my, Gmail, supposedly, but no, I receive it raw?
Well, that's great. Look at that. đ
I'm confused on why it's behaving like this, though?
I personally prefer RainLoop as it's not so over loaded
I thought it was a RoundCube issue, but it sent fine?
https://images-ext-2.discordapp.net/external/DYc51tzPGOc3FQ_QpdQxeWUz8ShxpKn_c9XQMTwBxvc/https/cdn.hamoodihajjiri.com/fy7TUX3Ct3.png?width=1920&height=766
That will blur the entire site
Fair enough, I use RoundCube since I have experience with it.
You need to put a container, blurred, in the background
Why not just automatically forward it
Pardon???
Means you can blur your image but need to have something in the foreground, another container using a fixed or absolute position
Unless I misunderstood it
Which is tbh shitty to build an entire site on
I'm not sure about RoundCube but it also be able to enfore plain text, html and/or plain text/HTML
Well, it's the same code that I sent like a few minutes ago?
Receving the html email as plain text on gmail. :/
it does not do the background
not sure if you have to enable the texteditor to send html
I had to enable to enforce HTML
That's what I did.
I sent it like this but why am I receiving it as plain text on Gmail?
anyone know how to disable all restrictions on a nginx server? i have a share x cdn and images upload kinda slow even though the vps is under load i know that there are restrictions to nginx servers but i canât find them? if anyone knows thatâll be very helpful thanks
Oh oh discord is dying
not again
Well then just take a look at the plain email file (eml) if that's possible on GMAIL
If it contains your html code
Yes, it did contain my HTML code.
well then it doesn't accept the formatting somehow
Well
that's the issue
html email builders all respect specific limitations and general compatibility with tons of known mail providers and how they parse your code
I also learned the hard way html != common html code when used to format emails
So many mail client simply don't wanna show your entire code or got issues with it
Oh, that's unfortunate.
im trying try code something that when someone joins the server the bot sends a welcome message. I looked all over youtube and none of them are working so if anyone has a code that they can give me please message me or reply back to this
You would want to do something like
Client.on('guildMemberAdd', () => {
// code here
})```
You would want to add that code wither in your event handler or index file
i put it in my index
awesome
but would it be like this
// code here
})```
yes, then member would be the new member
possible if you could send the code. i been searching for like 2 hours and i am tired of it rn
You can use the send() method on the guild member object directly
member.send(...);
(which will be a direct message)
Using filesync, how would I convert an image? I receive the file type .webm, but I want to convert it to .png.
const streamPipeline = util.promisify(nodeStream.pipeline);
const response = await fetch(res.image); // Returns .webm image.
await streamPipeline(response.body, fs.createWriteStream(`./handlers/wallpaper/images/${fileName}.png`)); // Want to convert to .png
canvas?
[
{
"id": "827863ce-4f6a-4c72-904b-ac59b53bf855",
"title": "Testing",
"description": "Testing",
"createdAt": "1647401057578",
"updatedAt": null
},
{
"id": "46d5d73c-c01d-49d3-a65a-3e6e893bee5c",
"title": "Test",
"description": "Testing",
"createdAt": "1647458046045",
"updatedAt": null
}
]
Say I have this as a return value. I want to remove updatedAt from the final value that gets returned
How could I?
await this.bookService.fetchBooks(userId); returns an array of Books
You gotta loop through the array (or map it my gosh) and delete the object key "updatedAt"
Mmm
aka use the delete keyword
aye
though it would be better if you could write a query and just not include updatedAt
I mean, why bother deleting the key in the first place
probably because it's easier to do getById(id) and remove it
I just want to know for future reference ngl. I don't want to get rid of updatedAt but there will be some info on certain things that I wont wanna return
for(const object of array) delete object["updatedAt"]
before return the array
or mapping it
or whatever
there're always 1000 ways to do it
let a = [] //your array
let b = a.map(x => {
delete x.updatedAt
return x
})
I see thanks for the responses :)
could be both
also, keep in mind that the above method mutates the original objects, so only use it if you're not gonna need the originals anywhere else
I'm making a function to get the @{value} from a string, but if there is more than 1 @{value} in the string,
the replace method returns everything together
const string = `@{author}, Prefix changed to: @{prefix}`
const objects = {
author: await thebrozy.users.fetch(userId),
prefix: await thebrozy.galactic.getPrefix(guildId)
}
const pattern = /@{([\w\W]+?)}/g
const resulted = (number) => result.data.text.match(pattern).map((value) => value.match(/@{([\w\W]+?)}/)[number])
const objectValue = resulted(1).map((value) => objects[value])
your code seems to work fine, what is the problem?
prolly just showing it off?
I'm using the replace method to replace the values ââin the string but when it has more than one value it returns me all together
show the replace code then?
I just passed the value in replace, I couldn't think of a method to separate them
return:
@{author}
@{prefix}
str = `@{author}, Prefix changed to: @{prefix}`;
obj = { author: 10, prefix: 20 };
str.match(/@{([\w\W]+?)}/g).reduce((a, t) => a.replace(t, obj[t.match(/@{([\w\W]+?)}/)[1]]), str)
in this case its better to use matchAll
Tim benchmarking again...
im not actually benchmarking this, just testing regex replacing capabilities
although i should benchmark it as well, thx for reminding me

surprisingly
the first method is the fastest
calling match and replace multiple times is faster than calling matchAll or replaceAll
perhaps it will be a different story if you wanna match more than just 2 things
eh im fine
you're sure? 
And I wonder why I can't reach half of the internet
[i] Number of gravity domains: 34082611 (26080070 unique domains)
who cares about russia or north korea or china when you can censor your own internet at home :^)
well tbh nah I'm only adding known ad lists, malware, spyware, logger, metric shit etc.
I'm actually fine
But the advantage here is the network wide block
I mean most devices as smart TVs and phones don't have the possibilty to
...not even to speak about all the IoT devices
I don't see any reason calling that paranoid if you just block any possible source from tracking you in any way<
you have some work to put in if you want to pass china
99% of the internet blocked there, pump up those numbers
I think I'll put 10
mogus
sugom
balls?
@sly sierra knows all about them
bro is he still muted
bros been silently muted for 2 years instead of 2 weeks
I assume this isn't possible, but can a Discord bot start a screenshare and play a video via a stream or smth?
how to fix (413) Payload Too Large
(413) Payload Too Large
Headers:
Transfer-Encoding: chunked
Connection: keep-alive
CF-Ray: 6ed11ee8fd737495-LHR
CF-Cache-Status: DYNAMIC
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=8D0M92N04fOYC%2Fz6j%2FvuTtLb0cDc%2FfeGLPM3PLbt8z4DQ0mutDfL2J8fo%2F28eHvb20Njiwm%2BbfQmg7xiORtLwQrPNLxK%2BJGFEEbOPpF1qPdbtvDCze0ON8k1RkpFltfU11v0"}],"group":"cf-nel","max_age":604800}
NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
Content-Type: text/html
Date: Wed, 16 Mar 2022 23:03:12 GMT
Server: cloudflare
Response text:
<html>
<head><title>413 Request Entity Too Large</title><script src="/cdn-cgi/apps/head/-TgT7DBXLPVT8ciOa_7Hul5r85A.js"></script></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx/1.18.0 (Ubuntu)</center>
</body>
</html>
Cloudflare error go fix there
Has nothing to do with bot
I can still ask here 
I didn't say you couldn't. I was informing you that it has nothing to do with the bot
What bot??
Any bot.
This channel isn't specifically for bot development

There's ur hint
i know its an nginx issue
Nginx entity too large. Google
i'm just asking here because i know there are a lot of nginx pros here
Do not assume that users have not already googled their question. If they are asking here, it is likely because they were unable to find a helpful answer via Google. Telling someone to âGoogle itâ is unhelpful and rude.
hint: pins
@spark flint client_max_body_size 500M;
No
No
went for upload_max_filesize = 500M, that should work?
Well actually
500M is a rather unsafe limit
nah unless they add it in v14
i dont really know that will work but i use the one that i sent
500M is 0.5G, you could send 4 requests and you're potentially able to hit the sever with 2gb of body to process
ikr i sometimes upload big video to my sharex server 
there really isn't a point to screenshare something anyways since YouTube is taking down bots that upload and download content

thats exactly my use case
people were being hit with 413s when uploading
ah
500MB image and video is quite big
true
If you're going to have it that high make surs to reduce your max concurrency
Hi takii 
Cuz i doubt you're running on a system capable of handling 1024 * 500M * n_cores worth of uploads
https://capy-cdn.xyz/bVUrhSn9.png running on that
So no
mf disabling emitter memory leak warnings
yes
Just because you dont often doesn't mean you shouldn't worry
Somone uploading hundreds 0.5GB images will cause you all sorts of pain
yeah i dont do that often, but just in case i need it
There arenât any evil people on the internet
Aight thats what i thought. ty
hello. when i try to get my bots token it only says 'reset token' and not reveal token. I've been trying to get back into making bots but I'm really confused. I have a screenshot of the problem aswell. Thank you :))
discord removed the option to view tokens
the only way to view the token is to reset it
ohhhh okay. thank you.
more like a "follow what everyone else is doing" change but whatever
poggggg
jus added ogging lels
logging*
though i think i may have messed up lol shouldn't say active
feautures yes
You had time since yesterday night to move to slash commands.
Why nothing happened

uh cs voltrex is coding it for me lol
look at pog tree
branch*
Ahh Voltrex is lazy
He ainât doing shit
I mean facts
@earnest phoenix u lazy smelly boi

not like there gonna-
oh wait they are gonna disable v12 
probably won't become depreciated until may or april
it is better than before though
no 3.1k line index.js 
30th of April
So 1st may is the deadline
yep
it'll be done by then though :)
also cs youtube is being a meanie i'm currently making an api wrapper for spotify's api so you can use it with the same functionality as ytdl core

https://sourceb.in/dk1eTcSJxg why the amount keeps adding on wallet after js if(deposit > data.wallet) { return message.channel.send(`You don't have enough $ to deposit this amount.`) } triggered?
yes
because your if statement is inside a callback where you already increment the wallet
you should check it before your findOneAndUpdate
bruh
errrm
ah shit sorry for the ping
i can put .findOne and .findOneAndUpdate in one command right?
yes
oh make sense thanks!
np, fyi, this thing should work
let data = findone here
if(deposit > data.wallet) do your thing
data.wallet -= deposit
data.bank += deposit
await data.save()
your thing again
Hey Guys, best python library for discord bots?
pycord, nextcord, hikari, discord.py, etc.
they're all fine but have slightly different functions
pycord and nextcord are hard to distinguish, so either one could go, but you could pick pycord since it's more popular, or nextcord since the people in it aren't so big douchebags
hikari seems to target itself towards "more experienced devs" especially with its opinionated design
and discord.py is the original most popular discord python library, but it went in maintenance for a few months, which is why the other three are popular
it's back though, so it's a candidate
we gotta be careful now - No language / library wars - anyone involved will be muted. 
If you just want a bot, pick pycord
If you're fine waiting a bit longer, wait for Discord.py's big release.
Until the next drama comes over the maintainer (douche)
Being throwing the library away for another year
they are douchey though
fighting over the discord namespace instead of using your damn library name
oh no, what if we call it pycordâthe user will never remember!
Well branding is everything nowadays
Ask a fucking men living in the bush of Africa without any connection to the outer world
He will know what Coca Cola is
because all they're good at is advertising and giving you diabetes
Is there any good API's I can upload videos to and receive an embed of the video?
imgur would work
I mean specifically for large videos around 200-500mb
hi
is there any documents for using all as depositing/withdrawing all coins at once?
data.bank += data.wallet
data.wallet = 0
why do people complicate currency systems with banks and wallets
those are usually paid, data is expensive
because no one would want to use it otherwise
currency systems suck enough already
Ah. Yea that does make sense. Oh well; nvm then.
Donât forget the pay rent 
if thatâs actually the right term
just exploring some more with my bot xd
pycord
should i use .includes in this one?
nah i dont thing you need that
think*
smh
or um uhhh
haaaaaa
lol wrong one
painz
Thereâs always a reason to complain about something!
i wanna make among us discord bot
i am
or should i use collection?
can you come to my replit and code the rest i've done client.run()
you code the rest of amogus code pls
brah
Because they wanna have the affect of having money on you and money not on you
For some damn reason
that's a good thing
^that's-
what
what what
sarcastic lmao
tf
damn fake do be searching for that anime pfp
yes
nsfw false positive?
whaa-
Tried already
oh
discord app deletion now
skill issue
Yo ppl so do you wanna do all the commands like using slash or like old styled way with prefix is a good idea
Slash commands will basically replace the old style soon anyway
discord now disallow bot to use prefix command so want or not, slash command
Unless you're rolling with a private bot
^ too
Ion like slash commands đđĽš
ye
when editing a message my bot sends, is it possible to remove content from the message without deleting the message?
like, i want to keep embeds etc, but remove the text content ~ is there a way? đ
i think you cant remove the text but you can make it invisible
** ** or \u200b works fine
ahh yea, i did consider maybe using a \u200b, but hadnt tried that out
i've used that before for empty embed fields đ
ye
what is it, a zero width space or something?
how about {content: null}?
threw error đ
f
content must be a string error?
non empty string
ic
Sure just edit the message with only the embed
You donât need to specify any content
The entire message will be overwritten with your new message
when i try that, the previous content doesnt get removed
wth
the edited is annoy
yea, same thing with components afaik
omg wth, now its letting me send null as the content đ

Well that doesnât work
^ i tried earlier within an interaction handler lol
Thereâs nothing left
oh, hmm, yea that could be it lmao
yea, using a zero width space thing works fine though ~ still shows little edited message đ
Why tf do you wanna let an empty message left?
i have a slash command that creates a little dropdown(up?) menu thingy, for a user to select which item to buy, then i have a confirmation embed appear which they can respond to
so i wanted my reply to the initial interaction to vanish when the confirmation prompt appears
for some reason im not able to get my logic working while only editing the initial slash interaction response
no way to delete an interaction response?
Why donât you simply replace the initial response with your confirmation embed?
so it involves two messages, the initial slash one, and then the one i send
because i need them to select an item based on their current progression
The second one is a followUp message
like, i dont want them to select handgun if they own it already
But you can also append that confirmation embed to your initial response
To not have to use the follow up message
Exactly
i mean, i cant embed that to my initial response if i need to wait on user input?
After that confirmation you could edit the response again showing your select menu again with some content: âwanna buy another item?â
oh yea, surprisingly editing a message my bot initially sends isnt an issue ~ i have multiple minigames around it
but when it comes to editing an interaction response, idk, i struggle for some reason. i keep hitting random issues lol
lol, tyt đ
I'm trying to get the access token from OneDrive API. However, the result is constantly undefined or I get a 406 error saying, "Not JSON compatible." I'm extremely confused since I've tried both getting a client secret from either https://developer.microsoft.com and the Azure portal, but putting neither of those credentials works.
https://sourceb.in/3kv3tWSY4X
EDIT: oops that was a lot of code. mb put it in a bin
never messed with onedrive im afraid đŚ
nw
As long as you donât try to edit ephemeral messages, I donât see any kind of issues you can run into
I mean if your bot has the required permission you can still handle the webhook as response as normal channeled message you can freely edit and do whatever you want with it
yea im looking into it more because im obviously doing something wrong lol
I donât even got what issue you have based on your screenshot
Any time an user triggers an interaction on your edited (initial) response you will automatically get the webhook ID (again) when receiving the event
And if im not wrong here messages can be edited forever
Iâm sure the same goes for webhooks
But no guarantee on that
yea, but the issue is more, that i have to respond to the second interaction (when they select a menu item) which doesnt seem to allow editing of the initial message at that point
but im likely just being a moron đ
Well of course it should
thats what happens if i try to edit the initial interaction. because the interaction of the menu selection technically isnt being responded to
it just hangs etc
im sure its just me being dumb and getting confuzed in between the listeners somewhere
djs Right?
lol yea
that is the shortest code for any actual menu selection event handling
brb
lol no worries đ
^ part of the buyEquip handler
which is where the issue lies really ~ cause im updating the interaction but then having to trigger a new message for the confirmation, rather than being able to edit the interaction reply with the request confirmation data
So in your collector, you gonna edit the initial reply
Which fails
Since I donât see you deferred the initial reply
no defer, but an initial reply with content is sent
which contains the menu components
Doesnât matter the initial response is your select menu, isnât it?
yea
Well then you need to defer the interaction if you wanna edit the reply ever again after 3s
but i can respond to that fine, i just cant keep editing it after that first response lol
ahh yea, so if i defer it, would i be able to edit it numerous times?
You can edit the reply as much as you like to
Until 15 mins are over
Keep in mind you canât use reply() then anymore
As deferring is sort of a reply already
interaction reply system is confusing
You need to use the editReply() method then
yea, im testing things out atm to see how that goes đ
Tbh actually itâs not, only deferring being threatened as initial reply is totally bullshit
But the âbot is thinkingâ message acts as reply
i like that you can fetch defered replies
i use it to have a ping message without '(edited)' being visible đ
thatlookscool
Why would you edit it in the first place?
to get latency between when message is initially sent and interaction was created
usually how folks measure a bots response latency
yea, but normally folks bot's ping command has an edited text on it đ
The first editReply() doesnât cause a edited note
Funny and nonsense since Discord handles the deferring as first reply
i wish you could customize defer message đ
So it should be in theory cause an edited state but it doesnât
Customizing in which way?
idk Botname is checking the market or Botname is calling your mom, please wait...
something to give individuality to your bot
could be the same for all 'defers' your bot makes, or sent as content when defering the reply
While I agree on that you can simply send that text as message and edit the response later
But yeah itâs not the same
Thatâs actually not the worst idea
With some limited content you can pass like max 100 chars like descriptions
Open a ticket and request that
It might be implemented in the next 5-10y
Idk either but google is your friend
And largest enemy regarding tracking your entire being
To earn cash with that info
You can only dream of
kinda neutral
aww wth, they want me to sign in, idk my password đ

then remember it 
Letâs hope you never logout accidentally
nah, thats what password managers are for
but its a different url, so its not auto completing it
and clicking ito my vault is like: lvl5 hasstle
Canât you manually select a saved one then to autocomplete?
fml ,its telling me my password is wrong now lol
ok fk this site
two accounts its telling me are wrong details
totally a phishing page! đ
Then open a ticket to reset your password
lmfao
So I am making a post request to create some stuff in my database but I feel this is way too slow of a response.
2.33s?
It shouldn't take almost 3s should it?
howw much are you creating? and what db type?
are you able to calculate time between receiving and processing the request?
You still wouldnât know how long the database has needed
If the response only happens when the database is done
Well idk how helpful this is but postman tells me the network flow of the request.
that transfer start time seems to be a concern đ
It is leading me to believe it is a code issue that is slowing it down
whats that app
postman i think
hmm
But I have removed a good bit of useless checks and logic but it still hasn't gone down
On a server

are you, within your request, connecting to the database, or is a connection already established previously?
You should log the incoming request timestamp and when the response happened
The connection is already established
In the code processing your database request
const start = Date.now();
// do junkz
const duration = Date.now() - start;
console.log('duration:', duration);
``` something like that is probably enough, or you could use the console timer functions
Is the code processing your incoming request on the server your database is running on?
Or externally with an opened connection to the database?
I have a ssh tunnel open so I can connect from my local machine
so your local machine is sending the requests to the db server?
still shouldnt be 2s+ tho
actually one sec
724
If feel like the code handling your incoming request and database call might be the issue
I highly doubt the database can take that long
one reason i love docker: its super easy to have your projects db/website/bot/whatever all running on the same machine without actually having to install and manage each thing đ
and also super easy to go from development -> deployment
Yea I just don't know where it is possibly causing such a issue
what does your db call do?
Simply just does an INSERT
Single insert yes
thats pretty grizzly
Which is why I am confused why it is taking 2s+
You could do basically what dekita said, but between a few code lines just to see the differences in time between some code
already did that
I'm saying like
time = Date.now()
//code
//code
console.log(ms for this chunk)
//code
//code
//another log ect.
Can you log the time like you did before on that part of the code, too?
date.now()
Incoming request
date.now() log difference
date.now()
database call
date.now() log difference
console.time(label);
console.timeLog(label);
console.timeEnd(label);
^ logs different in ms between console.time calls with the same labels
How do you actually know the database call was successful?
Do you return a value for your database query?
Wasn't there a precision function for exactly such needs?
performance.now()?
@UseGuards(ApiGuard)
@Post('/')
async createBook(
@Body() createBookDto: CreateBookDto,
@Res() res: Response,
@UserSession() session,
) {
const userId = Buffer.from(
session.token.split('.')[0],
'base64',
).toString();
await this.bookService.createBook(userId, createBookDto);
return res.status(201).send({
message: 'Successfully created book',
});
}
I return status 201 and then send a json response
Ye
I did that all wrong tho logging the time
It didn't work anyway it just returned 0 and 730
I will get on that later if you havenât figured it out
ight
what does the createBook function do?
https://hatebin.com/twjqzqkpqq
this is the entire database call it makes when creating books
async createBook(userId: string, data: CreateBookDto) {
return await this.bookRepository.save({
id: randomUUID(),
title: data.title,
description: data.description,
user: { id: userId },
isNsfw: data.isNsfw,
});
}
dang, those are some lengthy sql queries đ
Ikr
this is just to get specific properties from your data table right?
its been a while since i sql'd đ
I don't really know why it queries the BookEntity table tbh
But it should query the UserEntity table as the api guard I have does so to make sure the token they have in their session is valid
if not it rejects the request
Cause if they don't have a valid token they can't request to the api
like, normally i would do that logic in the api handling logic before doing the db query
if (!validuser) gtfo()
import {
CanActivate,
ExecutionContext,
Injectable,
UnauthorizedException,
} from '@nestjs/common';
import { UserEntity } from '../../database/user.entity';
@Injectable()
export class ApiGuard implements CanActivate {
async canActivate(ctx: ExecutionContext): Promise<boolean> {
const request = ctx.switchToHttp().getRequest();
if (!request.session.user)
throw new UnauthorizedException('You are not logged in.');
let token = request.session.user.token;
const id = Buffer.from(token.split('.')[0], 'base64').toString();
const user = await UserEntity.findOne({ where: { id } });
if (!user) return false;
if (user.token !== token)
throw new UnauthorizedException('Invalid token was provided in request.');
return true;
}
}
I mean this is essentially what I do
I first check if they even have a user attached to the session if not they havent logged in. Then I get the token then decode the id from it then query the user table for it if the user doesn't exist reject the request and if the user token doesn't match the token in the session then reject as well
I could probably do this a better way but I can't think of one as of rn
hmm, are you using a node express server?
I am using nestjs which is a webframework that uses express under the hood
ahh ok, not familiar with that but i have heard its name being throwwn around lately đ
normally for login type things, i use the passport middleware for express, and that handles serialization/deserialization of user sessions/tokens etc for me
I dislike passport so I did my own implementation of it
so im able to just check if a user is logged in for each request
fair enough, its a little cumbersome đ
are clients connecting to the DB?
Ok. Just that code makes it seem like that JS is run by the client
Only the backend ever makes a connection to the db
if the client is connected to the DB directly, you can throw away any protections
ok good
just making sure you arent making a huge mistake
I don't even have any client side stuff done
I worry about stuff!
Yeeee
I am glad you asked tho
I still don't see how it is taking 2s+ to create a book
seems a bit outrageous even if I am connected to the database externally and such
Depends how busy the database is and how complex the statement is and how far away the application is from the db
if its on the same machine/in the same datacenter, no problem
Well the db is hosted on a server and I have an ssh tunnel open
Should I use pools tho?
whats your latency between your pc and that server?
no idea ngl
dns queries can take time if the name isnt cached
yea, but once connected you should get a few pings for seeing
if they all take 2s+, then... well...
lol
roughly 200ms
Are you adding B as the first param, if its not available? Right?
I didnt wanted that, intead I wanted to contrain the B to be the first param.
so 200ms for server reply, and 700ms for your api route to process, thats only like 900 ms lol
1 second right there
1 != 2+
So there is a 1s delay here that is popping up out of narnia
almost 1 second to handle a single route is outrageous
I am probably fucking up majorly somewhere
mans probably got functions like ```js
function isEven(n) {
if (n === 0) return true;
if (n === 1) return false;
return isEven(n - 2);
}
jeez
it takes 2s just to select something
I wonder how some operators work internally like % if it uses recursion

maybe im too tired for this tho
Seems like the entire api is slow asf
hitting a db on another server is really rough
But it shouldn't result in that big of a time delay no?
what are you using for sql anyways
no
I am using typeorm + pg
Im in the U.s while my server is in canada.
dang, way to go for the heart đ
pg is good
mongodb is better
I mean the server is in germany while I am in the us so maybe that could be a problem
I use maria
mongo is not better
But i've never had time issues of this scale before
mongo good
yeah
Every other time i've never had this huge of a problem with the time being over 1-2s
Your database is probably being slammed then
Mmmm
mongo isn't that good
Well typeorm naturally uses pooling iirc so shouldn't that at least be some help?
if using sql, why not use like, sqlite or something that runs locally?
more connections to a database getting stuffed a lot of requests only makes it worse off
cause sqlite sucks
so does your db đ
try running sqlite on an hdd
:^)
long ass queries

tbf, most db on hdd would be slow af compared to almost any db on nvme ssd
wym my sqlite database on my hdd is fast asf boi
u dont like csv?
it is good db
why not roll your own json powered db that parses sql statements? đ
Not for a bunch of rows
Make your own arbitrary format and parser
all of your problems will be your fault
aww, i was hoping for misql
I tried to make my own. Worst mistake ever. Do not try to
misql is also a good name
time to make a project called misql but plot twist it has nothing to do with sql at all
time to uninstall my bios
i havent used my bios in at least 6 months 
mongodb epico
why
is easy and nice
whats wrong
because my pc doesnt sleep ~ when i sleep, its on mining bitcoin and running bots đ
hm
i used to do the bitcoins but
i moved mainly to linux
and nicehash dont really have a miner for it
i think they do?
mining crypto seems pointless to me
they have an os
i use nicehash miner, but they have a full os now im sure
ye
just buy crypto and see if it rises or not
i dont pay the power so its good for me
if it does u good
and i cant buy/sell :/
idm paying the power for the possiblity it might return in the future đ
i also have like 250k shiba inu coins đ
Yea but you'd need more than one machine for it to be profitiable on a large enough scale for it to pay for that 500$ power bill
i might start mining crypto more soon once i get my pi ||and set it up||
:true...:
it actually doesnt use that much depending on your rigs consumption
what miner you use
for the actual gpu usage your talking cents a day
Imagine not running 20 bitcoin miners on the same machine
nicehash quickminer
đ
:how:
kool
just get good
would that even be useful
no
more mining but less mining power
makes sense
you probably wouldn't be able to do jack shit
u'd need a beefy pc
for it to even make sense
and idk if it is even possible to begin with without shit going wrong
ye
doesnt tim have some kinda db thing?
ahh, i was thinking of: https://github.com/timotejroiko/ftset
not quite a db
So I have a command called ${prefix}give the thing is when I picked bank the wallet going to add too.
https://sourceb.in/IGWVDu02SV
eyyyy i got it working the way i wanted â¤ď¸
when i select the item, its properly editing the message with the confirmation embed
and also properly updating on timeout etc đ
fixed
what is this?
wtf are they thinking
HUH?
Please describe the changes this PR makes and why it should be merged:
This PR adds support for the upcoming text in voice feature.
Notable changes:
Voice channels are now text based channels (sur...
fuckers broke my lib because of this
at 2 fucking am
LMAO
even worse, that shit is from 6 months ago
and suddenly they turn it on with no warning
That's Discord for you đ¤Ł
I always hv wondered y can't they allow joining vcs in text channels.
when both the channel share same underline structure
wait wtf
That makes B the first param in all functions inside the object only if the function's first param isn't already B
await DiscordUser.findOneAndUpdate({ discordId: user.discordId }, { $inc: { cips: -price } }, { new: true }, async (err, doc) => {
if (err) return res.send(500, { error: err });
console.log(id)
when i run this it does remove from the price but it removes double the amount
Isn't there a $dec directive?
where is that
Also lmao take a look at what I found https://github.com/DulLabs/bhai-lang
Actually right now, it automatically checks, if the methods in ActionMap has first param of IState. If not it complains.
Thats what I wanted
I'm asking you
i tried dec but it didn't seem to work
i wasn't trying to solve the problem, I just thought it was odd to use $inc -int
What's cips
the thing my website works with
Yeah, it does so by making B the first param in all functions, so it works for you?
How do i use findOneAndUpdate in all member data using 1 command?
yeah, but without that WithState Utility
and I dont want to make B as first param, I want to constrain that. (It should already be there)
Only added to one user? How do I make it as everyone will get the amount when their's have a specific role? here's the full source https://sourceb.in/YMppMM0Jqn
it gets complicated since you haven't stored if a user has the role in your database
but the general idea is to fetch every record (yes your decisions have consequences) then painfully sift through them checking if a user has a specific role
oh to accomplished that i need to store the role too?
u dont need to but that brings it to his 2nd sentences
You can make a claim command that checks if the user got a role n rewards if they do
Automatic seems hard n more resources usage
thats going to another command, but i need to know how to add in other data with specific role too xd
Im lowkey confused lol
since speedy mentioned to use fetch i think ive got any ideas xd
anyone got server leave command code ?
i hab but its only the same with js guildMemberAdd but with js guildMemberRemove
which common parent class does, Document and HTMLElement share?
nvm i found the issue
Does anyone know how to fix this in vsc
node-pre-gyp install --fallback-to-build
Get this error when downloading ```js
@discordjs/opus
Says who? Such FakE news
Go back to being lazy instead of programming anything as usual 
by your car?
No by calling the facts heâs lazy :P
and by your car?
Arrrrrrrrrrg I didnât hit somebody or anything the last 8 hours!!!1!
while I slept so be quiet!!
gn fake
More like good afternoon
damn forgot ppl can sleep anytime
I know it, trust me, we got an insider reporting to us about your daily activities
I sure know that they have no idea I have placed several pipe bombs in your mailbox
woa
You fool, I have already placed those and they will detonate as soon as it's touched after it's set, which I already have and left
There are also several atomic bombs in your car
Damn⌠any common Iranian is a bomb builder
I knew it
Must be a lesson in school
âHow to build bombs to fuck off people in the evil Western worldâ

There's also a lesson to 187.241.75.251
The last 8 hours?????
Hart attack time


hello, 911
Wym I'm hardly ever lazy when coding I just typically don't wanna do it
Copium
copium
hushe
Interesting đ¤
due date is my do date
in your car




