#development
1 messages · Page 106 of 1
Here’s the first few bytes
(Sorry I can’t screenshot, using my phone for discord rn)
Yeah all good, at least it's readable unlike other people's pictures
Not sure how to do that? I don’t have any access to winrar or anything like that here
Which sucks but yeah
I’m not sure, haven’t done this before
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.
I’m building through command line so maven isn’t a factor here
No option for that
Expand-Archive in powershelll exists apparently
Expand-Archive -Path <SourcePathofZipFile> -DestinationPath <DestinationPath>
Why can't schools just let students install their tools 
Doesn’t support .jar files apparently
Only supports .zip
are you using jetbrains?
Gives me a 0 byte folder
wattheheck
Yes and no, I’m compiling on replit via the command line, but I’m downloading it on a windows pc with Intellij idea on it
So you downloaded the already compiled jar of replit
And also trying to use the extract all option on just using right click gives me The Compressed folder is invalid
Yes
And on replit it works 
OS related eventually 
I’m thinking that it’s something wrong with the download process
everything says "corrupt jar/zip" lol
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
What if you get the checksum of both files
Nvm I got a couple more mins
^
I’ll try rq
yeah
The MD5 checksum of the file is the exact same
lovely
Fair
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
blame your school if it's the case
Yeah
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.
holy guacamole the winner check
Omg XD
Can u guys plz help me solve this error?
There are so many replies that I really have no idea where the issue could be
e.g. line 110, when button user id ain't equals opponent id, it should say "You cannot use these buttons" But instead throws error.
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
But the same code works for my testing bot.
That I doubt
Can u tell me how to fix?
I tried many times but keeps getting annoying.
As said, to me you're replying/acknowledging the interaction twice
Don't do it twice
Do it once
But it's a followUp bro.
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 
Obviously I'm not gonna edit because someone else clicked button.
That's kinda rude
Ik that, I just took brotherhood seriously
So about code, isn't there a way to respond without editing
Wdym
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
Can u suggest?
Winners can be checked with a single line
Uh how's that?
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
Can u tell a solution within the code I have?
(If any?)
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
Certainly better than hell full of if and else if
I mean that map thingy
Maybe and probably a better way to get the int value of the choice made
lmao how did they manage to fuck up like this
interns
Yeah GitHub is amazingly good at leaking their keys
Not the first time and won't be the last time either
i do nasty things all the time
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
how are you building it
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
what is jar anyway, since it's usually called like java -jar ...
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
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
Gj
All my fault
Tried to keep Waffle away from Java but I failed
Now we gonna need an exorcist
tbf I have to do java for school
and I like it now
bundling a jar with it though is actual hell
Wtf you talking bout
exdee
Please, could someone review it so that I can then edit/get this pull request approved?
https://github.com/top-gg/php-sdk/pull/4
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
log the error
Maybe try
catch (error) {
console.log(error)
}
Writing codeblocks on a phone is a tragedy
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
It doesn't look like you could join a channel like that
[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
What do you think this error could mean?
i have it imported tho
But you probably don't have this library downloaded
You need to download it using npm because it is not included in discord.js
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)```
:/
- We need to see your
play.jsandinteractionCreate.jsfiles - You leaked a database username and password
- Did you write this code?
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
yes, 99.9% if writen by me but my friend write a basic template that literally only had a ping command so everything else was me
sorry ive been trying for awhile to fix this so i didnt see
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
CSS media queries are almost enough to deal with this
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
hmm but wouldn't that only set the screen size based on a certain threshold.
So if it's 400px+ it will set it to ..., and else if 800+ to...
i can't define all cases i suppose?
Yea
you usually use that combined with percentage values for width
There are common values (sizes) used to cover most of the screens used nowadays
Like smartphone (horizontal and vertical), big and small tablets, etc.
owh i see, where can i find those sizes?
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
320px — 480px: Mobile devices
481px — 768px: iPads, Tablets
769px — 1024px: Small screens, laptops
1025px — 1200px: Desktops, large screens
1201px and more — Extra large screens, TV```
Also depends a little bit on your layout and what things you wanna cover and/or hide especially on mobile devices
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
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
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?
Not without using like a template (editor) and r page builder
Because all elements are up to you being build like you want
shiii
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
Better to use an emulator, cuz statusbar and such elements
But browser frame is good too
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
Narrator: And here we can see FakE in his natural habitat, web development
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 _
everything works it plays the song but then i get this error js [ANTI-CRASH] Unhandled Rejection: Error: Expected a voice channel
You're a webdev, harry
Please use hatebin or smth
Shhh FakE News
hello , how to make a vote tracker for my bot
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
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?
yes
how do i check if a string has space in it?
If you are talking about javascript then its this
<string>.includes(' ')
nah we gotta regex 
oh ok
no, no not regex
/ +/g.test(<string>)
You wanna use the token \s to match all whitespaces
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

the fact that nextjs just casually fully exposes my deployment path
unless thats only on the dev run
"dependencies": {
"discord.js-old": "npm:discord.js@^12.0.0",
"discord.js": "^14.0.0"
}
then require("discord.js-old") in your v12 projects
Dude, I recommend upgrading to v14
Lkppooimnbvcxx
Mnj
. Hi
?
Should I hash password with sha-512?
cause stackoverflow said
Can't see what is the different, they all hash things :D
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 
i use scrypt
yes, also a good choice
Hashing a pass with 512 is like using a tank to kill a cockroach
you know it gets the job done at least
you'll be miserable maintaining overengineered code
most updates having nothing to do with the actual problem
argon2 is the next big thing
also crystals-kyber, crystals-dilithium, falcon and sphincs+
if you want quantum-resistant crypto
:^)
it doesn't even make sense to use sha alone to protect a password
Sounds like we all need it
Why does member.user.avatarURL() return nothing?
because the user does not have a custom avatar
They do
I am testing it on my account
Hold on
Wait
Isn't member.user.name a thing?
username
OOOOH
Will avatarURL() return null or undefined if the user has the default avatar? So should I be taking an action against it?
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
So is it safer in some cases?
pretty much yeah
Well btw I am on my alt and my main account is @earnest phoenix is it a problem?
I'm testing my bot
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
im pretty sure this server is not very happy about alts
Ah
but i dont remember it being a bannable offense, unless your main was already banned
Ty a lot
Only alt related things I can think of that Top.GG doesn't appreciate is obviously ban evasion and voting with multiple accounts
we dont care
until the main is banned
👍 xd
👍
👌
Probably everybody is high right now
print(":thumbsup:"*10);
Uhm
while(unbanned == true) {
console.log(":thumbsup:");
}
tim make white() a thing
what would it do

welcome to the internet
Hello I'm new to this 👋
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
oh.. didn't think of that,
tysm that is gonna help me alot 
sometimes java verbosity is quite annoying
that's less verbosity and more duplication
i assume that discord.ext.commands still relies on message commands and not slash commands?
yes
Because if so you should specify that you're using the message intent
Because you'll need it past 100 servers
I'm using message and slash so is it the same way for me as well
use Map.of()
or Map.fromEntries() (I think)
the latter allows infinite args
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
most likely yes
if you get rejected you won't get the intent
and past 100 servers you won't receive the events
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?\
Oh I meant more for shortening the declaration
You're passing "true, true" where it should be "true"
@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)
Funny enough I never tried using audio stuff in java
See if apache has anything, they always have
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
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
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
Ah, lmao
it uses another lib called LavaPlayer it seems
But the problem with this is it seems like it was built specifically for discord
Since it's meant for transferring raw bytes
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
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
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
Maybe it's so it doesn't hold a stream open?
I would think that it loads the data when I call the open method from this example
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
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
Can't u reuse an instance?
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"
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
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
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
Can it be something related to the file itself?
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
run mediainfo on it or similar
find the actual codec
wav is a container that can use multiple codecs
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
yeah makes sense
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)
why isn't the if statement that check if the message is bigger then 2000 won't run?
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)
that won't work for time intervals, you'll end up getting a low number like this
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
is there a discord API i can use to fetch all the guilds my bot is in?
by sending the bot id
or token
GET /users/@me/guilds
There should already be a jni bindings for libmp3lame which would be ideal for quality and compression
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
can i pass any query params to fetch this data along with channels?
im having to fetch guilds then all channels and then look for the channel where my bot has perms to send message in
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
the channel object from the api is also not returning permissions
how do i check if the bot has perms to send message in a channel that was retrievede from api
No, read the docs.
To get the channels of a guild you need to make a new request to the channels endpoints of a guild resource https://discord.com/developers/docs/resources/guild#get-guild-channels
And there you have the list of permissions overwrite which answers your second question 
Sometimes taking the time to read docs to find the solution is worth it
Some channels have an empty permissions overwrite array, does that mean I can send message there. If it has overwrite that’s when I know I can’t send message, correct ?
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 
As said, taking the time to search is always good
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
dont append ${interaction.guild.id}, but change it to something like example_messages
something you can globally know without depending on a guild
Hmm
Does anyone know why my RAM is dipping every hour 
garbage cleanups that happen every hour/crontabs?
But the total amount of ram dips? That orange line should be flat, right?
a whole 4 gigs drop does sound sus
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

Is my VPS just shouting at me to upgrade? 
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
unlikely
still sounds like garbage cleaning
do you keep logs of like, objects being cleared up? if so try checking on these specific times
2023-03-26 15:00:06
Mar 26 15:00:06 botvps kernel: [537104.751610] sh (1881266): drop_caches: 1
2023-03-26 15:00:06
sh (1881266): drop_caches: 1
Times don't seem to align
perhaps dropping the caches took 2 minutes?
though doubt
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
but it does happen consistently right?
Could it be swapping?
seems like a normal thing
That's how gateways work, especially Discord's gateway
i checked the docs, im still not sure how i can check the permissions of a bot in a specific channel. the channel object simply doesn't have any info.
"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
Hello all!
.filter(x => x.name === "whatever you want")
or just <:name:id> which you can get by putting \ behind the emoji
Can I webscrape the rating of a server that's on top.gg?
Or can I access it within the API
No
No
Against terms of services and if you get caught you'll most likely end up being banned or similar
Where's the tos
It is also common sense that web scraping is against most website's guidelines
Thank you.
just a question mainly for moderators but anyone can respond.
Is using APIs, even undocumented APIs, to retrieve information against ToS or not?
apis? no
undocumented apis? maybe
I'll wait for a mod response
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?
Undocumented top.gg APIs
also why do u even need an undocumented api?
He does not specify.
Then I am used to reading and writing ToS in Italian so it could be that I missed something because of the language.
what do you need those apis for?
Cuz I integrated a function for the TopPHP library to retrieve the information of the servers as well.
And the library uses an undocumented API
don't think it's wise to use an undoc api in a public library
since it can change at any moment
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
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
it's https://top.gg/api/search
I don't think they will change it
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
So using an undocumented API is kinda allowed
Topgg ain't going to change at any time
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
No
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
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
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)
its more reverse engineering than scraping...
though as with any service If you use the endpoint just be aware that at any given time you can be banned, blacklisted and at worst C&D'd by top.gg
@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?
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
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
Oh yeah, The actual definition of free
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
Then u read the wrong docs
Clearly on discords docs yeah
caching permissions 
abusing interactions giving you permissions for sending, using external emojis and embedding content and images no matter what 
sending "test can i send here pog yes" every time
Chad method is to try to send a message in every channel to know the permissions 
as papi said, not possible with only the channel data.
to check permissions you need multiple things, the channel data for permission overwrites, the roles data for role permissions and the member data for the roles the member has
"[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);
});```
u cant log an interaction
interaction contain the buttons which contain the interaction which contain the buttons which contain the interaction...etc
ic ty
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
can u override js' toString()?
yes
perhaps d.js overrode it and made it break if there was a circref
or like, made a custom serializer for interactions
thats called prototype pollution, and its considered bad practice
they dont do that
lol
ah, so u have to resort to proto
then idk, the times I found that error were when using JSON.stringify()
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
nah I'm using a logging dependency
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
then the problem is with that dependency
all g
this tho
helpp!!!! 
likely the same issue
Spread operator did the job.., somehow
i have no idea about that, the code looks correct
how can i remove the green dot of online state?
set the status to any of the other 3
you'll still need to live with a dot regardless, but it wont be green
ive seen a lot like these
that's an application-only bot
like, wasn't added as a bot, but as an app
if that makes any sense
f
basically, "bot" and "application commands" (slash, context, buttons, etc) aren't mutually inclusive
you can have one without the other
text commands arent going to dissapear on small bots right?
no, neither will they for big bots
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)
It may get more strict to obtain it, but I would expect it to always exist.
is it important to fetch/update discord.js cache or does it automatically update itself?
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)
got it 👍
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
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
the only true free option will be selfhosting the AI yourself
even that wont be free since energy bills and hardware
"get MLs"?
you cant take the AI out of AIML
machine-learning is a methodology, not something you can "get"
maybe, just remember you need hardware to back it up
I've seen some projects which say they can run completely locally
And actually be usable
Would probably need beefy GPUs to back the AIs
most can be ran locally, you just reserve a lot of resources to it
how big are the images you want to generate?
all of the resources
The one I was looking at needed 20 gigs of vram just to start
There are less hardware intensive ones.
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
The hardest part is the legal battle you have to face for training your AI on items with different licenses
ofc, those datasets might not fit your needs, since they're usually trained in a certain domain
Correct
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
I mean, it's little if you're thinking abt hdds
That's just training, that data doesn't need to be kept
but using hdds will put the performance to a crawl
that's just talking about storage
the price comes from actually running it in a reasonable timeframe

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)
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
Are the models not already trained on hugging face? 🤷
but unless you have a somewhat beefy gpu don't even bother
from what I understood that site it mostly a model sharing site
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?
all models will be local
They have a site for you to test
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
We are in the future, that's a real sentence
no, the future begins in a second 
you missed it, now it's past
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
did it ever happen for you to lose your cat amidst that grey blanket?
hi guys!
Pillow covers are grey
how do i make my database quicker
Indexing
Indexes take up storage space
I think we explained the pros and cons before in this very channel
Yeah we have
how much more storage
Not much
i forget
why not index by default then
you can create an api with any language that can make http requests
why would you do that
it's doable yes, tho idk if lua is suitable for that
yes its easy af
lua heavily tends towards the scripting side, but if you know the language well you can definitely do it
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
there are big projects that use lua, like PoB I linked before
I personally would never use it aside for modding or mouse scripting
yup
express makes it really ez
what
tf is a site panel
yes you can
oh
i guess so
if you can try using a linux vps, it's good knowledge to have
and not that hard despite the apparent big first step
imagine having to download a library
You forgot to include the 69 installation and setup steps
As well as the 420 debug and error fixing steps
The whole internet can be scanned in a few hours
I'll try to ELI5 it:
I'm talking to you right? in this case, you're the API and I am making requests
Don't worry about your IP, it will be known
my ip isn't known
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
I need to do that in real life
this is almost literally how APIs work: one talks, the other listen
i think they understand how an api key works
i would hope so
and the other way around
for sure it is, there are few combinations in ipv4
no
As I said
every website has it's ip exposed
it is, but they won't be able to do anything with it
lol
The entire internet is scanned in a few hours
aside from DDoS attempts
So every IP is known to everyone within that timespan
which are expensive and wouldn't be spent with a nobody's api
Yeah probably will do that from now on
And tbh, a ddos isn't really as common as you would think
it is
A random guy: but...
Krypton: Sorry buddy, but get 401'ed
yeah depends on the users too and depends on how beef u got with others lmao
Failed attempts much more than succeeded attempts
DDoS'ers are mostly script kiddies using tools from GitHub so yeah
yes
After second attempt, you fot 429ed
ok thats not the entire internet but thats 40 million DNS records stored for analysis
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
ddos requires an humongous amount of computers, which aren't easy to gather
yeah this ^
then explain the guy on gta who took down my wifi for 2 hours
I run a few antiscam tools, all being ddossed multiple times, but they are uncommon
You'll probably see more bruteforce attempts than ddos attempts
your internet is shite
and was u hosting the server?
doesn't take much to take down your wifi
not surprising
gta itself took like
30 hours to download
I could do it with a can of soda and some matchsticks
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
no
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
low orbit ion cannon anyone?
always
:^)
bro just gave u permission to shutdown his internet
well it was more of a bet
if i send my ip here
no
a cannon that fires a tiny pulse able to flip a single bit in the targeted server
will anyone take it down?
watch the world burn
idk why would someone do so?
but eitherway it's not a great idea
and its pretty much against the rules
how would we know its urs
y
because when you ddos it
lmao
i won't respond for a little bit
😎
mine is static too
it's not that bad
but i am banned from certain sites
due to me being sus
lmao
miodec of https://monkeytype.com banned me
Real chad servers still fail against ICMP flood 
and believe it or not i am one of the only ones ip banned from that site
why
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.
ok i have a question
let me find it
i asked awhile ago
..
(ignore the guy bullying me)
restore state?
yes
i want to remove something i added
inb4 “looks too hard, nvm”
not possible
Well I hope so
I'd be pretty sad to be the opposite
I mean. If you want, hit https://amanda.moe
canvas is draw and forget, once pixels are put in the canvas, they cannot be removed, they can only be overwritten
ok
use layers
just like a real life painting
true
you cant remove paint, you can only cover it with more paint
you can paint with transparent
clearcoat
bro
set fill/stroke color to transparent
in canvas
different blending modes do different things
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
...why don't you literally draw over it?
draw a gray rectangle over it to erase it, then draw a new graph over it
well i did do this at first
but i thought it could have issues
cus more data on image
cus 2 graphs on one image one just over the other
if you're thinking about old stuff being remembered, then dont, thats not how canvas works
canvas does not remember old data
so
if i draw another graph on top
the graph on the bottom will no longer be in existence to canvas?
oh ok
and the old data will be lost
is that the most ideal way to do it
pretty much yeah
i mean
there are more efficient ways
like storing multiple canvases on memory then putting them together
i want most efficient as possible
this sounds like too much work
it is
😵
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
well mine goes high after drawing like
idk
20 times
it goes past 200mb and auto restarts
are you still using skia/napi-rs?
no
then idk
cus u said it has serious memory issues
yeah i tested them and they did use tons of memory more than node-canvas
as we pointed many times, it's impossible to tell what is leaking memory without seeing your code
well i don't care much but




bro funky