#development
1 messages · Page 33 of 1
đ
everything about "making a process think it can use more ram than you physically have" is a bad idea
offbrand pendrive vendors used to do that all the time, look what happened to ur data
If that would only work for my cars

bruh theres a reason they recomend a lower end ram limit most of the time.
like yeah technically you can run the game under spec lamost always it will jsut run like shit since you have assets and crap moving in and out of ram all the time
beamng doent enforce you have more than 2gb
but you will have all kinds of graphical issues with 1g
was a fun time
had to use only modded maps that where small
in short yeah if you can get a resorce intensive game to open on low specs its a lottery
my old hd7770 got 25fps in the latest beamng cuz the vram was always full in most small maps
now have a gtx760, its not much more powerfull but has more vram so fps is buttery now
YouâŠknow what requirements are⊠right?
If the game cannot allocate the textures because your GPU doesnât have enough left of course youâre going to have texture bugs⊠thatâs how a GPU works
Iâm surprised it didnât crash your game entirely
I mean, it IS allocating, or at least it think it is lmao
If heâs having weird texture bugs the likelihood is that the GPU is rejecting any sort of allocations to it until it can free some memory up
_just lower the graphic settings from poor to poorest or better black and white without textures _

I suppose it doesnât crash because allocations on the GPU failing arenât really âcrash worthyâ since itâs not critical to the core process
Plus texture bugs happen all the time in big games like that so theyâre designed to handle allocations failing on the VRAM
i mean it could be if its not crashing that all the textures on the lowest settings are lower than 1gig the restriction is just there cuz the devs are lazy and dont want to deal with complaints of shit not loading properly in som instances
Well, long story short, I already have my website have an A record with a let's encrypt certificate, however, I now started hosting node.js website applications and I think it's not working due to already being a certificate, present. Also, my main website is via Plesk but the node.js application is via a VPS.
Doubtful. Itâs probably less than 1gb because of other processes using it but the limit to how much GTA is allowed to take up is likely filled
Information stored on the GPUâs VRAM is mostly vertex buffers and such, which are only for efficiency when rendering the same textures over and over, so not much critical data other than some other stuff is stored there
why is it that when i disconect my servers internet when my bot is in vc it just hard crashes? is that normal? the error originates from "unhandled error event" in "discord.js/voice/dist/index.js"
Because you lost connection to the outside world? Seems pretty unrecoverable from a library standpoint to me
bruh my net went out for a week and when it came back up no errors
but vc just kills it?>
and if thats normal why is there a section on the d.js docs on how to try to reconnect a vc session if its just gonna die befor youy can do shit
reference:
Yes but you are essentially just managing the channel itself
so it makes little sense to be able to mess with roles as a whole
What if you want them to be able to change channel perms but not roles/create roles with more perms than needed
I mean to me it sounds like you need to stop trying to duct tape patch up the problems you get as a result of your real problem: you need a proper host if you want reliability
wheres the fun in that
people take tech for granted
i whanna make a bot and i want it to be robust enough that it wont crash
even on my potato internet
đ€
Potato internet is not good for hosting
and?
I think that goes without saying
i know
You need to fix the main problem
bad internet leads to horrible uptime
but why should on litttle blip cause my whome program too die
which in turn leads to bad bot
my bot its only on my mates server
Hi guys i have a question for you. The output I gave above is a data output, how can I create an array, object set that will give a result like this?
[
Track {
id: '1012466577531998208',
title: 'Bir Derdim Var',
author: 'mor ve ötesi',
url: 'https://open.spotify.com/track/5UV2oqgMXvlkOvvtK3aT7f',
thumbnail: 'https://i.scdn.co/image/ab67616d0000b27361cd6f5ad7c69b76adbc5419',
duration: '03:24',
views: 0,
requestedBy: User {
id: '615029465726320654',
bot: false,
system: false,
flags: [UserFlagsBitField],
username: 'Umut',
discriminator: '6070',
avatar: 'a9f1a560cabf761341f7c3cce0616d69',
banner: undefined,
accentColor: undefined
},
playlist: Playlist {
player: [Player],
tracks: [Circular *1],
author: [Object],
description: 'Senin aydınlıÄın, benim karanlıÄım.',
thumbnail: 'https://i.scdn.co/image/ab67706c0000bebbf568ae0c6888cdff0377cd0b',
type: 'playlist',
source: 'spotify',
id: '358umDe5Z8BDX8rGohoIHn',
url: 'https://open.spotify.com/playlist/358umDe5Z8BDX8rGohoIHn',
title: 'Karanlık'
}
}
]```
Thatâs like having the hoover dam burst and youâre patching it up with one piece of flex tape
Wait what are you trying to do
You seem to already have exactly what you asked for?
flex tape is strong enough

âTHATS A LOTTA DAMAGEâ
i mean not really thats a total failure of infrastructure, im just trying to deal with intermitant issues
I do not give this output, the system does, but I do not understand how it gives. I need an object, array data saving code that will give me results like this.
Thatâs already more than what the government does to keep their dams intact
If you already get the data like that what are you trying to do yourself
Your issues are extreme in the case of hosting. Having disconnects so often that you need an automatic system to reconnect it when you could just use a proper host is just not the right way to go about it
inb4 they implement that region specific reconnect system
:^)
bro I say that this data output does not belong to me. I say that I am looking for an array object saving code that outputs like this.
If libs don't swap over, there will be 10x more disconnects
there is not one host that has 100% uptime and therefor atleast every bot that anyone has made has lost internet atleast once are you trying to tel me that they all just outrught crash after that?
You could save yourself 1000 lines of duct tape code to handle complex internet issues, or you could spend 5 minutes setting up a free forever oracle VPS with pm2 that would be plenty to handle your bot
I have been hosting my bot on a free forever tier of oracleâs VPS for the last year. I have only ever had one disconnect that required me to restart the bot myself, and that was due to discordâs recent issues caused by cloudflare
Ofc not
that would be near impossible to guarantee
Just return an object inside an array âŠ
return [
{
property: value,
âŠ
}
];
Done
Or push the object to an existing array
I'm testing
But they are skilled enough to at least guarantee uptime nearly 24/7
so how do i make this not die in a short disconnect then?
To be fair the entire ecosystem of javascript is designed around âhave someone else do it for meâ, so why not just let someone else handle that for you? Use a service like PM2 on a proper VPS
you could always self host if you have good enough internet
also bruh my net isnt that bad its just short blips like once every two ish days that causes vc so storworking and i need to reload the connection
He self hosts right now
Heâs saying that his internet is cheeks so it disconnects and crashes the bot
Even the tiniest blip can cause a disconnect
why cant i handle that error though
Cause its YOUR internet cutting out for a split second
and? it reconnects
There is no way to prevent that other than getting better internet
I guess I can't. Can I send you a sample of my code?
Because youâve completely fucked the gateway connection and interrupted the stream of packets that are being sent through said gateway to discord while itâs playing audio
Not to me but into this channel
use a bin if its a large amount of code please
Aye
yeah so why cant i just get an error saying its disconnected?
rather than it killing everything
It should send an error if the connection is interrupted iirc
Because itâs probably going to terminate your gateway connection
ask error handling
let tracks = []
await music_filter.map(async m => {
let Track = {
id: interaction.guild.id,
title: m.music_name,
author: m.author,
url: m.music_url,
thumbnail: m.thumbnail,
duration: m.duration,
views: 0,
requestedBy: interaction.user,
playlist: {
player: client.player,
tracks: tracks,
author: interaction.user,
description: interaction.user.username,
thumbnail: interaction.user.displayAvatarURL({ dynamic: true }),
type: 'playlist',
source: 'playlist',
id: 'playlist',
url: 'playlist',
title: m.playlist_name
}
}
tracks.push(Track)
})```
Currently this code gives data as an object { } but I want an output like
Track {
}
i guess the process dies right? @wooden ember
Thatâs⊠what an object is
if i unplug my pc from the internet whilst im on vc with my mates discord will disconnect and then reconnect once i plug it back in why can in not do that with my bot?
....
?
PM2???
Resolve the promises and then map the results
Thats not how the gateway works....
but it does
like you should attempt to reconnect
manually
if there is a valid session id then ofc you can reconnect
but if you outright disconnect then you just have to re-identify
i want to but d.js throws an error and the whole prosses gets fucked befor i can
handle the error then
its not comming from my code
i think you can still do it ?
đ
- You can't reconnect without a valid session id, so if you just outright disconnect from the gateway you no longer have that (iirc)
- If this happens, you just have to re-identify (calling .login again)
Which means, stopping the process and re-running it
Which as you can see, is a bad idea
im genuinly confused if i unplug my pc rn from the internet it will not blue screen cuz all of windows telemitry, discord shit, google chrome, and whatever elce loses connection. so why is it that a i have to reboot the entire bot just for a momentary blip
if everything else can handle the internet dying why cant I?
Cause djs just kills the process once it gets an error like that
or does google have to reboot data centers everytime some one drives a tracter through a fibre line
why
thats dumb
said it was from d.js in the log
ws could be causing issues once it notices the gateway connection is no longer stable and just killing the process and telling you that
but idk literally stupid if one small thing causes the whole prosses to die
Again, this can be solved by just getting a reliable host but whatever
Just keep restarting the process
I have no way to help you with internet issues
"oh no the breaks are worn on my car better buy a new one"
đ€
not replacing my entire host just for one small issue
But, your analogy just stated a major issues
why is there no way of it retrying the connection
the hell are you on about
You can use pm2 like they've been suggesting
once it encounters an error it just restarts the process itself
henceforth restarting the bot
and you trying to force it to reconnect isn't?
im not able to do anything, it crashes as soon as its realises theres no internet
Thats how a lot of things work.
that is actually dumb
Either way, I can't help you with what you wanna achieve so just wait for someone who can
why is it that internet dying kills my bot but theres an entire page on how to handle disconnects on the d.js docs if i cant bloody use it
how im i suposed to use anyof this if i have to restart the bot anyway
what the fuck
this is why i genuinely hate software devs they single handedly have held back 30 years of hardware development.
yes blame others for ur problems
in the 90s you could get on the internet with a 800mhz cpu now you gotta have a 2ghz cpu to do the exact same fucking thing
did i write discord? no
did i write d.js
no
and back in the 90s you didn't have access to anything that has helped us as a society today
bruh what?
Anyway, what you linked relies on a session still existing and or discord closing the session themselves
If none of that is possible, then you simply have to re-identify
yeah exactly, i can see that but if the prosses gets yeetes as soon as theres no internet why are they telling me how to try to recover it
đ
This is going in circles
if it CANT reconnect then why should it bother trying further
this is definitely a fallacy of some sort I just donât know the name of it
what do you mean
Strawman fallacy
whats that?
Look it up
A form of argument and an informal fallacy based on giving the impression of refuting an opponent's argument, while actually refuting an argument that was not presented by that opponent
Basically you were being irrelevant
bruh didnt mean it liek that, i was expressing my general dismay againsed most modern software in a tangent
In this case the modern hardware has nothing to do with the internet, it doesnât change anything
And in the 90s CPUs were far less than that speed
But thatâs besides the point
if you want a more relevent tangent, the internet was invented as a nuclear prove data comunication network, i some how dont thing the US govournment would be happy with a network they have to reboot at every slight loss of service
In the 90s the internet was fantastically slow you seem to be forgetting
đ€
Dial up was still the most common form of internet access and that maxed out at something like 32kbps
It was fast for its time 
it was slow, it was shit, it disconnected and yet you didnt have to restart enternet explorer everytime your internet went out
A common thing was to bring a magazine to read at your computer while you waited for your website to load
Internet explorer was not a thing in the 90s pretty sure
Apparently launched in 1995 nvm
And yet you have to reload a website every time you lose connection to it if it depends on anything other than static pages no?
netscape was around the 90s
yes reload
i just want to fucking reload
that is it
i dont want it to crahs
But its essentially just starting a new connection no?
yes
An app in 1995 for windows was probably being built with C where you can access more internal low level things as well
and....you re-identifying the gateway does what?
but i cant start shit if the program crashed
Then go libless and control how it works, though I have a feeling it isn't djs itself that is causing this
He doesn't want a "bandaid" solution
Youâre trying to fit a square peg into a circle hole here
nomatter what i do i will never have internet with 100% uptime
But his solution is the bandaid solution
therefor it will crash at some point
Then use pm2
but that wount stop it crashing
Youâre right it wonât
Some things are unrecoverable
In the case of gateway connections
It could be a thousand different things
but why? i can disconect my pc from the internet whilst in a vc call and then plug it back in later and it will reconnect
Just use a process manager and use a proper host so that your bot will only crash like once every blue moon and itâll restart in 15 seconds
why cant i just make it so i get a console log like "theres no insternet at the moment retry connection in 30 secconds"
Discord is internally destroying and recreating your connection
no software is safe from eventual crashes
Because itâs a bandaid solution to a bigger problem
except RCT, idk how tf that guy managed to make it
Thatâs called the halting problem đ ^
Go ahead and solve it I dare you đ
nah I'm fine
i know but i can damn well try to get close
i know
well, you could encapsulate your entire process inside another process in a way that, should the child crash, the parent will create another one
The easier solution is to use a proper host that will take you 5 minutes to access and then another 10-15 minutes to set up with pm2
but even then, the parent has a chance to crash, thus killing the child
true but that wont be subject to anything that the child did
and this is starting to sound a lot more like a fantasy
an entirely unrelated process could crash ur own too
When malloc fails youâve got a big issue đ
It will return a nullptr if it does not have any more available memory
Then download more memory
Which I highly doubt that everyone is checking if malloc failed in their C program each time they allocate memory
or edit regedit 
or cry yourself to sleep
ah, misty missed the context
hm?
so, bae tries fiddling with regedit to make gta V think it has more vram than his gpu has
spoiler: it didn't went well
whatever works for you ig
it just console logs the error now
rather than killing the entire god damn prosses
literally works perfectly
ther was no reason for it to end the prosses at all
I have a suspicion that it will at some point cause issues but đ€·ââïž
if you think it is the perfect solution go with it
Idrc anymore
yet
lol
we will see
the only thing it does is the bot leaves the vc but still reports its in a vcin the code
but my disconnect command still works and after that it reconnects fine
What link?
Something like this: https://discordapp.com/oauth2/authorize?client_id=CLIENT_ID&scope=bot&permissions=PERMSHERE
Where to find it
Where is it located?
"Head over to https://discord.com/developers/applications/YourBotID/oauth2/general and set the links"
Replace YourBotID with the ID of your bot
Did you even do what I advised you to do?
https://discord.com/developers/applications/1010922215564378183/oauth2/general - This should be your link
Integrate your service with Discord â whether it's a bot or a game or whatever your wildest imagination can come up with.
Just try this for now
Maybe you do not even need a link
Then set the permission(s) and see what happens
Go to the bot thing?
Yes, as you do not have slash commands
Ok
Then set the permissions in the "Bot Permissions" tab that pops-up
Like this
Yeah, what do next?X
Save it and check out your bot
How to save it
How to make people to invite my bot
We do not give tips on advertising. Please take care of that yourself. You can also use our auctions
I donât have the option to save it
Then it was maybe saved automatically. Check if your bot has the button now, otherwise you need to dive in deeper yourself
A little research never hurts
anyone good with mongodb (mongoose) that might be able to help with an issue im having?
we manage roles in channel settings
um I'm a beginner
async function guildRemove(client, con, id) {
await guildSettings.findOneAndDelete({ guildId: `${id}` });
return 0;
}
well according to the docs, this is correct, yet its not quite doing anything its suppose to be doing.
i'm just wondering if someone can verify its correct?
yeah it does look correct tho
actually wait
you need to return a promise in that function to be able to work
so what are your suggestions?
for that you can make the promise return in the function
that wont change anything
also why do you have client an con params if you dont use them?
uh it would i guess
i used to have it setup as MySQL, an am switching to MongoDB. Must've forgot to remove it.
because i have a friend who's also a beginner at mongodb (even new than me) and he sometimes forgets to use await and so his action isn't performed
then he has other issues because thats not really how js works
I mean, it is, just not within the same execution
you could also use .then() but not sure if it'll work
await just makes the code wait for a result
yeah
^
async functions are promises already
it says "await has no effect on this type of expression"
that means youre using await in the wrong places
oh
anyways, am i wrong by saying what i have is correct or is there something im missing?
how do you call the guildRemove function?
ive tried finding it first, then using .deleteMany(), but same result (nothing)
oh my, im so dumb 
that would explain why its not working
forgot i commented out await client.utils.guildRemove(client, con, guild.id); when i was testing 

okay, maybe im not as dumb as i thought i was because its still the same issue đ€Ł
the await deos nothing in that context
yeah that's what I was saying
unless you have code that waits for the action's completion in consumer scope
he needs a promise
no
i can just do something like
function guildRemove(id) {
guildSettings.findOneAndDelete({ guildId: id });
}
if i don't depend on completion of anything
also
id if it's from djs api
it's a string
no need to stringify it again
if the code doesn't work: it might either be incorrect key, wrong schema, or the key just didn't exist in the first place
key exist in database, schema is correct. as far as the incorrect key, i could console.log it and see what its actually returning
my guess is its returning [object Object]
if you removed the client and con parameters from one side but not the other side of the function, then yes
see, key is correct
(in the database at least)
so its not returning anything 
well nevermind. didnt change a single line of code and it fixed itself... đ€·ââïž
That's a worrying case then, code that works when it shouldn't are the worst case
very, but thats why im testing it in multiple guilds at a time. seems to be working stable
You were likely fetching with an incorrect guild id tbh
Which is faster? map first or sort first?
it was fetching with undefined as the picture above shows
is it normal for guildAdd function to be ran on bot start?
(on bot start, my guildCreate event is firing)
yes but typically they return null/undefined if it can't find anything
so you were likely feeding it wrong info
As I said, I didnât change any code and it fixed itself lol
i don't see why not
Just spamming my console wile âerror: duplicate guildIdâ as my bot creates the database for the servers when it joins it⊠so the bot is trying to create the databases on bot start.
And with 100+ guilds, I donât think I want it spamming each individual guild in the console lol
I suppose I could add an !exist variable
As the bot identifies it does indeed run guildCreate event
Hello. I'm new to python and I don't really know how to fix this Error. It says that I am temporary blocked from discord's api for sending too many requests. I did read some documents and still don't understand. If possible, could anyone please fix it for me. thanks đ
import cloudscraper, requests
import discord, time
import random, threading
import asyncio
from discord.ext import commands
bot = commands.Bot(command_prefix=".", intents=discord.Intents.all())
scraper = cloudscraper.create_scraper(browser={'custom': 'ScraperBot/1.0'})
@bot.command()
async def crash(ctx):
games = scraper.get("https://rest-bf.blox.land/games/crash").json()
if ctx.author.id != bot.user.id:
await ctx.reply(embed=discord.Embed(description="Loading Bloxflip Crash API.",
color=0x5ca3ff))
ok = await ctx.channel.send(
embed=discord.Embed(title="Checking Bloxflip API",
description="Checking Crash's API. Please bare with us.",
color=0x5ca3ff))
def lol():
r = scraper.get(
"https://rest-bf.blox.land/games/crash").json()["history"]
yield [
r[0]["crashPoint"],
[float(crashpoint["crashPoint"]) for crashpoint in r[-2:]]
]
for game in lol():
games = game[1]
avg = sum(games) / len(games)
chance = 1
for game in games:
chance = chance = 95 / game
prediction = (1 / (1 - (chance)) + avg) / 2
if float(prediction) > 2:
color = 0x81fe8f
else:
color = 0xfe8181
desc = f"""
**Crashpoint:**
*{prediction:.2f}x*
**Chance of Reaching Crashpoint:**
{chance:.2f}%
Semi Accurate, will always be improved in the future. Chance = Chance of getting to the Crashpoint. There is always a chance of it going above the Crashpoint."""
em = discord.Embed(description=desc, color=color)
await ok.edit(embed=em)
bot.run('')
You have been ratelimited it sounds like
All you can do is wait, and not spam discord's api anymore
oh, alright.
By any chance do you know how to do something like this in python?
like randomly place the checkmarks around the board.
no
where do u host your bot?
repl
hm
since they use a shared ip
alright. it's fine ig.
try kill 1 on shell
I did
still error?
hi
&help
hello, i have a problem with mysql
if i execute
const infoID = `SELECT \`ID\`, \`Reason\`, \`ID_Utente\` FROM \`shark_warn\` WHERE ID='${unwarnID}'`
con.query(infoID, function(err, result){
if (err) throw err;
var warnInfoID = result[result.length - 1];
client.warnInfoID = warnInfoID.Reason
client.warnInfoIDut = warnInfoID.ID_Utente
console.log(warnInfoID.Reason)
console.log(warnInfoID)
});```
it print RowDataPacket {
ID: 70,
Reason: 'Motivo non specificato.',
ID_Utente: 470991831329407000
}
the id is wrong
but in db is correct
What MySQL library are you using?
this is the structure for ID_utente
Add supportBigNumbers: true and bigNumberStrings: true to your connection options
in this section? ```var con = mysql.createConnection({
host : client.config.host,
user : client.config.user,
password : client.config.password,
database : client.config.database
});````
Ya
ok
It'll turn numbers from your database to strings since some numbers can go over the maximum safe integer in JS
thanks it work
I want to have my bot and website "communicate" with each other, now this would be easy from bot to website, with a simple api, but how could i easily communicate with my bot from my website? like for example, the website needs the bot to perform an action, how would it tell the bot to do so?
One message removed from a suspended account.
working on this atm....
https://media.discordapp.net/attachments/728178163309608961/1012943739116851230/202208270504_25.mp4
pulled an all nighter getting it this far. it still needs to properly support languages and have timeouts
this is what I got so far, needs some tidying up and comments, but feedback welcome
https://github.com/brainboxdotcc/triviabot/blob/master/modules/trivia/cmd_context_start.cpp
- Make a matrix with integer (uint8) values
- Fill it randomly (Like 0 for nothing, 1 for mine, 2 for already scanned, 3 for question)
- Then just run some if else Everytime someone votes
if target == 0:
# nothing
elif target == 1:
# you died
elif target == 2:
# You already did this
something like this
hello, anyone can help me with mysql npm?
i want to add all the result in embed organaized
this is the code i use for getting one (the first line)
const infoID = `SELECT \`ID\`, \`Reason\`, \`Timestamp\`, \`Staffer\`, \`ID_Staffer\` FROM \`shark_warn\` WHERE ID_Utente='${target.id}' AND Staffer_unwarn IS NULL AND ID_Staffer_unwarn IS NULL`
con.query(infoID, function (err, result) {
if (err) throw err;
var warnsInfoID = result[result.length - 1];
client.warnsInfoID = warnsInfoID.ID
client.warnsInfoRe = warnsInfoID.Reason
client.warnsInfoTime= warnsInfoID.Timestamp
client.warnsInfoStaff= warnsInfoID.Staffer
client.warnsInfoIDStaff= warnsInfoID.ID_Staffer
console.log(result)
console.log(warnsInfoID)
console.log(warnsInfoID.ID)
console.log(warnsInfoID.Reason)
console.log(warnsInfoID.Timestamp)
console.log(warnsInfoID.Staffer)
console.log(warnsInfoID.ID_Staffer)
});```
and this is the result:
RowDataPacket {
ID: 1,
Reason: 'Motivo non specificato.',
Timestamp: 2022-08-27T13:12:29.000Z,
Staffer: 'Manfry#8538',
ID_Staffer: '470991831329406978'
},
RowDataPacket {
ID: 3,
Reason: 'Motivo non specificato.',
Timestamp: 2022-08-27T13:34:10.000Z,
Staffer: 'Manfry#8538',
ID_Staffer: '470991831329406978'
}
]
RowDataPacket {
ID: 3,
Reason: 'Motivo non specificato.',
Timestamp: 2022-08-27T13:34:10.000Z,
Staffer: 'Manfry#8538',
ID_Staffer: '470991831329406978'
}
3
Motivo non specificato.
2022-08-27T13:34:10.000Z
Manfry#8538
470991831329406978```
now, how can i get all organized with a string?
or i use a count and after a for cicle
for defining all the lines
or idk
result.map(âŠ) where you can do whatever with the map
thanks
onestly i don't know how to use it đ
<Array>.map transforms all elements in an array with specified callback, and returns the transformed array
the original array is not modified via this function call
i try
for example
const number = [1, 2, 3];
console.log(number.map(v => v ** 2)); // [1, 4, 9]
console.log(number); // [1, 2, 3]
i stay create a system to visualize all your warn registrated in a mysql databases, how can i create the embed with the data mysql give me (writed 8 message up) and the correct return?
sadly i have 0 zero type inference for your snippet since i don't work with sql and sql-js libraries
ok
Npm library for info boxes like this?
embed type this:
ID. Reason. Timestamp. Staffer. ID_Staffer
1 Motivo non specificato. 27/08/2022 13:12. Manfry#8538. 470991831329406978
3. Motivo non specificato. 27/08/2022 13:34. Manfry#8538. 470991831329406978
Thereâs also a built in console.table method if you donât want more dependencies. Chances are itâs not as advanced as youâre looking for though
thanks. question, how do I make it so like I have a list of vals and it will randomly choose one. like [1, 2, 3] Answer: 2
basically like a slots machine if you would call it.
are you using python?
If so:
import random
list = ["orange", "apple", "fruit", "pineapple", "other"]
randomAnswer = list[random.randint(0, len(list)-1)]
print(randomAnswer)
@supple oriole
ty
?
Hmm
does anyone know why Klasa is not working?
npm ERR! Could not resolve dependency:
npm ERR! peer discord.js@"github:discordjs/discord.js#master" from klasa@0.5.0
npm ERR! node_modules/klasa
npm ERR! klasa@"*" from the root project
maybe ask in their server (if there is)
One message removed from a suspended account.
kid amogus
isn't klasa deprecated
what is instances for pm2 ?
you really need to learn how to properly organize code
also why do u have 2 columns for the same data
and dont use var, like, never
Hey @lyric mountain I wanted to verify with u something before I start using this in prod cause I made lots of changes recently (using command prefix and also changed psycopg2 to asyncpg) and while debugging before I got a few times an error saying "FATAL: sorry, too many clients already.
I'm using a connection pool. The flow is as follows (removing irrelevant stuff):
db_connection.py
if not tunnel_mode:
pool = asyncpg.create_pool(
database=database_name, user=database_username, password=database_password, host=database_host_address, port=database_port
)
return pool
Runner.py
async def main():
async with db_connection.create_postgres_pool() as pool:
bot.pool = pool
await bot.start(TOKEN)
if __name__ == '__main__':
asyncio.run(main())
then when there's an event this is how I use the pool:
async def get_rnchannelid_for_guild(bot, guildid):
try:
rn_channel_id = await bot.pool.fetch(sql_get_rnchannelid_for_guild, str(guildid))
...
Also found that my Postgres is limited to 20 connections right now, which idk if should be enough (thanks PythonAnywhere)
you should really use a pool
let the pool handle how many connections are active at once
yes I just moved to using the pool now, I wanna use it in prod
was just wondering if I implemented it correctly, the docs were horrible
Run function, if it throws an error, use "null" as result
How to? (JS)
Ah yeah
function() {try{var=result}catch(){var=null}}
But in a ()=>{}
let queue = ()=>{ try { return (await client.player.createQueue(interaction.guild.id)) ?? null } catch(_) { return null } }
Did this become a function?
try it and see 
Yes, but you could abstract it more.
function attempt(f, def = null, ...args) {
try {
return f(...args);
} catch {
return def;
}
}
attempt(() => {
throw new Error("wow");
}); // `null`
Still throws an error
let queue = () => {
try {
return client.player.createQueue(interaction.guild.id) ?? null;
} catch (_) {
return null;
}
};
queue = queue();```
doesn't createQueue return a promise
why'd you await it here then 
dk thought it'd help
doesnt do anything if it doesnt return a promise
and why would createQueue throw an error?
what package are you using?
then maybe it's throwing elsewhere/later
then use the join function 1st?
then check if theres a queue connection prior to skipping the song or something
check if ur url is correct
if its a replit url, its https
if its an ip address, its http
is the port correct?
Yes.
you're using a vps or a different type of host?
Umm
ran smootly after I did that
in fact, it did
it never went past 1GB even though I allocated 1,5GB
I had to decrease the regex value to 512 and that fixed any memory leak I had
because you donât have that much memory dingbat
You canât take more than you have
đ€Ł
it tried to when I set the dedicated to over 2gb that's why the memory leak happened
from what I read the allocation works by borrowing space from your physical ram to allow increased virtual ram
and when I borrowed over 4gb of my actual ram it tried allocating chunks of the gta map to a non existing space
it thought it had the space so yeah
well it went up to 1070 something mb so the alloc prolly still worked
that's not memory leak btw
Invalid bitfield flag or number: MANAGE_CHANNEL.
đż
Discord.js, trying to manage permission overwrites
use discord-player. its so much easier. i think discord-music-player is outdated as well
also, make sure to follow the guide where it mentions using a custom stream. ytdl-core is facing some issues right now
It's MANAGE_CHANNELS
people that described the issue on intels forum said it's a memory leak tho
It's not
Memory leak is when resources aren't freed after usage
So it's gets accumulated over time
Aka "leaking" your memory
yeah and chunks of the map stayed loaded when you had no actual ram left, that's what I was explaining
No, they just aren't loaded at all
Increasing "memory" through regedit doesn't increase the actual usable memory
they were, I've seen it happen with my own eyes when trying to fix that issue in the first place
No, what u probably saw was address overlap
then how come some games I installed ran better after doing that?
When the memory manager cycles back to the beginning of the memory because it can't find any more memory available, so it kinda corrupts whatever was there
so when I had less ram aka 8-10gb since 4-6 was being consumed by virtual alloc and now I got 10-12 available and the game runs fine
my vram changed from 2gb to 1,5gb
and it doesn't lag or cut randomly anymore as I play
google "gta v map vram memory leak"
Because you disregard data integrity in favor of "space"
Also, swap memory is a thing
what's that?
well isn't that what alloc is anyway???
Alloc is loading stuff into addresses
it takes space from ur physical actual ram u got on ur motherboard and uses it as virtual ram
that's what the people said
Alloc is just short for allocation
Also there's no "virtual ram"
I meant video ram
Regex is just a pattern matching language, stop making up techy sentences
Vram is exclusive to the gpu, normal ram can't be used
If u got 1gb vram u got 1gb vram
Nothing aside from buying a new card can change that
except downloading more ram
I meant regedit yk what I was talking about đ
Who tf calls regedit regex?
but yeah i guess it does trick the game into thinking u got more vram
how come some games ran better then?
Because u sacrificed data integrity
if it works it works ig
The memory manager is smart enough to loop back once it reaches the last address if it must
It'll overwrite whatever is in those addresses tho
Meaning many corrupted assets and probably stuff like save data
people called the way gta v managed their resourced bad
and there was some issues with drivers detecting only chip memory which is 124 or 256 mb
so people used the dedicated reg to edit their displayed vram
to make gta v actually recognize their vram or something like that
You're missing the entire problem bae
Gta only reads whatever values the OS shows
completed around 24% of the game never had any issues show yet
I think i'm good
If the computer isn't detecting your actual memory, you DEFINITELY shouldn't simply edit those values
A bad example
Nobody except ultra knowledgeable people should ever open the regedit
That's the recipe for a big metal paperweight
Ik, that's why I don't fiddle with regedit
edited lots of things in regedit nothing ever happened to me because of it
well except one time but we don't talk about that
Yet
had this current pc for 5 years now
since when are pcs considered no good after 5 years
I changed a key in reg to change the color of my taskbar once đ
make it transparent
it looks cool
never said that? Still using mine after 5 years
the classic âedit random regedit keys for cool looking thingsâ
All fun and games until you change the wrong thing
how can i create a field on a embed according to the number i give?
i stay create a system to visualize all your warn registrated in a mysql databases, how can i create the embed with the data mysql give me and the correct return?
RowDataPacket {
ID: 1,
Reason: 'Motivo non specificato.',
Timestamp: 2022-08-27T13:12:29.000Z,
Staffer: 'Manfry#8538',
ID_Staffer: '470991831329406978'
},
RowDataPacket {
ID: 3,
Reason: 'Motivo non specificato.',
Timestamp: 2022-08-27T13:34:10.000Z,
Staffer: 'Manfry#8538',
ID_Staffer: '470991831329406978'
}
]
RowDataPacket {
ID: 3,
Reason: 'Motivo non specificato.',
Timestamp: 2022-08-27T13:34:10.000Z,
Staffer: 'Manfry#8538',
ID_Staffer: '470991831329406978'
}
3
Motivo non specificato.
2022-08-27T13:34:10.000Z
Manfry#8538
470991831329406978```
embed type this:
ID. Reason. Timestamp. Staffer. ID_Staffer
1 Motivo non specificato. 27/08/2022 13:12. Manfry#8538. 470991831329406978
3. Motivo non specificato. 27/08/2022 13:34. Manfry#8538. 470991831329406978
anyone know how to help me?
I don't know how to use a map
I want to create a gradient color code using the dominant colors in a picture using javascript (to be used in css) does anyone have an idea how to do it?
like this
@lyric mountain, I'd like to ask a question. When making a java project, when should I be making something like com.example.something.Something and when should I make like only a Main class and that's it.
s
yes
okay my discord bot works absolutely fine locally, but heroku throws error (node:4) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
now I have made sure my app id and bot token is correct. On heroku i did go to settings and added in config variables section but it still doesn't work.
locally i did heroku config --> consoled log correct bot token and app id
i also did heroku local --> runs absolutely fine no error
but on heroku it still throws the error
maybe try hardcoding the token??? 
Sweet, makes more sense now.
looks cool
there's no env vars?
Ideally, you'd never have only the Main class unless it's a very simole project
But never, never, put the Main class in the sources root
src/java/Main = nono
src/java/com/example/Main = yesyes
What? Well, I have this, so how will it work? https://cdn.hamoodihajjiri.com/W9ytexPztR
Yes, don't do that
While it will work, the jit can't optimize as much as when u have an actual package
It's when ur making a gradle/maven project
Because they need to bw able to know where they can find the sources
I see that more often
And there's the resources folder too
A main and a test folder, basically.
Indeed.
That's because of unit tests
So, to conclude this...
Always place Main on the package root, not on the sources root
Create packages inside src when creating classes?
How does that differ, I didn't understand. package or sources root.
Fair, alright.
Leading me to the next question, when should my package be com/example, and when can it be like this, supposedly: https://cdn.hamoodihajjiri.com/njSCdIdJjO .
Don't do that too, make a parent package
Like?
src/com/example
Oh.
Then put anything else inside it
src/com/example/entity or src/com/example/main or src/com/example/object, and such, correct?
Yes
What about vanilla?
Including vanilla
Cause supposedly I'm making a vanilla project.
Wooot, that too?
I thought this rule applies to maven/gradle project, though.
Not really rule but best practice, I believe.
The only thing that applies to them is the java and resources folders
Everything else is best practices
Also, usually you name your folders like:
model = for POJOs and normal, instantiable classes and templates
controller = database connectors and managers
view = screens and UX/UI classes
Looks like every time I start a project, I'll do something like this: /src/main/java/com/example/main/Main.java.
I'll take that into notice.
Just /src/com/example/Main.java
Or if ur using gradle/maven, /src/java/com/example/Main.java
Fair enough.
Anyways, some projects or developments comes with an auto-generated main and test folder within the sources root.
src/main/java/...
That's because unit testing
main I believe would be the replacement of java folder for vanilla
Ah true, just checked
Along with java would be the resources folder.
Also, last question..
A package named by com.example, is the same as /com/example?
Yes, the former is package notation, the latter is directory notation
Both are the same, but usually you use . instead of / when referring to classes and not normal folders
Also for imports
Usually, when I made new classes inside the java folder, I call the class com.example.Main.java.
It'd make a package named by com.example and a class named by Main.
Yes
Sweet.
That's part of why you always need a root package, so you can use imports
And libs that rely on reflection don't work at all without packages
Like spring
Or jpa
Don't know what those are.
Spring is a huge framework that contains many stuff from database managing to REST to class managing
I use more for the REST interface (springboot)
Jpa is THE database manager, sequelize was based on it
It's the official "java" way of managing databases
how do i add a bot to my discord server
The good thing about jpa is that it's database-agnostic, you can use any database (and multiple different database at the same time) without changing a single line of code
@feral aspen Thanks a lot
Ooo.. now I've started a bit in Java, can't wait to get into that, soon.
Once you get past the "meh java is bad" stereotypes, you discover it's actually a great language
Honestly, I've tried it for MC plugin development. đ
But in the end, I've noticed it's pretty decent, compared to Javascript.
Then I studied it for game development, too. And to challenge myself into making a calculator with NO HELP AT ALL. I mean, seriously.
Like, it's way more strict than js, but it's also exponentially stronger, especially if u need to do multithreading
Yes, yes. Correct. I've also liked it cause its rules are similar to JS.
And in the end, the strictness makes it easy to debug
Btw, I really recommend u to also try groovy
Groovy?
Yes, it's a superset of java
Is it like TS for JS.
Ye basically
But gor java it's the opposite
Ts adds types to js, groovy kinda removes them
It still allows them, but it's more dynamic
When u don't need a highly optimized project, groovy is great
Kotlin is another jvm language entirely
If java was C++, kotlin would be Go
Brb
Oh, damn.
Back
But well, all jvm languages can talk to themselves because they compile to the same language - bytecode
Sometimes you can even have both within the same project working like a charm
Groovy directly extends java, in such a manner that to convert a java project to groovy, all u need to do is rename from TheClass.java to TheClass.groovy
Ooooo.
Ts requires an additional step that is refactoring the code to add typed parameters and variables, groovy doesn't
and example of "groovy way" (almost everything java has a "groovy way"):
java ```java
for (int i = 0; i < 100; i++) {
System.out.println("Step " + i);
}
groovy ```groovy
100.times { print "Step $it" }
No way it's that simple, damn.
Map<String, Object> map = new HashMap<>(){{
put("key", "value");
put("otherKey", 123);
put("abc", new Object());
}};
def map = [
"key": "value",
"otherKey": 123,
"abc": new Object()
]
SomeClass abc = new SomeClass("a", 123, true, "blabla");
def abc = ["a", 123, true, "blabla"] as SomeClass
(also works to convert arrays into class objects)
kotlin walks in
Feels like english.
but well, there's a ton of stuff, just read https://groovy-lang.org/differences.html
wdym?
No like how they work and such.
what kind of imports u mean?
java.<something>.<something>.
it's kinda like esm imports
but instead of import stuff from "package" u do import package.stuff
Well, in JS, it's not like I do const { Math } = require("javascript");
Oh.
Hy
there are 3 ways of using classes from other files in java:
import com.example.*= import everything from packagecom.example(not including subpackages)import com.example.AClass= specifically importAClass- no import, simply use the fully named class (eg.
com.example.AClass obj = new com.example.AClass())
with intellij u don't really need to bother abt this (same for most IDEs) since it auto-imports on-the-go
u can also enable auto-removal of unused imports (alt + enter -> Enable automatic optimization of imports (or smth))
Yup, that's why I used it and why you recommended me to use it, too.
Oh, fair. Sweet.
ALT + ENTER, I'll need to remember that.
alt enter is the shortcut for quick fixes
alt + insert is the shortcut for quick code generation (like getters and setters, constructor, overrides, etc)
alt + O for overrides
alt + I for implementations
đ đ
there's a plugin for IJ that shows u what shortcut u could've used instead of the mouse
dont remember the name
No worries about that. :)
Quick quick question about this...
If I'm inside /src/com/example, and I want to make packages...
com/example is already a package
Well, what about multiple packages.
Example, package main and package methods, and package pictures, and etc.
What do I do?
while u can, it's not recommended
Why not?
because some libs wont work at all unless u configure them to search in other root packages
Example, for this: https://cdn.hamoodihajjiri.com/5OLkY0rJDY .
u shouldn't treat packages as folders like that
Oh, what do I do then?
com.example.
â entity
â main
â object
â tile
Alright, so I add those packages inside the domain package.
yes
shouldn't it be com.example.project.[...]
u don't usually put the project name in the root
only when packaging that u sign it with com.example.ProjectName
So, example, if I'm building a maven project, it'd be like this, supposedly: src/main/java/com/example/main/Main.java
Oh, and the rest in packages.
yes
It's like index.js in src and rest in folders like commands and events, and whatever (in discord bot making)
yes
Alright.
What's this, by the way.
when u make a jar file, u need to put details about it
Cause I also have this, src/main/java/com.example.sub/Woohoo.java.
that's not a valid package name
Mhm?
Well, suppose I'm making about ducks.
Or somethin', Idk.
Is this a valid example.
ah that's because intellij skip empty folters
so it shows only a long-named folder
So is .duck a package or what is this.
the entire thing is
Well, this didn't work.
And I'm geniuenly confused as to why.
show ur structure
u cant have a package that starts with java
Oh.
like, for vanilla, simply use com.hamood
for maven/gradle, there'll already be a folder named java
And is java a folder or a package.
a folder
a fodder
Unless I'm actually blind, where is folder: https://cdn.hamoodihajjiri.com/XKA3iSHPJy .
bcuz u cant make a folder inside sources root
Oh, what now.

What
I mentioned it before but I did go to settings config variables and added it
put your package inside the root, that's it
com.hamood goes inside the blue folder
don't worry abt other stuff
the best way imo is to use environment variables
or by any way, hide the token from outside
Config var is the environment variable
say if json config file, make sure nothing but the bot process access that
I am accessing my token through process.env.BOT_TOKEN
and don't forget to gitignore it
I did
I donât understand why this is happening now I had the bot hosted for like 1-2 years now I did change all of the code but I specifically didnât mess with the settings
is it repl?
What no
what's the context again?
This
Plus this
yk heroku is ending free dynos right?
Yeah
ay, I called that almost 2 years ago
well, try printing what is being retrieved from the config
it was expected, they said many times their service isn't supposed to be used for bots
Itâs not like I am setting everything up right now, itâs just I had it all set up I updated the code to slash commands because discords like no more message content intent and ahhh
try printing what's being retrieved
Okay I will
GitHub question... main or stable: https://cdn.hamoodihajjiri.com/RW4FuG4iHu .
I know what each does, but I'm not sure which one to choose.
Cause in the end, if I do stable, then I need to make a new branch and work on main, and if it's main, then I need to make a new stable branch and leave it as the stable branch.
So.. what's better.
master đ
that was the standard name during the entire git story until they changed it because "politically correct"
other than that, it doesn't really matter what u name ur branches
How about this?
names doesn't matter
Yes, I know. But what does it mean, master, that's it's the development one or the stable one. đ
As like in development? or like it being stable.
production is production
the currently running one
in-dev is in-dev, never confuse with production
for development branch it's usually called nightly
Fair enough.
dafuq are you trying to do?
Just reply with like a embed for example and add buttons with the ButtonBuilder
Wait
modal.getTextInputValue("custom-id") if your using a components Handler and I think you can use collectors instead then
I have a blacklist script with execute should send a different message however it ignores the message and script and moves straight onto the command.
E.g: /avatar
Supposed to say: You are blacklisted.
What it does: Sends avatar
Code:
Error fixed! Thanks to tim!
thats a very bad idea
you should never create event listeners inside commands
you should only have one client.on('interactionCreate' in your bot
either in your main file or in your event loader
Would it still run without it?
Thank you so much!
It works, that was the thing failing the override.
đ
204 is accepted though, for most APIs youâd get a valid object back along with a 204
"valid response" could mean anything
Why is a 204 returning a body
Then just check if you got an object in the body (Iâm assuming itâs returning 204 either way)
Oh Iâm stupid, I was thinking of 200
Just check the status code
there's also this option for config
You could do that but just make sure youâre catching the rejection
what
Youâre overcomplicating it
Just check the status code
How can i check to see if channel acccess is there to prevent downtime?
204 is âNo Contentâ
res.status or res.code or res.statusCode or something, look at the docs
DiscordAPIError[50001]: Missing Access
DiscordAPIError[40060]: Interaction has already been acknowledged.
Uncaught Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
Process exited with code 1
When used in a channel without the bot accessing it ^
How can I fix it?
dont reply to an interaction which has already been replied to or deferred 
I haven't from what I am aware of.
the error message says otherwise
It shuts down because the bot has 0 access to the channel.
Can I send my code?
To see if i miss typed something
yes
const { SlashCommandBuilder, PermissionsBitField } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('purge')
.setDescription('Purge up to 99 messages.')
.addIntegerOption(option => option.setName('amount').setDescription('Number of messages to purge.')),
async execute(interaction) {
//Blacklisted Script
//Blacklisted End Script
if (interaction.member.permissions.has(PermissionsBitField.Flags.ManageRoles)) {
const amount = interaction.options.getInteger('amount');
if (amount < 1 || amount > 99) {
return interaction.reply({ content: 'You need to input a number between 1 and 99.', ephemeral: true });
}
await interaction.channel.bulkDelete(amount, true).catch(error => {
console.error(error);
interaction.reply({ content: 'There was an error trying to purge messages in this channel!', ephemeral: true });
});
return interaction.reply({ content: `Successfully purged \`${amount}\` messages.`, ephemeral: false });
}
else {
await interaction.reply({content: 'You did not meet our requirements. `MANAGE_MESSAGES` is needed.',ephemeral: true})
}``` @drifting cairn
I was testing to see if the error was because the bot didn't have access to using that channel (which it shut down too - but I got all 3 of those messages)
inside of your .catch on the bulkDelete function
oh.
yep
Do I just use followUp then? or? (Sorry abit new to purge and console.log)
just dont continue if the bulkDelete function throws an error
Ok. Thank you!

Yes
Yes can only reply once
Then need to send a follow up message to your initial response
Works just sends a message saying it purged because there is no follow up.
You can send a deferUpdate without worrying about it later if you don't want to send any message
otherwise, you need to edit the original interaction response or followup
ok
403 post channel messages
You donât have the permission to send a message in that channel
(make a permission handler, your life will instantly become 10 million times easier)
I should start doing pull requests to github projects, maybe I'll gain a little bit more confidence in my programming skillset
if you want scalability, js makes writing handlers easy, so definitely go for the handlers route if that's what you need
but if it's a small project then do whatever
Fair
I'm just looking for any excuse to procrastinate on this essay
just get the embed from the message
The data of the message isn't attached to the interaction, and since the embeds are a part of the message, you can't get it that way
No, apparently the entire message is attached to the button interaction so you can get it that way
https://discord.js.org/#/docs/discord.js/main/class/ButtonInteraction?scrollTo=message
Huh? What exactly are you trying to do?
cant u simply serialize the fields into the custom id?
The embeds have the fields property so you can access that embed's fields, and then access the specific field you want with indexes
but anyway, if ur the one who created the embed, simply iterate over the fields
since u already know the sequence beforehand
And finally access the value property of the field for it's value
just do ```js
let embed = new MessageEmbed(<embed>)
.setTitle("Application Accepted")
that gets the current EXISTING embed, and edits the title, then just send that new embed
That should work if you want to get the value of that embed's first field
