#development

1 messages · Page 90 of 1

earnest phoenix
#

No

wheat mesa
#

good

#

ok I can't figure this out rn, gonna be done for the night

#

if anyone has suggestions on how to implement a subcommand handler, lmk (feel free to ping me)

lyric mountain
#

Just check for the command's name

wheat mesa
#

The command's name comes through as the name of the subcommand parent

#

I think

lyric mountain
#

Just merge both

#

Like, treat as one string separated by spaces

rugged dawn
#

mods?

earnest phoenix
#

@solemn latch NSFW and racial slurs ^

tawny musk
#

Is there a way to

#

Dammit, didn't mean to send that, just opened the channel and it was already typed -.-

sudden geyser
#

you could delete it

rigid maple
rigid maple
#

but i got a error like this, Since the data retrieved with getChannelData from Stackoverflow returned Float32Array, I concat the buffers and converted them to Float32Array and used it like that and since it is saved as unsigned-integer, not signed-integer, it will be in the range 0-65535, not -32768-32767. I couldn't solve this problem even though I made the necessary adjustments

carmine summit
#

message.contentand message.embed seem to be empty when the message is an interaction reply. but fine if it is a normal message sent by a bot. Is this intentional? Is there any way to get around this?

slender wagon
#

@quartz kindle even after using the nodes stream/promises i still get this error

stiff dust
#

Which OS is better for Linux VPS?
CentOS 7x64
Debian 10x64
Debian 11x64
Ubuntu 18x64
Ubuntu 20x64
Mikrotik

rustic nova
#

The fuck is mikrotik

slender wagon
#

YOOO CHATGPT IS THE BEST!!!!

pearl trail
lyric mountain
#

At least all the times I saw it was for network monitoring

sudden geyser
#

homework?

slender wagon
#

Codeing

sudden geyser
#

isn't it quite inaccurate?

slender wagon
#

Not at all

#

At least not for me

deft wolf
#

Codeing what?

slender wagon
#

Anything really

deft wolf
#

Okay, I'm going to see if this will be able to do a basic slash command

sudden geyser
#

message is no longer an event

#

wrong!!!

deft wolf
#

Adding "v14" doesn't change anything at all, so it's best to look at the documentation anyway

wheat mesa
#

Y’all gotta stop relying on ChatGPT and thinking it’s right. 9/10 times it’s pretty much wrong

radiant kraken
#

even Google is more reliable than ChatGPT

lament rock
#

ChatGPT's training cutoff was 2021

wheat mesa
#

Yeah

lament rock
#

v14 came out later

radiant kraken
#

what if you ask it about the events happening in 2022

#

like idk

lament rock
#

like who was in paris

radiant kraken
#

the russo-ukrainian war

#

or the current monarch of the united kingdom

deft wolf
#

I am a language model and my training data only goes until 2021 so I can't provide you information about 2022 events, but if you are looking for general information, you can check the 2022 calendar and schedule, sports events, political elections, and major holidays, you can also check public predictions and forecasts for the year. However, it's worth noting that many events can happen in 2022, some of them can be positive and some of them negative, it depends on the context and the location, so it would be hard to predict all of them.

sudden geyser
#

on stackoverflow you just get like 5 answers and in the comments it's always someone like "actually this is wrong for x, see y's answer it's better"

radiant kraken
#

what if you ask "what will happen in 2022"

deft wolf
#

Same thing

lament rock
#

did we all die in 2012

radiant kraken
#

then how did it know that it's an event from the future

#

kinda sus

#

when will the end of the world happen
I am a language model and my training data only goes until 2021 so I can't provide you information about 2023 events, but if you are looking for general information, you can check the 2023 calendar and schedule, sports events, political elections, and major holidays, you can also check public predictions and forecasts for the year. However, it's worth noting that many events can happen in 2023, some of them can be positive and some of them negative, it depends on the context and the location, so it would be hard to predict all of them.

lament rock
copper cradle
lament rock
#

this is the year

radiant kraken
#

yes

#

and it's tomorrow

lament rock
#

no I get paid tomorrow

#

Can it wait

#

+a couple days for amazon deliveries

radiant kraken
#

no

sudden geyser
#

"how do I do X in java"
+9999 "use guava"

  • -3 "don't want to"
  • +500 "then use apache commons instead"
lament rock
#

A lot of node q and a's include answers of libraries no one has heard of and are just bloat providing very simple and mundane processing

copper cradle
#

Just like the leftPad fiasco

#

That's why don't recommend stack overflow to new cs students and anyone in my uni

sudden geyser
#

I mean, leftpad was just npm being stupid in structure

lament rock
#

Discord has been a better dev resource to me than any google search

#

which is kinda cringe

copper cradle
#

yeah a bit

solemn latch
#

Honestly, imo google is way better once you understand what things are called.

I generally can find whatever much faster via Google or reading documentation.

wheat mesa
#

I do a lot of rubberducking on discord

#

But it’s a really useful resource because other people get to criticize your work from a perspective that you haven’t thought of before

sudden geyser
#

even if you don't understand it google's a better source 95% of the time

solemn latch
#

As feedback i don't really trust it.

A beginner trying to learn might get advice from another beginner which isn't good.

Google has that risk too

sudden geyser
#

can plop in a cryptic error message and likely find what's wrong with at most 3 links

#

you really don't need someone else to ask when you're good at searching. I've found a lot of issues by just searching github repositories with certain error messages

solemn latch
#

I think that's the issue for most people in the beginning, not knowing what something is called, not knowing how to read documentation, or even how to read error messages.

sudden geyser
#

well if you're beginning you don't know where to go

#

so asking initially is expected

copper cradle
#

there aren't many reliable sources for beginners

solemn latch
#

I think I disagree with that.

there are hundreds of online courses ranging from free, to very cheap(or start with a free trial).
for very little money some courses cover everything you'll need to know as a beginner for the first year or so. I've seen some which even go into the topic above, how to search on google for more information on your own.

cedar moth
#

How can I add screenshots of my bot in the bot page

slender wagon
lyric mountain
#

apache is at least modularized so u can get what u really need

#

guava is just a huge bloat all around

eternal osprey
#
  if(message.attachments.size == 0)
  {
    message.reply({ephemeral:true, content: `:x: **You are only allowed to send images in this channel!**`})
    return message.delete()
    
  }```Would it be possible to actually ephemeral send a message reply?
#

Or is it only for interactions

wheat mesa
#

You cannot send ephemeral replies on message commands

eternal osprey
#

aight thanks!

deft wolf
#

Also, you must keep in mind that message.attachments are also different types of files, such as .txt files

#

If you really want users to only be able to upload photos in your channel then you need more than that

knotty quartz
#

How do you use choices? I can add them I just don't know how to call them so

return //statement 
}```

is it get choices?
lyric mountain
#

check the docs for ur lib

knotty quartz
lyric mountain
#

the same page will also tell you how to retrieve the selected options

knotty quartz
lyric mountain
#

don't worry, whenever you have questions regarding "how to do X" related to discord, always resort to the official docs

#

any half-decent library will have docs for all methods and objects

neon leaf
#

so I have an array with alot of objects (could be over 500), each has a type property, how can I delete every object with the type prop set to x except the last one?

lyric mountain
#

iterate

neon leaf
#

pretty vague but I think I know what you want

lyric mountain
#

like, iterate can only mean one thing

boreal iron
#

use a for loop, check if the item is an object, if it has your property then delete it

#

Once the index = array length - 1 you're at the last item

#

Which you wanna skip

lyric mountain
#

just make sure to create a copy of the array just so u don't run into concurrency modification issues

#

and not skip indexes for deleting items

neon leaf
#

alr, thanks

boreal iron
#

Sowwy haven't been online the last weeks

junior elk
#

Please help because the bot gives me an error when I vote on it

#

pls

sudden geyser
#

post your error

craggy pine
wheat mesa
#

Still can't figure out how to handle subcommands

#

Ideally I'd be able to just do new SubcommandClassThing() in a parent command's options array, but I just can't figure out how to make the types compatible

boreal iron
#

Can show you an example how I handle em tomorrow

steep creek
#

faucet0x1efd3b626b4814848b995a12e52fa2c0e7d7fbbc

spark flint
#

?

radiant kraken
dry imp
#

what is a good js image manipulation lib

#

or just yall personal recommendations

dry imp
#

mkay, imma check it all out, thx

lyric mountain
#

Canvas is the ol' reliable

sudden geyser
#

how does discord still not have mutually exclusive options for interactions

quartz kindle
#

#discordpls

#

#discordsucks

#

#banned

lyric mountain
craggy pine
#

Quite literally the only reason I use slash commands is because auto complete + database is pretty nice.

boreal iron
lyric mountain
#

Nah, I depend on context-dependant args

#

Also, my command handler works for both systems, all I need to do is to upload as slash

oblique sky
#

Hmm is it a great idea to support both of them
I need slash commands because localization is quite important for me

sudden geyser
#

you can do localization with regular commands though

#

I prefer interactions interface wise since it standardizes a lot of things

sharp geyser
rigid maple
#

I want to write a function but I can't think of an easy way, when I enter seventeen as input, it should give me 17 as output.

#

or fifty one => 51

frosty gale
#

you could try tokenizing for example fifty and one and since there's 2 tokens fifty must be in the 10ths and one in the 1s then add them together

#

or use a library

#

make sure to ignore tokens like and though

rustic nova
#

please dont just have several ifs containing checks or a whole dictionary with any number possible (unless single digits)

rigid maple
#

I'm printing to chatgpt 😃

boreal iron
#

You gotta need to go with the time

ripe wyvern
#

I forgot to uncomment a piece of code that checked for typos in my bot, waited ~4 days for a review and they typo'd.

#

I love coding

#

its so fun

deft wolf
#

Sometimes it happens unfortunately

ripe wyvern
#

yep, my fault in here

#

one could even say it was a skill issue

#

annoying part tho is that the bot works, except for that specific part it seems. I'll try to QA some more but rn I'm just gonna sit around ig

earnest phoenix
#

Do you guys know why this is happening?

#

I want to fix it

deft wolf
#

This is most likely because you take the number of servers from the cache and not all servers need to be in it

#

Try to fetch the servers with fetch() but be careful because this creates a direct request to the discord api and you may get rate limited

#

You can also save the servers where your bot is in the database and take the number of servers from the database

quartz kindle
#

discord does not show real guild count on their authorization page

#

they show approximate guild count

#

also yikes admin perms

#

:^)

old path
lyric mountain
#

until the bot token gets leaked and 30+ servers get nuked (leading to account ban)

#

that or the classic "why is it taking so long to reach X servers?"

lilac kestrel
#

how can I dm a user when he vote on top.gg with python

lyric mountain
spark flint
#

Under 1k is always the exact

lilac kestrel
lyric mountain
#

one has no meaning without the other

lilac kestrel
#

# This example uses topggpy's webhook system.
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")

# The port must be a number between 1024 and 49151.
bot.topgg_webhook.run(5000)  # this method can be awaited as well

@bot.event
async def on_dbl_vote(data):
    print(data)```
lyric mountain
#

you literally copied the example code

lilac kestrel
#

do I need to replace somthing?

lyric mountain
#

yes you do, and you shouldn't simply copy example code mindlessly

astral goblet
#

C

#

F

lyric mountain
#

ask #topgg-api for further help, apparently the issue is that bot.topgg_webhook.run(5000) cannot be where it currently is

earnest phoenix
lyric mountain
#

you cant fix something that's on discord's side

quartz kindle
# earnest phoenix wat

you cannot control what discord shows on that page, and what they show there is not necessarily exact, they use approximate counts in that page, not exact counts

lilac kestrel
wheat mesa
#

🥄

lyric mountain
solemn latch
#

The error seems to explain what needs to happen too

thorn spruce
#

Hey 👋, does anyone have already setup an Authentication with Symfony and Ldap ? (Symfony 5.4)

stuck dawn
#

anyone has got this error? I am using vite..

#

idk if i need to add something to vite.config

wheat mesa
#

What version of nodejs are you using? node --version if you’re not sure

copper cradle
#

My guy be using node 8

wheat mesa
#

I’m thinking it’s probably pretty old

lyric mountain
#

lmao

#

old is an understatement

earnest phoenix
#

That's invalid JavaScript code, I'm suspecting you're using a bugged version of React-Native

obtuse coral
#

Hello, currently I am helping run and improve a discord that does weekly clips. Their current vote/rating system is not automated. I plan on automating this with a bot. Before doing a re-structure and switching to a weekend poll for voting. I wanted to see if there was a bot that could keep track of weekly ratings on clips and just give us a list of who voted on each clip. This is needed as one of the rules is, if you submit a clip you must rate every other clip that has been submitted for the entire week. The rating system is also done by using reactions 1️⃣ - 10

#

It would also be useful to be able to DQ people that don't vote on all clips and then just automatically post the winner at the end of the week with runner-ups and all. Just not sure if there is a bot out there that specifically does this.

earnest phoenix
#

I don't think there's a bot that does that at all, that's a very specific use case

deft wolf
#

Probably not. This sounds very much like a server-specific feature

obtuse coral
#

is there a bot that does any of that at all? even portions of that?

earnest phoenix
#

No as far as I'm aware

#

But should be easy to implement, you can ask for help if you need any about implementing it here

obtuse coral
valid cypress
#

I want a code when someone vote the bot the bot send msg to a channel v14 js

deft wolf
#

True, it doesn't sound too complicated, especially since it's just reactions and maybe some fun with the database

earnest phoenix
obtuse coral
deft wolf
earnest phoenix
# obtuse coral Unfortunately no 😦

Then here's what you can do:

  1. Choose a beginner friendly programming language such as JavaScript or Python, and learn it to a decent point, there are tons of guides online (many of them are free), and once you've done that you can get going
  2. Choose a Discord API library for the programming language you've learned, such as discord.js for JavaScript, or discord.py for Python
  3. Look up how to create a Discord bot application through the Discord Developer Portal and set it up with the Discord API library you chose (the libraries themselves have a comprehensive guide so I would recommend reading through those)

And now the part where you implement that:

  1. Setup a database for your bot, so that you can save the users, votes, and clips, that corresponds to each of them respectively
  2. Implement a command that the users can use to opt-in to the voting game or whatever, and also one to opt-out before the game (or whatever) begins
  3. Once it starts, you can check the contents of each message sent and get the clip, and react to it with the reactions you mentioned (1 through 10)
  4. Collect the reactions and the users who reacted, disqualify those who didn't react in time
  5. Determine the winner by the highest vote count attached to a clip by looking through your database

And that's pretty much it

#

If that sounds complicated then that's fine, because these terms and methods are new to you, most likely

#

If you don't want to do it yourself you can hire developers to do it for you via platforms like Fiverr or similar

obtuse coral
valid cypress
#

You saw my bot ?

earnest phoenix
hushed robin
#

your asking a prompt like this chatgpt

hushed robin
#

ok ask your bot

deft wolf
#

XD

eternal osprey
#

hey

#

does anyone know why my recording sounds like there's a nuclear war going on?

#
  function createListeningStream(receiver, userId, user) {
        const opusStream = receiver.subscribe(userId, {
            end: {
                behavior: EndBehaviorType.AfterSilence,
                duration: 100,
            },
        });
    
        const oggStream = new prism.opus.OggLogicalBitstream({
            opusHead: new prism.opus.OpusHead({
                channelCount: 2,
                sampleRate: 48000,
            }),
            pageSizeControl: {
                maxPackets: 10,
            },
        });
    
        const filename = `./recordings/OfficerEventMeeting.pcm`;
    
        const out = createWriteStream(filename, { flags: 'a' });
        console.log(`👂 Started recording ${filename}`);
    
        pipeline(opusStream, oggStream, out, (err) => {
            if (err) {
                console.warn(`❌ Error recording file ${filename} - ${err.message}`);
            } else {
                console.log(`✅ Recorded ${filename}`);
            }
        });


  connection = await joinVoiceChannel({
              channelId: voiceChannel.id,
              guildId: voiceChannel.guild.id,
              selfDeaf: false,
              selfMute: true,
              adapterCreator: voiceChannel.guild.voiceAdapterCreator,
          });

          /* Add voice state to collection */
          client.voiceManager.set(interaction.guild.id, connection);
          await entersState(connection, VoiceConnectionStatus.Ready, 20e3);
          const receiver = connection.receiver;

          /* When user speaks in vc*/
          receiver.speaking.on('start', (userId) => {
             
              createListeningStream(receiver, userId, client.users.cache.get(userId));
          });
#

I put these 2 functions toghether into 1 code block, they initially belong to different buttons.

#

I am trying to record a WHOLE voice channel instead of just 1 user

quartz kindle
#

likely because you are writing multiple steams into the same file

#

which basically destroys the file

eternal osprey
#

Well yeah thats the whole point as i am trying to record the whole file

#

channel*

#

so far i've only encountered how i can record 1 user ids voice but that's not really what i want

quartz kindle
#

you need to merge the streams through an audio mixer/encoder, before writing to a file

eternal osprey
#

do you by any chance already know a package that i can use for that?

quartz kindle
#

most people use ffmpeg for pretty much everything, including that

eternal osprey
#

ah i see

#

i will try to find out how i can merge the pcms together into 1 using ffmpeg

#

thanks!

#

i could use this i guess

#

tho it takes a mp3 and not pcm so not sure how it will work

river kettle
#

hey, I don't know if this is the right channel, but can somebody tell me how to put an image in my bot description by having the imgur link?

earnest phoenix
#

Remember that you have to link to the image directly, not to the Imgur page, you can do that by adding the i. subdomain to your Imgur page link, and adding an extension, such as https://i.imgur.com/<image page ID>.png

ripe comet
#

so top.gg autoposter will post shardring and cluster data ?

jaunty basalt
earnest phoenix
earnest phoenix
jaunty basalt
lament rock
#

My shit gets so cluttered so fast

#

I need a 3rd monitor

rustic nova
#

Lmao

radiant kraken
#

so that's why bot devs have a lot of monitors

copper cradle
#

That's why I have 6 monitors

#

3 are for logs

radiant kraken
#

average bot dev moment

#

one monitor per terminal

copper cradle
#

I haven't developed a single bot for like 3 years

lament rock
#

Currently in the process of making my bot not monolithic and well, it can be split up into a ton of processes. Super easy to scale now theoretically. I'm sure there will be plenty of bugs when I try to do it in the real world, but this is really good.

#

The fact that the dashboard still works 100% is incredible

#

damn. Songs take me back to when this place still invited devs' bots and I with some other people would be jamming and showing off each other's bots 💪

tight axle
#

memories comes back

#

My dashboard is little too futuristic

crystal wigeon
#

Does topgg disclose users ip address to bots??

solemn latch
#

No

lyric mountain
#

topgg doesn't even know the ips

modern sable
#

if you vote for a bot, you visit the site and therefore top.gg does know your IP address

#

we don't share the IP to bot devs, but if they have a iframe in their bot description, they could still get your IP that way (because your browser will load their site)

lyric mountain
neon leaf
#

does anyone know why this doesnt make the text blue on screens less than 500px? (tailwind)
max-[500px]:text-blue-500

tight axle
#

so

#

if you need text blue on page below 500 px you need to setup custom config or i 640 is ok you can use like:

class="text-blue-500 sm:text-green-500 lg:text"

#

Read little about "Mobile First" strategy

blissful coral
#

Heyo - never have had a issue with this until midnight last night when my bot started getting a little weird. My command handler is initalizing before the bot has connected the WS causing things to not correctly run when I call certain API commands on discord.js any fix around this if I am using a extended class of the base client inside a constructor?

wheat mesa
#

Probably going to want an async init method that you await before calling .login

slender wagon
#

setting up a nextjs project sucks

#

i gotta use nginx and pm2

#

and the domain configuration

lament rock
#

thats normal website setup

lyric mountain
#

except for pm2, which isn't really necessary for a site

quartz kindle
#

neither is nginx

#

:^)

boreal iron
#

cough Apache lives forever cough

winged linden
#

hi!

#

how can i check if a user is part of a guild or not?

#

{"name":"DiscordAPIError","stack":"DiscordAPIError: Unknown Member\n at RequestHandler.execute

winged linden
lament rock
#

If it returns a 404 then it means that either your client isnt in the guild or the member isn't in the guild

winged linden
#

sounds great gonna try it! thanks alot!

lament rock
#

although doing this often goes towards your CloudFlare ban countdown if you exceed so many 400 status codes in a given time

winged linden
#

this returns an error if the user isnt in the server though

#

maybe instead of fetch i could us has

wheat mesa
#

Use the .? operator to return early if there’s a null

wheat mesa
winged linden
#

yeah exactly

#

what if the member wasnt fetched

winged linden
quartz kindle
#

what happens when you run it? it should work, the code is correct

winged linden
#

same error i had above

quartz kindle
#

can you show the error?

winged linden
#

wait tryin smth

quartz kindle
#

ah i think i know why

#

members.fetch does not return undefined like members.cache.get when it doesnt find a user

#

it throws an error

#

so you have to do it like this ```js
const checker = (
await client.guilds.cache.get("958809457645723678").members.fetch(id).catch(() => null)
)?.roles.cache.has("987034716140081242");

compact pier
#

maybe try

try {

} catch(error) {

}
#

or that, yeah

wheat mesa
#

Glad that detritus is getting maintained again soon

quartz kindle
#

but imo its cleaner like this ```js
async function check(id) {
const member = await client.guilds.cache.get("958809457645723678").members.fetch(id).catch(() => null);
return member?.roles.cache.has("987034716140081242");
}

compact pier
#

damm long time, haven't heard anything about that lib

quartz kindle
#

last time i tried detritus it was slower than djs

compact pier
#

how do you even test that?

#

I don't know a lot about benchmarking

quartz kindle
#

i tested the time it took for the data to go from websocket to being emitted by the library's raw event

compact pier
quartz kindle
#

no, like most libraries use ws for the websocket connection

compact pier
#

or how long it takes, to log the bot in

winged linden
#

thanks ser it worked
🐐

#

@quartz kindle

quartz kindle
#

between the packet being received by ws and the library emitting the event, the library does a lot of stuff

#

like creating the structures and classes

compact pier
#

mhmm, still don't get it

quartz kindle
#

a very basic example of what the libraries do would be like this ```js
ws.on("message", data => {
const object = JSON.parse(data);
if(object.t === "MESSAGE_CREATE") {
const message = new Message(object.d);
client.emit("messageCreate", message)
}
})

#

i basically measured the time it takes for that to happen

compact pier
#

Ohh

quartz kindle
#

unpacking/parsing the data and building the structures

compact pier
#

now I get it

#

mhmm, maybe I will try with other languages and see if it is faster

quartz kindle
#

the language itself wont make much difference, its more about how efficient the library is

#

but yes, a c++ library will likely be faster

#

like D++

compact pier
#

do you think GoLang is faster then C++ in some area?

#

or Rust

quartz kindle
#

rust and c++ are roughly equal

#

Golang should be faster than js/py but slower than c++/rust

compact pier
#

mhmm

#

cause they all complie into machine code, so I was wondering

quartz kindle
#

afaik golang has some interpreter layer

sick agate
#

yea

quartz kindle
#

its not pure machine code

sick agate
#

and executables in general are larger in go

compact pier
#

I think C++ convert to assembly, idk

quartz kindle
#

assembly is a way to read machine code

sick agate
#

you can ask the compiler if you want to

sick agate
compact pier
#

I though machine code is 0 and 1

sick agate
#

assembly is just more readable

compact pier
#

nvm, Go use Gcc lol

sick agate
#

so can rust

compact pier
stuck dawn
#

i think i've fixed it

#

just added this to my vite.config

eternal osprey
#
import java.util.Scanner;
public class students {
    static Scanner in = new Scanner(System.in);
    static int group_size;
    static int[] id_numbers;
    static String[] names;
    public void allocate() {
        System.out.println("Please input the group size: ");
        group_size = in.nextInt();
        id_numbers = new int[group_size];
        names = new String[group_size];
    }
    public void Push_new_users() {
        for(int i = 0; i < id_numbers.length; i++) {
        System.out.println("\nPlease input one name, id combo: ");
        String non_seperate_name_and_id = in.nextLine();
        String seperate_name_and_id[] = non_seperate_name_and_id.split(",");
        String name = seperate_name_and_id[0];
        String id = seperate_name_and_id[1];
         id_numbers[i] = Integer.parseInt(id);
         names[i] = name;
         System.out.println("\nSuccessfully added student with name: " + seperate_name_and_id + " and student id: "
                 + id);
         
        }
    }
    
}```hey guys, does anyone know why when i run this i get the error: Index 1 out of bounds for length 1
#

I did some research and found out that when i remove the .split() and in.nextline() it works perfect.

#

Must i clear the in.console after each iteration?

lyric mountain
#

Holy please use smaller variable names

rustic nova
#

I'd prefer more descriptive variables then something like i or a

#

than

lyric mountain
#

I mean, too small is bad, too long alas

rustic nova
#

Yea

rustic nova
lyric mountain
#

String id = ... I suppose, but am on mobile so I can't understand a thing

#

Also u need to show what ur inputting

#

And don't use nextInt() when dealing with free console input, it can and will break

#

Instead get it as String and check if it's a number before using it

eternal osprey
#

ah i think that i solved it

eternal osprey
#

what my scanner was doing, was actually taking the previous input and using that. However, i then declared a new scanner inside the class and it worked

lyric mountain
#

I'd suggest initializing the variables on their declarations btw

#

and removing static from them

#

oh, and adding private final

eternal osprey
#

i know final, not private

#

i just started the java course

#

so maybe they didn't teach us that yet

lyric mountain
#

java likes when u specify scopes

#

private means the variable won't be accessed from outside that class directly

eternal osprey
#

ahhh i see

lyric mountain
#

public is the opposite

#

and protected limits the variable to extending classes

eternal osprey
#

So public can be accessed anywhere, private only within the classes they are used in, static means that a method can be called without specifying an object, and public the opposite (so you need an object), eventually public static means that it can be used both ways?

lyric mountain
#

no, private is only within the enclosed class

#

not classes

rustic nova
#

static stays after object reinitialization

lyric mountain
#

static means a variable/method is class-bound

eternal osprey
rustic nova
#

yeah class-bound

lyric mountain
#

so u can do TheClass.something()

#

if u change a static value, it'll change globally

rustic nova
#

I fr dont wanna touch java anymore lmao

eternal osprey
#

whereas a public class doesn't?

lyric mountain
#

public is regarding access

#

static is regarding scope

eternal osprey
#

oowh damn ofc i keep mixing them together

lyric mountain
#

access modifiers are private, protected, package (or the abscence of any mod) and public

#

from least visible to more visible

eternal osprey
#

i see, thank you! I will definitely learn these things 🙂

copper cradle
#

also use camelCase for variables

eternal osprey
#

so far ngl, i like this language more than c++ and js

copper cradle
#

and PascalCase for classes

#

my eye started to twitch as soon as I saw snake_case being used

eternal osprey
#

yeah my past course was c++

#

where we had to use _

#

my bad

lyric mountain
#

am back

#

scope modifiers are static and nothing at all

#

just remember that static stuff will reflect changes on every single place

#

and that static constants wont be garbage collected ever

eternal osprey
#

could you use static to actually create a call-by-reference function?

lyric mountain
#

no

#

static is always class-bound

#

if u want reference-bound stuff simply dont add static

copper cradle
eternal osprey
copper cradle
#

I mean you don't have to follow those style guidelines

lyric mountain
#
public class Example {
  public static void doStuff() {
    ...
  }

  public void doOtherStuff() {
    ...
  }
}
#

Example.doStuff() works

#

Example.doOtherStuff() will error

#

new Example().doStuff() works (with a warning)

#

new Example().doOtherStuff() works

#

got it?

copper cradle
#

think about it as if static members live on the class

eternal osprey
#

yeah i do now!

lyric mountain
#

always remember to be explicit regarding your scopes and accesses

eternal osprey
lyric mountain
#
void doStuff() {
  ...
}

is short, yes, but java doesn't like that

eternal osprey
#

But i understand it now

#

imagine we have a static int test = 0; and i later on in a function change its value to 1, it will globally be changed right?

lyric mountain
#

yes

#

because test is bound to the class itself

eternal osprey
#

owhhh i see ofc

#

damnn i understand it now

lyric mountain
#

it's equivalent to doing ```js
String.prototype.test = 0

#

kinda

eternal osprey
#

i see, finally i can get to work confidently. Thanks for all the help!

lyric mountain
#

the other thing to know is that you should always initialize variables on their declarations when possible

#

and if they're a collection (or array), declare as final

eternal osprey
#

and solved it by just []; it.

eternal osprey
lyric mountain
#

yes if you're doing like u were

eternal osprey
#

because it's like const right? We want to constantly change array so that it stays dynamic.

eternal osprey
lyric mountain
#

because allocate isn't the class' constructor

#
public class Students {
  private final int groupSize;
  private final int[] ids;
  private final String[] names;

  public Students() {
    System.out.println("Please input the group size: ");
    groupSize = in.nextInt();
    ids = new int[group_size];
    names = new String[group_size];
  }
}
``` would work just fine
copper cradle
#

also don't use plain old [] arrays

#

if you want them to be dynamic use ArrayList

lyric mountain
#

they're still beginning, teacher will probably introduce collections later on

copper cradle
#

or anything that implements the List interface

eternal osprey
lyric mountain
#

they're equivalent to js arrays

#

they can resize dynamically

#

whereas an array can't

eternal osprey
lyric mountain
#

but don't worry abt this for now

lyric mountain
#

since a constructor is called when an instance is created

eternal osprey
lyric mountain
#

it's equivalent to declaring the values directly on the declaration

#

the static variant of a constructor is ```java
static {
...
}

#

but u probably wont use it ever

#

there are many more keywords and modifiers, but time will teach u the remaining

eternal osprey
#

ahh i see, thank you very much!

#

Really helped me to understand the basics

#

because these classes, public, static etc really got thrown at me like a truck

lyric mountain
#

java likes having everything declared explicitly

#

people hate this part because it's verbose, but I like it for its charm

#

also it helps a ton debugging

copper cradle
#

yeah, but ffs, sometimes I don't wanna handle an exception

#

I'm just grateful no other professors in my uni use java

lyric mountain
#

not all exceptions need to be handled

#

only those that can potentially crash your runtime

copper cradle
#

yeah but dealing with those when I don't want to is a pain

#

because now I have to add a try catch block and move everything up, because I don't want to move everything inside the try catch block

#

one of the reasons why I don't use java

lyric mountain
#

u can just defer to the caller

copper cradle
#

the other one is well, JVM

copper cradle
#

I just don't want to use java anymore

boreal iron
#

understandable

wheat mesa
twin geyser
#

Heyooo how do we show how many servers our bot is in on top gg?

#

Doesn't seem to be want to populate...

radiant kraken
lament rock
#

I love lean 💜

#

In all seriousness, the libs I maintain are fast and have great introduction to the raw API

radiant kraken
#

libless >>>

lament rock
#

I would fucking hate having to maintain a codebase like that. If you take a look at CloudStorm, I consider that like bare minimum to a comprehensive gateway connection basis

rustic nova
#

Fuck it, work with raw data

#

I'll do all the tcp connections and memory changes

wheat mesa
#

Fuck it, make yourself the HTTP server and respond to requests with voice recognition

rustic nova
#

Exactly

#

Run doom on http server

quartz kindle
boreal iron
radiant kraken
sudden geyser
#

call the unix http method

radiant kraken
#

calling the unix http method is too lazy, write the assembly instructions yourself

lament rock
# boreal iron Is that something that has been finished or is this on your todo list?

It's done already
https://github.com/timotejroiko/tiny-discord/blob/master/src/WebsocketShard.js

Tim gave me permission to use it and I slimmed it down a lot and converted to typescript.
https://github.com/DasWolke/CloudStorm/blob/master/src/structures/BetterWs.ts

GitHub

A high performance zero dependency raw library for interacting with the Discord API - tiny-discord/WebsocketShard.js at master · timotejroiko/tiny-discord

GitHub

Modular discord gateway library for microservice oriented bots - CloudStorm/BetterWs.ts at master · DasWolke/CloudStorm

#

It's fucking fast

sharp geyser
#

Shameless plug TrollDespair

radiant kraken
#

it's not tiny if it's not in Rust

lament rock
copper cradle
#

turn your bot into a bootloader and make your computer be the bot

gleaming bolt
#

I was studying the "CORS", and I came across a doubt. I wanted to know, when I use an API with "CORS" configured for specific domains, and I use this API on a machine, without a site/domain, if there is any restriction or something like that

#

or use "CORS" as an IP access control tool, for example

#
app.use(cors({
  origin: ["myip", "youip"]
}))
rustic nova
#

could you elaborate what you mean with youip

#

cors allows you to tell the browser what requests it should be able to process. So if your browser is trying to reach out to notexample.com while being on example.com, the cors headers are able to restrict that

gleaming bolt
#

ok

#

so could i create a login system and just pass the headers that would work fine?

#

this in a node environment

quartz kindle
#

you want to make an api only usable in a specific website? or also allow access to authorized users?

gleaming bolt
#

I'm creating an API for a Bot client's systems

#

type: add coins, remove coins, etc...

gleaming bolt
quartz kindle
#

use an api key system

#

the bot has an api key to access the api

#

and the website has a server-side script that has the api key

gleaming bolt
#

I thought of this method. but in that case I won't need the cors?

quartz kindle
#

no you dont need cors, because the api is never accessed from the browser directly, only from a server-side script

#

like a php file or a express.js route

gleaming bolt
#

hm

#

okay

#

thks

stiff dust
#

Which OS is better for Linux VPS to host discord bots?

CentOS
Debian
Ubuntu
Mikrotik

rustic nova
#

reading the previous responses might be useful yk

earnest phoenix
slender wagon
#

how come i completly clear the cache from a website and even after hosting it into another server it still shows the vercel one

#

but when i open it on a browser i never used it shows the current one

earnest phoenix
#

You're probably not clearing the cache properly

slender wagon
#

i am definetly clearin git properly

earnest phoenix
#

That has nothing to do with Git

#

Or did you mean "clearing it"?

#

What web browser are you clearing the cache with and using what steps to do so?

slender wagon
#

sorry didn't notice

slender wagon
#

and

#

could it be the dns

earnest phoenix
#

I said what web browser

slender wagon
#

but still why does it work on some browsers and in some it don't

slender wagon
earnest phoenix
# slender wagon edge

Go to the website you mentioned, press the F12 key and click on the "Network" option at the top, after that press CTRL + R to clear all the cookies and the cache for that specific website

slender wagon
#

same thing

lyric mountain
#

anyone aware of any postgres function that accumulates arrays?

#

for example, transform ```
1 | {1, 2}
2 | {3}
3 | {}
4 | {4, 5, 6}
5 | {7, 8, 9, 10}

into ```
1  | {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
#

array_agg isn't an option because it'll create a 2d array (and will error since one of the arrays is empty)

earnest phoenix
#

For anyone using open AI for a Discord bot for ChatGPT 3API

#

TO AVOID SLURS PLEASE USE THIS LINE OF CODE

#
    const filter = gptResponse.data.choices[0].text;
deft wolf
#

And what does that change?

lyric mountain
#

they probably spent many hours trying to fix something and wanted to share the solution

#

too bad it means nothing without context

sudden geyser
#

wait

sudden geyser
#

no way

rigid maple
#

How can I wait a command inside a for loop?
I write the data to that file with fs, but it deletes that file before it can process the exec line, so the exec line cannot be used
How can I wait for the exec line?

#

I tried to create a new promise but it didn't work

lament rock
#

await new Promise(res => exec(command, res));

#

or if you want to look for errors

const result = await new Promise((res, rej) => exec(command, (err, stdout) => err ? rej(err) : res(stdout)));
rigid maple
#

there is no need, there will be no error 😃

lament rock
#

That's what you'd like to think :)

rigid maple
#

thanks i'm trying now

lament rock
#

also, fs has a promise api, otherwise you're just pausing the thread with sync methods

rigid maple
#

thanks did work

soft cypress
#

Can anyone point me to where I can find information on Discord's premium bot subscriptions? Last i heard it was being tested with bigger bots, but I want to know when it'll come out for all bots.

lyric mountain
#

don't think they gave an estimate for official release

rigid maple
#

how can i add attachment in for loop

rigid maple
#

I want to create as many attachments as file paths inside the array

lyric mountain
rigid maple
#

i did

lyric mountain
#

u can add up to 10 attachments per message

lyric mountain
rigid maple
#

thanks

wind pumice
#

I was going to apply for bot commentators, where is it done?

eternal osprey
#

hey guys

#
public void Push_new_users() {
        for(int i = 0; i < id_numbers.length; i++) {
        Scanner in = new Scanner(System.in);
        System.out.println("\nPlease input one name, id combo: ");
        String non_seperate_name_and_id = in.nextLine();
        String seperate_name_and_id[] = non_seperate_name_and_id.split(",");
        String name = seperate_name_and_id[0];
        String id = seperate_name_and_id[1].replace(" ", ""); 
         id_numbers[i] = id;
         names[i] = name;
         in.close();
        }
        ```how come that this returns me: "No line found"?
#

It's to do with the scanner but why

lyric mountain
#

still using giant variable names I see

#

actually, disregarding all java naming and formatting convention

eternal osprey
#

I am changing the names once i have resolved all big issues

#

as there's no need to fix variable names when the whole function isn't even working

lyric mountain
#

fixing the names usually helps finding errors

wheat mesa
#

Also doing String name[] is archaic C syntax and should be avoided whenever possible (pretty sure the compiler warns you of it too)

eternal osprey
#

otherwise it errors

wheat mesa
#

No

#

String[]

#

That's the proper syntax for that

#

It's only supporting the other version because C convention never dies™️

eternal osprey
#

oowh damn

wheat mesa
#

I'd recommend you only open 1 scanner for the entire method instead of destroying it and reopening after each loop

lyric mountain
#
public void pushNewUsers() {
  try (Scanner in = new Scanner(System.in)) {
    for(int i = 0; i < ids.length; i++) {
      System.out.println("Please input one 'name, id' combo: ");
      String input = in.nextLine().split(",");

      names[i] = input[0].trim();
      ids[i] = input[1].trim();
    }
  }
}
#

see, much better to read

eternal osprey
#

yeah i see, i haven't had try yet so i don't really know what it does/means

lyric mountain
#

could've split by , + too to remove the need of trim

lyric mountain
lyric mountain
#

Scanner implements the interface AutoCloseable, so u can do that

eternal osprey
#

As soon as i just declare 1 scanner on top of the file and use that scanner in the methods it returns me this

lyric mountain
#

that's because ur not checking for any lengths

#

java is not js, if u try to access an invalid index it'll error

eternal osprey
#

hmm i see, but its coming from the nextline pretty sure

lyric mountain
#

it isn't

#

besides, the error will tell u the exact line

eternal osprey
#

it's coming from this line

lyric mountain
#

yes, because of what I said

#

ur supposing that it'll have 2 indexes

#

but java is not js, invalid indexes will error

#

see the code I sent

#

it doesn't have size check, but it should be much easier to fix than the original thing

eternal osprey
#

Owhh i see what i did wrong

lyric mountain
#

I told u 2 times 😭

eternal osprey
#
public void Push_new_users() {
        for(int i = 0; i < id_numbers.length; i++) {
        System.out.println("Please input one name, id combo: \n");
        String non_seperate_name_and_id = in.nextLine();
        String[] seperate_name_and_id = non_seperate_name_and_id.split(",");
        String name = seperate_name_and_id[0];
        String id = seperate_name_and_id[1].replace(" ", ""); 
         id_numbers[i] = id;
         names[i] = name;
        }
        
        }```but with this code, we are just constantly asking for a name and id combo, and it will then be splitting the string into 2 parts. That's always going to be only 2 indexes for all i's.
#

so how is it even occuring i am lost wtf 😭

lyric mountain
#

show what ur inputting

#

and please use the new code godammit

eternal osprey
wheat mesa
#

Show what you're inputting

#

please

eternal osprey
#

yessir

wheat mesa
#

major buffer issue

eternal osprey
#

before i can input this it already errors

lyric mountain
#

just noticed

#

where is ur scanner?

eternal osprey
#

on top of the file under the class definition

lyric mountain
#

also, what ide are u using?

wheat mesa
#

Also ideally you'd have a static Scanner here instead of opening and closing scanners nonstop

eternal osprey
#
import java.util.Scanner;
public class students {
     boolean ErrorFound = false;
     Scanner in = new Scanner(System.in);```
wheat mesa
#

the lack of access modifiers and casing hurts me inside

eternal osprey
#

I just started java 2 days ago, my bad 😦

lyric mountain
#

I just want to know what abomination of ide they're using that it's allowing that

#

please tell me it's not eclipse

eternal osprey
#

Eclipse is what i use

lyric mountain
#

fuck

#

boi, lemme tell u a thing

wheat mesa
#

intellij IDEA is where it's at

lyric mountain
#

eclipse is shit, like, if I called a pile of shit "Eclipse" it'd sue me for moral injury

#

there's virtually no reason not to use idea

#

I mean, unless ur coding on a potato

eternal osprey
#

I am going to use intllij

lyric mountain
#

yes please

eternal osprey
#

so the problem with the code was Eclipse?

lyric mountain
#

also don't mind that it'll make your whole code yellow

#

since it'll "kindly" ask you to refactor your names/formatting

lyric mountain
eternal osprey
#

dayumm

#

Was it a buffer overflow or something happening?

lyric mountain
#

but by not using a bad ide it'll make it much easier to code

lyric mountain
#

also, use a debugger on idea

#

it'll allow u to step line by line to see what value each thing is returning

eternal osprey
#

while idea is installing

#

do you have any idea what might be the problem

#

with that line

lyric mountain
#

System.out.println(in.nextLine())

eternal osprey
#

lemme do that

lyric mountain
#

look at what ur dealing with

#

also remember that nextLine will advance the scanner

eternal osprey
#

i ma try it with 2 now tho

#

So the first part worked but then it was stuck.

#

And when i typed enter (as the confirmation text didn't popup while it exceeded my group size), it errored

lyric mountain
#

u need to learn how to debug

#

System.out.println(Arrays.toString(seperate_name_and_id))

eternal osprey
#

aight uno secundo

#

this is prob because it errors out while i didn't even input anything just yet

#

the in.nextline() is bugging

#

because when i enter the 2

lyric mountain
#

see, the array is empty

eternal osprey
#

and i do another ssytem.out it goes to the next line

#

i think it's on how the scanner is defined

lyric mountain
#

also yes, sout will move to the next line cuz it'll print to the console

eternal osprey
#

So instead of using a static scanner and using the in.nextline() everywhere (as that's probably causing the issue)

#

how can i fix this then?

lyric mountain
#

has the advantage of not keeping a scanner open needlessly

eternal osprey
#

I don't really want to use try as i honestly don't fucking now what it is, and not even sure whether we can use it

lyric mountain
#

then just remove it and close the scanner at the end of the function

wheat mesa
#

You could also pass the scanner by reference, it'd be a bit odd but would work lol

lyric mountain
#

I'd rather not keep a scanner open

#

it can lead to weird behavior sometimes

eternal osprey
#

and report back with what happens

#
 public void Push_new_users() {

            for(int i = 0; i < id_numbers.length; i++) {
                System.out.println("Please input one 'name, id' combo: ");
                String[] input = in.nextLine().split(",");
                names[i] = input[0].trim();
                id_numbers[i] = input[1].trim();
            }
        in.close();
    }```
#

still same issue

#

wtf

sudden geyser
#

doesn't scanner eventually close itself

wheat mesa
#

when the program ends yeah

#

but that's more or less the OS just killing the process

#

other than that I'm pretty sure it doesn't close itself

lament rock
#

Made my own encoder and decoder for custom IDs for components and it works fantastically.

These examples are over the limit, but it's a lot of info being encoded.

#

plus mine can encode bigints

#

json.stringify also doesn't include keys which values are undefined while mine does. If I wanted mine to be json with extra steps and save more characters, I could also not encode void

lyric mountain
#

But they're still bound to the process, so it dies with it

#

Nonetheless, open streams are common causes for memory leak

lyric mountain
#

when I said "simply delete the try" I meant try itself

#

not what's inside it

eternal osprey
#

owhh i see

#

btw, i had a question

#

imagine i have string.split(" ")

sudden geyser
eternal osprey
#

which returns me data[1], data[2], data[3]. How can i then get only data without data[1].

#

like .trim?

lyric mountain
#

or use it within a try-with-resources

#

scanner is even more dangerous since it'll receive constant input so the gc can't touch it

#

for regular streams it might get garbage collected once the influx of data ends, but gc works in mysterious ways

#

so u might have something hogging memory for a long time before gc notices it

sudden geyser
#

oh I think I get it now

#

I was thinking of classes like bytearray(input/output)stream where closing is unnecessary

lyric mountain
#

ur probably closing them already

#

u probably use it like this right? ```java
try (var baos = new ByteArrayOutputStream()) {
...
}

#

it's very likely since intellij will put a big yellow fix if u don't

#

that's a try-with-resources, it's equivalent to ```java
var baos = new ByteArrayOutputStream()
try {
...
} finally {
baos.close();
}

sudden geyser
#

I use a method akin to that

lyric mountain
#

TWR is a marvel of programming

#

just like enhanced switches

sudden geyser
#

tf are enhanced switches

lyric mountain
#
switch (value) {
  case 1 -> {
    ...
  }
  case 2 -> {
    ...
  }
  default -> {
    ...
  }
}
#

which allows ```java
String str = switch (value) {
case 1 -> "Hello";
case 2 -> "World!";
default -> "Goodbye!";
}

eternal osprey
#

can we use += for string concat in java?

lyric mountain
#

yes

#

but if ur gonna do it in a loop, use StringBuilder instead

sudden geyser
#

oh so none of that break nonsense

lyric mountain
#

yes, note that it allows u to dump the branch value directly onto a variable

#

and it's getting even better in the next release

#
String str = case (someAnimal) {
  case Person p -> p.getName();
  case Dog d -> d.getOwner().getName();
  case Cat c -> c.getHooman().getName();
  default -> "Unknown";
}
sudden geyser
#

more special keyword types should just be expressions tbh

lyric mountain
#

wdym?

sudden geyser
#

like with the case of switch now, where you can assign it to a variable

#

makes lots of things much easier to write

lyric mountain
#

ah yes, they call it "pattern matching"

#

I wish it reached groovy-levels of switch enhancing one day

sudden geyser
#

no it's not pattern matching

lyric mountain
#

ik, they just call it like that

eternal osprey
#

Hey imagine that i have an object Students

#

and another array that contains the students

#

would i access each student individually like array[i]

lament rock
#

assuming you know the index sure

eternal osprey
#

i have tried this but it sadly aint working

lament rock
#

I have a ton of questions of design choices.
1: numStud seems pointless if you can get the length of the array.

  1. displayStudents wouldn't need the Group name param if you can access the all Array in the function. You'd do all[i]
eternal osprey
#

This is the file that my teachers gave me

#

i dunno

lament rock
#

what did they ask you to do with it

lyric mountain
#

java isn't as raw as them

#

also, u don't need \n line terminator

#

System.out.println() already includes it

eternal osprey
lyric mountain
#
for (Student s : students) {
  System.out.println(s);
}
#

then just override toString() to make a custom line format

eternal osprey
#
public static void welcome() {

        Scanner scan = new Scanner(System.in);
        System.out.println("Welcome, how big do you want the group to be?");
        int size = scan.nextInt();
        Group group = new Group(size);
        for(int i = 0; i < size; i++){
            System.out.println("Please enter a student: ");
            String nonSeperated = scan.nextLine();
            String[] seperatedArray = nonSeperated.split(" ");
            int studentNumber = Integer.parseInt(seperatedArray[0]);
            String studentFirstName = seperatedArray[1];
            String studentLastName = seperatedArray[2];
            Student newStudent = new Student(studentFirstName, studentLastName, studentNumber);
            group.addStudent(newStudent, i);
        }
        group.displayStudents();

    }``` This is my main
eternal osprey
lyric mountain
#

override toString, print the object itself to the console

#
@Override
public String toString() {
  return "banana";
}
#

will print ```
The group now contains:
banana
banana
banana
banana

#

if u have 4 students

eternal osprey
#

yeah but i need to only show their names

#

i tried using all[i].firstnames

lyric mountain
#

sigh

eternal osprey
#

but firstnames doesn't seem to be recognized

lyric mountain
#

yes because u made it private

eternal osprey
#

my teacher made it private

#

i am not allowed to touch that thing

lyric mountain
#

doesn't matter who did it

#

if it's private u cant access it from outside its class

eternal osprey
#

what should i do then?

#

i prob need to pass a Group name to the method as a parameter

lyric mountain
#

show the class

eternal osprey
#
public class Group {
    private Student[] all;
    private int numStud;

    public Group(int amount) {
        all = new Student[amount];
        numStud = 0;
    }
    public void addStudent (Student name, int place) {
        all[place] = name;
    }
    public void displayStudents(){
        Student cursor;
        String allStudents = "The group now contains: ";
        for(int i = 0; i < all.length; i++){
          
          
        }
    }
```this is the group
#
  public static void main(String[] args) {
        welcome();
    }
    
    public static void welcome() {

        Scanner scan = new Scanner(System.in);
        System.out.println("Welcome, how big do you want the group to be?");
        int size = scan.nextInt();
        Group group = new Group(size);
        for(int i = 0; i < size; i++){
            System.out.println("Please enter a student: ");
            String nonSeperated = scan.nextLine();
            String[] seperatedArray = nonSeperated.split(" ");
            int studentNumber = Integer.parseInt(seperatedArray[0]);
            String studentFirstName = seperatedArray[1];
            String studentLastName = seperatedArray[2];
            Student newStudent = new Student(studentFirstName, studentLastName, studentNumber);
            group.addStudent(newStudent, i);
        }

        group.displayStudents();

    }```the main
#
public class Student {
    private String firstName;
    private String lastName;
    private int stNumber;
    
    public Student (String fName, String lName, int sNum) {
        this.firstName = fName;
        this.lastName = lName;
        this.stNumber = sNum;
    }
    
    
}
```the student
lyric mountain
#

that's all?

eternal osprey
#

yeah

lyric mountain
#

well, then u cant

eternal osprey
#

whaaat

lyric mountain
#

because ur teacher locked the class from the world

eternal osprey
#

what should i do then

lyric mountain
#

u don't, unless u go into reflection black magic u cant access those properties

eternal osprey
#

how tf do i show all the groups then

lyric mountain
#

ask ur teacher if they forgot to add getters for the student class

rustic nova
#

time to bytecode manipulate

#

lmao

eternal osprey
#

it found student.Group

lyric mountain
#

that's because name isn't an array

eternal osprey
#

name is a group, which is an array of students right?

lyric mountain
#

no

#

Group is a class

eternal osprey
#

owh bruhh yeah

#

it just contains a students array

lyric mountain
#

still

#

class is class, array is array

eternal osprey
lyric mountain
#

ur making it worse

eternal osprey
#

yeah i know

#

it's .all

#

but its private

lyric mountain
#

please for the sake of gaben's dog, type . and press ctrl + space

eternal osprey
#

what the fuck

#
 public static void welcome() {

        Scanner scan = new Scanner(System.in);
        System.out.println("Welcome, how big do you want the group to be?");
        int size = scan.nextInt();
        Group group = new Group(size);
        for(int i = 0; i < size; i++){
            System.out.println("Please enter a student: ");
            String nonSeperated = scan.nextLine();
            String[] seperatedArray = nonSeperated.split(" ");
            int studentNumber = Integer.parseInt(seperatedArray[0]);
            String studentFirstName = seperatedArray[1];
            String studentLastName = seperatedArray[2];
            Student newStudent = new Student(studentFirstName, studentLastName, studentNumber);
            group.addStudent(newStudent, i);
        }


    }``` I could prob drop the actual for loop here to eventually show all the users
#

however, it doesn't look great and i want to use a method

lyric mountain
#

ctrl + space is all u need

eternal osprey
#

I see

#

but yeah, what should i ever do now

lyric mountain
#

the stuff u get in that list is everything u can access in that class

#

anything that isn't there (you guessed it) cannot be accessed

#

see there's an addStudent method there?

#

that's how u add students to it

eternal osprey
#

i know

lyric mountain
#

...if u know then use it

cursive musk
lyric mountain
#

for printing there's nothing u can do

cursive musk
# cursive musk

how can I make it so that if bot.servers isn't a value, then it returns 0?

lyric mountain
#

without a toString override or getters u have no way of accessing the values

cursive musk
#

lmk if u know a fix

lyric mountain
#

put || 0 inside the script block

cursive musk
#

I'm just doing bots[i].servers = japidata.data.bot.approximate_guild_count;

#

And japidata coming from the npm module

eternal osprey
#

lok

#

i pushed a new student in the group

#

how the fuck is that code erroring btw

#

as soon as i am entering a number it just poof fucks me over

lyric mountain
#

just look at what the IDE tells u

eternal osprey
#

same error

#

the one with the scanner

lyric mountain
#

"" is not a number

#

use the debugger

#

click on the line numbers on the left side and run it by clicking on the bug

eternal osprey
#

I see, but this is probably the scanner issue that we talked about before

#

imagine i am fucking closing the scanner again

#

can i reopen it or sumthing wtff

#
 public static void welcome() {
        String allUsers = "Group now contains: \n";
        Scanner scan = new Scanner(System.in);
        System.out.println("Welcome, how big do you want the group to be?");
        int size = scan.nextInt();
        System.out.println(size);
        Group group = new Group(size);
        scan.close();
        for(int i = 0; i < size; i++) {
            System.out.println("Please enter a student: ");
            String nonSeperated = scan.nextLine();
            String[] seperatedArray = nonSeperated.split(" ");
            int studentNumber = Integer.parseInt(seperatedArray[0]);
            String studentFirstName = seperatedArray[1];
            String studentLastName = seperatedArray[2];
            Student newStudent = new Student(studentFirstName, studentLastName, studentNumber);
            group.addStudent(newStudent, i);
            allUsers += studentFirstName + " " + studentLastName + "s"+ studentNumber + "\n";
scan.close();
        }```
lyric mountain
#

use the debugger

eternal osprey
#

well it returns an emtpy []

#

same as before

compact briar
#

i restarted my bot today and suddenly its having a problem with .setName and sending to a channel defined from client.channels.cache.get

this issue is not across the board. I have multiple commands/functions that utilize client.channels.cache.get and only two are having this issues

i have verified that the channel ids are correct

these logs have been running for about a year now with no issues. Im using djs 13.6 Has something changed?

lyric mountain
#

Nothing is ever guaranteed to be there at any given moment

#

Channels will only be there after some channel-related event happens

wheat mesa
compact briar
hushed robin
#

anyone know what causes node-schedule to duplicate my cronjob?
the below is exactly what i'm experiencing, it runs fine at first, but after a day or two the cronjob starts running twice.

sharp geyser
#

@wheat mesa bro fuck nginx man

#

this shit pissing me off

#
2023/02/01 22:42:35 [emerg] 90914#90914: cannot load certificate "/etc/letsencrypt/live/mail.aarondye.dev/fullchain.pem": BIO_new_file() failed (SSL: error:0200100D:system library:fopen:Permission denied:fopen('/etc/letsencrypt/live/mail.aarondye.dev/fullchain.pem','r') error:2006D002:BIO routines:BIO_new_file:system lib)

How fix

lament rock
hushed robin
#

it's not

sharp geyser
#

@neon leaf you available to help with nginx stuff?

lament rock
# hushed robin it's not

then it sounds like a lib issue you can't control other than waiting for a fix from dev or using a different library or making your own solution. It's simple to do math for how much time is remaining in a specific time frame like hour and then using setTimeout to run after the clock strikes the hour for example

hushed robin
#

yeah I’ll probably just find another library

sharp geyser
#

Bro nginx keeps telling me port 80 is in use but thats what my website is being served on

sudden geyser
#

is the in-process server running on 80

#

e.g. server.js spawns on 80 and nginx.conf wants to use 80

sharp geyser
#

the process is on port 3xxx

#

nginx is looking at 80

#
server{
 listen 80;
  listen [::]:80;
  server_name aarondye.dev;

  root /home/misty/Portfolio/dist;
  index index.html;

  client_max_body_size 100m;
  client_body_timeout 120s;

  location / {
   try_files $uri /index.html;
  }
}
server {
  listen 82 default_server;
  listen [::]:82 default_server;
  server_name mail.aarondye.dev autodiscover.* autoconfig.*;
  return 301 https://$host$request_uri;
}
server {
  listen 443 ssl http2;
  listen [::]:443 ssl http2;
  server_name mail.aarondye.dev autodiscover.* autoconfig.*;

  ssl_certificate /etc/letsencrypt/live/mail.aarondye.dev/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/mail.aarondye.dev/privkey.pem;
  ssl_session_timeout 1d;
  ssl_session_cache shared:SSL:50m;
  ssl_session_tickets off;

  # See https://ssl-config.mozilla.org/#server=nginx for the latest ssl settings recommendations
  # An example config is given below
  ssl_protocols TLSv1.2;
  ssl_ciphers HIGH:!aNULL:!MD5:!SHA1:!kRSA;
  ssl_prefer_server_ciphers off;

  location /Microsoft-Server-ActiveSync {
    proxy_pass http://127.0.0.1:81/Microsoft-Server-ActiveSync;
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto https;
    proxy_connect_timeout 75;
    proxy_send_timeout 3650;
    proxy_read_timeout 3650;
    proxy_buffers 64 512k; # Needed since the 2022-04 Update for SOGo
    client_body_buffer_size 512k;
    client_max_body_size 0;
  }

  location / {
    proxy_pass http://127.0.0.1:81/;
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto https;
    client_max_body_size 0;
  # The following Proxy Buffers has to be set if you want to use SOGo after the 2022-04 (April 2022) Update
  # Otherwise a Login will fail like this: https://github.com/mailcow/mailcow-dockerized/issues/4537
    proxy_buffer_size 128k;
    proxy_buffers 64 512k;
    proxy_busy_buffers_size 512k;
  }
}

this is my current conf

#

I was adding in my mail server stuff and went to go restart nginx and not its saying port 80 is in use

#
Netid  State   Recv-Q  Send-Q   Local Address:Port    Peer Address:Port Process 
udp    UNCONN  0       0         154.53.63.48:28015        0.0.0.0:*            
udp    UNCONN  0       0         154.53.63.48:28016        0.0.0.0:*            
udp    UNCONN  0       0        127.0.0.53%lo:53           0.0.0.0:*            
tcp    LISTEN  0       4096           0.0.0.0:995          0.0.0.0:*            
tcp    LISTEN  0       4096         127.0.0.1:7654         0.0.0.0:*            
tcp    LISTEN  0       4096         127.0.0.1:18983        0.0.0.0:*            
tcp    LISTEN  0       80           127.0.0.1:3306         0.0.0.0:*            
tcp    LISTEN  0       4096           0.0.0.0:587          0.0.0.0:*            
tcp    LISTEN  0       511          127.0.0.1:6379         0.0.0.0:*            
tcp    LISTEN  0       4096           0.0.0.0:110          0.0.0.0:*            
tcp    LISTEN  0       4096           0.0.0.0:143          0.0.0.0:*            
tcp    LISTEN  0       511            0.0.0.0:80           0.0.0.0:*            
tcp    LISTEN  0       4096         127.0.0.1:81           0.0.0.0:*            
tcp    LISTEN  0       4096           0.0.0.0:465          0.0.0.0:*            
tcp    LISTEN  0       100            0.0.0.0:28017        0.0.0.0:*            
tcp    LISTEN  0       128            0.0.0.0:209          0.0.0.0:*            
tcp    LISTEN  0       100            0.0.0.0:28084        0.0.0.0:*            
tcp    LISTEN  0       4096     127.0.0.53%lo:53           0.0.0.0:*            
tcp    LISTEN  0       4096         127.0.0.1:19991        0.0.0.0:*            
tcp    LISTEN  0       244          127.0.0.1:5432         0.0.0.0:*            
tcp    LISTEN  0       4096           0.0.0.0:25           0.0.0.0:*            
tcp    LISTEN  0       4096         127.0.0.1:442          0.0.0.0:*            
tcp    LISTEN  0       4096         127.0.0.1:13306        0.0.0.0:*            
tcp    LISTEN  0       4096           0.0.0.0:4190         0.0.0.0:*            
tcp    LISTEN  0       4096           0.0.0.0:993          0.0.0.0:*            
tcp    LISTEN  0       4096              [::]:995             [::]:*            
tcp    LISTEN  0       4096              [::]:587             [::]:*            
tcp    LISTEN  0       511              [::1]:6379            [::]:*            
tcp    LISTEN  0       4096              [::]:110             [::]:*            
tcp    LISTEN  0       4096              [::]:143             [::]:*            
tcp    LISTEN  0       511               [::]:80              [::]:*            
tcp    LISTEN  0       4096              [::]:465             [::]:*            
tcp    LISTEN  0       128               [::]:209             [::]:*            
tcp    LISTEN  0       244              [::1]:5432            [::]:*            
tcp    LISTEN  0       4096              [::]:25              [::]:*            
tcp    LISTEN  0       4096              [::]:4190            [::]:*            
tcp    LISTEN  0       4096              [::]:993             [::]:*            

Which I can see why its saying that, but if I am restarting it, shouldn't it just like yknow work since 80 is already nginx

sharp geyser
#

Alright I fixed that issue but now mailcow won't use the mysql shit so I give up for the night

wind pumice
#

I got the active developer badge. Can you give me the bot developer role?

deft wolf
#

No

#

This role is given to people who have an approved bot on top.gg

wind pumice
#

oh i understand

rustic nova
thin tide
#

In the code below, while depthWS WebSocket is stable, tickerWS WebSocket works on its own, sometimes it returns empty, sometimes it returns different symbol data.

 
const { excluded_err_bad_request } = require('../!data/Binance/datas/!excluded_err_bad_request/FuturesOrderBook.json');
 
module.exports = (data, wss) => {
  for (const symbol of excluded_err_bad_request) {
    try {
      const tickerWS = new WebSocket("wss://fstream.binance.com/ws/" + symbol.toLowerCase() + "@ticker");
      tickerWS.on("message", d => tickerWebsocketData = JSON.parse(d));
      let tickerWebsocketData = {};
      const depthWS = new WebSocket("wss://fstream.binance.com/ws/" + symbol.toLowerCase() + "@depth20@0ms");
      depthWS.on("message", depthData => {
        const depthJsonData = JSON.parse(depthData)
      });
    } catch (e) { console.error("Error!", e) }
  }
}```
do you have any solution suggestions?
quartz kindle
#

how are you using this code?

#

the way its arranged looks very wrong for most use cases

south kiln
#

is topgg have api error to any one 504 gatway timeout

lyric mountain
#

5xx means serverside issue

sharp geyser
neon leaf
#

anyway, the database stuff could just be a mess up, try running ./helper-scripts/update.sh (or something like that) in mailcows folder

sharp geyser
#

I’ll have to wait

sharp geyser
#

But I notice I have to keep putting the port when I go to the mail server on the web

#

Why is this?

neon leaf
#

oooh, I see it now

#

can you send me your mailcow.conf?

sharp geyser
#

That might be hard as I’m doing it on my phone with terminus but let me try

neon leaf
#

do
curl -T mailcow.conf https://api.pastes.dev/post

#

@sharp geyser

sharp geyser
neon leaf
rustic nova
#

Thats what fucked me over

neon leaf
#

yeah, I fixed that for him in the configs

sharp geyser
#

One last question tho

#

How can I make my emails not look like whatever@mail.aarondye.dev but rather just whatever@aarondye.dev I assume this is something I do in the ui under email config

neon leaf
#

yeah, just add aarondye.dev as a domain in the admin panel

sharp geyser
#

What exactly is tags

#

Anything I need to worry about?

neon leaf
#

I dont think so

sharp geyser
#

Alright let me try

#

For some reason the password I set for my mailbox isn’t working on sogo

#

Nvm

#

Forgot to use the extension @pulsar oliveye.dev

#

Oops

#

Sorry random person

radiant kraken
#

poor aarond

sharp geyser
neon leaf
#

that can have alot of reasons, most likely your server is too new or you forgot some dns records

sharp geyser
#

I see

#

So it’s basically a waiting game

#

What dns records should I have?

neon leaf
#

well what do you have?

sharp geyser
#

I have all the ones from the docs minus the advanced setup

neon leaf
#

these are mine

sharp geyser
#

Those are the ones I have as well

neon leaf
#

then its just a bit of waiting, I guess.
what did you test with? gmail?

sharp geyser
#

Minus the e google thing

sharp geyser
neon leaf
#

or your servers ip is flagged which would be not good

sharp geyser
#

Welp

neon leaf
#

mine is on 3 lol

sharp geyser
#

So I’m screwed?

neon leaf
#

not sure, Id just wait and see if it works, else you should ask your host for a non flagged ip

sharp geyser
#

I have 2 ips actually

#

Let me see if the other one is flagged

#

My other one is on 1 TrollDespair

neon leaf
#

I dunno

sharp geyser
pulsar olive
sharp geyser
copper cradle
#

zamn

#

I just can't get around setting up neomutt with my uni email

sharp geyser
#

Networking ain’t my thing

copper cradle
#

zamn

slender wagon
#
[error] 239#239: *688 connect() failed (111: Connection refused) while connecting to upstream, client: (client Ip), server: (mywebsiteurl), request: "GET / HTTP/1.1", upstream: "http://[::1]:3000/", host: "(serverip):443"

hey so i finished setting up my nextjs app on my vps. It works fine until it randomly stops working and it displays the image below, i check my nginx logs and it shows this error. Anyone of you knows what the cause could be?

lament rock
#

Improved my data saving json string encoder and decoder more and now it all works regardless of what data is thrown at it except for functions, symbols or classes.

#

decided to use the null character � as the delimiter between items since practically nobody uses that character meaning I won't have to escape as much or anything

#

No regular expressions

#

was much easier to do it without regex tbh