#development

1 messages · Page 93 of 1

wheat mesa
#

Nah I've already got that down somehow

#

But it was embarrassing when I gave this to someone with the hopes that it would run and it instantly complained about missing DLLs

#

bc I forgor that I need to statically link everything

lyric mountain
#

Doesn't c++ have a dependency manager?

wheat mesa
#

I'm using cmake

#

But I had some sort of issue with DLLs when trying to run it on another PC

topaz terrace
#

how would i convert the text file into a string tho?

lyric mountain
#

It already is

#

You're reading it as a string

dusky idol
#

can someone explain me how do I make a leaderboard command for coins? I use pymongodb, disnake

#

I tried reading the docs and all but nothing's really helpful

sick agate
#

soo uh

#

how do i block an iframe from accessing the upper direcotires of the url

#

i need to access data from an spesific route in a iframe though

sick agate
#

i will try to use it

sick agate
gilded venture
#

@quartz kindle - In case you cared for an update I found the issue. My bot uses a websocket to grab links from a website for a pick and ban system. Turns out that website is/has been down for I guess 2 days. So my entire bot couldn't start up when attempting to connect.

Now writing a fallback mechanism incase it happens again in the future (it probably will)

earnest phoenix
#

Does anyone know how to put the Timestamp footer in the format Date hours minutes and seconds in node.js?

#

I tried by .setTimestamp() but the seconds do not appear

#

I wanted the seconds to appear as well

earnest phoenix
deft wolf
#

But you could probably make a timestamp yourself with .setFooter() and the moment package

earnest phoenix
quartz kindle
earnest phoenix
#

that is also in the footer

#

You would need to format the date & time yourself and put it in the text field of the footer, not in timestamp field

#

taking advantage of the moment, which admin do I talk to to reset my nick?

#

And as mentioned, you could use a date & time library like Luxon to get it done

earnest phoenix
earnest phoenix
#

Moderator, not community manager as that one's busy

earnest phoenix
earnest phoenix
#

Well note their status and custom status WiseTree

earnest phoenix
#

is it still showing up?

#

I'm talking about the status and custom status of the community manager you mentioned

#

@drowsy crag Hello how are you? could you please reset my nick?

earnest phoenix
#

I'm glad you didn't see mine, it was kind of embarrassing kakka

surreal sage
#

.

earnest phoenix
surreal sage
#

oh sorry I didn't see

lyric mountain
earnest phoenix
lyric mountain
#

ah, didn't see it

real oriole
#

OK after talking it through with my host, the issue was that AUTHORIZATION is a protect system header for secured platforms and is stripped from the server request when used. this is something enabled on all secured apache systems, they have made a workaround for it to allow me to see it, but as a note i thought i would say it might be best for all systems to change the header to X-Authorization as these are not protected and is a suggested header by my host who specialise in protected systems, as this can and will effect others with the same setup and the workaround is a dirty one at best and ideally shouldn't be done. but for now it is working. YAY

rustic nova
#

what fucking host just strips away the auth header

#

lol

solemn latch
#

I really dont think this is a topgg issue though, authorization headers are standard headers, x-authorization isn't.

Our webhooks probably are not meant for secured platforms like that

#

https is plenty ^_^

rustic nova
#

the header "authorization" is sent by top.gg

#

but what host just

#

strips away a crutial header

#

thats actually cring

solemn latch
#

sounds like a security measure(somehow?)

rustic nova
#

nah dont see any security there lol

solemn latch
#

x-authorization is actually probably a bad thing to use tbh

rustic nova
#

just some bothersome measure to annoy devs

lyric mountain
solemn latch
#

most platforms will hide the authorization header from you, for example if I log my headers in cloudflare it will auto hide the auth header

Which is a real security measure the authorization header has that x-authorization doesnt.

#

if anything, we'd be putting more at risk by adding it 👀

lyric mountain
#

cloud hides from viewing the header afterwards, but it doesn't simply remove it before reaching the server

real oriole
solemn latch
#

oh yeah, absolutely, its just a feature that can protect users headers.

solemn latch
#

sounds like they are viewing all requests you have incoming

#

headers are typically encrypted right? 👀 @lyric mountain

real oriole
#

yes they do monitor incoming traffic for security to make sure nothing is malicious

#

it is a host i have used for 2 decades and they have help protect my 3 companies systems for that time also, i cant fault there service and level of security they provide

real oriole
lyric mountain
#

I mean, ain't that the entire reason for https?

real oriole
#

yes it is haha

solemn latch
#

yeah 👀

#

I'm assuming they are providing the ssl certs then?

real oriole
#

maybe implement a custom header that TopGG can use like patreon does

solemn latch
#

tbh, I dont think anyone has ever had this happen.

real oriole
#

yes they provide me wildcard SSL certs for all domain as part of my account type with them

solemn latch
#

I dont think we can dedicate developer resources on an issue that affects one person, which is already solved, and could optionally be solved by just ignoring the auth header and only taking requests if they are from the topgg IP, or by proxying the request.

neon leaf
#

so I have a react component, if I pass any children the color should be green and if its self closing it should be red (as example), how do I do that?

solemn latch
#
return <div style={{ color: props.children ? "green" : "red" }}>{props.children}</div>

👀

real oriole
solemn latch
#

thats fair, but also pretty unlikly.

Someone guessing your webhook url would be pretty impossible anyway, especially if it was randomized, they would have to know you're not using an auth header, and know youre checking the request IP.

feral aspen
#

I'm currently learning Next.JS, and whenever I run npm run build, I get these errors:

Failed to compile.

./src/pages/404.tsx
1:10  Error: 'WrappedImage' is defined but never used.  @typescript-eslint/no-unused-vars
19:69  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities

./src/pages/index.tsx
35:13  Warning: Do not use `<img>` element. Use `<Image />` from `next/image` instead. See: https://nextjs.org/docs/messages/no-img-element  @next/next/no-img-element
46:186  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
49:46  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
52:259  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
61:76  Error: `"` can be escaped with `&quot;`, `&ldquo;`, `&#34;`, `&rdquo;`.  react/no-unescaped-entities
61:93  Error: `"` can be escaped with `&quot;`, `&ldquo;`, `&#34;`, `&rdquo;`.  react/no-unescaped-entities

./src/pages/_offline.tsx
15:95  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities

info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
info  - Linting and checking validity of types .
```.
spark flint
#

you can't use '

#

you need to use the escaped version

feral aspen
#

Fair, but how do I access the above files or whatever I want to be accessing?
Nevermind, I'm blind. I see now.

spark flint
#

you need to go to your page file

#

/src/pages/404.tsx and /src/pages/index.tsx and /src/pages/_offline.tsx

feral aspen
#

Quick question, which one from &quot;, &ldquo;, &#34;, &rdquo;?

spark flint
#

replace every instance of ' with &apos;

feral aspen
#

Do I like use any of the above?

spark flint
#

depends on the symbol

#

' is the one you need for '

feral aspen
#

Oh, sweet.

feral aspen
spark flint
#

have you imported Image

#

import Image from 'next/image'

feral aspen
#

Oh, I see now. Much appreciated.

#

I'm curious, whenever I run npm run dev, it usually goes like wait, compiling /directory and such, but when it's npm run start, it doesn't do that (that's when I do npm run build before). It's also missing some content in the non-compiled directory (if it's even supposed to log in the console).

#

I hope that made sense.

#

Notice how there's no event or wait for compiling, is it normal that it's like this? If so, why would some content from the website not appear?

oblique sky
#

It’s expected, next start will run your production build instead of starting a dev server

#

Check if there’s problems in your build process

feral aspen
#

I'm getting this error.

oblique sky
#

Same as the error, getContents is not a function, I guess it is actually undefined
If it works in development mode then you need to check either the function exists or not in production

winged linden
#

yo got a question

#

i am filtering roles of a guild, is there a way to filter roles related to bots?

earnest phoenix
winged linden
#

is their a way to detect if this role is related to a bot?

earnest phoenix
#

Yeah I'm talking about that, such roles have a field called managed which determines that

earnest phoenix
winged linden
#

getting blocked bruh

lyric mountain
#

instead of comparing role name, compare role id

#

everyone will always have the same id as the guild

winged linden
winged linden
#

didnt know it existed

winged linden
lyric mountain
#

ye, it's a funny detail

eternal osprey
#

Hey hey, I got another Java question here. Is it possible to put a class in a class?

rustic nova
winged linden
rustic nova
#

One of the filters set on automod

eternal osprey
#

So public class Wallet{
private Person; (where this person is a class on its own)
}

lyric mountain
#

you CAN, but really need to ask if you should

#

oh wait, u mean reference, not the actual class

#

yes sure, it's just a data type like any other

eternal osprey
#

I see

#

Actually like: private Person = new Person()

#

I think it would work indeed

lyric mountain
#

yes, that's just declaring a variable

eternal osprey
#

Also about interfaces am I correct that all functions, declared variables etc inside that interface can be used by all classes that implement that interface?

lyric mountain
#

no

#

interfaces cannot have variables

eternal osprey
#

Owh really?

#

Cant you have default int size = …

#

owh wow I didn’t know that

lyric mountain
#

interfaces are just contract declarations

eternal osprey
#

In the lecture they did add this tho 😳

#

public interface paying{
default int size = 50;
}

lyric mountain
eternal osprey
#

Wtf

#

Huh what does default even stand for then

lyric mountain
#

it's for methods

#

to declare default implementations

#

interfaces can, tho, have static constants

eternal osprey
#

Ahhh I see

#

That’s what he used

lyric mountain
#

no default tho

eternal osprey
#

Every class implementing this will start with that int right?

lyric mountain
#

no

eternal osprey
#

And it’s individual?

lyric mountain
#

it's a static constant

eternal osprey
#

oowh

lyric mountain
#

interfaces cannot have variables since they're contracts

#

but interfaces are still somewhat classes, so they can have static stuff

eternal osprey
#

I see so the int size belongs to the interface and classes can use it, but it doesn’t belong to the objects nor do they get their own individual integer

#

So in interfaces its rather used to like store a constant that all classes can read etc

lyric mountain
#

kinda

eternal osprey
#

I see

lyric mountain
#

interfaces are meant to enforce a method contract

#

for example

eternal osprey
#

Honestly I love you

lyric mountain
#

all my cards implement the interface Drawable

#

so all cards have those methods

eternal osprey
#

I see yeah

eternal osprey
#

btw kuuhaku

#

in an interface

#

instead of not intializing a public void

#

can't we create a method already and define it?

lyric mountain
#

wdym?

eternal osprey
#

I want to use the displayMethods() in all classes

#

can i just already define it in the interface

#

implement the interface in the class, and then use displayMethods()?

lyric mountain
#

yes you can, that's what interfaces are for

#

wdym by "public void"?

eternal osprey
#

Owh my teacher mainly focused on non-unintionalized methods so i thought that that's the only way interfaces could work

eternal osprey
lyric mountain
#

public void means nothing by itself

#

it's just an access modifier + return type

eternal osprey
#

yeah i know my bad

#

Btw if i try to define a method within my interface

#

it says that methods cannot have a body

lyric mountain
#

because u need to add default keyword

eternal osprey
#

owhhhhh

lyric mountain
#

all methods in an interface are automatically public, that's why u just write the return type

eternal osprey
#

i see now

#

Why would my teacher then create an unintioanlized method?

#

FOR EACHHH single class

#

while in fact he could an already defined and static method in the interface?

#

I mean that would fucking save lots of space and time

lyric mountain
#

for example

#
public interface Walking {
  void walk();
}

public class Human implements Walking {
  @Override
  public void walk() {
    ...
  }
}

public class Cow implements Walking {
  @Override
  public void walk() {
    ...
  }
}
#

u cant write a default that'll fit both cases

#

because Cow uses 4 legs, while Human uses only 2

#

if you declare a default implementation you lose the ability of forcing subclasses to have their own implementations

#

that's VERY important in a library for example, because you cannot cover all possible use-cases on your own

#

btw, add @Override whenever u implement/override a method, to know which methods are coming from superclass

slender wagon
#

can i make some slash commands only show on certain servers or channels?

deft wolf
#

On specific servers yes, but on specific channels the owner of the server must set them so

#

Although no, it looks like you can set a command on a specific channel

wheat mesa
wheat mesa
quartz kindle
#

damn void walkers

lyric mountain
#
public class Void implements Walking {
  @Override
  public void walk() {
    dont();
  }
}
quartz kindle
#
public class VoidWalker implements VoidWalking {
  @Override
  public void voidwalk() {
    dontvoidwalk();
  }
}
wheat mesa
lyric mountain
#
public class Object extends java.lang.Object {
  ...
}

smirk

eternal osprey
#

Ahhh wow i see

#

Thanks guys this will definitely help me

lyric mountain
#

and you can have many implements, but only one extend

eternal osprey
#

Owh i ssee

#

i didn't get to extend just yet

#
public interface Methods {
    String[] paymentMethods = {"Chartaal", "Crypto", "Natura", "Giraal"};
    public void pay();
   
         }```
#
public class Wallet implements Methods{
    private int balance;
    private int[] payments = new int[4];
    private PersonInfo person;
    public void setPerson(PersonInfo p) {
        person = p;
    }
    public int getBalance() {
      return balance;
    }

    @Override
    public void pay(int price, int paymentMethod){
        paymentMethod = paymentMethod - 1;
        payments[paymentMethod] -= price;
    }


}
```This is giving me the error
#

that i must set pay as abstract method or import class Wallet as abstract?

#

owh no i am stupid

#

i am not passing the parameters within the interface

wheat mesa
#

Be very careful, do not define instance variables within interfaces

rustic nova
#

Even confusing me

#

Why is it called methods

lyric mountain
#

ah wait, u didn't add a body

#

your formatting is confusing me

lyric mountain
wheat mesa
#

I know but I’m pretty sure he’s under the impression that it is one

lyric mountain
#

all "variables" inside interfaces are automatically final and static

wheat mesa
#

Yes I’m aware

lyric mountain
wheat mesa
#

Ah

lyric mountain
wheat mesa
#

Is there an easy way to output 1 or 0 based on if a number has a certain bit?

lyric mountain
#

(num >> index) & 1

wheat mesa
#

Thanks

lyric mountain
#

yw

wheat mesa
#

That won't mutate num right?

lyric mountain
#

nope, primitives are immutable

#

at least in java

wheat mesa
#

js but I suppose the same thing probably applies

#

I'll test it

lyric mountain
#

yep, in js they are too

#

actually all non-overridden operator are non-mutating

wheat mesa
#

I'm going to make this into a method but honestly not sure what to call it

lyric mountain
#

I have something like that

wheat mesa
#

I would call it hasBit but that seems a little weird since it returns a num and not a straight up boolean

lyric mountain
#

then I just call Bit.on(bits, 0) for example

wheat mesa
#

I'll just call it hasBit since nobody but myself needs to understand this code anyways

#

Thanks C:

sudden geyser
lyric mountain
#

lmao

radiant kraken
neon leaf
#

does anyone know some good (& cheap) vps hosts? Im currently with some random german one thats very cheap but has regular outages which are kinda annoying me alot by this point.

lyric mountain
#

contabo

neon leaf
neon leaf
lyric mountain
#

still using them for 2 years, didn't have an issue

neon leaf
#

did you ever get ddosed?

lyric mountain
#

probably not ig

#

I do use cloudflare tho, so I think it'd block any attempt

rose warren
#

Slash command adoption vs old prefixed messages for my bot over the last 13 months

lyric mountain
#

I think it'll settle at 33/66

rose warren
#

Yeah. I really want to not have to accommodate for prefixes in my rewrite though darkAYA

real rose
#

damn

tough star
#

discord.js v12.5.3
@discordjs/opus is not working when i try to install it on a RDP ..
it works on repilit tho

#

any idea?

lyric mountain
#

Missing module

#

See the long line

spark flint
stuck dawn
#

Does anyone knows a good api, free of image labeling for example I got 2 apples on the desk the image label api says Fruit

spark flint
#

Except i never removed mine LUL

rancid kraken
#

Not sure if this is the right channel to ask but would somebody be willing to explain to me how you set up a role channel where you have to go through that prior to being able to actually access the server

feral aspen
#

I'm hosting a Next.JS project, and whenever I restart my PC and open the localhost link (even though I never start the application), it's PORT, somehow, is like yet being used by the application even though it's not started. How does that work and how can I fix it?

stuck dawn
deft wolf
#

If you mean help in writing something like this in javascript or any other language then this is the right channel

#

In general, this channel helps with programming, not setting up public bots

digital swan
# rancid kraken Not sure if this is the right channel to ask but would somebody be willing to ex...

I’d do it by setting the @ everyone role to not have access to view channels, then for the channel you want users to go through you enable the little green check thing for view channel on everyone role. Then that channel is the only thing you can see without any roles

Then I’m assuming you want some sort of reaction role thing to give a role which has the “view channel” permission so you’d do that however you want

feral aspen
#

It's the same on PORT 5000 and I can't seem to figure out why.

rustic nova
#

using the example with a different port

feral aspen
#

It's chrome.exe? PID 8584.

#

I want it to stop using that such port (3000 and 5000) whenever I don't have the project running.

foggy escarp
#

I can't add bots to my discord server

feral aspen
#

Whenever I even kill such process, it just makes another one.

rustic nova
#

then check again

#

you might be viewing the one chrome tries to visit

feral aspen
#

I have no project running on that port, though. I've only run a Next.JS project before but how is it running even though I never started it?

rustic nova
#

welp I never actively hosted projects on my own machine so

#

cant help

feral aspen
#

I'm hoping I didn't like screw my PC because of this.

#

I ran next dev, next build, and then next start -p 3000.

solemn latch
#

👀

#

and you closed both next dev and the next start?

#

both those start nextjs

feral aspen
#

Yes. *smiley face

feral aspen
# solemn latch both those start nextjs

Yes, but when I close them, restart my PC, turn off my house electricity and boot everything again FRESH (without opening anything) and open localhost on PORT 3000, the project is running. ;-;

solemn latch
#

if you start something else on port 3000 does it error? 👀

#

yeah, maybe a process manager? 🤷

#

pm2 can auto start stuff on bootup

feral aspen
#

Anyways, my main issue is that whenever I turn-off a Node.JS project, the site is supposed to say This site can't be reached, however, it does not say so and remains on the same Node.JS project page (even though it's off) but unfunctional.

solemn latch
#

👀 this site cant be reached, you mean the default browser 404 page when you load the page right?

feral aspen
solemn latch
#

you're refreshing the page after the program is closed right?

feral aspen
#

Yes.

#

I even restarted the whole PC, still displays.

quartz kindle
#

open dev tools

#

go to the network tab

#

press f5

#

post print of the network tab

feral aspen
#

Hold on, where's what?

rustic nova
#

Pending

#

Means that port is being used, but doesn't send any data back

feral aspen
#

Well, I'm legit doing nothing with the port, so I'm not sure...

#

Although the issue doesn't work on incognito, I tried to hard reload and clear cache, that didn't work either; the issue yet persists.

quartz kindle
#

its "served from cache" right?

#

thats your issue

quartz kindle
feral aspen
quartz kindle
#

tick this box

#

and reload again

#

with the dev tools open

feral aspen
#

Moment.

rancid kraken
quartz kindle
#

lmao

#

theres nothing wrong with anything

#

your website just supports offline mode

#

using web workers

feral aspen
#

Sweet, but how about a normal express application, which doesn't support it?

quartz kindle
#

express is just a server

#

if it serves files which contain js code that creates webworkers to manage offline states, then it will do the same thing

feral aspen
#

Oh, fair. Although, could I not have it do it on port 3000?

quartz kindle
#

open dev tools, go to application -> service workers

feral aspen
#

However, anyways, I was dumb enough to run it once on PORT 3000 when it's supposed to be on PORT 5000.

#

Is there a way to fully remove offline states or so from a specific localhost port?

quartz kindle
digital swan
feral aspen
rigid maple
#

In React JS, I will change the url and part of the website outside of the sidebar, but how can I do this without refreshing the page?

visual marsh
#
  size: 0,
  timeout: 0,
  [Symbol(Body internals)]: {
    body: PassThrough {
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 5,
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: true,
      [Symbol(kCapture)]: false,
      [Symbol(kCallback)]: null
    },
    disturbed: false,
    error: null
  },
  [Symbol(Response internals)]: {
    url: 'https://discord.com/api/v9/gateway/bot',
    status: 429,
    statusText: 'Too Many Requests',
    headers: Headers { [Symbol(map)]: [Object: null prototype] },
    counter: 0
  }
}```
#

what is this

quartz kindle
#

you are temp banned

visual marsh
tribal relic
#

then nvm

quartz kindle
#

console.log the headers to see how long you have to wait

visual marsh
#

Thonk i will use another bot wait

#

The Same Problem With another bot

spark flint
#

how to stop node crashing with a 17 million length array

#

lul

tribal relic
spark flint
#

probs gonna store in cache

grim aspen
#

it's a ratelimit

#

you've been ratelimited and probably will be active for several hours

#

your bot is requesting something to be done too fast

visual marsh
tribal relic
visual marsh
#

i think its from host

grim aspen
#

don't

tribal relic
visual marsh
#

i have badest luck in the world
i am add my bot yesterday to top gg today its offline then bot will decline

deft wolf
#

The waiting time for accepting the bot is about 10 days

#

You still have plenty of time to fix this problem

rustic nova
#

such as just closing the terminal

quartz kindle
spark flint
#

lol

#

thing is

#

i am not even joking LUL

#

it's getting a text file of IDs from an API

#

and splitting into an array

grim aspen
#

wtf

spark flint
#

storing in redis instead

visual marsh
spark flint
#

so a free host

#

that is why you are rate limited

grim aspen
#

they won't allow free hosts

spark flint
#

yeah

grim aspen
#

i use digitalocean

quartz kindle
spark flint
#

yeah

tough star
spark flint
#

because i'm storing to array

quartz kindle
#

give it more memory

spark flint
#

idk how uhh

sudden geyser
#

why is it so large to begin with

spark flint
#

i would rather store in redis anyways

quartz kindle
#

node --max-old-space-size=4096 index.js

spark flint
#

ah

#

ty

sudden geyser
#

you seriously want that in memory 💀

spark flint
#

i need to cache it

sudden geyser
#

why

rustic nova
#

17 million datasets?

sudden geyser
#

having it in a db is going to be infinitely better

grim aspen
#

christ

spark flint
#

its a 17 million line long file

sudden geyser
#

than one giant hashmap

spark flint
sudden geyser
#

or set even

quartz kindle
#

you probably also want to parse it procedurally

#

instead of parsing it all at once

spark flint
#

do i want to make 17 million database requests

#

probably not

quartz kindle
#

no but you have a string

#

you can parse the string in chunks

#

instead of all at once

spark flint
#

ah

lyric mountain
grim aspen
#

that would blow up my HP desktop from 2013

spark flint
#

yeah it hates me opening it

lyric mountain
#

my 254k line dictionary takes a moment to open

#

imagine 17m

spark flint
#

lol

grim aspen
#

tf you using a nasa pc?

spark flint
#

well it does open for me

#

im on macbook air m1

tough star
#

christmasthink my 300 lines one takes 10 mins to open

#

not fair

spark flint
#

lol

#

you have bad pc then

grim aspen
quartz kindle
#

how big is the 17 million line file in mb?

spark flint
#

m1 is powerful lmao

spark flint
grim aspen
#

watch it be a terrabyte

spark flint
#

i know the sql db version is 1.6gb

sudden geyser
#

probably like half a gigabyte

#

oh lame

tough star
# spark flint you have bad pc then

i have 2 pcs but the one i'm working on rn is intel core 2 duo 4gb ddr2 .. hdd no ssd
second one is 500ssd 16gb ddr4 3200mhz ram and ryzen 5 4650g pro
so ye

spark flint
#

450mb

#

but this gets it from a url

quartz kindle
#

thats not much

spark flint
#

which is querying a friends DB

quartz kindle
#

wait what

#

lmao

spark flint
#

yeah the lines are literally single user ids

spark flint
#

but that is not kept up to date

#

and is 1.6gb

grim aspen
#

would that be a breach of tos or no?

quartz kindle
#

wait so

#

they made a url

spark flint
quartz kindle
#

that lets you download a 450mb file

#

directly from their db

grim aspen
#

fair point

spark flint
#

it's from Beemo's raid lists

quartz kindle
#

i hope that file is pre-generated and not queried live lmao

spark flint
quartz kindle
#

ok, so

spark flint
#

this is all the response is

#

a very very long file

quartz kindle
#

you want to do this only once? or you want to periodically download it again and update your db?

tough star
#

discord.js v12.5.3
@discordjs/opus is not working when i try to install it on a RDP ..
it works on repilit tho
any idea?

(modules installed)

spark flint
#

it periodically updates

quartz kindle
#

streams to the rescue

spark flint
quartz kindle
#

you use node right?

spark flint
#

yes

quartz kindle
#

make a js file

#

that opens a request to that url

#

get the result as a stream

#

use .on("data")

#

on every chunk you get, parse the lines and update your db

spark flint
#

alr

quartz kindle
#

make sure to check if there are any leftover characters

#

and add them to a buffer

#

chunks can cut IDs for example, because streams are chunked in bytes, not in lines or characters

lyric mountain
#

bonus point if someone peeks at ur pc screen, make sure to wear a balaclava or a hoodie

spark flint
#

lmao

quartz kindle
#

another thing, make sure your friend has a decently large timeout on their server

#

since you're gonna be slowly downloading and parsing the file, the server will cancel the download if it takes too long

spark flint
#

yeah i think they fixed that

#

it timed out originally

hidden gorge
#
            ^

TypeError: Cannot read properties of null (reading 'setPresence')
    at Object.<anonymous> (C:\Users\James\Desktop\bots\PhonkBot\index.js:11:13)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47

Node.js v18.12.1```
#
const { Client, Events, GatewayIntentBits, ActivityType } = require("discord.js");
const { token } = require("./config.json");
const clc = require("cli-color")

const client = new Client({ intents: [GatewayIntentBits.Guilds] });

client.once(Events.ClientReady, c => {
    console.log(clc.blue("[INFO]"), clc.green("-"), clc.red(`Logged In as ${c.user.tag}`))
});

client.user.setPresence({
    activities: [{ name: "Phonk", type: ActivityType.Listening }],
    status: "idle"
})



client.login(token);```
deft wolf
#

Discord.js version?

hidden gorge
#

v14

wheat mesa
#

You’re doing client.user but your event parameter is c

#

Use c.user instead

hidden gorge
#

thx

spark flint
#

also

#

do it when ready

#

s like

hidden gorge
#

@wheat mesa
`ReferenceError: c is not defined
at Object.<anonymous> (C:\Users\James\Desktop\bots\PhonkBot\index.js:11:1)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47

Node.js v18.12.1`

spark flint
#
client.once(Events.ClientReady, c => {
    console.log(clc.blue("[INFO]"), clc.green("-"), clc.red(`Logged In as ${client.user.tag}`))
  client.user.setPresence({
    activities: [{ name: "Phonk", type: ActivityType.Listening }],
    status: "idle"
})
});
#

bad indentation

wheat mesa
#

Oh wait

deft wolf
#

Oh yeah. You must have it in the ready event

wheat mesa
#

You fucked up your event

#

I didn’t see the closing curly bracket

hidden gorge
#

fixed

wheat mesa
#

Do it in the event and it’ll work

spark flint
#

client.on("ready") doesn't send the client

#

just get the client from client, not c

wheat mesa
#

Yeah I also found that to be odd

spark flint
#

yeah

#

dpy is different

#

dpy sends the client

wheat mesa
#

I would rather cry myself to sleep every night than use python for a full blown project

craggy pine
#

I started creating a python twitch bot thing and I immediately said fuck it and went to js

spark flint
#

lmao

craggy pine
#

Like I don't mind python, just some things that normally would work in JS I just instinctively do it in python to usually be dissapointed

wheat mesa
#

Python is fine as a scripting language. I think it’s a good replacement for batch install scripts

#

But when you start to build backends with it? That’s when I think it’s a terrible idea

#

Only exception here being machine learning since that is calling C functions anyways

rustic nova
#

have been happier than on java

wheat mesa
#

Java is good for backends

rustic nova
#

I hate java

wheat mesa
#

Using it for UI though is a different story

rustic nova
#

I dont like how difficult it is to use to try to make a web backend

#

for me at least

wheat mesa
#

It’s good for server side development

#

I haven’t tried any web frameworks with Java but I imagine they can’t be too great because integrating Java with a browser application sounds hellish

royal portal
#

you replace map('DATASOURCE_LOCAL_DIRECTORY', 'string', 'datasource.local.directory'), with export DATASOURCE_LOCAL_DIRECTORY=$(bashio::config "DATASOURCE_LOCAL_DIRECTORY")

#

as in what

#

you want to replace all of map('DATASOURCE_LOCAL_DIRECTORY', 'string', 'datasource.local.directory'), with export DATASOURCE_LOCAL_DIRECTORY=$(bashio::config "DATASOURCE_LOCAL_DIRECTORY")?!?!1

lyric mountain
rustic nova
#

springboot was pain for me to setup

lyric mountain
#

Weird, did you use the spring installer or just springboot?

#

Cuz spring is ridiculously abstracted (which becomes overcomplicated), but springboot alone is pretty straightforward

rustic nova
#

then was probably spring itself

#

didnt bother going further than that

lyric mountain
#

I don't like spring

#

Like, I'm all in for abstraction, but I also want freedom

#

Having to Google how to change settings for every single thing is tiresome

#

Also I hate offclass configurations

#

Which spring apparently loves to use (everything is configured in properties/yaml files)

rustic nova
#

with flask

#

its just routes

#

and done

#

I like that simplicity

lyric mountain
#

It is with springboot, really

#

The only thing u do, if ur not declaring the routes on the entry class is calling Application.run(TheRoutesClass.class)

#

It's all u do to declare a route

#

(not the stuff inside the method)

rustic nova
#

yeah still too complicated somewhat for me

#

but yeah its mainly the spring setup

royal portal
#

cant you use the replace thing in vsc

rocky hearth
#

Whats the difference in defining a type like this,

type MyFunc = () => void;
// and
type MyFunc = Function;
craggy pine
#

same thing I believe, arrow functions just look prettier.

#

Could be incorrect.

sudden geyser
#

Probably depends on what Function is

#

Since the former is a zero-arg anonymous function that returns nothing.

#

While Function could e.g. mean any callable that returns anything

#

but I'm not sure myself

sharp geyser
#

It is as Klay says iirc

#

First being a anon func with void being its expected return type (e.g returns nothing) and the second is like saying I want this to be a function, but it can take in any number of args and have any return value (or I could be mistaken so take my words with a grain of salt)

lament rock
#

It's this thing everyone else is saying (but I may be wrong so fact check plz)

sharp geyser
#

Oh btw

#

How did your rabbitmq thing come along?

lament rock
#

Super helpful

sharp geyser
#

Noice noice

#

I still haven't touched rabbitmq

#

looks too scary

lament rock
#

its a pain in the ass to install

sharp geyser
#

I noticed

#

I dont even wanna attempt

#

but it might be helpful for my project idea

sudden geyser
#

how does rabbitmq compare to kafka, since they look similar

near grotto
#

hi

#

I need a help with my java code

#

I am creating a program that prints the eligibility of a student by inputting marks. I am allowed to use 4 member methods - Class(String name, int, int, int), void input(), String check(), void display()

#

And I have to take 4 global private variable - String name, int math, int science, int computer

#
import java.util.*;
public class Student
{
    private String name;
    private int mm;
    private int scm;
    private int comp;
    
    public Student(String n, int m, int sc, int c)
    {
        name = n;
        mm = m;
        scm = sc;
        comp = c;
    }
    
    String check()
    {
        String Eligibility = "Not Eligible";
        double avg = (mm + scm + comp)/3.0;
        
        if(mm >= 90 && scm >= 90 && comp >= 90)
        {
            Eligibility = "Science with computer";
        } else if(avg >= 90)
        {
            Eligibility = "Bio Science";
        } else if(avg >= 80 && avg < 90)
        {
            Eligibility = "Science with hindi";
        }
        
        return Eligibility;
    }
    
    void display()
    {
        String elig = check();
        System.out.println(elig);
    }
    
    void input()
    {
        String n;
        int m, sci, c;
        Scanner sc = new Scanner(System.in);
        
        System.out.println("Enter the name");
        n = sc.nextLine();
        System.out.println("Enter the marks scored in maths");
        m = sc.nextInt();
        System.out.println("Enter the marks scored in science");
        sci = sc.nextInt();
        System.out.println("Enter the marks scored in computer");
        c = sc.nextInt();
        
        Student ob = new Student(n, m, sci, c);
    }
    
    public static void main(String args[])
    {
        //how to call?
    }
}
#

I need help to call the two functions in the main method

#

input() and display()

rustic nova
#

What exactly do you need help with these 2 methods

#

You should be able to just call these using input(), input will work through the scanners, then use the display() to use it

rigid maple
#

How can I find the interior angles of a triangle from the side lengths?

rustic nova
#

Pythagoras

rigid maple
#

i solved thanks

topaz terrace
#

How do I make it so that when a user voted a specific bot it will send a message?

deft wolf
#

In pinned messages you should have everything explained

neon leaf
#

so I have this:

export default function InputCheckbox({ title, className, defaultValue = false, disabled, onChange }: Props) {
    const [value, setRealValue] = useState(defaultValue);
    const setValue = (value: boolean) => {
        setRealValue(value);
        onChange(value);
    };

    return (
        <button
            type={'button'}
            className={className}
            css={tw`mt-4 -mb-2 bg-gray-850 border-2 disabled:opacity-75 border-gray-150 hover:border-gray-600 p-3 transition-all rounded focus:border-gray-300 focus:ring-2 focus:ring-gray-300`}
            onClick={() => setValue(!value)}
            disabled={disabled}
        >
            <label css={tw`text-base flex items-center cursor-pointer`}>
                <Input
                    type={'checkbox'}
                    css={tw`text-blue-500! w-5! h-5! mr-2`}
                    defaultChecked={defaultValue}
                    checked={value}
                    onChange={() => setValue(value)}
                    disabled
                />

                {title}
            </label>
        </button>
    );
}

Its a checkbox with some additional stuff, I only want it to trigger when clicking its parent button, the checkbox itself is just decoration so its disabled, but if I click on the checkbox precisely it wont trigger, so how can I make the button be prioritised for clicking?

lyric mountain
#

disable pointer events

#

it'll ignore any mouse-related events

neon leaf
#

how can I do that?

#

ah, pointer-events-none right?

#

yup, thank you so much!

lyric mountain
#

yw

sterile brook
#

who can suggest nice and +- cheap vps?

solemn latch
#

novonode, galaxygate

craggy pine
#

^ Galaxygate is what I use and it's pretty solid.

stiff dust
lyric mountain
#

are u using versioning or copying files directly?

stiff dust
#

what is versioning ?

#

I just import files with WinSCP to the VPS

lyric mountain
#

well, aside from risking losing your entire project, something might've happened during the transfer

#

corrupting some binaries

rustic nova
#

or certain dependencies relying on system-based elements and these elements no longer being present, but your dependencies not knowing that

stiff dust
lyric mountain
#

I really suggest using some versioning system like git, this also makes it easier (and safer) to transfer your project to other servers

lyric mountain
#

instead of copying with scp

stiff dust
#

well I didn't put my config.json there 👀

#

what should I do about that? 🤔

lyric mountain
#

I suppose config.json is your token file?

stiff dust
#

yes

lyric mountain
#

that one u can scp directly

wheat mesa
#

Copying with scp is also way slower because you’d be transferring the node_modules folder (and btw, that won’t work)

lyric mountain
#

like, scp is fine for small files like config.json

wheat mesa
#

Yeah

stiff dust
wheat mesa
#

Ah okay

#

Good

stiff dust
lyric mountain
#

u excluded node_modules from being commited to github right?

lyric mountain
#

when u attempt cloning it'll ask u to login

stiff dust
#

okay let me try

#

BTW I don't think so it will solve the problem

wheat mesa
#

(Modern method is generating a private key for the repo on GitHub)

lyric mountain
#

it might, who knows

wheat mesa
#

I don’t think the login method is allowed anymore

lyric mountain
#

at least it'll be one less possible cause

wheat mesa
#

But I could be wrong

stiff dust
#

maybe Opus and Sodium too

lyric mountain
#

did u try reinstalling it?

stiff dust
#

re install what?

lyric mountain
#

I do know if u login it shows a login prompt, at least on windows

lyric mountain
stiff dust
lyric mountain
#

if u transferred it with scp it might be the reason

#

since it relies on system-specific files

stiff dust
#

I just transfered a file 54KB folder with SCP I don't think so something missed there

lyric mountain
#

54kb? for ffmpeg?

stiff dust
#

and also I don't install the whole FFMPEG I am using ffmpeg-static librrary

stiff dust
#

I create a zip from my files (except node_modules)

#

and package-lock

#

so it was only few texts in.js

#

and then I do npm install in VPS

lyric mountain
#

well, try reinstalling ffmpeg again

#

but start using github to transfer projects from now on, it's the proper way to do it

stiff dust
lyric mountain
#

idk, never had to do it

stiff dust
#

ok let me try

#

ok I run

npm uninstall ffmpeg-static libsodium-wrappers @discordjs/opus @discordjs/voice

and after that

npm install ffmpeg-static@5.1.0 libsodium-wrappers@0.7.10 @discordjs/opus@0.8.0 @discordjs/voice@0.14.0

and I get

added 64 packages, and audited 210 packages in 4s

15 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

and still my bot don't play musics

lyric mountain
#

hm, do you get any error at all?

#

like, try running at debug level if you don't

neon leaf
#

ffmpeg on nodejs linux is pretty broken, If I remember correctly ffmpeg just straight up doesnt work

#

you should probably install ffmpeg using apt and execute bash commands to use it, bad solution but I dont know any other fix

stiff dust
stiff dust
quartz kindle
#

what type of linux?

#

ubuntu?

craggy pine
#

uninstall FFmpeg static w/ this

npm uninstall ffmpeg-static
npm ci --no-optional
npm update
stiff dust
# quartz kindle ubuntu?

yes - I just change VPS Provider and VPS Region from Netherland to US because of better ping

last ubuntu was v18 and this one is v22

#

so

npm uninstall ffmpeg-static
npm ci --no-optional
npm update

and then

sudo apt update
sudo apt install ffmpeg
ffmpeg -version
stiff dust
#

finally fixed ;-;

craggy pine
#

yerp

surreal sage
#

I am getting "Segmentation fault" on Node v16.19 and buffer overflow on latest LTS

#

I'm working with Discord's Gateway and the npm WS package

#

it worked fine on v12

#

it still does*

rustic nova
#

refer to my message in support

lament rock
#
> part.substr(7 - 2, 16).length
9
#

substr is so weird

sudden geyser
#

what language is this

lament rock
#

js

#
/**
 * Gets a substring beginning at the specified location and having the specified length.
 * @param from The starting position of the desired substring. The index of the first character in the string is zero.
 * @param length The number of characters to include in the returned substring.
 */
string.prototype.substr(from: number, length?: number): string;
sudden geyser
#

are substr and length counting differently

#

like unicode characters vs. perceived characters

#

however to describe it

lament rock
#

idk. Quite possibly

#

part is "= ⋄ ==== ⋄ ==="

#

on a polyfill I made, it does properly return a length of 16

#

trying to figure out wtf is going on

#
text.repeat(Math.ceil(length / (from + text.length))).slice(from, from + length)
#

nvm now I got it to work 100% compliant with substr

lyric mountain
#

why substr instead of substring?

quartz kindle
#

jesus christ

#

i knew erlpack was bad, but i didnt know it was this bad

sudden geyser
#

what is this packing

quartz kindle
#

this ```js
const obj = {
a: 10,
b: 20,
c: "02fh203jf0293",
d: [32,42352,3523,234],
e: { r: 4345, g: "fwefw" }
}

sudden geyser
#

oh I thought that said erlang

#

wait it is erlang

quartz kindle
#

yeah, packing a js object to erlang term format

cursive musk
#
    if (invitecode instanceof Error)
      return interaction.reply(
        `There was an error while trying to make that invite.\n\`\`\`js\n${invitecode}\`\`\``
      );
``` This usually works for me, but I'm now getting the error:

Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
at ChatInputCommandInteraction.reply (/Users/ishaan/Downloads/Universe List/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:102:46)
at Object.execute (/Users/ishaan/Downloads/Universe List/src/servers/commands/invite.js:51:26)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

#

Not sure what's causing it

craggy pine
#

you can't have a reply, than another reply.

#

So try editReply or deleting it

lament rock
lyric mountain
#

Doesn't js already have that?

lament rock
#

it does have a string.substr method, but in node, it's deprecated as substr isnt really part of the spec and is only there for browser compatibility

lyric mountain
lament rock
#

substr returns a portion of it and repeats if it has to

#

more convenient than writing what my method impl shows

cursive musk
#

Thanks a lot

craggy pine
#

I wonder the same as it says the exact problem in the error message. 😛

spark flint
#

lol

cursive musk
#

if only they could explain it to me like i'm 5

spark flint
#

that one isn't

#

it literally says a reply has already been sent

craggy pine
#
Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred. //here
    at ChatInputCommandInteraction.reply (/Users/ishaan/Downloads/Universe List/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:102:46)
    at Object.execute (/Users/ishaan/Downloads/Universe List/src/servers/commands/invite.js:51:26) //and your error is exactly right here
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
#

I added some comments to your error for you.

#

invite.js line 51 at character count 26

lyric mountain
radiant kraken
#

or just read the first sentence

The reply to this interaction has already been sent

lyric mountain
#

Usually the answer is in the first 2-3 lines

lyric mountain
#

The rest is just the stacktrace

lyric mountain
#

Even more than js

radiant kraken
#

like wtf is a Symbol

lyric mountain
#

A class

#

But depends on context

radiant kraken
#

descriptive as in how long their stack trace are and at how much they fill your terminal screen?

lyric mountain
#

I mean, u can simply edit how long u want them to be

#

But usually having the full stacktrace is more useful than shorter ones

#

That said, they rarely get longer than 15 lines, unless it's an stack overflow

radiant kraken
lyric mountain
#

C++ is something else KEKW

radiant kraken
#

ikr

#

since when can errors be that recursive 😭

#

only in C++™️ iara_thisisfine

#

like imagine C++ IDEs

lyric mountain
#

My issue with c++ are::those<long>as.hell<error<messages>, that>take::10::full<lines, to>.say.what::they::want

radiant kraken
#

or they just dont say the real cause

#

like they would never say "you missed a semicolon" or you "did a typo"

#

and Rust is the exact opposite iara_love_give

lyric mountain
#

I still have to try rust one day

#

But idk, never liked low level langs

radiant kraken
#

fair

#

i wouldn't really say Rust low level tbh

#

i would say it's the middle ground between low-level and high-level

#

it makes low-level programming feel like what would you do in high-level programming

wheat mesa
#

so it's not totally unreasonable to use that in error messages

radiant kraken
#

but why not use an object instead

#

Symbol sounds way too technical

wheat mesa
#

because object is obscure and doesn't describe what it actually is

sudden geyser
#

Like I've gotten Java error stacktraces that are completely useless and tell nothing about even the high-level context

lyric mountain
#

Hmm I do use java in my bot, which is somewhat a complex environment

#

Especially considering my game runtime

#

And all the reflection stuff

#

If you're getting non-descriptive error messages chances are it's a library issue, not java

#

After all, java can't guarantee lib devs will write proper exception messages

sudden geyser
#

The last instance I remember was using Jetty

lyric mountain
#

Some devs are reckless and don't care about writing concise errors

#

Yes I'm talking to you google

#

Fuck your gson lib

sudden geyser
lyric mountain
#

I was blessed of finding moshi

#

Else I'd be either dealing with gson or jackson by now

rocky hearth
#

What the moduleResolution should be in tsconfig for react app created with CRA.

earnest phoenix
radiant kraken
earnest phoenix
#

So true! LLVM™️ is the best, even Rust™️ is made with it, so fast™️ and safe™️

sterile brook
#

Anyone used contabo Vps?

lament rock
#

yes

#

theyre good

sterile brook
#

Oke, ty

rustic nova
#

Used one-provider before contabo

#

OneProvider decided to randomly consider my dedi as defunc

#

Contabo has a good cli tool to make snapshots, using them for my 3-2-1 backup

#

maybe their dashboard seems a bit older but still covers everything

lyric mountain
#

they revamped the dash recently

rustic nova
#

Not the my.contabo one

lyric mountain
#

a

rustic nova
#

a

quartz kindle
#

a

solemn latch
#

C

quartz kindle
#

c-c-c-c-combobreaker

gleaming bolt
#

I'm passing an object to my API, without defining body or header

exemple:

const response = await fetch("api", {
  headers: {
    ...
  },
  teste: "my teste"
})

want to get the "test" in my API

#

How can I do this? I'm using express

quartz kindle
#

you cant?

#

fetch sends the headers and the body

#

you cant make fetch send something else that is not in the headers nor in the body

#

well, you can use trailers, but thats the same thing as headers just on the end of the message

gleaming bolt
#

ok

quartz kindle
#

if you explain what is the reason for wanting that maybe there is a better solution

gleaming bolt
#

but i was looking at top.gg's "node-sdk" and i came across this code

await this._request("POST", "/bots/stats", {
      server_count: stats.serverCount,
      shard_id: stats.shardId,
      shard_count: stats.shardCount,
    });
#

I created a "GET" route, but if I pass the body in the "GET" route, it returns an error, and I don't want to pass the type of data that this route needs in the header

gleaming bolt
#

in the header I pass the user's access token, to be verified

quartz kindle
#

and is sent using body

#

just create a POST route

gleaming bolt
#

yes, the "GET" method is for receiving and not sending, in this case I can't send a body

#

but I need "GET" method in API

rustic nova
#

then dont include a body?

#

read the docs of fetch

earnest phoenix
#
Cannot find module 'top-gg/sdk'

can someone help?
i installed it but ?

gleaming bolt
#

so i want to understand how it works

      server_count: stats.serverCount,
      shard_id: stats.shardId,
      shard_count: stats.shardCount,
    });
gleaming bolt
rustic nova
#

post: the method, /bots/stats, the api path, the rest is self explanatory

#

just keep in mind that thats something made within top.gg/sdk itself and not a library

gleaming bolt
#

hm....

rustic nova
#

look up request libraries for python, most used one is probably aiohttp

#

or use requests

#

literally any works

#

reading the docs will help on the usage

gleaming bolt
#

ok

earnest phoenix
gleaming bolt
quartz kindle
#

on the server side, you listen to GET requests, to send something back to the client, and you listen to POST requests to receive some data from the client

#

then you also have other types of requests, such as PATCH, DELETE, OPTIONS, HEAD and a few others

quartz kindle
quartz kindle
#

and technically you can send a body with GET, but you'll have to use lower level tools, because most libraries will not allow you to do that

#

if you write a raw http request and parse the raw request in the server, then you can send anything, regardless of request method

surreal mica
#

can i ask help for an assignment here, im making a bot using dsharpplus and need guidance on a specific command i want to make

surreal mica
#

lol sorry, so im pretty new to programming just a disclaimer

#

i wanted to make a command that displays the users avatar to them

#

and i dont know where to start like i wanted to display the picture in a thumbnail like i seen in a tutorial (https://www.youtube.com/watch?v=0gQZc0jlPq4&ab_channel=DapperDino) but i just dont know how to get the bot to download the users pfp

#

im rly lost

lyric mountain
#

I recommend not following a video tutorial tho

#

they don't get updated as often as libraries do, and you become dependant on them

surreal mica
#

ah okay

lyric mountain
#

instead, think what you want to do and read the documentation to find out how

surreal mica
#

ill check these out thank you for your help

lyric mountain
#

yw

lament rock
#

I respect going for C# first versus a low hanging high level language

surreal mica
#

im suffering

lyric mountain
#

which is somewhat rare for newcomers around here

lyric mountain
surreal mica
#

about 4 months

lyric mountain
#

hm, I suppose u made other side projects before starting a bot?

surreal mica
#

no.. i just learned the languages. with the bot its a group project to they taught me the basics but i dont want to continuously ask them stuff incase its annoying

#

bc they are pretty advanced

lyric mountain
#

hm, I'd suggest attempting some simpler projects to get yourself familizarized with the language

#

like a calculator or a snake game

#

and make sure you're using a decent IDE, like rider or visual studio

surreal mica
#

yeah im using visual studio

lyric mountain
#

bots aren't a good first project if you aren't used to programming, it might feel overwhelming

lament rock
#

true

#

bots are more for advanced concepts especially if you're making certain types of bots

#

I learned that the hard way and once I got better, the scope of my bot's problems got significantly larger

gleaming bolt
quartz kindle
#

why not tho?

#

what exactly are you trying to do?

quartz kindle
sick agate
#

is it normal that browsers send cookies in a sandboxed iframe to the server (btw its from the same url so)

rustic nova
#

yes, the iframe is a separate web session

sick agate
#

when it should do that

rustic nova
#

su amogus

#

whats your goal right now

#

oh wait

#

is it normal that browsers send cookies in a sandboxed iframe to the server
if the origin is the same as the window outside the sandboxed iframe, yeah

#

you need to fr imagine it as if you're opening a new window on chrome, everything such as cookies or localStorage that match the origin will be accessible to the iframe

#

allow-same-origin Allows the iframe content to be treated as being from the same origin
could change that

sick agate
#

how-

#

i will definetly try it but

rustic nova
#

thats the same way how cookies work, only the same origin can access the same origins cookies

sick agate
#

i need the iframe to not access the cookies from the origin while stlil connecting to the origin site

rustic nova
#

also, you might need to define the origin on the cookies you specifically NOT want your iframe to be able to read

sick agate
#

i did

#

how do i do that might i ask?

#

flask btw

rustic nova
#

so defining your scope on a cookie would help, IF your iframe path and your parent window aren't the same path

sick agate
#

they arent

#

is it a way to exclude a path from it?

rustic nova
#

only include I think

sick agate
rustic nova
#

so lets say your main page where the iframe is embedded on is on path /main, the iframe uses the path /iframe

so you'd need a cookie with the path /main to only allow that path. This will not make the cookie be accessible to /iframe

#

That's at least how I understood it

sick agate
#

i actually use /api/ for some reason but yeah

rustic nova
#

just as a general example

#

if my codeserver wouldn't be dying, I could try to repro it

sick agate
#

yeah

rustic nova
#

apparently my config perms fucked themselves

#

great

sick agate
rustic nova
#

aight now, gimme 2 mins, apparently windows is shit

#

yeah wtf? I can see what issue you're getting

#

actually nvm, thats correct

#
from flask import Flask
from flask import request
from flask import render_template
from flask import make_response

app = Flask(__name__)

@app.route('/index')
def index():
    # set a cookie named "test" and with the value "Yes"
    response = make_response(render_template('index.html'))
    response.set_cookie(key='IndexTest', value='You should only be able to see this on /index', path='/index')
    return response

@app.route('/iframe')
def iframe():
    response = make_response(render_template('iframe.html'))
    response.set_cookie(
        key='iframeTest', value='You should only be able to see this on /iframe', path='/iframe')
    return response
app.run(host='0.0.0.0', port=2822)
#

so path is probably your go-to then

#

and also ensure the iframe has the following set, allow-scripts is just for js execution so that can be ignored if you're not using it

rustic nova
#

also does child paths

neon leaf
#

whats the best way to make a draggable server list in react?

#

basically being able to rearrange them

lyric mountain
#

that's pretty vague

#

listen to onDrag events and calculate the new position based on the top-left coordinate

neon leaf
#

how do I calculate which position they now are?

#

like in this case it should be 1-10

lyric mountain
#

just compare with the other items

#

if the y coord is higher than the other item's y coord, it's now where that item was

#

and everything below should be moved 1 index up

neon leaf
#

alr, I think I kinda understand. my api is in php (sadly) and how do I validate that the positions are valid? so make sure all from 1-servercount are fulfilled?

#

basically id just send an array with all server uuids and their position

lyric mountain
#

they can't be invalid

#

simply that

neon leaf
#

🤔

lyric mountain
#

you're comparing the dragged item's y coord with the other items' y coord

#

optionally, u can also simply sort the array by y coordinate

neon leaf
#

I mean if a user sends a faulty request from the network manager

#

like then id have a server with position 112214214

lyric mountain
#

simply clamp it

#

if the index is higher than the item count, set index to item count - 1

neon leaf
#

alr, lemme try

neon leaf
sudden geyser
#

jesus christ since when could video uploads be that wide

rustic nova
#

yeah no they definitely changed something

#

that is not what I remember either

#

discord again with their unnoted changes

#

Testing something, development reasons obv

#

Yeah nah they definitely did something

dusky idol
#

Hey can someone explain me how do I make my bot give rewards whenever someone votes for my discord server?
For rewards, I want to give coins which are stored in database. I want to give the user rewards even if they aren’t in the server & votes via bot.
I’ve never worked with top.gg api & I’m beginner at bot development as well.

For context, my bot is a public bot available to everyone & it contains an economy system (public/global), I want to collect votes for my server with the help of my bot.

burnt blade
#

To get the full api you would need a domain

#

For them to send to

#

Idk if they changed it though

burnt blade
#

Assuming they voted again

dusky idol
quartz kindle
#

does topgg support webhooks for servers?