#development
1 messages · Page 93 of 1
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
Doesn't c++ have a dependency manager?
I'm using cmake
But I had some sort of issue with DLLs when trying to run it on another PC
how would i convert the text file into a string tho?
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
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
i will try to use it
its what i asked for but şn reverse as it seems
@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)
the culprit - https://draftlol.dawe.gg/
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
The date & time format of the embed footer is set by Discord, you can't change it's formatting
But you could probably make a timestamp yourself with .setFooter() and the moment package
Note that the Moment library is no longer maintained, you should use https://moment.github.io/luxon/#/ instead
Immutable date wrapper
lmao rip, glad you found the issue
How could I put the seconds in the footer in some way other than Timestamp?
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
I understand
You can mention any moderator to reset your nickname
thanks
Moderator, not community manager as that one's busy
is that I saw the role of Moderator in this user
sorry
Well note their status and custom status 
strange, I thought I had taken
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?
AAA yes, sorry akakakkakak
I'm glad you didn't see mine, it was kind of embarrassing kakka
.
oh sorry I didn't see
wont that detach the console?
Note the stdio option, passing inherit to it will inherit the current standard input/output, the console, and won't detach
ah, didn't see it
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
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 ^_^
the header "authorization" is sent by top.gg
but what host just
strips away a crutial header
thats actually cring
sounds like a security measure(somehow?)
nah dont see any security there lol
x-authorization is actually probably a bad thing to use tbh
just some bothersome measure to annoy devs
you get: a very cheap host
we get: your authorization header
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 👀
but it makes no sense if you prevent the header from reaching the destination
cloud hides from viewing the header afterwards, but it doesn't simply remove it before reaching the server
i didn't know it was a thing till i went over it with them on a call, as i have never had header naming issues before this, but its used on protected servers for security for whatever reason they have chosen, im guessing this is why patreon use a custom auth header
oh yeah, absolutely, its just a feature that can protect users headers.
very strange 👀
sounds like they are viewing all requests you have incoming
headers are typically encrypted right? 👀 @lyric mountain
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
yes they are from end to end as far as i know, but once the server receives them they are decrypted and then readable by the server for the program to then use them
I believe so, at least in https
I mean, ain't that the entire reason for https?
yes it is haha
maybe implement a custom header that TopGG can use like patreon does
tbh, I dont think anyone has ever had this happen.
yes they provide me wildcard SSL certs for all domain as part of my account type with them
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.
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?
return <div style={{ color: props.children ? "green" : "red" }}>{props.children}</div>
👀
i get that, i was going to use IP but these can be spoofed so can be unreliable if someone were to override the headers sent, so the auth token is best as its something i set and if you can guess it good on you
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.
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 `'`, `‘`, `'`, `’`. 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 `'`, `‘`, `'`, `’`. react/no-unescaped-entities
49:46 Error: `'` can be escaped with `'`, `‘`, `'`, `’`. react/no-unescaped-entities
52:259 Error: `'` can be escaped with `'`, `‘`, `'`, `’`. react/no-unescaped-entities
61:76 Error: `"` can be escaped with `"`, `“`, `"`, `”`. react/no-unescaped-entities
61:93 Error: `"` can be escaped with `"`, `“`, `"`, `”`. react/no-unescaped-entities
./src/pages/_offline.tsx
15:95 Error: `'` can be escaped with `'`, `‘`, `'`, `’`. 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 .
```.
Fair, but how do I access the above files or whatever I want to be accessing?
Nevermind, I'm blind. I see now.
you need to go to your page file
/src/pages/404.tsx and /src/pages/index.tsx and /src/pages/_offline.tsx
Quick question, which one from ", “, ", ”?
replace every instance of ' with '
Do I like use any of the above?
depends on the symbol
A table of HTML predefined character entities
' is the one you need for '
Oh, sweet.
In the ./src/pages/index.tsx error, the first one, I'm getting the following error.
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
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?
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
I'm getting this error.
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
yo got a question
i am filtering roles of a guild, is there a way to filter roles related to bots?
Related as in roles created specifically for that bot (the name of the role being the same as the bot)?
you know how each bot comes with its own role? i wanna filter and remove those
is their a way to detect if this role is related to a bot?
Yeah I'm talking about that, such roles have a field called managed which determines that
ah really?
If you're using discord.js for example: https://discord.js.org/#/docs/discord.js/14.7.1/class/Role?scrollTo=managed
getting blocked bruh
instead of comparing role name, compare role id
everyone will always have the same id as the guild
everyone is all good lol, i just want the managed roles
gonna use that
didnt know it existed
thanks for the knowledge didnt know that lol
ye, it's a funny detail
Hey hey, I got another Java question here. Is it possible to put a class in a class?
Has the ateveryone
ah
One of the filters set on automod
So public class Wallet{
private Person; (where this person is a class on its own)
}
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
I see
Actually like: private Person = new Person()
I think it would work indeed
yes, that's just declaring a variable
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?
interfaces are just contract declarations
In the lecture they did add this tho 😳
public interface paying{
default int size = 50;
}
it's for methods
to declare default implementations
interfaces can, tho, have static constants
no default tho
Every class implementing this will start with that int right?
no
And it’s individual?
it's a static constant
oowh
interfaces cannot have variables since they're contracts
but interfaces are still somewhat classes, so they can have static stuff
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
kinda
I see
Honestly I love you
I see yeah
btw kuuhaku
in an interface
instead of not intializing a public void
can't we create a method already and define it?
wdym?
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()?
Owh my teacher mainly focused on non-unintionalized methods so i thought that that's the only way interfaces could work
just methods
yeah i know my bad
Btw if i try to define a method within my interface
it says that methods cannot have a body
because u need to add default keyword
owhhhhh
all methods in an interface are automatically public, that's why u just write the return type
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
interfaces are mainly used for enforcing methods, and sometimes u can't write a default implementation on the interface
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
can i make some slash commands only show on certain servers or channels?
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
Interfaces are primarily used for inheritance to provide a common type between two types
So with this example, you could make something like a List<Walking> list and do stuff like ```
list.add(new Human());
list.add(new Cow());
// perfectly valid, even though these two types are different
damn void walkers
public class Void implements Walking {
@Override
public void walk() {
dont();
}
}
public class VoidWalker implements VoidWalking {
@Override
public void voidwalk() {
dontvoidwalk();
}
}
Joke’s on you, Void is already a real class in Java
public class Object extends java.lang.Object {
...
}

when you discover abstract classes just keep this in mind: interfaces enforce, abstract classes suggest
and you can have many implements, but only one extend
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
Be very careful, do not define instance variables within interfaces
Wtf is that implements
Even confusing me
Why is it called methods
you forgot default
ah wait, u didn't add a body
your formatting is confusing me
that ain't an instance variable
I know but I’m pretty sure he’s under the impression that it is one
all "variables" inside interfaces are automatically final and static
Yes I’m aware
nah, gave him a pretty long explanation abt that
Ah
here actually
Is there an easy way to output 1 or 0 based on if a number has a certain bit?
(num >> index) & 1
Thanks
yw
That won't mutate num right?
I'm going to make this into a method but honestly not sure what to call it
I would call it hasBit but that seems a little weird since it returns a num and not a straight up boolean
then I just call Bit.on(bits, 0) for example
I'll just call it hasBit since nobody but myself needs to understand this code anyways
Thanks C:
public class MichaelJackson extends Walking {
@Override
public void walk() {
moonWalk();
}
}
lmao
I hate the fact that everything is a class in java
Rust traits ❤️
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.
Hetzner and Linode
contabo
hm, both of them are like 4x more expensive for the same specs
doesnt contabo have a scuffed up ddos policy? like they lock your ip?
still using them for 2 years, didn't have an issue
did you ever get ddosed?
Slash command adoption vs old prefixed messages for my bot over the last 13 months
I think it'll settle at 33/66
Yeah. I really want to not have to accommodate for prefixes in my rewrite though 
damn
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?
put a notice before the rewrite for all prefix commands advising they move to the slashcommand alternative, thats what i did
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
Except i never removed mine 
unlikely thats free
Yeah I'm going to do that
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
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?
:/
If you mean setting something in some bot then yes, it's the wrong channel
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
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
The application is somehow started even though I never opened/started the project: https://cdn.hamoodihajjiri.com/kj42thgjzQ .
It's the same on PORT 5000 and I can't seem to figure out why.
using the example with a different port
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.
I can't add bots to my discord server
Whenever I even kill such process, it just makes another one.
close chrome
then check again
you might be viewing the one chrome tries to visit
Yes, but whenever I close chrome and re-open localhost:3000, the project is somehow started.
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?
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.
Yes. *smiley face
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. ;-;
if you start something else on port 3000 does it error? 👀
yeah, maybe a process manager? 🤷
pm2 can auto start stuff on bootup
No, but I'm confused...
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.
👀 this site cant be reached, you mean the default browser 404 page when you load the page right?
It's supposed to display this but it doesn't, even though there's no project running on that particular port. https://cdn.hamoodihajjiri.com/FtaDZGeFac
you're refreshing the page after the program is closed right?
Well, I'm legit doing nothing with the port, so I'm not sure...
I found a similar issue and its solutions doesn't work, either. https://stackoverflow.com/questions/24349335/python-flask-application-is-running-after-closing
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.
expand the size tab
its "served from cache" right?
thats your issue
wdym "the issue doesnt work" lol, you mean it works on incognito (issue does not happen)?
Pretty much, I think.
Moment.
My server is a jack of all trades. So I'm trying to set it up so people aren't getting irrelevant notifications.
lmao
theres nothing wrong with anything
your website just supports offline mode
using web workers
Sweet, but how about a normal express application, which doesn't support it?
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
Oh, fair. Although, could I not have it do it on port 3000?
open dev tools, go to application -> service workers
For example, PORT 3001 doesn't support what you said above, however, if I run the project ONCE on port 3001 and turn it off and never open it again, PORT 3001 will do just like you said above.
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?
In case of our development, we serve files from https://localhost as the app is hosted in salesforce.com. In chrome service worker on chrome blocks anything coming from self-signed server i.e (http...
Should still work, you could create roles that only have access to certain categories and then reaction roles for that
I believe discord will be releasing their version of this to all servers relatively soon though it’s been around in some for a while
Figured it out, much appreciated! I was able to delete the service worker. :)
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?
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
you use replit?
no
then nvm
console.log the headers to see how long you have to wait
from discord / host
i will use another bot wait
The Same Problem With another bot
try to create another application
probs gonna store in cache
i wouldn't advise that
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
i create another acc and try from it and the same
try vpn
i think its from host
don't
you can read this to see https://discord.com/developers/docs/topics/gateway
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Appreciate the tips
i have badest luck in the world
i am add my bot yesterday to top gg today its offline then bot will decline
The waiting time for accepting the bot is about 10 days
You still have plenty of time to fix this problem
some apps stay alive in the background, depends on how the app starts and stays alive
such as just closing the terminal
what is your host?
lmao
lol
thing is
i am not even joking 
it's getting a text file of IDs from an API
and splitting into an array
wtf
storing in redis instead
they won't allow free hosts
yeah
i use digitalocean
you're running out of memory lol
yeah
saw it .. installed it .. its there .. still missing
give it more memory
idk how 
why is it so large to begin with
i would rather store in redis anyways
node --max-old-space-size=4096 index.js
because 17 million discord accounts have participated in raids lol
ah
ty
you seriously want that in memory 💀
i need to cache it
why
17 million datasets?
having it in a db is going to be infinitely better
christ
its a 17 million line long file
than one giant hashmap

or set even
no but you have a string
you can parse the string in chunks
instead of all at once
ah
that shit would refuse to open
that would blow up my HP desktop from 2013
yeah it hates me opening it
lol
tf you using a nasa pc?
the hell
how big is the 17 million line file in mb?
m1 is powerful lmao
lemme check
watch it be a terrabyte
i know the sql db version is 1.6gb
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
thats not much
which is querying a friends DB
yeah the lines are literally single user ids
they sent me the sql db version
but that is not kept up to date
and is 1.6gb
would that be a breach of tos or no?
it's all public info anyways
fair point
it's from Beemo's raid lists
i hope that file is pre-generated and not queried live lmao
it is a db of user ids, and returns a cached result
ok, so
you want to do this only once? or you want to periodically download it again and update your db?
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)
it periodically updates
streams to the rescue

you use node right?
yes
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
alr
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
1 - color 10
2 - type filename.txt
3 - ???
bonus point if someone peeks at ur pc screen, make sure to wear a balaclava or a hoodie
lmao
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
^
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);```
Discord.js version?
v14
thx
@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`
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
Then the code you sent is not the same code you’re using
Oh wait
Oh yeah. You must have it in the ready event
fixed
Do it in the event and it’ll work
Yeah I also found that to be odd
I would rather cry myself to sleep every night than use python for a full blown project
I started creating a python twitch bot thing and I immediately said fuck it and went to js
lmao
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
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
been there
have been happier than on java
Java is good for backends
I hate java
Using it for UI though is a different story
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
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
Eh? But with springboot you deploy a webserver in minutes
springboot was pain for me to setup
Weird, did you use the spring installer or just springboot?
Cuz spring is ridiculously abstracted (which becomes overcomplicated), but springboot alone is pretty straightforward
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)
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)
https://github.com/OtagamerZ/ShiroImageAPI/blob/master/src/main/java/api/handler/ReactionEndpoint.java this for example
It's all u do to declare a route
(not the stuff inside the method)
cant you use the replace thing in vsc
Whats the difference in defining a type like this,
type MyFunc = () => void;
// and
type MyFunc = Function;
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
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)
It's this thing everyone else is saying (but I may be wrong so fact check plz)

Oh btw
How did your rabbitmq thing come along?
came along well. Using it in production
Super helpful
its a pain in the ass to install
how does rabbitmq compare to kafka, since they look similar
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()
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
How can I find the interior angles of a triangle from the side lengths?
Pythagoras
i solved thanks
How do I make it so that when a user voted a specific bot it will send a message?
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?
yw
who can suggest nice and +- cheap vps?
novonode, galaxygate
^ Galaxygate is what I use and it's pretty solid.
My bot was working great I change the VPS and now it says I am playing and join to Voice channel but it don't play anything can someone help?
https://cdn.discordapp.com/attachments/1075413558415851590/1075414827394138272/image.png
I have a json file like this and have all of radios url there
https://cdn.discordapp.com/attachments/1075413558415851590/1075413999996379237/image.png
and then I create a player for all of them
https://cdn.discordapp.com/attachments/1075413558415851590/1075414106980491264/image.png
and when someone select one of the Radios I will do connection.subscribe(player[selectedRadio])
https://cdn.discordapp.com/attachments/1075413558415851590/1075414261859360840/image.png
the source is ok and it was playing but now when I change the VPS it became like this
I bought my VPS from HETZNER
and these are my packages
https://cdn.discordapp.com/attachments/1075413558415851590/1075414587530281100/image.png
ok so, something I must ask first
are u using versioning or copying files directly?
well, aside from risking losing your entire project, something might've happened during the transfer
corrupting some binaries
or certain dependencies relying on system-based elements and these elements no longer being present, but your dependencies not knowing that
I have the project in GitHub too 👀
I really suggest using some versioning system like git, this also makes it easier (and safer) to transfer your project to other servers
then just clone it
instead of copying with scp
I suppose config.json is your token file?
yes
that one u can scp directly
Copying with scp is also way slower because you’d be transferring the node_modules folder (and btw, that won’t work)
like, scp is fine for small files like config.json
Yeah
no I don't transfer that heavy folder I will install libs from package.json in VPS
well how can I clone a private repo?
u excluded node_modules from being commited to github right?
login on the vps
when u attempt cloning it'll ask u to login
(Modern method is generating a private key for the repo on GitHub)
it might, who knows
I don’t think the login method is allowed anymore
at least it'll be one less possible cause
But I could be wrong
because I have 3 different music bots and they don't play too Ig the problem is came from FFMPEG or something like that
maybe Opus and Sodium too
did u try reinstalling it?
re install what?
I don't recall anymore, been long since I setup git on my vps
I do know if u login it shows a login prompt, at least on windows
ffmpeg
nope let me try
if u transferred it with scp it might be the reason
since it relies on system-specific files
I just transfered a file 54KB folder with SCP I don't think so something missed there
54kb? for ffmpeg?
and also I don't install the whole FFMPEG I am using ffmpeg-static librrary
I told you I install libs in the VPS
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
well, try reinstalling ffmpeg again
but start using github to transfer projects from now on, it's the proper way to do it
npm uninstall ffmpeg-static and then npm install ffmpeg-static or there is a way to reinstall it instead of this?
idk, never had to do it
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
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
No
It was working on another linux vps before... exact same src
try removing ffmpeg static and install this https://www.tecmint.com/install-ffmpeg-in-linux/
uninstall FFmpeg static w/ this
npm uninstall ffmpeg-static
npm ci --no-optional
npm update
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
TNXXXXXXXXXXXXXXXXXXX
finally fixed ;-;
yerp
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*
refer to my message in support
what language is this
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;
are substr and length counting differently
like unicode characters vs. perceived characters
however to describe it
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
why substr instead of substring?
what is this packing
this ```js
const obj = {
a: 10,
b: 20,
c: "02fh203jf0293",
d: [32,42352,3523,234],
e: { r: 4345, g: "fwefw" }
}
yeah, packing a js object to erlang term format
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
substr can overflow strings and repeat them. What I use it for is slicing a portion of a progress bar for live playback since the bar is edited onto the message
Doesn't js already have that?
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
substr returns a portion of it and repeats if it has to
more convenient than writing what my method impl shows
How did I miss that 
Thanks a lot
I wonder the same as it says the exact problem in the error message. 😛
errors messages are usually so over complicated for no reason
if only they could explain it to me like i'm 5
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
The only language I ever saw having an overcomplicated error stacktrace is c++
or just read the first sentence
The reply to this interaction has already been sent
Usually the answer is in the first 2-3 lines
Java too
The rest is just the stacktrace
Java has by far a very descriptive error message
Even more than js
like wtf is a Symbol
descriptive as in how long their stack trace are and at how much they fill your terminal screen?

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
i remember the c++ compiler continuously spamming the same error in an infinite loop

C++ is something else 
ikr
since when can errors be that recursive 😭
only in C++™️ 
like imagine C++ IDEs
My issue with c++ are::those<long>as.hell<error<messages>, that>take::10::full<lines, to>.say.what::they::want
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 
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
to be fair Symbol is often used in compilers to indicate a language item of some sort, usually an identifier or user-defined name of some sort
so it's not totally unreasonable to use that in error messages
because object is obscure and doesn't describe what it actually is
I'm sorry but there's no way you've used Java in a complex environment if that's the case
Like I've gotten Java error stacktraces that are completely useless and tell nothing about even the high-level context
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
The last instance I remember was using Jetty
Some devs are reckless and don't care about writing concise errors
Yes I'm talking to you google
Fuck your gson lib
🔒 stackoverflow.com: how to parse config file
+99 answer: "use gson"
I was blessed of finding moshi
Else I'd be either dealing with gson or jackson by now
What the moduleResolution should be in tsconfig for react app created with CRA.
Proper modern C/C++ compilers:
*Compilers made with our LLVM™️'s very optimized™️ and fast™️ project like our Clang™️:
So true! LLVM™️ is the best, even Rust™️ is made with it, so fast™️ and safe™️
Oke, ty
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
they revamped the dash recently
Not the my.contabo one
a
a
a
C
c-c-c-c-combobreaker
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
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
ok
if you explain what is the reason for wanting that maybe there is a better solution
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
.
in the header I pass the user's access token, to be verified
that is sent using POST
and is sent using body
just create a POST route
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
Cannot find module 'top-gg/sdk'
can someone help?
i installed it but ?
so i want to understand how it works
server_count: stats.serverCount,
shard_id: stats.shardId,
shard_count: stats.shardCount,
});
ok
"@quasi shale-gg/sdk"
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
hm....
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
ok
same error
Official Top.gg Node SDK. Latest version: 3.1.3, last published: a year ago. Start using @top-gg/sdk in your project by running npm i @top-gg/sdk. There are 7 other projects in the npm registry using @top-gg/sdk.
a GET request, is a request made to obtain data from a server, it typically includes a URL and some headers
a POST request is a request made to send data to a server, it typically includes a URL, some headers and a body
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
show picture of the error
if you want to send data to the server using GET, the most common way of doing that is using query parameters in the URL
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
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
which is...?
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
Join Our Community: https://student.dapperdino.co.uk/
Just Here To Plug My Social Media Stuff:
https://www.patreon.com/dapperdino
https://www.twitch.tv/dapper_dino
https://twitter.com/dapperdino4
https://github.com/DapperDino
https://disco...
im rly lost
anything u need can be found here https://dsharpplus.github.io/DSharpPlus/api/
I recommend not following a video tutorial tho
they don't get updated as often as libraries do, and you become dependant on them
ah okay
instead, think what you want to do and read the documentation to find out how
ill check these out thank you for your help
yw
I respect going for C# first versus a low hanging high level language
im suffering
indeed, they also were fairly polite
which is somewhat rare for newcomers around here
are you experienced with c#?
about 4 months
hm, I suppose u made other side projects before starting a bot?
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
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
yeah im using visual studio
bots aren't a good first project if you aren't used to programming, it might feel overwhelming
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
I think I'll opt for this, I don't want to pass even a header in the url, like query/params
if you're worried about security, using https should be more than enough
is it normal that browsers send cookies in a sandboxed iframe to the server (btw its from the same url so)
yes, the iframe is a separate web session
the issue is it does not do that
when it should do that
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
wdym how
thats the same way how cookies work, only the same origin can access the same origins cookies
i need the iframe to not access the cookies from the origin while stlil connecting to the origin site
then give this a try
also, you might need to define the origin on the cookies you specifically NOT want your iframe to be able to read
An HTTP cookie (web cookie, browser cookie) is a small piece of data that a server sends to a user's web browser.
The browser may store the cookie and send it back to the same server with later requests.
Typically, an HTTP cookie is used to tell if two requests come from the same browser—keeping a user logged in, for example. It remembers st...
more specifically https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies
An HTTP cookie (web cookie, browser cookie) is a small piece of data that a server sends to a user's web browser.
The browser may store the cookie and send it back to the same server with later requests.
Typically, an HTTP cookie is used to tell if two requests come from the same browser—keeping a user logged in, for example. It remembers st...
so defining your scope on a cookie would help, IF your iframe path and your parent window aren't the same path
only include I think
ok
thanks
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
i actually use /api/ for some reason but yeah
just as a general example
if my codeserver wouldn't be dying, I could try to repro it
yeah

aight now, gimme 2 mins, apparently windows is shit
also
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
whats the best way to make a draggable server list in react?
basically being able to rearrange them
that's pretty vague
listen to onDrag events and calculate the new position based on the top-left coordinate
I drag em and they are now there and it saves to the db
how do I calculate which position they now are?
like in this case it should be 1-10
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
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
🤔
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
I mean if a user sends a faulty request from the network manager
like then id have a server with position 112214214
simply clamp it
if the index is higher than the item count, set index to item count - 1
alr, lemme try
since im lazy I just used a library for the in my opinion hardest part, react-beautiful-dnd
jesus christ since when could video uploads be that wide
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
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.
The last time I used their api it was like a checking system
To get the full api you would need a domain
For them to send to
Idk if they changed it though
You could create a command to check if they voted and give them the rewards with it, while adding a cooldown so they can claim again in 24 hours
Assuming they voted again
Oh well I’ll have to figure out how to do it then 😭. also people do be telling me weird stuff like webhooks and all
does topgg support webhooks for servers?

my 300 lines one takes 10 mins to open
