#development

1 messages ¡ Page 2002 of 1

feral aspen
#

It now goes further away?

boreal iron
#

What do you mean by shift enter?

feral aspen
#

Hello shift enter
Hi

#

Instead of

#

Hello

Hi

boreal iron
#

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

feral aspen
#

I didn't understand.

earnest phoenix
#

aa

boreal iron
#

<p>

earnest phoenix
#

i see what you're trying to do

boreal iron
#

aka paragraph

feral aspen
#

Why do you want me to remove the paragraph element around my name?

boreal iron
#

<p style="margin: 0;">Mohammad Hajjiri</p>

#

watch the magic

earnest phoenix
#

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?

feral aspen
boreal iron
#

Does also work

feral aspen
#

Let me try.

boreal iron
#

That only creates one line break

feral aspen
#

Fair enough, I suppose.

#

Yup, it worked.

sudden geyser
earnest phoenix
earnest phoenix
#

what about wordings

sudden geyser
#

I thought you wanted that ignored

boreal iron
#

got'em

rocky hearth
#

that is better to do, imo

boreal iron
#

Doesn't make any sense

#

Your paragraph elements have a margin by default

thorn spruce
#

Hey guys, someone know how get file input (html) with Ajax?

boreal iron
#

Explain further, please

feral aspen
thorn spruce
#

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

boreal iron
#

Ah... you mean you wanna do a POST or GET request

#

When sending your form

thorn spruce
#

Yep

#

I need to get the file to push him in specific folder

#

( i have php file in my Ajax url)

boreal iron
#
$.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

thorn spruce
#

I see

#

I don't use PHP because i don't want the page refresh

boreal iron
#

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

thorn spruce
#

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

boreal iron
#

I would rather use PHP to validate forms on the server side than JS on the client side

earnest phoenix
boreal iron
#

You can use a callback function to get a response from your PHP file when validing your POST data

thorn spruce
#

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

boreal iron
#
$.ajax(
{
  ...,
  success: function(data)
  {
    // data is your response
  }
});
thorn spruce
#

Also sorry i'm very bad in English sad

boreal iron
#

For example validate your input via. PHP then return it as JSON back to your ajax request

boreal iron
#

You put the validation code on the same site your form is

#

And

thorn spruce
#

Selfphp

boreal iron
#

As form field value, your $_POST['field']

thorn spruce
#

Yes but it will refresh the page no?

boreal iron
#

When hitting the submit button, yes, as that's the default html behavior

thorn spruce
#

Mmh

boreal iron
#

I don't see any issue with that

thorn spruce
#

I don't need to get back the data after they go in the php file

#

I use this file to edit my CSV

boreal iron
#

Ok well, no problem then

thorn spruce
#

So i just need to get a "Result" to know if its ok or not

boreal iron
#

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

thorn spruce
#

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

whole glen
#

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); }

feral aspen
#

Anyone here using RoundCube?

spark flint
#

yes

feral aspen
feral aspen
# spark flint yes

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?

spark flint
#

hmm

#

odd

#

i've used before and its worked for me

feral aspen
#

Well, that's great. Look at that. 😂

#

I'm confused on why it's behaving like this, though?

boreal iron
boreal iron
feral aspen
boreal iron
#

You need to put a container, blurred, in the background

sudden geyser
feral aspen
boreal iron
#

Means you can blur your image but need to have something in the foreground, another container using a fixed or absolute position

sudden geyser
#

Unless I misunderstood it

boreal iron
#

Which is tbh shitty to build an entire site on

boreal iron
feral aspen
#

Well, it's the same code that I sent like a few minutes ago?

boreal iron
#

errr explain the issue again, please

#

lol

feral aspen
#

Receving the html email as plain text on gmail. :/

whole glen
boreal iron
#

I had to enable to enforce HTML

feral aspen
#

I sent it like this but why am I receiving it as plain text on Gmail?

boreal iron
feral aspen
quaint rampart
#

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

boreal iron
#

Oh oh discord is dying

feral aspen
quaint rampart
boreal iron
#

Well then just take a look at the plain email file (eml) if that's possible on GMAIL

#

If it contains your html code

feral aspen
#

Like the Show original?

#

Which one?

boreal iron
#

idk I'm not using gmail

#

try it

feral aspen
#

Yes, it did contain my HTML code.

boreal iron
#

well then it doesn't accept the formatting somehow

feral aspen
#

How did RoundCube accept it?

boreal iron
#

idk try a different html email builder

#

I had issues in the past, too

#

tbh

feral aspen
#

I coded it, though. ;-;

#

Wasted so much time.

boreal iron
#

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

feral aspen
#

Oh, that's unfortunate.

earnest phoenix
#

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

earnest phoenix
#

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

boreal iron
#

You can use the send() method on the guild member object directly

#

member.send(...);

#

(which will be a direct message)

simple stump
#

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
lyric mountain
#

canvas?

earnest phoenix
#
[
    {
        "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

boreal iron
#

You gotta loop through the array (or map it my gosh) and delete the object key "updatedAt"

earnest phoenix
#

Mmm

sudden geyser
#

aka use the delete keyword

boreal iron
#

aye

sudden geyser
#

though it would be better if you could write a query and just not include updatedAt

wheat mesa
#

I mean, why bother deleting the key in the first place

sudden geyser
#

probably because it's easier to do getById(id) and remove it

earnest phoenix
#

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

boreal iron
#

before return the array

#

or mapping it

#

or whatever

#

there're always 1000 ways to do it

near stratus
earnest phoenix
#

I see thanks for the responses :)

quartz kindle
sudden geyser
#

could be both

earnest phoenix
#

me personally

#

maybe a bit of both lmao

quartz kindle
thorny flume
#

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])
quartz kindle
#

your code seems to work fine, what is the problem?

earnest phoenix
#

prolly just showing it off?

thorny flume
quartz kindle
#

show the replace code then?

thorny flume
#

return:

@{author}
@{prefix}

quartz kindle
#
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)
thorny flume
#

hm...

#

okay

quartz kindle
#

in this case its better to use matchAll

thorny flume
#

ok

#

I thought it might be the match too

quartz kindle
#

or even better

boreal iron
#

Tim benchmarking again...

quartz kindle
#

im not actually benchmarking this, just testing regex replacing capabilities

#

although i should benchmark it as well, thx for reminding me

boreal iron
quartz kindle
#

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

boreal iron
#

you gotta benchmark that case as well, please

#

because that's what u doing, Sir

quartz kindle
#

eh im fine

boreal iron
#

you're sure? smirk

#

And I wonder why I can't reach half of the internet

#

[i] Number of gravity domains: 34082611 (26080070 unique domains)

quartz kindle
#

paranoid

#

xD

boreal iron
#

guess I added every blocklist on the entire internet

quartz kindle
#

who cares about russia or north korea or china when you can censor your own internet at home :^)

boreal iron
#

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<

sudden geyser
#

you have some work to put in if you want to pass china

#

99% of the internet blocked there, pump up those numbers

boreal iron
#

on my way, Sir

split hazel
#

mogus

boreal iron
#

sugom

dry imp
#

a

#

deez nut

split hazel
#

balls?

#

@sly sierra knows all about them

#

bro is he still muted

#

bros been silently muted for 2 years instead of 2 weeks

dry imp
#

sadgr

#

indeed

simple stump
#

I assume this isn't possible, but can a Discord bot start a screenshare and play a video via a stream or smth?

spark flint
#

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>
willow aspen
#

Has nothing to do with bot

spark flint
#

I can still ask here shrug

willow aspen
#

I didn't say you couldn't. I was informing you that it has nothing to do with the bot

spark flint
#

What bot??

willow aspen
#

Any bot.

spark flint
#

This channel isn't specifically for bot development

willow aspen
#

K bye

#

Actually I see nginx. I see your issue

#

But. Have fun with that

spark flint
willow aspen
#

There's ur hint

spark flint
#

i know its an nginx issue

willow aspen
#

Nginx entity too large. Google

spark flint
#

i'm just asking here because i know there are a lot of nginx pros here

willow aspen
#

Itll be the first stack overflow link

#

Guarantee

spark flint
#

topggDotRedDo 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

willow aspen
#

You did not Google it

#

I'm not assuming. I know

spark flint
#

still

willow aspen
#

Lol wut

#

As I said. First link

pearl trail
#

@spark flint client_max_body_size 500M;

spark flint
plucky imp
#

Well actually

modest maple
#

500M is a rather unsafe limit

plucky imp
#

nah unless they add it in v14

pearl trail
modest maple
#

500M is 0.5G, you could send 4 requests and you're potentially able to hit the sever with 2gb of body to process

pearl trail
plucky imp
#

there really isn't a point to screenshare something anyways since YouTube is taking down bots that upload and download content

spark flint
#

people were being hit with 413s when uploading

pearl trail
#

ah

modest maple
#

500MB image and video is quite big

plucky imp
#

true

modest maple
#

If you're going to have it that high make surs to reduce your max concurrency

plucky imp
#

Hi takii pogey

modest maple
#

Cuz i doubt you're running on a system capable of handling 1024 * 500M * n_cores worth of uploads

plucky imp
#

Look at how pog code is

modest maple
#

So no

split hazel
plucky imp
#

yes

spark flint
#

I very rarely get big uploads or many uploads at once

#

so i should be gucci

modest maple
#

Just because you dont often doesn't mean you shouldn't worry

boreal iron
#

Exactly that! Don’t worry about things you can’t see

modest maple
#

Somone uploading hundreds 0.5GB images will cause you all sorts of pain

pearl trail
#

yeah i dont do that often, but just in case i need it

boreal iron
#

There aren’t any evil people on the internet

simple stump
hushed cairn
#

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 :))

split hazel
#

the only way to view the token is to reset it

hushed cairn
#

ohhhh okay. thank you.

split hazel
#

more like a "follow what everyone else is doing" change but whatever

plucky imp
#

poggggg

#

jus added ogging lels

#

logging*

#

though i think i may have messed up lol shouldn't say active

pearl trail
#

feautures yes

plucky imp
#

LMAO

#

I DIDNT EVEN MNOTICE

boreal iron
#

You had time since yesterday night to move to slash commands.

#

Why nothing happened

plucky imp
#

uh cs voltrex is coding it for me lol

#

look at pog tree

#

branch*

boreal iron
#

He ain’t doing shit

earnest phoenix
#

I mean facts

plucky imp
#

well i don't really care i have time to wait

earnest phoenix
#

@earnest phoenix u lazy smelly boi

boreal iron
plucky imp
#

not like there gonna-

#

oh wait they are gonna disable v12 kek

#

probably won't become depreciated until may or april

plucky imp
#

no 3.1k line index.js pOg

boreal iron
#

So 1st may is the deadline

plucky imp
#

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

bright hornet
#

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?

plucky imp
#

yes

pearl trail
#

because your if statement is inside a callback where you already increment the wallet

#

you should check it before your findOneAndUpdate

plucky imp
#

oh i thought they were asking if i was triggered

#

soz

bright hornet
#

bruh

bright hornet
#

ah shit sorry for the ping

#

i can put .findOne and .findOneAndUpdate in one command right?

pearl trail
#

yes

bright hornet
#

oh make sense thanks!

pearl trail
#

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
still karma
#

Hey Guys, best python library for discord bots?

sudden geyser
#

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

spark flint
#

we gotta be careful now - No language / library wars - anyone involved will be muted. KEKW

sudden geyser
#

If you just want a bot, pick pycord

#

If you're fine waiting a bit longer, wait for Discord.py's big release.

boreal iron
#

Until the next drama comes over the maintainer (douche)

#

Being throwing the library away for another year

sudden geyser
#

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!

boreal iron
#

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

sudden geyser
#

because all they're good at is advertising and giving you diabetes

boreal iron
#

at least he will see the trash at the beaches with the branding

simple stump
#

Is there any good API's I can upload videos to and receive an embed of the video?

spark flint
#

imgur would work

simple stump
#

I mean specifically for large videos around 200-500mb

earnest phoenix
#

hi

bright hornet
#

is there any documents for using all as depositing/withdrawing all coins at once?

pearl trail
#

data.bank += data.wallet
data.wallet = 0

quartz kindle
#

why do people complicate currency systems with banks and wallets

quartz kindle
sudden geyser
#

currency systems suck enough already

simple stump
boreal iron
#

if that’s actually the right term

bright hornet
bright hornet
dry imp
#

wouldnt recommend people to switch to d.py

pearl trail
#

think*

#

smh

bright hornet
boreal iron
bright hornet
#

haaaaaa

dry imp
#

damn just realized i cant shit on d.py

boreal iron
#

lol wrong one

dry imp
#

painz

boreal iron
#

There’s always a reason to complain about something!

dry imp
#

i wanna make among us discord bot

plucky imp
#

i am

bright hornet
plucky imp
#

sussy

#

amogus

dry imp
#

can you come to my replit and code the rest i've done client.run()

#

you code the rest of amogus code pls

bright hornet
#

brah

plucky imp
#

uh

#

sure

#

i'm lying pls don't send it here

earnest phoenix
#

For some damn reason

boreal iron
#

I mean imagine if you’re loosing your crypto wallet

sudden geyser
#

that's a good thing

bright hornet
#

^that's-

austere surge
#

what

boreal iron
#

what what

dry imp
plucky imp
#

I jeed

#

Need

#

Pfps

dry imp
#

okay ill send u

#

you're welcome

austere surge
#

tf

boreal iron
#

Got a better one

#

Let me find it

dry imp
#

damn fake do be searching for that anime pfp

austere surge
#

yes

boreal iron
#

Errr what

#

Why didn’t it send it

austere surge
#

nsfw false positive?

boreal iron
#

Wtf

#

Doesn’t work

bright hornet
#

whaa-

boreal iron
#

Arrrrrrreggg shit Discord

#

I don’t know it won’t send

austere surge
#

take a screenshot of the image

#

a bit zoomed out

boreal iron
#

Tried already

austere surge
#

oh

boreal iron
#

discord app deletion now

plucky imp
#

Lmao

#

I already found one

dry imp
boreal iron
#

You Sir shut up with your hip hop slang

fiery stream
#

Yo ppl so do you wanna do all the commands like using slash or like old styled way with prefix is a good idea

slender thistle
#

Slash commands will basically replace the old style soon anyway

pearl trail
#

discord now disallow bot to use prefix command so want or not, slash command

slender thistle
#

Unless you're rolling with a private bot

pearl trail
#

^ too

fiery stream
#

Ion like slash commands 😓🥹

austere surge
#

ye

neat ingot
#

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? 🙂

austere surge
#

i think you cant remove the text but you can make it invisible

#

** ** or \u200b works fine

neat ingot
#

ahh yea, i did consider maybe using a \u200b, but hadnt tried that out

#

i've used that before for empty embed fields 😄

austere surge
#

ye

neat ingot
#

what is it, a zero width space or something?

pearl trail
#

how about {content: null}?

neat ingot
austere surge
#

f

pearl trail
#

content must be a string error?

neat ingot
#

non empty string

pearl trail
#

ic

boreal iron
#

You don’t need to specify any content

#

The entire message will be overwritten with your new message

neat ingot
#

when i try that, the previous content doesnt get removed

neat ingot
#

wth

austere surge
#

the edited is annoy

boreal iron
#

Wut the content won’t be removed

#

Well I’m not aware of that lol

pearl trail
#

yea, same thing with components afaik

neat ingot
#

omg wth, now its letting me send null as the content 😓

pearl trail
boreal iron
#

It always lets you

#

As long as null is null and not a string

neat ingot
boreal iron
#

Well that doesn’t work

neat ingot
#

^ i tried earlier within an interaction handler lol

boreal iron
#

There’s nothing left

neat ingot
#

oh, hmm, yea that could be it lmao

boreal iron
#

It would be completely empty

#

And completely empty doesn’t exist

neat ingot
#

yea, using a zero width space thing works fine though ~ still shows little edited message 😛

boreal iron
#

Why tf do you wanna let an empty message left?

neat ingot
#

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

sudden geyser
#

no way to delete an interaction response?

boreal iron
neat ingot
#

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

boreal iron
#

The second one is a followUp message

neat ingot
#

like, i dont want them to select handgun if they own it already

boreal iron
#

But you can also append that confirmation embed to your initial response

#

To not have to use the follow up message

neat ingot
boreal iron
#

Exactly

neat ingot
#

i mean, i cant embed that to my initial response if i need to wait on user input?

boreal iron
#

After that confirmation you could edit the response again showing your select menu again with some content: “wanna buy another item?”

neat ingot
#

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

boreal iron
#

That confuses me

#

Brb

neat ingot
#

lol, tyt 😗

simple stump
#

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

neat ingot
#

never messed with onedrive im afraid 😦

boreal iron
#

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

neat ingot
#

yea im looking into it more because im obviously doing something wrong lol

boreal iron
#

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

neat ingot
#

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 😄

boreal iron
#

Well of course it should

neat ingot
#

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

boreal iron
#

djs Right?

neat ingot
#

lol yea

boreal iron
#

Hmm I see

#

How do you respond to the select menu interaction?

neat ingot
boreal iron
#

Oh yeah I see

#

One sec

neat ingot
#

that is the shortest code for any actual menu selection event handling

boreal iron
#

brb

neat ingot
#

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

boreal iron
# neat ingot

So in your collector, you gonna edit the initial reply

#

Which fails

#

Since I don’t see you deferred the initial reply

neat ingot
#

no defer, but an initial reply with content is sent

#

which contains the menu components

boreal iron
#

Doesn’t matter the initial response is your select menu, isn’t it?

neat ingot
#

yea

boreal iron
#

Well then you need to defer the interaction if you wanna edit the reply ever again after 3s

neat ingot
#

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?

boreal iron
#

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

austere surge
#

interaction reply system is confusing

boreal iron
#

You need to use the editReply() method then

neat ingot
#

yea, im testing things out atm to see how that goes 🙂

boreal iron
#

But the “bot is thinking” message acts as reply

neat ingot
#

i like that you can fetch defered replies

#

i use it to have a ping message without '(edited)' being visible 😄

austere surge
neat ingot
boreal iron
neat ingot
#

to get latency between when message is initially sent and interaction was created

#

usually how folks measure a bots response latency

boreal iron
#

Ah yeah well that doesn’t edit the message but I got what you mean

#

lmao

neat ingot
#

yea, but normally folks bot's ping command has an edited text on it 😛

boreal iron
#

The first editReply() doesn’t cause a edited note

#

Funny and nonsense since Discord handles the deferring as first reply

neat ingot
#

i wish you could customize defer message 😭

boreal iron
#

So it should be in theory cause an edited state but it doesn’t

boreal iron
neat ingot
#

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

boreal iron
#

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

neat ingot
#

yea, but it doesnt look as nice

#

lol

boreal iron
#

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

neat ingot
#

lol

#

ngl, no idea how i'd even open a ticket 😄

boreal iron
#

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

austere surge
#

kinda neutral

neat ingot
#

aww wth, they want me to sign in, idk my password 😓

boreal iron
austere surge
#

then remember it topggSunglasses

boreal iron
#

Let’s hope you never logout accidentally

neat ingot
#

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

boreal iron
#

Can’t you manually select a saved one then to autocomplete?

neat ingot
#

fml ,its telling me my password is wrong now lol

boreal iron
#

Let’s hope you never logout accidentally

#

Soon Dekita on a new discord account

neat ingot
#

ok fk this site

#

two accounts its telling me are wrong details

#

totally a phishing page! 😛

austere surge
#

tpotekly

#

man i messed that up

boreal iron
#

lmfao

neat ingot
#

nah thats nub moves

#

ill just keep auto logging into my accounts and ignore the issue

earnest phoenix
#

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.

austere surge
#

2.33s?

earnest phoenix
#

It shouldn't take almost 3s should it?

neat ingot
#

howw much are you creating? and what db type?

boreal iron
#

Depends on the connection to the database

#

I doubt the database needs that time

neat ingot
#

are you able to calculate time between receiving and processing the request?

boreal iron
#

You still wouldn’t know how long the database has needed

#

If the response only happens when the database is done

craggy pine
#

With I grab or query my db it usually takes a few ms

earnest phoenix
#

Well idk how helpful this is but postman tells me the network flow of the request.

neat ingot
#

that transfer start time seems to be a concern 😛

earnest phoenix
#

It is leading me to believe it is a code issue that is slowing it down

neat ingot
#

postman i think

austere surge
#

hmm

earnest phoenix
#

But I have removed a good bit of useless checks and logic but it still hasn't gone down

boreal iron
#

Where’s the database hosted?

#

On a server or at home or…?

earnest phoenix
#

On a server

neat ingot
#

are you, within your request, connecting to the database, or is a connection already established previously?

boreal iron
#

You should log the incoming request timestamp and when the response happened

earnest phoenix
boreal iron
#

In the code processing your database request

neat ingot
#
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
boreal iron
#

Is the code processing your incoming request on the server your database is running on?

#

Or externally with an opened connection to the database?

earnest phoenix
#

I have a ssh tunnel open so I can connect from my local machine

neat ingot
#

so your local machine is sending the requests to the db server?

#

still shouldnt be 2s+ tho

earnest phoenix
#

actually one sec

neat ingot
#

thats in ms i believe

#

still, thats like, half of the delay

earnest phoenix
#

724

boreal iron
#

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

neat ingot
#

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

earnest phoenix
neat ingot
#

what does your db call do?

earnest phoenix
#

Simply just does an INSERT

neat ingot
#

😐

#

a single insert? not like, 1000000 inserts? 😛

earnest phoenix
#

Single insert yes

neat ingot
#

thats pretty grizzly

earnest phoenix
#

Which is why I am confused why it is taking 2s+

craggy pine
#

You could do basically what dekita said, but between a few code lines just to see the differences in time between some code

earnest phoenix
#

already did that

neat ingot
#

724ms

#

imo, still high, but doesnt account for the 2+ seconds delay by a long way

craggy pine
#

I'm saying like

time = Date.now()
//code
//code
console.log(ms for this chunk)
//code
//code
//another log ect.
boreal iron
neat ingot
#
console.time(label);
console.timeLog(label);
console.timeEnd(label);
#

^ logs different in ms between console.time calls with the same labels

boreal iron
#

How do you actually know the database call was successful?
Do you return a value for your database query?

lyric mountain
#

Wasn't there a precision function for exactly such needs?

neat ingot
earnest phoenix
# boreal iron How do you actually know the database call was successful? Do you return a value...
    @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

lyric mountain
earnest phoenix
#

I did that all wrong tho logging the time

boreal iron
#

Oh my gosh

#

I forgot about the time KEKW

earnest phoenix
#

It didn't work anyway it just returned 0 and 730

boreal iron
#

I will get on that later if you haven’t figured it out

earnest phoenix
#

ight

boreal iron
#

Great another hour less I can sleep

#

FakE stupid

neat ingot
#

what does the createBook function do?

earnest phoenix
earnest phoenix
# neat ingot what does the createBook function do?
    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,
        });
    }
neat ingot
#

dang, those are some lengthy sql queries 😄

earnest phoenix
#

Ikr

neat ingot
#

this is just to get specific properties from your data table right?

#

its been a while since i sql'd 😄

earnest phoenix
#

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

neat ingot
#

hmm

#

how come you do it that way?

earnest phoenix
#

Cause if they don't have a valid token they can't request to the api

neat ingot
#

like, normally i would do that logic in the api handling logic before doing the db query

#

if (!validuser) gtfo()

earnest phoenix
#
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

neat ingot
#

hmm, are you using a node express server?

earnest phoenix
#

I am using nestjs which is a webframework that uses express under the hood

neat ingot
#

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

earnest phoenix
#

I dislike passport so I did my own implementation of it

neat ingot
#

so im able to just check if a user is logged in for each request

#

fair enough, its a little cumbersome 😄

lament rock
#

are clients connecting to the DB?

earnest phoenix
#

No?

#

Wdym by that

lament rock
#

Ok. Just that code makes it seem like that JS is run by the client

earnest phoenix
#

Only the backend ever makes a connection to the db

lament rock
#

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

earnest phoenix
#

I don't even have any client side stuff done

lament rock
#

I worry about stuff!

earnest phoenix
#

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

lament rock
#

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

earnest phoenix
#

Well the db is hosted on a server and I have an ssh tunnel open

#

Should I use pools tho?

neat ingot
#

whats your latency between your pc and that server?

earnest phoenix
lament rock
#

connection pools can be helpful

#

I usually limit my size to like 5

neat ingot
#

run command: ping ip.add.res.ss

#

or domain name

lament rock
#

dns queries can take time if the name isnt cached

neat ingot
#

yea, but once connected you should get a few pings for seeing

#

if they all take 2s+, then... well...

#

lol

lament rock
#

ping amanda.moe

#

:)

earnest phoenix
#

roughly 200ms

rocky hearth
#

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.

neat ingot
#

so 200ms for server reply, and 700ms for your api route to process, thats only like 900 ms lol

lament rock
#

1 second right there

neat ingot
#

1 != 2+

earnest phoenix
#

So there is a 1s delay here that is popping up out of narnia

lament rock
#

almost 1 second to handle a single route is outrageous

neat ingot
#

^ this is true

#

lol

earnest phoenix
#

I am probably fucking up majorly somewhere

neat ingot
#

im in the uk, my servers in like georgia or some junk

lament rock
#

try metricing a standard db statement

#

SELECT * FROM table LIMIT 1;

wheat mesa
#

mans probably got functions like ```js
function isEven(n) {
if (n === 0) return true;
if (n === 1) return false;

return isEven(n - 2);

}

earnest phoenix
#

jeez

earnest phoenix
#

it takes 2s just to select something

lament rock
#

I wonder how some operators work internally like % if it uses recursion

#

maybe im too tired for this tho

earnest phoenix
#

Seems like the entire api is slow asf

lament rock
#

hitting a db on another server is really rough

earnest phoenix
#

But it shouldn't result in that big of a time delay no?

lament rock
#

what are you using for sql anyways

craggy pine
#

no

earnest phoenix
#

I am using typeorm + pg

craggy pine
#

Im in the U.s while my server is in canada.

neat ingot
lament rock
#

pg is good

neat ingot
#

mongodb is better

earnest phoenix
#

I mean the server is in germany while I am in the us so maybe that could be a problem

craggy pine
#

I use maria

lament rock
#

mongo is not better

earnest phoenix
#

But i've never had time issues of this scale before

dry imp
#

mongo good

earnest phoenix
#

Every other time i've never had this huge of a problem with the time being over 1-2s

lament rock
#

Your database is probably being slammed then

earnest phoenix
#

Mmmm

neat ingot
earnest phoenix
#

mongo isn't that good

earnest phoenix
neat ingot
#

if using sql, why not use like, sqlite or something that runs locally?

lament rock
#

more connections to a database getting stuffed a lot of requests only makes it worse off

earnest phoenix
#

cause sqlite sucks

neat ingot
#

so does your db 😐

earnest phoenix
#

says u

#

mr mongo

lament rock
#

try running sqlite on an hdd

earnest phoenix
#

:^)

lament rock
#

long ass queries

earnest phoenix
#

Fuck it ima just use cvs

#

csv *

lament rock
neat ingot
#

tbf, most db on hdd would be slow af compared to almost any db on nvme ssd

lament rock
#

Not redis

earnest phoenix
#

wym my sqlite database on my hdd is fast asf boi

earnest phoenix
#

it is good db

neat ingot
#

why not roll your own json powered db that parses sql statements? 😄

lament rock
#

Not for a bunch of rows

#

Make your own arbitrary format and parser

#

all of your problems will be your fault

earnest phoenix
#

fuck it time to make an entirely new db

#

postgres? pfft mistgres

neat ingot
#

aww, i was hoping for misql

lament rock
#

I tried to make my own. Worst mistake ever. Do not try to

earnest phoenix
#

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

lament rock
#

time to uninstall my bios

earnest phoenix
#

who needs bios

#

sounds useless to me

neat ingot
#

i havent used my bios in at least 6 months CharDerp

austere surge
earnest phoenix
#

no

#

everyone who uses mongo are just nerds

austere surge
#

whats wrong

neat ingot
# austere surge why

because my pc doesnt sleep ~ when i sleep, its on mining bitcoin and running bots 😄

austere surge
#

hm

#

i used to do the bitcoins but

#

i moved mainly to linux

#

and nicehash dont really have a miner for it

neat ingot
#

i think they do?

earnest phoenix
#

mining crypto seems pointless to me

austere surge
neat ingot
#

i use nicehash miner, but they have a full os now im sure

austere surge
earnest phoenix
#

just buy crypto and see if it rises or not

austere surge
#

i dont pay the power so its good for me

earnest phoenix
#

if it does u good

austere surge
#

and i cant buy/sell :/

neat ingot
#

idm paying the power for the possiblity it might return in the future 🙂

#

i also have like 250k shiba inu coins 😂

earnest phoenix
#

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

austere surge
#

i might start mining crypto more soon once i get my pi ||and set it up||

neat ingot
#

it actually doesnt use that much depending on your rigs consumption

austere surge
#

what miner you use

neat ingot
#

for the actual gpu usage your talking cents a day

earnest phoenix
#

Imagine not running 20 bitcoin miners on the same machine

neat ingot
#

nicehash quickminer

earnest phoenix
#

😔

austere surge
earnest phoenix
austere surge
#

would that even be useful

earnest phoenix
#

no

austere surge
#

more mining but less mining power

austere surge
earnest phoenix
#

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

austere surge
#

ye

neat ingot
#

doesnt tim have some kinda db thing?

#

not quite a db

bright hornet
neat ingot
#

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 🙂

quartz kindle
#

fucking discord

#

adding text to voice channels

rocky hearth
#

what is this?

quartz kindle
#

wtf are they thinking

slender thistle
quartz kindle
#

fuckers broke my lib because of this

#

at 2 fucking am

slender thistle
#

LMAO

quartz kindle
#

even worse, that shit is from 6 months ago

#

and suddenly they turn it on with no warning

slender thistle
#

That's Discord for you 🤣

rocky hearth
#

I always hv wondered y can't they allow joining vcs in text channels.

#

when both the channel share same underline structure

earnest phoenix
cinder patio
slender wagon
#
 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

copper cradle
#

Isn't there a $dec directive?

slender wagon
copper cradle
rocky hearth
copper cradle
slender wagon
#

i tried dec but it didn't seem to work

copper cradle
#

i wasn't trying to solve the problem, I just thought it was odd to use $inc -int

slender wagon
#

well this used to do the job just fine

#

guess i gotta relook into this

copper cradle
#

What's cips

slender wagon
#

the thing my website works with

cinder patio
bright hornet
#

How do i use findOneAndUpdate in all member data using 1 command?

rocky hearth
#

and I dont want to make B as first param, I want to constrain that. (It should already be there)

slender wagon
#

bruh why does mongodb decrease the same amount 2 times

bright hornet
#

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

split hazel
#

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

bright hornet
dry imp
#

u dont need to but that brings it to his 2nd sentences

bright hornet
#

so i need to fetch every member's data if they have that role?

#

but i already did-

fiery stream
#

Automatic seems hard n more resources usage

bright hornet
fiery stream
#

Im lowkey confused lol

bright hornet
#

since speedy mentioned to use fetch i think ive got any ideas xd

earnest phoenix
#

anyone got server leave command code ?

bright hornet
rocky hearth
#

which common parent class does, Document and HTMLElement share?

timber fractal
#

nvm i found the issue

pearl trail
#
  • make a delay each request
#

you dont want to add a role to 100 members in 1sec mmLol

heavy marsh
#

Does anyone know how to fix this in vsc

node-pre-gyp install --fallback-to-build
#

Get this error when downloading ```js
@discordjs/opus

earnest phoenix
earnest phoenix
boreal iron
#

Damn… Voltrex got hit hard

lyric mountain
#

by your car?

boreal iron
#

No by calling the facts he’s lazy :P

dry imp
#

and by your car?

boreal iron
#

Arrrrrrrrrrg I didn’t hit somebody or anything the last 8 hours!!!1!
while I slept so be quiet!!

dry imp
#

gn fake

boreal iron
#

More like good afternoon

dry imp
#

damn forgot ppl can sleep anytime

earnest phoenix
boreal iron
#

I know it, trust me, we got an insider reporting to us about your daily activities

earnest phoenix
#

I sure know that they have no idea I have placed several pipe bombs in your mailbox

boreal iron
#

Errrrm let me call somebody real quick

earnest phoenix
#

Go call some bitches instead

boreal iron
plucky imp
#

Poggers

#

i think i'm having a stroke

dry imp
#

goppers

#

tf why

plucky imp
#

my heart it twitchinG

dry imp
#

woa

earnest phoenix
# boreal iron

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

boreal iron
#

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”

earnest phoenix
#

There's also a lesson to 187.241.75.251

boreal iron
#

Oh no IP revealed

#

running away and screaming

slender thistle
boreal iron
#

Yes!

#

Can’t remember further out Sir

slender thistle
boreal iron
dry imp
#

hello, 911

earnest phoenix
lament rock
#

if tomorrow aint the due date, today aint the do date

marble juniper
#

the doin date

#

where im doin

#

doin ur mom

marble juniper
#

copium

plucky imp
bright hornet
#

Interesting 🤔

wheat mesa
boreal iron
#

My gosh... anyone must be drunk

#

Where's my bottle of alcohol

plucky imp
#

i ma

#

d r u n k

wheat mesa