#development

1 messages · Page 106 of 1

wheat mesa
#

Here’s the first few bytes

#

(Sorry I can’t screenshot, using my phone for discord rn)

earnest phoenix
#

yah oke

#

And what if you just open the archive and try to unarchive its content

earnest phoenix
wheat mesa
#

Which sucks but yeah

earnest phoenix
#

eh

#

Doesn't windows have a default one?

wheat mesa
#

I’m not sure, haven’t done this before

quartz kindle
#

not sure if this is relevant for your use case, possibly not, but stackoverflow gave this

Then I searched for JAR file corrupted during mvn build and then found the solution. The file was corrupted during mvn build process. I removed <filtering>true</filtering> from the pom.xml file and I stopped getting the error message.

earnest phoenix
#

Could just right click and extract all maybe

#

Maven wasn't used

wheat mesa
wheat mesa
earnest phoenix
#

Expand-Archive in powershelll exists apparently

#
Expand-Archive -Path <SourcePathofZipFile> -DestinationPath <DestinationPath>
#

Why can't schools just let students install their tools CLi_NotLike

wheat mesa
#

Only supports .zip

earnest phoenix
#

maaaaan

#

Just rename it to a zip then

#

FIle signature is the same either way

quartz kindle
#

are you using jetbrains?

wheat mesa
#

Gives me a 0 byte folder

earnest phoenix
#

wattheheck

wheat mesa
earnest phoenix
#

So you downloaded the already compiled jar of replit

wheat mesa
#

Yes

earnest phoenix
#

And on replit it works 3HC_what

wheat mesa
#

Yup

#

Weird shit

earnest phoenix
#

OS related eventually krShrug

wheat mesa
#

I’m thinking that it’s something wrong with the download process

quartz kindle
#

everything says "corrupt jar/zip" lol

earnest phoenix
#

Yeah that's possible honestly

#

But would be weird tbf

wheat mesa
#

Because jars are meant to be cross platform

#

Damn, gotta leave this class period now

#

I’ll try to fix it when I get home

earnest phoenix
#

What if you get the checksum of both files

quartz kindle
#

did you open the jar with winrar

#

or7zip

wheat mesa
#

Nvm I got a couple more mins

wheat mesa
quartz kindle
#

do it at home then, where you have winrar

#

lol

earnest phoenix
#

yeah

wheat mesa
earnest phoenix
#

lovely

wheat mesa
#

I’ll be leaving this class in about 2 mins anyways, I’ll be back to work on it at about 3:45pm or so (time is almost 1pm rn for me)

#

It would be even more bizarre if I can run it just fine on my pc at home lmao

earnest phoenix
#

blame your school if it's the case

wheat mesa
#

Yeah

jaunty basalt
#

Hey, anyone plz help-

So i made a rps command in discord.js v14.8.0 but it throws an error saying -Interaction already acknowledged. this happens when button user id not equals opponent id (or whomsoever chance is)
The same code works in my test bot but throw this error in my main bot. Plz help me solve this.

Code- https://sourceb.in/FrMrLSieON

earnest phoenix
#

holy guacamole the winner check

deft wolf
#

Omg XD

jaunty basalt
deft wolf
#

There are so many replies that I really have no idea where the issue could be

jaunty basalt
earnest phoenix
#

because at line 97 you already replied?

#

And you're trying to reply again to an already replied interaction?

#

Don't know what followUp does in the background

#

But considering it is an ephemeral message and the reply isn't, you're probably respond/acknowledge the interaction twice

jaunty basalt
#

But the same code works for my testing bot.

earnest phoenix
#

That I doubt

jaunty basalt
earnest phoenix
#

As said, to me you're replying/acknowledging the interaction twice

#

Don't do it twice

#

Do it once

jaunty basalt
#

But it's a followUp bro.

earnest phoenix
#

An ephemeral followup

#

So you're definitely not editing the previously sent reply

#

You're sending a new one

#

And I'm not your brother, in fact I don't have any brothers gigachad

jaunty basalt
earnest phoenix
#

Why's that rude?

#

Don't think you're from my family at all

jaunty basalt
earnest phoenix
#

Honestly it's just weird code

#

So many defers

jaunty basalt
#

So about code, isn't there a way to respond without editing

earnest phoenix
#

So many followups

#

Can't you clean that up or something

jaunty basalt
earnest phoenix
#

Well don't think you need to many followups

#

And think about a better way of checking for the winners

#

Will eventually help you solve your issue as you won't have so many edge cases

jaunty basalt
earnest phoenix
#

Winners can be checked with a single line

jaunty basalt
#

Uh how's that?

earnest phoenix
#

With 1 being rock, 2 being paper, 3 being scissors
With a being player 1 and b being player 2:

winner := (3 + a - b) % 3
#

a and b are obviously the choice the players made as integer

#

So if player 1 chose paper and player 2 scissors:

winner := (3 + 2 - 3) % 3 // winner = 2 (player 2)
#

Should help to clean your code to a much shorter solution

jaunty basalt
earnest phoenix
#

The one above

#

Just set variable of choice of player 1 and 2 to be an integer

#

A map or similar can do the trick

#
let map = new Map();
map.set("rock", 1);
// etc.

let playerOne = map.get(playerOneChoice);
let playerTwo = map.get(playerTwoChoice);

let winner = (3 + playerOne - playerTwo) % 3;
#

May not be the cleanest code, I hate JS either way

deft wolf
#

Certainly better than hell full of if and else if

earnest phoenix
#

I mean that map thingy

#

Maybe and probably a better way to get the int value of the choice made

sudden geyser
#

lmao how did they manage to fuck up like this

lyric mountain
#

interns

earnest phoenix
#

Yeah GitHub is amazingly good at leaking their keys

#

Not the first time and won't be the last time either

rustic nova
#

good at leaking

#

good at changing them quickly

spark flint
#

lol

#

gh is borked rn

frosty gale
wheat mesa
#

Alright back on my home pc, opening the jar with winrar produces this:

#

I'm thinking this has to be a replit download bug

#

ok well now running it in replit doesn't work

#

great

sudden geyser
#

how are you building it

wheat mesa
#

jar cvmf MANIFEST.MF TestJar.jar -C build . -C PlayBrew/src/test/resources .

#

and my build folder is just the compiled files of my application

#

Now that I've recompiled it, it's working on replit again

#

This is so bizarre

#

oh now I've redownloaded it and it doesn't seem to be corrupted this time

sudden geyser
#

what is jar anyway, since it's usually called like java -jar ...

wheat mesa
#

it's another command from java, it's specifically for working with jar files

#

I'm just using it to view the contents of it

#

I'd use java -jar to run it normally

#

ok now we're getting somewhere

#

I'm going to update java (thought I already had it updated but whatever)

#

man ok now I'm just straight up confused

#

I installed jdk 20 and I'm still getting the error that it only recognizes up to class file version 55.0

#

I set my JAVA_HOME env var to the new installation directory too

#

damn it openjdk is taking precedence over oracle's jdk

quartz kindle
#

still having issues? lmao

#

thats why i stay away from java

wheat mesa
#

it's because I have like 35 java installations since we apparently can't decide on one vendor for a jvm

#

fucking finally

#

windows is awful for managing installations

#

I swear

#

I got it to run

#

FINALLY

#

jesus christ that took way too long

deft wolf
#

Gj

boreal iron
#

Now we gonna need an exorcist

wheat mesa
#

tbf I have to do java for school

#

and I like it now

#

bundling a jar with it though is actual hell

boreal iron
sharp geyser
#

Wtf you talking bout

quartz kindle
#

exdee

sterile vault
potent wing
#

i need help with something idk what is going on :/

#
const { SlashCommandBuilder } = require("@discordjs/builders");
const { Player } = require("discord-player");
const { VoiceChannel } = require("discord.js");

module.exports = {
    config: {
        name: "play",
        category: "Music",
        description: "Plays a song in the voice channel.",
        usage: "play <song>",
        type: "slash",
        cooldown: 3
    },
    data: new SlashCommandBuilder()
        .setName("play")
        .setDescription("Plays a song in the voice channel.")
        .addStringOption(option => option.setName("song").setDescription("The name or URL of the song.").setRequired(true)),
    async execute(interaction) {
        const query = interaction.options.getString("song");

        if (!query) {
            return interaction.reply("Please provide a song name or URL.");
        }

        const player = new Player(interaction.client);
        const voiceChannel = interaction.member.voice.channel;

        if (!voiceChannel) {
            return interaction.reply("You need to be in a voice channel to play music.");
        }

        const song = await player.search(query, {
            requestedBy: interaction.user,
            searchEngine: "youtube"
        }).catch(() => {});

        if (!song || song.length === 0) {
            return interaction.reply("Sorry, I couldn't find that song.");
        }

        const queue = player.createPlaylist(interaction.guild, {
            metadata: interaction.channel
        });

        try {
            if (!queue.connection) {
                const connection = await voiceChannel.join();
                queue.setConnection(connection);
            }
        } catch {
            player.destroy();
            return interaction.reply("I couldn't join your voice channel.");
        }

        queue.addTrack(song[0]);

        if (!queue.playing) {
            await queue.play();
        }

        return interaction.reply(`Now playing: **${song[0].title}**`);
    }
};
#

im trynna create a play command but its saying that it cant join the voice channel but it has the required permissions to be able to join

#

im not getting any errors as well

earnest phoenix
#

log the error

deft wolf
#

Maybe try

catch (error) {
console.log(error)
}
#

Writing codeblocks on a phone is a tragedy

potent wing
#

okok

#
TypeError: voiceChannel.join is not a function
    at Object.execute (C:\Users\ethan\OneDrive\Documents\Maru V2\src\commands\slash\Music\play.js:48:59)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.execute (C:\Users\ethan\OneDrive\Documents\Maru V2\src\assets\events\client\interactionCreate.js:60:17)
Logging channel doesn't exist.
#

thats the error i get

deft wolf
#

It doesn't look like you could join a channel like that

potent wing
#

oh

#

what do i do then im lost 😭

deft wolf
potent wing
#
[ANTI-CRASH] Unhandled Rejection: Error: Cannot find module 'C:\Users\ethan\OneDrive\Documents\Maru V2\node_modules\@discordjs\voice\dist\index.js'```
#

its saying that now

deft wolf
#

What do you think this error could mean?

potent wing
#

i have it imported tho

deft wolf
#

But you probably don't have this library downloaded

#

You need to download it using npm because it is not included in discord.js

potent wing
#

it is installed

#
 "author": "Ghostie",
  "license": "ISC",
  "dependencies": {
    "@discord-player/extractor": "^4.1.0",
    "@discordjs/opus": "^0.8.0",
    "@discordjs/rest": "^1.5.0",
    "@discordjs/voice": "github:discordjs/voice",```
#

fixed it lol

#
Error: Expected a voice channel
    at _Player.play (C:\Users\ethan\OneDrive\Documents\Maru V2\node_modules\discord-player\dist\index.js:2623:13)
    at Object.execute (C:\Users\ethan\OneDrive\Documents\Maru V2\src\commands\slash\Music\play.js:42:32)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.execute (C:\Users\ethan\OneDrive\Documents\Maru V2\src\assets\events\client\interactionCreate.js:60:17)```
#

now i get that error

#

i habe a feeling its something to do with that

#
ypeError: player.createQueue is not a function
    at Object.execute (C:\Users\ethan\OneDrive\Documents\Maru V2\src\commands\slash\Music\play.js:38:34)
    at Object.execute (C:\Users\ethan\OneDrive\Documents\Maru V2\src\assets\events\client\interactionCreate.js:60:31)
    at Client.<anonymous> (C:\Users\ethan\OneDrive\Documents\Maru V2\src\assets\functions\handleEvents.js:17:55)
    at Client.emit (node:events:513:28)
    at InteractionCreateAction.handle (C:\Users\ethan\OneDrive\Documents\Maru V2\node_modules\discord.js\src\client\actions\InteractionCreate.js:97:12)
    at module.exports [as INTERACTION_CREATE] (C:\Users\ethan\OneDrive\Documents\Maru V2\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (C:\Users\ethan\OneDrive\Documents\Maru V2\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)
    at WebSocketShard.onPacket (C:\Users\ethan\OneDrive\Documents\Maru V2\node_modules\discord.js\src\client\websocket\WebSocketShard.js:494:22)
    at WebSocketShard.onMessage (C:\Users\ethan\OneDrive\Documents\Maru V2\node_modules\discord.js\src\client\websocket\WebSocketShard.js:328:10)
    at callListener (C:\Users\ethan\OneDrive\Documents\Maru V2\node_modules\ws\lib\event-target.js:290:14)```
#

:/

wheat mesa
#
  1. We need to see your play.js and interactionCreate.js files
  2. You leaked a database username and password
  3. Did you write this code?
supple oriole
#

Prob opened sourced.

#

Then again, could be either.

eternal osprey
#

hey does anyone know how i can make my website responsive? So basically, make it change res automatically based on the screen size

#

as of now, my code is fucking up when i change from pc to mobile for example. All the labels, text, images will clusterfuck over the whole page

potent wing
#

sorry ive been trying for awhile to fix this so i didnt see

wheat mesa
#

Well there’s your problem

#

That’s not how you import that, look at the docs for the library: https://www.npmjs.com/package/discord-player

boreal iron
#

People often also use JS to animate the elements once somebody is actively changing the screen size to prevent the design to just transform instantly

eternal osprey
#

So if it's 400px+ it will set it to ..., and else if 800+ to...

#

i can't define all cases i suppose?

quartz kindle
boreal iron
#

There are common values (sizes) used to cover most of the screens used nowadays
Like smartphone (horizontal and vertical), big and small tablets, etc.

eternal osprey
#

owh i see, where can i find those sizes?

boreal iron
#

Trying to define a perfect layout for each possible screen size is like impossible or let's say extrem clusterfuck

#

It makes much more sense for smaller screen sizes to work with elements using a percentage as width as Tim said

boreal iron
#

Also depends a little bit on your layout and what things you wanna cover and/or hide especially on mobile devices

eternal osprey
#

hmm i see

#

wouldn't there be like an easier solution then defining cases such as this

#

on my windows pc it looks great, but on my mac it's fucking up

#

would adding percentages instead of pixels help?

#

That way it wouldn't be fixed

boreal iron
#

Personally I flex my site and elements at 320, 480, 720, 960 and >1200px

#

Not the entire layout but specific elements get adjusted at various screen sizes

#

As example for all devices with very tiny screen sizes I do hide unnecessary elements which would ruin or extend layout

#

For example in the footer

#

Or even descrease the font size much more than on larger screen sizes to fit more text into elements

#

You basically begin the develop the entire design in a response way not creating a layout thrn trying to transform it into something responsive

#

That's only getting painful

eternal osprey
#

yeah indeed

#

but it's only a one-pager

#

and iactually only got to it later

#

when i tested the site on my phone

#

isn't there a package or something that will actually handle this automatically?

boreal iron
#

Not without using like a template (editor) and r page builder

#

Because all elements are up to you being build like you want

eternal osprey
#

shiii

boreal iron
#

Instead of testing stuff specifically on your phone which should also be done at some point you can also your browser element inspector to represent different devices and screen sizes

#

Especially makes sense when you're unexperienced with responsive layouts to test and try out stuff

#

It can usually simulate like each common device and screen sizes

#

Also sending the appropriate user agent etc with it when simulating it

lyric mountain
#

Better to use an emulator, cuz statusbar and such elements

#

But browser frame is good too

boreal iron
# eternal osprey shiii

For me personally it was easier in the past to start with the mobile design as default css attributes to set then adding media queries to it, for example min-width: 480px then change the layout and elements like I want moving many from a percentage-wise width to fixed width etc

#

Then with the next larger screen size and so on

#

At a specific size when expecting people to use desktop size screen I usually don't create specific css code anymore

#

Only rarely like increasing the padding and margin of close by containers on very large screens like 1200+ for example to expand the overall layout a bit

#

But this all is totally up to you and pretty much has endless possibilities limited by your imagination, knowledge and time to spend

lyric mountain
#

Narrator: And here we can see FakE in his natural habitat, web development

boreal iron
#

lol

#

Im far away from being a web developer

#

Especially when it comes to modern and neat designing

#

But I had to do a lot of projects in the past for many communities and quite gained lot of experience

#

Doesn't mean the state of the art way to do things is what I like to do

#

_cough php cough _

potent wing
#

everything works it plays the song but then i get this error js [ANTI-CRASH] Unhandled Rejection: Error: Expected a voice channel

lyric mountain
boreal iron
austere niche
#

hello , how to make a vote tracker for my bot

boreal iron
#

Subscribe to the topgg vote webhooks and use the data they send to you once somebody votes

#

In other words create an endpoint listening for webhooks, add its URL to topgg to your profile and receive the data once a vote happens

#

More details can be found in the docs in the channel topic of #topgg-api

hushed robin
#

cus

#

you guys tell me the wrong thing

#

lair

tough star
#

hi,
is it possible to run 2 different discord.js versions on the same work space?
i got a rdp that I use for my bots but alot of my working projects are still on discord.js@v12
and now im working in new ones using v14.. but when I install v14 using a cmd it just stops the v12 ones.. any ideas?

hushed robin
#

yes

topaz terrace
#

how do i check if a string has space in it?

neon leaf
#

If you are talking about javascript then its this

<string>.includes(' ')
rustic nova
#

nah we gotta regex TrollBait

topaz terrace
neon leaf
boreal iron
#

Also without using the global flag as he's just looking for the first whitespace

#

Which would technically made it at least a bit efficient

topaz terrace
#

why is it returning null

#

oh wait

#

i putted the wrong object

rustic nova
#

the fact that nextjs just casually fully exposes my deployment path

#

unless thats only on the dev run

quartz kindle
#

then require("discord.js-old") in your v12 projects

jaunty basalt
cinder peak
#

Lkppooimnbvcxx
Mnj
. Hi

deft wolf
#

?

compact pier
#

Should I hash password with sha-512?

#

cause stackoverflow said

#

Can't see what is the different, they all hash things :D

boreal iron
#

Nowadays people use bcrypt for password hashing

#

I would also recommend using it

#

I would consider using slow hasing algorithms than fast ones as passwords usually only need to be encrypted once

#

The complexity of bcrypt is good enough (as it was designed for hasing passwords) unless you're a bank etc.

#

cause stackoverflow said

Also... you should continue reading not stopping after the first sentence freerealestate

sick agate
#

i use scrypt

boreal iron
#

yes, also a good choice

lyric mountain
lament rock
#

you know it gets the job done at least

sudden geyser
#

you'll be miserable maintaining overengineered code

#

most updates having nothing to do with the actual problem

quartz kindle
#

argon2 is the next big thing

#

also crystals-kyber, crystals-dilithium, falcon and sphincs+

#

if you want quantum-resistant crypto

#

:^)

sudden geyser
#

it doesn't even make sense to use sha alone to protect a password

boreal iron
neon flicker
#

Why does member.user.avatarURL() return nothing?

quartz kindle
#

because the user does not have a custom avatar

neon flicker
#

They do

#

I am testing it on my account

#

Hold on

#

Wait

#

Isn't member.user.name a thing?

quartz kindle
#

username

neon flicker
#

OOOOH

#

Will avatarURL() return null or undefined if the user has the default avatar? So should I be taking an action against it?

quartz kindle
#

it should return undefined if the user does not have a custom avatar

#

on the other hand, displayAvatarURL() returns the default avatar instead of undefined

#

one of the discord default colored avatars

neon flicker
#

So is it safer in some cases?

quartz kindle
#

pretty much yeah

neon flicker
#

Well btw I am on my alt and my main account is @earnest phoenix is it a problem?

#

I'm testing my bot

quartz kindle
#

unless you explicitly want to check if the user has a custom avatar or not, its safer to simply show whatever avatar the user is using, whether custom or not

neon flicker
#

Oh

#

Ty

quartz kindle
neon flicker
#

Ah

quartz kindle
#

but i dont remember it being a bannable offense, unless your main was already banned

neon flicker
#

Ty a lot

craggy pine
#

Only alt related things I can think of that Top.GG doesn't appreciate is obviously ban evasion and voting with multiple accounts

rustic nova
#

until the main is banned

neon flicker
#

Well I'm not banned so yes

#

Lemme prove that

craggy pine
#

yet 👀

#

jk

quartz kindle
rustic nova
#

👍

boreal iron
#

👌

quartz kindle
#

👍 👍

#

who says we are

#

xD

boreal iron
#

Probably everybody is high right now

rustic nova
#
print(":thumbsup:"*10);
boreal iron
#

Uhm

craggy pine
#
while(unbanned == true) {
console.log(":thumbsup:");
}
quartz kindle
#

<p style="transform: scale(999)">👍</p>

#

white not banned

#

razist

craggy pine
#

tim make white() a thing

quartz kindle
boreal iron
#

Soon to be banned

#

Things go quickly in here

craggy pine
quartz kindle
boreal iron
sudden geyser
#

yes

#

neovim

#

programming in general (think of lua as python with less built-ins)

#

if you search for projects on github you'll probably find a lot to do

tough star
wheat mesa
#

sometimes java verbosity is quite annoying

sudden geyser
#

i assume that discord.ext.commands still relies on message commands and not slash commands?

rustic nova
#

yes

sudden geyser
#

Because if so you should specify that you're using the message intent

#

Because you'll need it past 100 servers

frank thicket
lyric mountain
#

or Map.fromEntries() (I think)

#

the latter allows infinite args

wheat mesa
#

It’s not going to matter anyways unfortunately

#

I’m going to have to use an audio lib because Clip doesn’t support like half of the controls I need

#

Literally only supports MASTER_GAIN

#

That’s it

sudden geyser
#

if you get rejected you won't get the intent

#

and past 100 servers you won't receive the events

stray sinew
#

Access to fetch at 'https://api.website.com/authenticate' from origin 'https://website.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Credentials' header in the response is 'true, true' which must be 'true' when the request's credentials mode is 'include'.

#

can someone help please?\

lyric mountain
lyric mountain
wheat mesa
#

@lyric mountain know any decent libs for sound? Using AudioCue rn but I can't really figure out how to make this easy to use in my engine

#

(Simply because of the way it uses IDs for “instances” of sound and it doesn’t make a whole lot of sense from the standpoint of making it easy to use in my engine)

lyric mountain
#

See if apache has anything, they always have

wheat mesa
#

Unfortunately I think AudioCue is my best bet, I’ll have to figure out how to make a wrapper around this

#

Seems really complex for what I want to do since it allows concurrent playback and requires you to “obtain” instances and shit

lyric mountain
#

There has to be a good audio library

#

What does lavalink use?

#

U could try reading its source code to see what it uses, since it's the most used music module in discord

wheat mesa
#

Yeah I'm looking through rn

#

Kotlin isn't my thing though so it'll take me a little while longer to figure out what's what lol

lyric mountain
#

Ah, lmao

wheat mesa
#

it uses another lib called LavaPlayer it seems

lyric mountain
#

Never liked kotlin syntax

#

It feels too sugary

wheat mesa
#

But the problem with this is it seems like it was built specifically for discord

#

Since it's meant for transferring raw bytes

lyric mountain
#

LWJGL has a music module

#

Apparently, the best are those who wrap OpenAL

#

There's also JOAL

#

Which I imagine is the OpenAL equivalent of JOGL

wheat mesa
#

I think I should probably stick with AudioCue, I just need to figure out a way to use it properly

#

it's very weird though

#

You can't modify any sort of parameters of the audio without an active clip playing as far as I know

lyric mountain
#

U could make a wrapper to preload params

#

Like, never use audiocue directly

wheat mesa
#

this is the really annoying thing

#

I can't just reserve one "instance" at all times and assign it to an instance variable in my class, I have to get it from the play function

#

Which doesn't make much sense to me

lyric mountain
#

Maybe it's so it doesn't hold a stream open?

wheat mesa
lyric mountain
#

Yes, play() simply starts the audio if it's open

#

That's what I understood from the description

#

Like, if it's not yet opened it simply returns a new instance, else it returns and starts playing

wheat mesa
#

Problem is that most functions require me to pass an instanceID so it knows what to apply the effects to

#

But the instanceID isn't generated until I'm calling the play method

#

Which really sucks

lyric mountain
#

Can't u reuse an instance?

wheat mesa
#

Uhhh

#

There's a method called obtainInstance which "reserves" an instance but I couldn't figure out how to actually get that to play anything

#

Hold on lemme research that a little more

#

There's a method called start(int instanceID), might be what I'm looking for

#

I'll check it out rq

#

wow now THAT is annoying

#

"throws an exception if it's already playing"

lyric mountain
#

Ah lul

#

Most native apis will have rigid state control

#

Which often result in many mandatory exceptions

#

Tho that one is runtime exception, so it doesn't need to be catched

#

See if there's a way to check if an instance is already playing

wheat mesa
#

yeah maybe I just need to use a different library

#

This one straight up breaks

lyric mountain
#

See if JOAL is too complicated

#

Else just search for the most popular options

wheat mesa
#

This looks kind of complex but looks like it has a lot of control

#

ok nvm this has an OpenGL-like interface in the sense that it's a giant fucking state machine and I do NOT have the time to go down that rabbit hole again

#

I'm just going to try to see if I can figure out a fix to the javax.sound.sampled api

#

because honestly it has exactly what I need, it just complains about certain things not being supported

wheat mesa
#

Ok so I'm running into a weird issue that may or may not be a java fault

#

But basically, some of my .wav files have support for more controls than others

#

For example, a sound effect I generated with sfxr only has support for MASTER_GAIN and MUTE, but one I downloaded off of the internet has support for MASTER_GAIN, MUTE, BALANCE, and PAN

lyric mountain
#

Can it be something related to the file itself?

wheat mesa
#

I'm assuming so, but I don't know how to actually fix it

#

I'd ideally like to swap over to mp3s, but unfortunately the javax api doesn't seem to support it

#

Not sure why

quartz kindle
#

run mediainfo on it or similar

#

find the actual codec

#

wav is a container that can use multiple codecs

wheat mesa
#

oh I think I figured out what the criteria is

#

I think sfxr generates mono audio wavs

#

When the controls for panning and balance and such obviously only exist on stereo audio files

quartz kindle
#

yeah makes sense

wheat mesa
#

Now the problem is that wav files are ridiculously large for what they do and I need to figure out a better format to store them

#

And I can't seem to find much info out there on libless solutions for playing mp3 files (I don't necessarily NEED it to be libless, but it would definitely be preferred)

topaz terrace
#

why isn't the if statement that check if the message is bigger then 2000 won't run?

topaz terrace
#
const time = Math.floor(Date.now()/1000) //(reload.js)
// ready event
const timeleft = Math.floor(Date.now()/1000) - time;
#

why is it showing the wrong time

#
        fs.readFile(path.join(__dirname, "../../restart.txt"), (err, data) => {
            if (err) {
                return;
            }
            if (data) {
                const restart = data.toString();
                const [messageId, time, userid] = restart.split(",");
                const user = client.users.cache.get(userid);
                console.log(time)
                const timeLeft = Math.floor(Date.now()/1000) - time;
                user.send({
                    embeds: [
                        new Discord.EmbedBuilder()
                            .setTitle("Started!")
                            .setDescription("The bot has started up!")
                            .setColor("#a8f1b0")
                            .addFields({ name: "Time taken", value: `<t:${timeLeft}:R>` }),
                    ],
                });

                fs.unlink(path.join(__dirname, "../../restart.txt"), (err) => {
                    if (err) {
                        return;
                    }
                });
            }
        });```ready event
#
            const file = path.join(__dirname, "../../restart.txt");
            let data = `${msg.id},${Math.floor(Date.now()/1000)},${message.author.id}`;
            fs.writeFileSync(file, data);```reload.js (not full code)
scenic kelp
#

and discord will interpret the 48 as a timestamp

#

<t:48>

#

if you want to show just a time interval you're on your own for handling that, though the code you have now gives you the seconds elapsed between the two times

crystal wigeon
#

is there a discord API i can use to fetch all the guilds my bot is in?

#

by sending the bot id

#

or token

earnest phoenix
#

No discord has no API /j

#

Your bot is sending messages to Discord with magic

lament rock
#

GET /users/@me/guilds

lament rock
lament rock
# lament rock GET `/users/@me/guilds`

it should be noted that you should not try to use this for stuff like stats if you have no intention to cache the guilds. You should instead rely on GUILD_CREATE and GUILD_DELETE ws events because it's literally free

#

the READY event does have an Array of guild ids, but that isn't updated

crystal wigeon
#

im having to fetch guilds then all channels and then look for the channel where my bot has perms to send message in

maiden gazelle
#

hello i have a question, i use mongodb and if i add something in my database i do await db.set(example_${interaction.guild.id}) but how can i set something for every serer

#

in this case i use it for cached messages

crystal wigeon
#

how do i check if the bot has perms to send message in a channel that was retrievede from api

earnest phoenix
#

And there you have the list of permissions overwrite which answers your second question krShrug

#

Sometimes taking the time to read docs to find the solution is worth it

crystal wigeon
earnest phoenix
#

No, that means the channel has no permissions overwrite

#

So the permission of the role applies

#

Along with the guild-level permissions, Discord also supports permission overwrites that can be assigned to individual roles or members on a per-channel basis.

#

Everything on the documentation krShrug

#

As said, taking the time to search is always good

maiden gazelle
#

hello i have a question, i use mongodb and if i add something in my database i do await db.set(example_${interaction.guild.id}) but how can i set something for every serer

#

in this case i use it for cached messages

rustic nova
#

something you can globally know without depending on a guild

snow scroll
#

Hmm

rose warren
#

Does anyone know why my RAM is dipping every hour darkThink

rustic nova
#

garbage cleanups that happen every hour/crontabs?

rose warren
#

But the total amount of ram dips? That orange line should be flat, right?

rustic nova
#

a whole 4 gigs drop does sound sus

rose warren
#

Like if you look at this one and add them up that's no longer 16GB

#

Sometimes it dips more, and other times it's less

rustic nova
rose warren
#

Is my VPS just shouting at me to upgrade? darkAYA

rustic nova
#

still somewhat sounds like cleanups to me

#

nah lol

rose warren
#

It's kinda concerning though

#

A 4 - 6GB drop in available ram on the server could crash my bot, right?

#

Since it's already running at 10GB used

rustic nova
#

unlikely

#

still sounds like garbage cleaning

#

do you keep logs of like, objects being cleared up? if so try checking on these specific times

rose warren
#

Times don't seem to align

rustic nova
#

perhaps dropping the caches took 2 minutes?

rose warren
rustic nova
#

though doubt

rose warren
#

There's 4 minutes between the dips (which are 2 minutes past the hour every hour), and the cache dropping which is at 6 minutes past

rustic nova
#

but it does happen consistently right?

rose warren
#

yep

#

Disk I/O also seems to peak at the same time as the RAM dips

lyric mountain
earnest phoenix
#

seems like a normal thing

#

That's how gateways work, especially Discord's gateway

crystal wigeon
#
  "id": "41771983423143937",
  "guild_id": "41771983423143937",
  "name": "general",
  "type": 0,
  "position": 6,
  "permission_overwrites": [],
  "rate_limit_per_user": 2,
  "nsfw": true,
  "topic": "24/7 chat about how to gank Mike #2",
  "last_message_id": "155117677105512449",
  "parent_id": "399942396007890945",
  "default_auto_archive_duration": 60
}```

This is what gets returned. now how do i check if the bot has perms to send a message here. do i have to check global perms? if so how do i do that wew
#

ev en the guild object just has the name and id

limpid rain
#

Hello all!

wheat mesa
#

.filter(x => x.name === "whatever you want")

spark flint
#

iirc it needs to be an object

#
.setEmoji({
  name: "emoji_name",
  id: "emoji_id"
})```
hushed robin
#

or just <:name:id> which you can get by putting \ behind the emoji

neon prairie
#

Can I webscrape the rating of a server that's on top.gg?

#

Or can I access it within the API

earnest phoenix
earnest phoenix
#

Against terms of services and if you get caught you'll most likely end up being banned or similar

neon prairie
#

Where's the tos

earnest phoenix
#

It is also common sense that web scraping is against most website's guidelines

neon prairie
#

Thank you.

sterile vault
#

just a question mainly for moderators but anyone can respond.
Is using APIs, even undocumented APIs, to retrieve information against ToS or not?

lyric mountain
sterile vault
#

I'll wait for a mod response

sudden geyser
#

undocumented discord apis or top.gg apis?

lyric mountain
#

you could read the ToS linked up there, if it doesn't say anything then it's likely allowed

#

that said, how would u even use an undocumented api?

sterile vault
lyric mountain
#

also why do u even need an undocumented api?

sterile vault
lyric mountain
#

what do you need those apis for?

sterile vault
lyric mountain
#

don't think it's wise to use an undoc api in a public library

#

since it can change at any moment

sterile vault
#

It is not a hidden or temporary API, it is official and I don't think it will ever change as it is a necessary function for top.gg

lyric mountain
#

it's technically hidden if it's undocumented

#

even if it's necessary, nothing prevents them from changing it, since they just need to change on the frontend too

sterile vault
sudden geyser
#

change is more an application problem

#

if the benefit of having the api outweighs the negative of it maybe changing under your nose in the future I'd say use the api

#

that's what bots did with the music api and it basically had zero documentation

sterile vault
#

So using an undocumented API is kinda allowed

boreal iron
rustic nova
#

I can confidently tell you, dont use undocumented endpoints

#

Api endpoints that are used by the browser shouldn't be used as api, could theoretically be considered scraping

rustic nova
#

I agree there should be endpoints for that lol

#

But scraping isnt fine

#

also cc @sterile vault since you requested the answer of a mod, tldr could be considered scraping, you cant assume that endpoint functioning 100%, theres a reason why its undocumented

#

Also since thats in context of the library that might be merged into the current one, shouldn't use endpoints that aren't documented to begin with

sterile vault
#

I personally believe that since it is a widely used public endpoint and certainly with few exceptions and parameters it should be allowed to be used.
Not being a niche endpoint, perhaps hidden, I don't see the problem

rustic nova
#

Its not a widely used one, its a backend one used for user-related actions (searching for servers, interacting with server listings such as deleting, editing, refreshing data)

delicate zephyr
wheat mesa
#

@lyric mountain you tried to make an oracle cloud 24gb instance right? Did you have any trouble with "Out of capacity" errors when trying to create it?

lyric mountain
#

Don't remember which instance I made, but it definitely wasn't the good options

#

Those were marked as out of capacity

#

The one I got was like 2gb or so ram

#

All I needed it for was as a proxy server, so anything would suffice

wheat mesa
#

agh

#

I'm trying to get a decent one for a minecraft server for my friends

#

Unfortunately I'm battling that "out of capacity" error

boreal iron
#

Gonna sell you some server for free, just $99 $49 per month

brisk fox
#

Oh yeah, The actual definition of free

crystal wigeon
#

can someone pls help, how di know if my bot has perms to send a message in a channel from the object returned by discord api - guilds/<id>/channels

#

@boreal iron @lyric mountain sorry for ping

#

i couldn't find any info on the docs regarding this

rustic nova
tulip ledge
rustic nova
#

Clearly on discords docs yeah

lament rock
#

caching permissions DrakeNo
abusing interactions giving you permissions for sending, using external emojis and embedding content and images no matter what DrakeYes

rustic nova
#

sending "test can i send here pog yes" every time

earnest phoenix
#

Chad method is to try to send a message in every channel to know the permissions gigachad

quartz kindle
surreal sage
#

"[unable to serialize, circular reference is too complex to analyze]"
Getting this as response when logging an interaction made by a message component collector

                    const collector = reply.createMessageComponentCollector({
                        max: 1,
                        filter: (btnInteraction) => btnInteraction?.user.id === command?.user.id,
                        time: 60_000,
                    });
                    collector.once("collect", async (btnInteraction) => {
                        console.log(btnInteraction);
                    });
                    collector.once("end", (_, reason) => {
                        console.log(reason);
                    });```
lyric mountain
#

interaction contain the buttons which contain the interaction which contain the buttons which contain the interaction...etc

surreal sage
#

ic ty

quartz kindle
#

that makes no sense, you absolutely can log it

#

console.log does handle circular references gracefully

#

the error "unable to serialize" suggests the problem is elsewhere, not with logging itself

lyric mountain
#

can u override js' toString()?

quartz kindle
#

yes

lyric mountain
#

perhaps d.js overrode it and made it break if there was a circref

#

or like, made a custom serializer for interactions

quartz kindle
#

thats called prototype pollution, and its considered bad practice

#

they dont do that

quartz kindle
lyric mountain
#

ah, so u have to resort to proto

#

then idk, the times I found that error were when using JSON.stringify()

quartz kindle
#

JSON.stringify is different from console.log

#

json does not support circular references

#

you need a replacer function to support it

#

console.log does not actually stringify anything

#

it inspects things

#

like the node inspector utility

surreal sage
#

Somehow the length property on an after-.filter array doesn't exist
Neither does it exist after Object.keys or iterating through the keys and returning the count

quartz kindle
surreal sage
#

all g

lyric mountain
#

likely the same issue

surreal sage
#

Spread operator did the job.., somehow

quartz kindle
#

i have no idea about that, the code looks correct

opaque acorn
#

how can i remove the green dot of online state?

lyric mountain
#

set the status to any of the other 3

#

you'll still need to live with a dot regardless, but it wont be green

opaque acorn
#

ive seen a lot like these

lyric mountain
#

that's an application-only bot

#

like, wasn't added as a bot, but as an app

#

if that makes any sense

opaque acorn
lyric mountain
#

basically, "bot" and "application commands" (slash, context, buttons, etc) aren't mutually inclusive

#

you can have one without the other

opaque acorn
#

text commands arent going to dissapear on small bots right?

lyric mountain
#

no, neither will they for big bots

opaque acorn
#

okey

#

great

#

a long ago i listened that they will dissapear bc discord new api

lyric mountain
#

just people making drama

#

prefix commands will exist as long as message intent does, simply because if you can read something, you can parse it

#

and I don't think discord will remove that intent anytime soon since some features require reading message content (like automod or chatbots)

solemn latch
#

It may get more strict to obtain it, but I would expect it to always exist.

earnest phoenix
#

is it important to fetch/update discord.js cache or does it automatically update itself?

lyric mountain
#

you can't do either

#

I mean, kinda

#

fetch is just an async way to retrieve data

#

as all async ops in d.js, it will update the cache since you just retrieved it (simply throwing it away would be a waste)

earnest phoenix
#

got it 👍

lyric mountain
#

cache works like this

1 - You request the data
2 - D.js checks if a cached version exists (if yes, skip to 5)
3 - D.js calls discord api for the data
4 - D.js caches the newly retrieved data
5 - You get the data

lament rock
#

bing ai

#

haven't used the drawing part. Only the gpt 4 part

#

its probably some form of stable diffusion

#

stable diffusion is an AI for drawing like how chatgpt is for chatting. Bing uses modified chatgpt 4.

#

bing ai is free

#

you just cant wrap it in an api

#

If you mean one with a free api then that doesn't exist

lyric mountain
#

the only true free option will be selfhosting the AI yourself

#

even that wont be free since energy bills and hardware

#

"get MLs"?

lament rock
#

you cant take the AI out of AIML

lyric mountain
#

machine-learning is a methodology, not something you can "get"

#

maybe, just remember you need hardware to back it up

sudden geyser
#

And actually be usable

solemn latch
#

There are a lot

#

I almost bought a 3090ti to use one.

lament rock
#

Would probably need beefy GPUs to back the AIs

lyric mountain
#

most can be ran locally, you just reserve a lot of resources to it

#

how big are the images you want to generate?

lament rock
#

all of the resources

solemn latch
#

The one I was looking at needed 20 gigs of vram just to start

lament rock
#

The model was probably just that large

#

That's insane

solemn latch
#

There are less hardware intensive ones.

lyric mountain
#

is 1024x1024 big for you?

#

well, maybe you can fare with a "cheap" 2060

#

and ofc, a ton of fans to offset the temperature

#

the model page should mention the recommended specs

#

oh, also, you'll need to either train it or get a dataset

#

hardest?

#

the hardest part is making the actual AI

#

the second hardest part is training yes

#

datasets are huge, and the training process is very long

#

using an hdd to hold the data is cheaper, but you'll get a fraction of the performance

lament rock
#

The hardest part is the legal battle you have to face for training your AI on items with different licenses

lyric mountain
#

ofc, those datasets might not fit your needs, since they're usually trained in a certain domain

lament rock
#

Correct

lyric mountain
#

some are, some aren't

#

most are probably text

#

this is a single compressed file from danbooru2022 dataset

#

note the filename has 4 zeroes

#

I'm still scrolling trying to find the last file

#

danbooru

#

yes, just like most ~booru sites, it might contain nsfw

#

that dataset would generate anime images

#

since it's basically fed only anime samples

#

found the last file

#

each around 1GB

#

that's around 1tb of compressed files

#

I'd say 4-5 uncompressed

solemn latch
#

👀 that's not so bad

#

I thought it would be more

lyric mountain
#

I mean, it's little if you're thinking abt hdds

solemn latch
#

That's just training, that data doesn't need to be kept

lyric mountain
#

but using hdds will put the performance to a crawl

solemn latch
#

Or a $60 nvme drive.

#

My gen 4 1tb ssd was only $90 or so

lyric mountain
#

that's just talking about storage

#

the price comes from actually running it in a reasonable timeframe

earnest phoenix
solemn latch
#

Well, that dataset is temporary for training

#

Once it's trained you won't need it anymore

#

(But yes, ai is really cheap these days)

lyric mountain
#

yes, it'll be transformed into a couple million text files, which are somewhat lighter than images

#

try it, the worst that can happen is your motherboard melting

#

jokes aside, grab the lightest model you can find and see how it fares

solemn latch
#

Are the models not already trained on hugging face? 🤷

lyric mountain
#

but unless you have a somewhat beefy gpu don't even bother

lyric mountain
solemn latch
#

Some seem to be trained.

This model was trained on 768x768px images, so use 768x768px, 640x896px, 896x640px, etc. It also works pretty good with higher resolutions such as 768x1024px or 1024x768px.

#

I can send it in dms

#

I assume so, it shows how to run it

#

When you click download?

lyric mountain
#

all models will be local

solemn latch
#

They have a site for you to test

lyric mountain
#

those wont be listed

#

no, I mean, proprietary models won't be listed in that site since why would they be shared?

#

those which do have licenses usually have some way to get authorization to use it

#

like the image u sent

#

you saw it in spaces, not models

#

always has been like that

#

it's just that technology-related areas usually grow exponentially

#

it just wasn't as "shiny" as general purpose AIs are

#

so the general public didn't see it as a big thing

#

nevertheless tech was always growing behind the curtains, those who were working with it felt it

#

for example, 2019/2020 we had the insane jump that was raytracing

#

2018 (iirc) it was the first commercial quantum computer being created

#

not forgotten, but assimilated

#

just like cellphones were

solemn latch
lyric mountain
#

no, the future begins in a second mmLol

solemn latch
#

Oh

#

Ok

lyric mountain
#

you missed it, now it's past

solemn latch
#

Shit

#

I'm sad now

#

I tried to take a picture of the future

#

That's okay, I got a picture of Nala instead

#

That's the past

lyric mountain
# solemn latch

did it ever happen for you to lose your cat amidst that grey blanket?

solemn latch
#

Absolutely

#

My sheets are grey

hushed robin
#

hi guys!

solemn latch
#

Pillow covers are grey

hushed robin
#

how do i make my database quicker

solemn latch
#

Indexing

hushed robin
#

ok

#

what are the cons of indexing

solemn latch
#

Indexes take up storage space

lyric mountain
#

I think we explained the pros and cons before in this very channel

solemn latch
#

Yeah we have

hushed robin
#

how much more storage

solemn latch
#

Not much

hushed robin
solemn latch
#

Databases do

#

But they can't index everything by default

lyric mountain
#

you can create an api with any language that can make http requests

hushed robin
#

why would you do that

lyric mountain
#

it's doable yes, tho idk if lua is suitable for that

hushed robin
#

doubtful

#

yes

#

i have made an api with js

#

its very easy tbh

#

i mean it depends

spark flint
#

yes its easy af

hushed robin
#

but if your just getting data from a database

#

yes it'll be ez

lyric mountain
#

lua heavily tends towards the scripting side, but if you know the language well you can definitely do it

spark flint
#
const express = require('express');
const app = express();
const port = 3000;

app.get('/', (req, res) => {
    res.json({ hello: 'world' });
});

app.listen(port, () => {
    console.log(`Example app listening at http://localhost:${port}`);
})```
#

done

lyric mountain
#

there are big projects that use lua, like PoB I linked before

#

I personally would never use it aside for modding or mouse scripting

hushed robin
#

express makes it really ez

#

what

#

tf is a site panel

spark flint
#

yes you can

hushed robin
#

oh

spark flint
#

just set the port to your pterodactyl port

hushed robin
#

i guess so

lyric mountain
#

if you can try using a linux vps, it's good knowledge to have

#

and not that hard despite the apparent big first step

spark flint
#

no

#

you can use the ip:port

earnest phoenix
spark flint
#

lemme whip up an example rq

#

they wont if you add authorization

earnest phoenix
# spark flint done

You forgot to include the 69 installation and setup steps
As well as the 420 debug and error fixing steps

spark flint
#

lol

#

you can require an API key

#

yes but they cannot do anything without a API key

earnest phoenix
#

The whole internet can be scanned in a few hours

lyric mountain
#

I'll try to ELI5 it:

I'm talking to you right? in this case, you're the API and I am making requests

earnest phoenix
#

Don't worry about your IP, it will be known

hushed robin
#

my ip isn't known

lyric mountain
#

now imagine if you required my ID to allow me to talk to you

#

which would be the authorization factor

#

unless I handed my ID (or handed an invalid ID), you'd refuse to listen to me

earnest phoenix
#

I need to do that in real life

lyric mountain
#

this is almost literally how APIs work: one talks, the other listen

hushed robin
#

i would hope so

slender wagon
lyric mountain
hushed robin
#

no

earnest phoenix
#

As I said

hushed robin
#

every website has it's ip exposed

lyric mountain
#

it is, but they won't be able to do anything with it

hushed robin
#

lol

earnest phoenix
#

The entire internet is scanned in a few hours

lyric mountain
#

aside from DDoS attempts

quartz kindle
#

here's my ip: 127.0.0.1

#

hack me

earnest phoenix
#

So every IP is known to everyone within that timespan

lyric mountain
#

which are expensive and wouldn't be spent with a nobody's api

slender wagon
#

and you can develop protections against ddos's

#

limit requests per ip etc etc

earnest phoenix
#

Yeah probably will do that from now on

solemn latch
#

And tbh, a ddos isn't really as common as you would think

slender wagon
#

it is

lyric mountain
#

A random guy: but...
Krypton: Sorry buddy, but get 401'ed

earnest phoenix
#

Depends what website

#

Attempts are probably made countless times

slender wagon
#

yeah depends on the users too and depends on how beef u got with others lmao

earnest phoenix
#

Failed attempts much more than succeeded attempts

#

DDoS'ers are mostly script kiddies using tools from GitHub so yeah

earnest phoenix
spark flint
#

ok thats not the entire internet but thats 40 million DNS records stored for analysis

quartz kindle
#

step 1: set up an nginx server on your vps
step 2: enable warn logging
step 3: enjoy watching random access attempts multiple times per minute

lyric mountain
#

ddos requires an humongous amount of computers, which aren't easy to gather

hushed robin
spark flint
#

I run a few antiscam tools, all being ddossed multiple times, but they are uncommon

earnest phoenix
#

You'll probably see more bruteforce attempts than ddos attempts

slender wagon
#

and was u hosting the server?

lyric mountain
hushed robin
#

gta itself took like

#

30 hours to download

lyric mountain
#

I could do it with a can of soda and some matchsticks

lament rock
#

404 GET /.env
404 GET /actuator/gateway/routes
404 GET /actuator/health
404 GET /test.sql

People bombard my web server with requests trying to find explolits

spark flint
#

yeah i get that on CF logs

#

a lot of wordpress stuff

hushed robin
slender wagon
#

i mean some guy was hosting a streaming service on his pc and took me no more than 2 sec (with his perms) to turn off his net

hushed robin
#

with his perms

#

mhm

quartz kindle
#

low orbit ion cannon anyone?

slender wagon
#

always

quartz kindle
#

:^)

hushed robin
#

bro just gave u permission to shutdown his internet

earnest phoenix
#

LORIS

slender wagon
hushed robin
#

if i send my ip here

slender wagon
#

no

lyric mountain
hushed robin
#

will anyone take it down?

lyric mountain
#

watch the world burn

slender wagon
#

but eitherway it's not a great idea

#

and its pretty much against the rules

#

how would we know its urs

hushed robin
#

y

hushed robin
hushed robin
#

i won't respond for a little bit

slender wagon
#

hHAHAHAHAAHHAA

#

KEKW bro funky

hushed robin
#

😎

quartz kindle
hushed robin
#

bro

#

why is my ip static

#

L wifi company

slender wagon
#

mine is static too

#

it's not that bad

#

but i am banned from certain sites

#

due to me being sus

hushed robin
#

lmao

slender wagon
earnest phoenix
hushed robin
#

bro

#

i hate that i learned to type with only two fingers

#

😭

slender wagon
#

and believe it or not i am one of the only ones ip banned from that site

hushed robin
#

my wpm is only like

#

80

slender wagon
#

mine is around 125 on a good day but #general

hushed robin
#

why

slender wagon
#

Channel for chatting about development. If you have questions, ask the questions and wait for someone who can answer to help you. Do not ask to ask. Provide all possible information so people know what's up. Just saying "I get an error" doesn't give us enough information on your problem. Do not @mention people randomly.

hushed robin
#

ok i have a question

#

let me find it

#

i asked awhile ago

#

..

#

(ignore the guy bullying me)

quartz kindle
#

restore state?

lament rock
#

my server is immune to low orbit ion cannon

#

:)

hushed robin
quartz kindle
hushed robin
#

i want to remove something i added

wheat mesa
#

inb4 “looks too hard, nvm”

quartz kindle
hushed robin
#

bruh

#

bruhh

earnest phoenix
#

I'd be pretty sad to be the opposite

lament rock
quartz kindle
#

canvas is draw and forget, once pixels are put in the canvas, they cannot be removed, they can only be overwritten

hushed robin
#

ok

lament rock
#

use layers

quartz kindle
#

just like a real life painting

hushed robin
#

true

quartz kindle
#

you cant remove paint, you can only cover it with more paint

hushed robin
#

why cant it be like pencil tho

#

so i can erase

quartz kindle
#

you can erase by painting white over it

#

lol

hushed robin
#

but

#

will it be transparent still?

quartz kindle
#

you can paint with transparent

hushed robin
#

oh fr?

#

how

lyric mountain
#

clearcoat

hushed robin
#

bro

quartz kindle
#

set fill/stroke color to transparent

hushed robin
#

in canvas

quartz kindle
#

with rgba

#

or use different composition modes

lament rock
#

different blending modes do different things

quartz kindle
hushed robin
#

is there a more better way to do that
basically, i want to remove the graph on the below
bc i want to add another graph in it's place

lyric mountain
#

...why don't you literally draw over it?

quartz kindle
#

draw a gray rectangle over it to erase it, then draw a new graph over it

hushed robin
#

but i thought it could have issues

#

cus more data on image

#

cus 2 graphs on one image one just over the other

quartz kindle
#

if you're thinking about old stuff being remembered, then dont, thats not how canvas works

#

canvas does not remember old data

hushed robin
#

so

#

if i draw another graph on top

#

the graph on the bottom will no longer be in existence to canvas?

quartz kindle
#

yup

#

those pixels will be replaced by new pixels

hushed robin
#

oh ok

quartz kindle
#

and the old data will be lost

hushed robin
#

is that the most ideal way to do it

quartz kindle
#

pretty much yeah

#

i mean

#

there are more efficient ways

#

like storing multiple canvases on memory then putting them together

hushed robin
#

i want most efficient as possible

hushed robin
quartz kindle
#

it is

hushed robin
#

😵

lyric mountain
#

got to store this

hushed robin
#

my bot already uses a lot of memory bc canvas sucks

#

i don't need more

quartz kindle
#

html games made with canvas use those techniques, they use multiple canvases to represent different layers and enable editing specific areas without redrawing the whole image

hushed robin
#

i think canvas itself has a memory leak

#

i hope they eventually fix it

quartz kindle
#

never noticed memory leaks on mine

#

using node-canvas

hushed robin
#

well mine goes high after drawing like

#

idk

#

20 times

#

it goes past 200mb and auto restarts

quartz kindle
#

are you still using skia/napi-rs?

hushed robin
#

no

quartz kindle
#

then idk

hushed robin
#

cus u said it has serious memory issues

quartz kindle
#

yeah i tested them and they did use tons of memory more than node-canvas

lyric mountain
#

as we pointed many times, it's impossible to tell what is leaking memory without seeing your code

hushed robin
#

well i don't care much but