#development
1 messages · Page 194 of 1
now you have LLMs as well so the bots can trash talk
lmao
Lmao
fr I could do that
And make the bot more engaging 
but I need to train the bot for my game context
and I have no idea how to do that
There are occasional tournaments help by different guilds
But again they feel the bot is not balanced / not good enough yet
Sadly that’s the price I have to pay for leaving too many bugs for prolonged period
Anyway playerbase rn is slowly depleting and I see no hope
So I’d rather give to some game dev who can maybe make few sensible changes and revive it
Or I just quit

tough position
Yeah any balancing change I make is seen as nerf and people quit
I can’t change the mentality frfr
Now that i think about it there was no reason for me to make it exponential buff. It was balanced as it but since nobody was using it and they kept complaining I killed that skill I made this dumb change

sometimes if a change is needed for the health of the ecosystem, a sacrifice is unavoidable
you will lose players, but you will have a chance of getting new, more satisfied players
Not if it kills off the entire playerbase
It’s more like the players physiology is weak. They think 400k damage is normal and when I balance it out they start spamming that I killed the game myself lol just cause they don’t wanna try something new or balanced
All the trolling takes a mental toll ngl
I wanna get this over with fr
you dont need to engage with them
game devs and game companies rarely interact with players
they just post updates and go home
But at the same time it has also prevented by bot from growth
Yeah I’m looking at metrics too
the metrics are what people say here in this case
thats not good for your mental
Cause these guys are the ones engaging with new players
And then they drive them away ish
if they are so invested in the game, then why not ask them to balance it for you
or make a voting system
I did that’s where the exponential buff came
Welp not entirely but I just thought of it based on some suggestions that’s all
Now if I change it. They’ll say it got too nerfed
Schrödinger cat
Anyways
idk why I’m also struggling to get like new players too tho
Bot hasn’t grown at all
Despite doing all the auctions on topgg
Welp
Ig it’s just not good enough
sometimes throwing more money isnt the solution
there are a bunch of factors that correlate to player count
mostly boils down to how appealing your bot/page/ad/etc is to the player looking at it
the average person looking at your ads is probably just browsing for something completely unrelated and random so you really have to attract their attention
and also use the right tags ofc
mmm
but thats only one part of the problem, the second is actually getting the person looking at the ad to actually get and use the bot
im not an advertising or business expert but i would take a step back and look at what you can improve and ask yourself would you play/get this bot
ask for your players opinions as well, polls, suggestions, etc
they are the ones playing after all
what can you do to make the bot different
there are so many clones of idlerpg
and they all follow the same tropes of card collecting, anime characters, etc etc
what did you do to make it different, make note of that and make that the thing you emphasise on ad campaigns and on your bots page
on my bots webpage I explicitly call out how all these bots are the same in my FAQ and that my bot isn't anything like them
you have to stand out
I'm sure you already do, because if people wanted more idlerpg and more epic RPG they'd just play those bots, they're playing yours so it means you have something unique
Finding a niche concept gives you an edge, for sure.
most people probably already have one and aren't telling anyone that needs to know
My bots aren't like the others. Mine are shitty and break down for no reason. Give money so I can totally fix that and make the bot usable :)
i sumbiited my bot but that time my bot offlined anyone can say why
@green kestrel
What
@deft wolf can you come to vc
No, I can't
@deft wolf bro i sumbited my bot to topgg but that time my bot offlined
i cant start my bot
\
saying like this
@deft wolf
can you help me
No
No clue how pterodactyl works but it sounds like some other service is running that can't run concurrently with the discord bot
don't run discord bots in pterodactyl
it's not made for that it's made to host game server instances
just use a plain vps
and the fact it's called "my first bot" perhaps means it isn't ready for prime time yet, you didn't even give the project a proper name
overpowered buffs clearly
honestly if people are happy over them currently and making money id just keep the change
but introduce more subtle changes that balance the game out more later on
cash cow per se
yeah don't remove your bread and butter feature
have you considered making the really big buffs premium feature? 
(this for hoax)
from the sounds of it at the moment he doesnt have the people to spare to make these changes that upset the user base that is actually paying you
tough spot really
premium feature: massively op enemies that need huge buffs, huge buffs in the premium
hmm, wait, you need multiple people to maintain a bot????
first I heard of it

im tempted just to make a panel specifically designed for hosting discord bots/node apps/python apps and give it away for free just so people stop fucking using pterodactyl
at least, when it comes to source, I've never trusted anyone but myself
do it but don't restrict it to just those two langs, build it around docker
I would recommend it for dpp too if it was bundled with it
not a bad idea actually
i would of course do it around docker
basically the standard for container apps anyways
yeah
since i do security i can probably also harden it pretty well as well
I think people are using pterodactyl because cheap Minecraft hosting is readily available and that's what they all use, part of the problem is removing that interia
if they have to self host your bot platform it won't ever replace ptero
someone would have to offer it at the same price point as the cheap Minecraft boxes
most people using it aren't in the position to self host it
yeah thats what i thought
youd mostly be marketing it to panel hosts
cheap ones at that usually
i also see the pterodactyl containers for bots usually fail quite quickly and come up with some error
and the average developer using this likely wont know how to fix the issues
ill think about it
its definitely a promising project to add to a portfolio
and i could design it pretty well given ive been in the exact position like 5-6 years prior using pterodactyl for a bot without knowing what im doing
I tried to use pterodactyl to self host a Minecraft server
I hate the thing
it tried to take over my entire server
Bro thats a free host
it doesn't work if you do other things on the server too
...you get what you pay for
I dont have money
running a bot costs money
Ooo
But bro that host giving 24/7 support
The bot running in that host properly but i submited here my bot gone to offline
Then contact their support
@green kestrel
I'm sure that they really really give good 24/7 service for free 
contact them, they'll fix it for sure
You're using the same host provider as me I think lol
If it is, they have a Discord support server linked from their website. You can open tickets there for help. I opened one recently for perms issues and they sorted it 
Ooo you using opticserver i see thank u bro
aint forcing
Try git pull origin dev if you're using cmd line. Then git push.
did u receive any email regarding it?
you were probably locked out of verification for that app for some reason
Nope bro
What the heck bro
what is your app about?
is it a bot or a game?
and did you get it from some template?
It's a bot
and the other 2 questions?
i dont think theres anything wrong
just scroll down and fill out the forms normally
do you have a valid ID or passport?
ah lmao, I misread this as a "your app EMBEDDED cannot be verified"
you are embdedded
embededededded
that's just discord verification, and they dont get your personal data either way
embededashion
no u 🔄
eh, yk they already have any and all data they might want about you right?
they already know
they just dont care for 90% of the cases
speaking of which, i still need to do my taxes
says the guy with a rainbow clown cartoon cat profile picture
The Linux backdoor made news lol
A popular compression library called XZ Utils was recently backdoored by a hacker which compromised Linux distros like Debian, OpenSUSE, Fedora, and Kali. Learn how the liblzma hack happened who is behind it.
#programming #linux #thecodereport
💬 Chat with Me on Discord
🔗 Resources
Details of XZ vulnerability ht...
then just do what it says
fill out the forms
you can ignore that warning
what about the eop exploit that rarely anyone is talking about https://github.com/Notselwyn/CVE-2024-1086
wild
I think there was a similar exploit for su
is it possible to attach photos to command?
just supply the info it asks for
you'll need to verify your identity through stripe, so you'll need to either do it yourself or get someone older than 16 to do it for you
then there'll be the technical data about your bot, such as infrastructure and data collection policy, hope you paid attention during development else you'll struggle on this part
Congrats on getting to 100 servers!
definitely an achievement that you should be proud of! 
god bless bro
my bot is still verified but not used lmao, anyone know what to do with it?
I am thinking about rebuilding the bot to a crypto bot
turning your bot into a crypto scam bot is definitely a good next step idea
That's the million $ question, coming up with an idea that'll attract lots of users
😭 ain’t no one talking about scams
Yeah I got something cool in mind .. do I need to do a manual verification on topgg again or something if I make such a heavy revamp of my bot?
why does discord need ID again when verifying a bot
I think (though correct me if I'm wrong) that they're wondering, if their bot undergoes a complete revamp and becomes a bot that does something totally different to what it was originally verified on, if top.gg needs to reverify it. 
It likely comes down to data privacy and insurance. Bots are hosted on their platform and they're trying to allow bots to have deep integration with it. So much so that users probably wont think too much on the fact that an app is operated by a third party. If their data was being collected by this third party and they're exposed online, then Discord could get in big trouble. This way, they have collateral and can hold malicious actors responsible beyond banning their account and can get authorities involved.
My bot got denied verification because it retains user's data until the user requests a deletion. (just user IDs)

when verification first came out, i said my bot stores user data for 1 year
and still got verified
im guessing verification got much stricter with time
yeah
thats insane wtf
exactly that
Hey papiophidian,
Unfortunately, after looking it over, I have decided to deny your verification request. This is due to the duration in which you retain discord data. Do not fret, though! We will reconsider this verdict if you implement stronger data disposal processes and reapply for verification!
Furthermore, if you require additional assistance while using the Discord app, you can easily contact our Customer Experience team at any time. You can reach them at https://dis.gd/contact.
I'll go ahead and close this case as solved, but please reply to this ticket if you have any other queries, and I'll be pleased to assist you.
Cheers,
Davis
Hey Davis,
I had a question regarding the specifics of what I'm storing since I only store user IDs. Having to delete user's settings and economy data unless the user explicitly wants me to might suck for if they wanna keep that. How long do you suggest I should even retain this info for?
Hello papiophidian,
Thanks for writing back!
As much as we want to, due to our policy, we cannot provide precise information regarding your inquiry. We encourage developers to refer to the provided documentation and articles. Kindly check our Developer Policies and Terms of Service, which might help address your concerns.
Here are some more details on the topic: https://discord.com/developers/docs/policy#don’t-do-anything-illegal-harmful-or-otherwise-not-cool
Thanks for understanding!
Cheers,
Davis
well, i've seen people simply reapplying without changing anything
and eventually they get it lol
I thought about lying but I dont want to
I guess it could help for people who abandoned and forgot my bot
would be a lot of data just left in the database unless they request deletion
but how I see that is a problem for me to solve if it comes to that
Instead of user id, save a generated string instead that can be converted using a certain hash function
Technically it ain’t an id no more 🤷🏽
That way you only store the generated part but can still benefit from the perks of having a user id
The point of a hashing function is that it's one-way only
If he needed those IDs without the actual known user, he wouldn't have a way to get it
I wanted to create an egg hunt around my server that will have the post randomly post eggs around certain channels, once a player finds it,they reply to it with the 🥚 emoji and they will get 1 point. the bot then announce the amount of points a player has and hides another egg. this loops until the score to win is reached, the bot announces the winner in the channel the command was invoked and then it deletes all the egg emojis that it put.. can someone look over this code and tell me what I could change on it?
even though i'm sure this is stupid.
Bot verified
Thanks bro
Lol 😂
I verified last night
yea, iirc i had to delete (or rather anonymize) data within 30 days of them leaving the server or something
economy bots according to discord:
didnt access your account in 30 days? gg you lost all your money
your ultra rare one-of-a-kind item? too bad, where were you for the last 30 days?
just make a game at this point
yeah
an encoding type of system where we store a sort of 'hash'. I didn't really mean an actual cryptographic hash function.
but even then, it would be possible if he would store the private keys
that way the data is confidential and the id is only released and read ocne it's needed after solving the hash
but that's how any password-based encryption works
you simply store a hash of the password (because you shouldn't store plain text pass) and use that to encrypt whatever data you want to
you dont "solve" the hash, you decrypt the data
my textbook says solving hashes
we solve a hash using a private key
that's pretty wrong in the technical sense
thats what they refer to as decrypting a hash using a function and private key
could be an older term
idk it's an old book
forgot from who it was
IT study material shouldn't even be books anyway
unless it's a language documentation
and even then it's iffy
I don't study IT though
java bible for example gets a new release every so often
computer science?
yessir
IT as in any code-related topic
To be fair i barely did anything that has to do with coding or something
in these past 3 years i only did theory after theory
that's code-related
is it?
Majority where math classes
i don't see that closely related to code
it is, you dont need to build houses to learn architecture
math is used in coding
yeah i know it is
but many of the things i am kearning rn will be useless in the future
like 80% of my courses
if you stay in the IT area it'll help understand things you search for
like how I should've paid attention to matrix classes
why
yeah true, matrices and vectors are hella useful.
because I need to do matrix stuff for game dev
Especially when creating games
tho godot is helping a lot tbh
probably movement
translation/rotation calculation
do you use it a lot for collision physics as well?
Idk how it's done in practice, i know the theory tho
kinda, as my collision hitboxes aren't axis-aligned rectangles
but I can use point-inside method for detecting hits
nonetheless I'm using godot now, so I dont need to do it myself anymore
laziness will end the human race
lul not laziness this time, I needed to do it to be able to compile to web
no jk, it's good that you use something to do it for you. The calculations are hella hard
so I could migrate my tcg to discord activities
ahhh
the ship game is nearly ported fully, just need to finish the first boss and implement the other player ships
https://sb.shirojbot.site if u wanna see it
the source code is public I believe, spacebreach on my repo
nvm it was private, now it's public
damn godot is a bit slow
rewrite your game in vanilla js 
well, I'll need to look up what's the fps issue
game was working normally yesterday
I am shooting while standing still and my bullet curves heavy to the left each time
on a side note, how tf did someone reach 38k score
i did inspect element /s
the bullet should move in a linear path according to your current angle
if it's curving something is wrong
i think there is, the hitboxes are also not entirely accurate i think. i hit that mf like 5 times on the sides
does your game lag?
the game is really cool tho
yeah a lot
oh i thought it's just my browser lol
I'll try reuploading it, perhaps it solves the issue
the game was supposed to run 60 fps, as it was earlier
@lyric mountain are you using projection matrices for the hitboxes and checking whether 2 points align on the same coordinates? If yes i suggest increasing the width, so the x, of the numerator.
cuz i keep hitting that ship but it aint dying
i can literally see my bullet go in his sides.
the lag might cause collisions to be skipped
if it's physics processing lag, that is
do you have the game as a standalone application?
maybe it being in the browser could cause some of the lag issue
compiled no, if you have vstudio I think you can run from the project tho
my laptop cant run visual studio 
I'm having it too, started lagging today
uploading the binaries again, I'll clear cf cache just in case too
if anyone has a moment to take a look and give me feedback 😅
well, it's lagging less but still subpar
what issue are you having?
it doesnt award the user who found the egg the last point, so it doesn’t announce the winner or delete the eggs. it just keeps posting the eggs in the channels
yep, it's definitely a vps issue, the same code runs pristine if I host locally
does it send the "found the easter egg" message?
yes for every egg except the winning point
I'm on mobile for a while so I can't check, but how are you checking if it's the winning point?
Put some console.log or message before those resolves to see whether it's reaching them
Use quadtrees for collision
That's out of my reach on godot
They’re easy to implement and will give you a massive increase in performance compared to the naive O(n^2) attempt
Oh
That’s fine then
Thought you were still working on your engine of sorts
Also the lag is happening because slow resource streaming probably, as the lag disappears when I host locally
I need to find a way to fix that
I was, but ported to godot for activities
ok i’ll do this
Aight, found some possible fixes, I'll try in a moment
Nah
1 in 150 though
The max i paid for a 65% is like 120€..
is that an April fools
id never buy anything other than a full size with numeric keypad
wait now that i’m looking at this
where i put the check for required points to win… should that be AFTER the end of round collector? or does it matter?
Am I tripping or did I wake up to FUCKED up embeds?
Why is this shit on 2 lines? I swear it never used to be.
just another tuesday for discord
every feature is broken every once in a while
I hope it's a feature and not an update
if anyone is able to help that would be great. firstly, it's worth noting this is only happening in production and was not happening in testing. but upon authentication, it doesn't return the session until the user gone onto another page and refreshed. (NextJS + AuthJS (formerly Next Auth)
the component you're looking at:
[redacted]
my _app.js (i've seen some people say this might be the issue?)
[redacted]
my next auth callback
[redacted]
yo that site looks sick
thank you my man, would be great it it was functional too :(
hahaha yea
i haven't used authjs
how do you manage your sessions?
for next-auth you could set it to jwt and avoid needing any backend session tracking
lemme take a look
my first time using both nextjs and authjs (formerly next auth) so still ropey
yea fair
pog fixed with refetchOnWindowFocus={true} on the sessionprovider
Onebump on top
sorry about him

id just write my own
and if you use the argument that you can mess it up and leave a vulnerability you can do the same by using authy
even moreso id say because youre putting in less care overall
according to the console log, the end of the round is registering and the winner has been determined
then the issue is where you're checking promise result
// Wait for a user to find the egg or timeout
const collected = await new Promise(resolve => {
collector.on('collect', async (reply) => {
// If a winner is already found, do nothing
if (winner) return;
idk what’s wrong with it then lol
i don’t get one
- thats not how you return inside a promise, nor inside an event
- you're trying to reinvent the wheel, discord.js already has a built in method to do exactly that
tim man i’m sorry 😭😭😭😭😭
i didn’t know that though 👀
what type of collector is that? messages or interactions?
or reactions
messages
@radiant kraken quick question, what browser did u use to run the game?
some people are saying edge runs fine while chrome has heavy performance issues on it
edge
hmm ok, i will try this
holy moly webdev is awful, just had to make this duct tape solution for something I'm trying to do ```js
window.onload = () => {
const element = document.getElementById("term-user-input");
element.addEventListener('keydown', event => {
if (event.key == "Backspace" && element.innerText.trim() == ">") {
event.preventDefault();
}
})
}
Hi
is there a built-in function in JS that will only filter out undefined items in an array?
dont think so, but you can always prototype it
if i did that i would overwrite the functionality for filter() with no params. it would filter out undefined by default. i would probably need to copy over the original filter() code just to modify it. i never modify the prototypes
0 is a falsy value
I wouldnt overwrite it unless you arent using any third party libs
You can always make your own prototype
Array.prototype.filterUndefined = function(callback) { return this.filter((i, ind, arr) => i !== undefined && callback ? callback(i, ind, arr) : !!i) }
Array.prototype.__originalFilter = Array.prototype.__originalFilter ?? Array.prototype.filter;
Array.prototype.filter = (callbackFn, thisArg) => {
if (callbackFn === undefined) {
return Array.prototype.__originalFilter(a => a === undefined, thisArg)
}
return Array.prototype.__originalFilter(callbackFn, thisArg)
}```

Libs may expect the original behavior. Overwriting isnt good
function notNull<T>(value: T | null | undefined): value is T {
return value !== undefined || value !== null;
}
my favourite way to do this
const values: (number | null)[] = [1, 2, null, 4, 5];
const filteredValues: number[] = values.filter(notNull);
Now make that a js lib and you’ll make bank
sorry i already had a security article made about me this month
or
return value != null 

Yea and there will be another
sadge
how
We don’t speak about it
🤨
Imagine a function that accepts a list of numbers and returns two lists of numbers, where the sum of the numbers in the two lists are as close as possible. is it possible to write that function so it's 100% accurate without checking every combination?
i have this unit test that compares everything i write against the brute force method and i keep failing
this is my attempt not using brute force
// return two lists of numbers, where the sum of the numbers in the two lists are as close as possible
function splitNumbersEvenly(numbers) {
// sort the number list input
numbers.sort((a, b) => a - b);
// initialize two list arrays
const list1 = [];
const list2 = [];
// add numbers alternately to list1 and list2
let i;
for (i = 0; i <= numbers.length - 4; i += 4) {
// add the first and last numbers to list1
list1.push(numbers[i]);
list1.push(numbers[numbers.length - i - 1]);
// add the second and second-to-last numbers to list2
list2.push(numbers[i + 1]);
list2.push(numbers[numbers.length - i - 2]);
}
// add the remaining numbers
for (let j = i; j < numbers.length; j += 2) {
list1.push(numbers[numbers.length - j]);
list2.push(numbers[numbers.length - j + 1]);
}
// return the balanced lists
return [list1, list2];
}
module.exports = splitNumbersEvenly;
bit of a weird use case but was wondering if anyone could help...
- my users make a request from nextjs frontend to nextjs backend with some params.
- the backend makes a request to /pdf-template which is on the fronend (with the params)
- the pdf template is updated with the params
- puppeteer turns it into a pdf and returns to client
my issue is when i have "I'm under attack" mode enabled on cloudflare. The puppeteer request gets captcha. I tried changing the configuration rules to: ip src add !== vercel deployment ip but that did not work.
any tips?
is pdf-template ever accessed directly by users?
in any case, you can probably access it internally using localhost:port/pdf-template
it's "technically" public but will redirect to root if the header we set in backend isn't there. and since users will never know what that header is then
your attempt is good, there is something more you can add
as you add the numbers to the arrays, keep track each array's total score
on every number, check how that number would affect each score, and add to the lowest scored array
at the end you can walk through the arrays just a little to even out any large score discrepancy
or even just walk through the numbers backwards, from highest to lowest
mmkay, i'll give that a try. thanks!
// return two lists of numbers, where the sum of the numbers in the two lists are as close as possible
function splitNumbersEvenly(numbers) {
// sort the number list input
numbers.sort((a, b) => a - b);
// initialize two list arrays
const list1 = [];
const list2 = [];
const numbersCopy = [...numbers];
// iterate over the numbersCopy array while it has elements pop
// the first and last elements and push them to list1 and list2
// respectively
while (numbersCopy.length) {
const listOneAverage = list1.reduce((acc, curr) => acc + curr, 0) / list1.length;
const listTwoAverage = list2.reduce((acc, curr) => acc + curr, 0) / list2.length;
// if the average of list1 is greater than the average of list2 then push the highest number
if (listOneAverage > listTwoAverage) {
list1.push(numbersCopy.shift());
list2.push(numbersCopy.pop());
} else {
list2.push(numbersCopy.shift());
list1.push(numbersCopy.pop());
}
}
// return the balanced lists
return [list1, list2];
}
module.exports = splitNumbersEvenly;```
the brute force is still finding better lists that are closer
AI came up with this magic
function splitNumbersEvenlyOptimized(numbers) {
const totalNumbers = numbers.length;
const halfTotal = totalNumbers / 2;
let minDifference = Infinity;
let result;
// Iterate over all possible bitmasks for the first list
for (let bitmask = 0; bitmask < (1 << totalNumbers); bitmask++) {
if (countSetBits(bitmask) !== halfTotal) continue; // Skip if the number of set bits is not halfTotal
const list1 = [];
const list2 = [];
let sum1 = 0;
let sum2 = 0;
// Distribute numbers based on the bitmask
for (let i = 0; i < totalNumbers; i++) {
if (bitmask & (1 << i)) {
list1.push(numbers[i]);
sum1 += numbers[i];
} else {
list2.push(numbers[i]);
sum2 += numbers[i];
}
}
// Calculate the difference in sums
const difference = Math.abs(sum1 - sum2);
// Update the result if the current difference is smaller than the minimum difference
if (difference < minDifference) {
minDifference = difference;
result = [list1, list2];
}
}
return result;
}
// Function to count the number of set bits in a number
function countSetBits(num) {
let count = 0;
while (num) {
count += num & 1;
num >>= 1;
}
return count;
}
module.exports = splitNumbersEvenlyOptimized;```
that code is prettybad performance wise
huh interesting, at first glance its very hard to understand what it is actually doing, how were the results?
also, that only works if the total sum of either array is less than 32 bits
can you show your brute force version as well? im in the mood for some benchmarking :^)
here's the brute force
function splitNumbersEvenlyBruteForce(numbers) {
const totalNumbers = numbers.length;
// Generate all possible combinations of indices for the first list
const combinations = generateCombinations(totalNumbers);
let minDifference = Infinity;
let result;
// Iterate over each combination and calculate the difference in sums
for (const combination of combinations) {
const list1 = [];
const list2 = [];
let sum1 = 0;
let sum2 = 0;
// Split numbers into two lists based on the current combination
for (let i = 0; i < totalNumbers; i++) {
if (combination.includes(i)) {
list1.push(numbers[i]);
sum1 += numbers[i];
} else {
list2.push(numbers[i]);
sum2 += numbers[i];
}
}
// Calculate the difference in sums
const difference = Math.abs(sum1 - sum2);
// Update the result if the current difference is smaller than the minimum difference
if (difference < minDifference) {
minDifference = difference;
result = [list1, list2];
}
}
return result;
}
// Function to generate all combinations of indices for the first list
function generateCombinations(totalNumbers) {
const combinations = [];
const halfTotal = totalNumbers / 2;
// Recursively generate combinations
function generate(current, remaining, start) {
if (current.length === halfTotal) {
combinations.push(current.slice());
return;
}
for (let i = start; i < remaining.length; i++) {
current.push(remaining[i]);
generate(current, remaining, i + 1);
current.pop();
}
}
generate([], Array.from({ length: totalNumbers }, (_, i) => i), 0);
return combinations;
}
module.exports = splitNumbersEvenlyBruteForce;
the optimized one is twice as fast for me
can you also paste your test function so i can copy it
test('test', () => {
let bruteForceTimeAccumulator = 0;
let optimizedTimeAccumulator = 0;
// run 100 times with random numbers
for (let i = 0; i < 100; i++) {
// log the iteration number
console.log(`iteration: ${i}`);
// random even number between 4 and 24
const randomEven = Math.floor(Math.random() * 11) * 2 + 4;
// function to generate a random number between 800 and 1600
const randomNumberFn = () => Math.floor(Math.random() * 800) + 800;
const numbers = Array.from({length: randomEven}, randomNumberFn);
// see how long it takes to run the optimized method
const startOptimized = new Date().getTime();
const [list1, list2] = splitNumbersEvenlyOptimized(numbers);
const endOptimized = new Date().getTime();
optimizedTimeAccumulator += endOptimized - startOptimized;
// see how long it takes to run the brute force method
const startBruteForce = new Date().getTime();
const [list1BruteForce, list2BruteForce] = splitNumbersEvenlyBruteForce(numbers);
const endBruteForce = new Date().getTime();
bruteForceTimeAccumulator += endBruteForce - startBruteForce;
// difference between the sum of the numbers in the two lists
const sum1 = list1.reduce((acc, val) => acc + val, 0);
const sum2 = list2.reduce((acc, val) => acc + val, 0);
const difference = Math.abs(sum1 - sum2);
const sum1BruteForce = list1BruteForce.reduce((acc, val) => acc + val, 0);
const sum2BruteForce = list2BruteForce.reduce((acc, val) => acc + val, 0);
const differenceBruteForce = Math.abs(sum1BruteForce - sum2BruteForce);
expect(difference === differenceBruteForce).toBeTruthy();
}
// avg time in ms
console.log(`optimized avg: ${optimizedTimeAccumulator / 100}`);
console.log(`brute force avg: ${bruteForceTimeAccumulator / 100}`);
});```
the initial array is always even?
yeah, i plan to use it to balance teams based on player Elo ratings
so like a 5v5 game. it will alway be even
does anyone here use resend for emails?
the brute force function time seems to grow exponentially depending on array size lmao
when i use a list of 30 number or more it runs out of memory
lmfao
99 iterations of array4 takes 1ms
99 iterations of array16 takes 380ms
array18 takes 1800ms
array 20 takes 8000+ms
array24 took 162194ms
lmao
what is the maximum team size?
12v12 would be the biggest
alright
24 total numbers
the AI version is indeed faster, but still horribly slow
200ms at 16
3600ms at 20
24 still running lmao
it's slow, but i think it's the only thing that gives the correct result
that cant possibly be the most efficient way to do this
i know. there must be a better way
i need to help a bit at home, so brb, but i'll experiment a bit with it
I ran sudo ip addr add public.ip.here.123/255.255.255.0 dev enp2s0 on my ubuntu 22.04 server
for some reason, all connections outside the local network (192.168.*.*) are timing out
ip addr show enp2s0
blurred/24 = public ip/24
i see the gist of the problem now, i really cant think of a much better way than brute forcing if you want the best possible match
but i think the bruce forcing can be optimized
I'm still confused by what the ai did to optimize the brute force code.
I guess the ai code is still brute force, but doing some bitwise trickery
it seems to be a known problem
Leet code would put an annoying problem like that on their website.
I vote pokemon hq but not sending vote success message
oh, if that happens dm their bot support team, we can’t do anything with that
because it’s probably webhook issues
Thank you sir. 8)
Your welcome
hey yall i need a stupid easy developer-oriented question for my work for verifying developers 
nothing too difficult, something that a developer of any experience should be able to get correctly
can you give an example?
Fizz buzz
:)
Or Fibonacci
It’s simple
https://hatebin.com/prkisuqlbp
for x in range(1,101):
if x % 3 == 0 and x % 5 == 0:
print("FizzBuzz\n")
elif x % 3 == 0:
print("Fizz\n")
elif x % 5 == 0:
print("Buzz\n")
else:
print(f"{x}\n")
i see, thanks!
actually I can make this better by not doing an addition of x
cause iircyou can set where it starts in range
but im too lazy
:D
mhm

i was able to optimize the AI version by about 20%, but still sucky yucky
1 second for a single function call is ridiculous
honestly i would just go with a naive version and not care about teams being slightly uneven
lmao
i didnt try the leetcode versions yet, they will likely be faster
@quartz kindle you are a genius!!!!
ok the game runs exactly how I wanted it to!!!
the only issue is when invoking the command i get "application did not respond" but the command does run like it's supposed to, and I don't get any errors in my terminal
when i use the command, it sends a message to the channel letting people know the game started.. I'm guessing that response is not within the 3 seconds.. so I changed it to an ephemeral and it worked fine - no error.. but I wanted the response to the command to be a channel message that everyone sees so that they know the game has started
show code
the main problem is that you're receiving an interaction and responding with a normal message, not with an interaction reply
ohhhhhh
you could simply change the first response The Easter egg hunt game has started! to interaction.reply()
also, a suggestion
save the egg messages in an array
Wana make a bot with me
so you can directly delete them afterwards, without needing to fetch messages
eggs.push(await randomChannel.send("🥚"))
Promise.all(eggs.map(egg => egg.delete()))
Dm me make bot
With me
no thanks
hm, this actually makes more sense
ok i’m gonna try this
“Wanna make a bit with me” = “I’ll tell you what to do and you make the bot for me” lol
And you are gonna pay for hosting
ayo bruh there goes @rose warren
how dare we delete him
can't let him take over all the channels
yooo what's up!!!
:^)
i have a great bot idea that will make a lot of money, code it for me and we split profits 50/50
what a great question
thanks for your answer to it, just learned a lot from it
i enjoy those types of questions
😂
require the least amount of effort to respond to
im surprised yall have not blocked me yet LOL
unlike some other people we've seen here, you demonstrate actual effort and interest in what you're doing
which is a big plus
dub
inb4 battleless arrives
yeah i’ve wanted to do this for a long time honestly
and it’s hard right now but i’m learning a lot and making progress
thank you guys fr for being so patient with me
i know @deft wolf got tired of me 😂😂
hey, does anyone have a clear overview of all discord markup features?
like # test
- test
hey
etc
arigato

Hey does anyone know why it says Expired when it shouldnt be?
<script>
// Set the target date in Eastern Standard Time (Friday, March 5th, 2024)
const targetDate = new Date('March 5, 2024 12:00:00 EST').getTime();
// Update the countdown every second
const countdown = document.getElementById('countdown');
const timer = setInterval(function () {
const now = new Date().getTime();
const distance = targetDate - now;
// Calculate days, hours, minutes, and seconds
const days = Math.floor(distance / (1000 * 60 * 60 * 24));
const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Display the countdown
if (distance > 0) {
countdown.innerHTML = `Expires in: ${days}d ${hours}h ${minutes}m ${seconds}s`;
} else {
clearInterval(timer);
countdown.innerHTML = 'EXPIRED';
}
}, 1000);
</script>
because its cool
the target date is in the past lol
your subscription will has been expired
lmao
I'm stupid
thank u
Wait until this guy finds out about operator overloading existing in every modern sane language other than Java
(It’s an awesome feature that they should honestly support in java)
nvm i got it
in a message component collector, is it possible to retrieve input from 2 different embeds?
const collector = message.createMessageComponentCollector({
componentType: ComponentType.Button,
});
right now i have hit the max of 5 components, but i need 5 more..
Or is it not doable?
You can create another row of buttons if you wanted it on a single embed.
Holy
Wait, so you haver 25 buttons?
no
or 20 whatever the limit is
Wait i might actually be really stupid rn
i tried to categorize them in diff rows lmao
but that's not needed
each row holds like max 2/3 buttons
let row = new ActionRowBuilder()
let row2 = new ActionRowBuilder()
add 5 buttons to row 2?
Then components: [row, row2]
miyuka i know, i was having a brainfog moment
what i did is categrize each button section into a new actionrow
I see i see
but that's not needed, so i saved space by filling each row
just wondering;
I have trash internet, I was testing a few things on a web page I was making but if I show it to my mates over the internet it loads like ass because even lowrez images tank m,y 0.8Mb/s upload. I had the idea I can just upload the image to discord and link it from there to save on my bandwidth. However it still loads sorta slow, is that still my internet also having bad download? Or is that cuz it downloads the image from discord to the web server and then gets reuploaded to the client?
there are literaly tons of image hosting services you can use
as well as free webhosting services in general like github pages
yeah but I'm testing this one thing and I will forget about all this in the morning
just an idle curiosity really
this is literally it.
was messing with transparency effects
thats just a b/w baground image but with an orange background colour on top of it that is opaque
originally I was wondering if it would mean I would save on file size but thats dumb cuz an orange and white image will use the same space as a black and white image does(probably)
transparent images usually cost more space than opaque images
and generally, colorful images also cost more space than simple images, with less colors and less complexity
other than that is depends on image format, encoding and compression
i would imagine it would be about the same? since its technically a color
unless you need some other data to figure out which pixel is transparent and which isnt
so they can still be compressed no problem no?
in the sense of rgba vs rgb
1 extra byte needed for transparency
the image isnt what is transparent its an orange overlay that is done purely through css so no space used for that
well exept for the bytes for the line in the css file I guess
that would probably help saving bytes yes
if your imageis pure black and white, you can also use a format that uses indexed colors
for example PNG8
idk if webp also does that by default
I have no idea its just a png I found on the internet
png8 basically has a maximum of 256 different colors and uses an index table to lookup colors
so instead of being 3 bytes per pixel, is just 1 byte per pixel
one of the few tiling pcb traces images I could find that was hard to see if it was tiled but also interesting
it can be further reduced
ooo nice
if you have a color index with only 2 colors, technically each pixel can use only 1 bit
but idk if png can be slimmed down that far
The standard allows indexed color PNGs to have 1, 2, 4 or 8 bits per pixel
I know nothing about image formats other than jpg is for printing and png is usually for digital stuff
and gif is for the funny moving images
jpg is a "lossy" format, which means it doesnt store all pixels, but only key pixels
and reconstructs the image by guessing the missing pixels from its neighbours
it also sucks around curves
png is lossless, which means all pixels are saved
yeah
then you have bit depth, aka how many bits per pixel
jpg is usually 24 bits, aka 3 bytes per pixel
png has variable depth, which can go as low as 1 bit per pixel, for pure black and white images
webp has both modes, lossy and lossless
lossy webp is similar do jpg, but with a lot of improvements
lossless webp is similar to png, but also with a lot of improvements
interesting
recently updated my bot to start using hybrid sharding which means i've opted for vanilla requests.
can anyone tell me what i'm doing wrong here? i'm getting status 400
async function updateTopGGStats() {
if (client.cluster.id !== (client.cluster.count - 1)) return;
const guildAmount = await client.utils.getServerCount().catch((e) => console.error(e));
await fetch(`https://top.gg/api/bots/${client.user.id}/stats`, {
method: "POST",
headers: { "Authorization": `${client.config.topgg}`, },
body: {
"server_count": guildAmount,
"shard_count": client.cluster.info.TOTAL_SHARDS
}
}).then((r) => {console.log(r.status, r.body); client.logger.dbl(`TOP-GG-UPDATER Updated the Stats`)}).catch((e) => console.error(e))
}
try JSON.strigify() the body
Hey tim
strigify
hai
i've been going back and forth on this. another thing i need to worry about is memory usage. i'm running the code on 128MB lambdas and it takes about 450MB to use the brute force method with 24 numbers. the optimized version barley uses any memory so it's actually possible to use that. and lambdas are pretty cheep. it would cost about $0.0000021 each time i run that function(if it "only" takes a second)
dont they charge for cpu time tho
1000ms of "cpu time" is not a small amount
let me see
this is their pricing page im looking at
https://aws.amazon.com/lambda/pricing/
idk about AWS, but like cloudflare workers limit instances to 10ms of cpu time per request
well, i guess you need to try it and see how it affects your billing :^)
that's the aws way
Duration is calculated from the time your code begins executing until it returns or otherwise terminates, rounded up to the nearest 1 ms*. The price depends on the amount of memory you allocate to your function. In the AWS Lambda resource model, you choose the amount of memory you want for your function, and are allocated proportional CPU power and other resources. An increase in memory size triggers an equivalent increase in CPU available to your function. To learn more, see the Function Configuration documentation.
i wonder what this means and are allocated proportional CPU power and other resources
it means the more memory you give it, the more cpus and etc it will come with
but i wonder if they limit the time like cloudflare
it seems like a lambda that is running idle would cost as much as a lambda running at 100% cpu usage
but that doesnt make sense
they dont run at idle
once the request is done, the instance is shut down / sleeps
i mean a lambda that is waiting for a sleep() before it shuts down
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}```
ah no, that doesnt count as cpu time
idk lambdas, but cf workers are limited by time as well
30 seconds per request
hey, a designing dilemma here again!
Is this okayish looking?
lambdas have time limits too. they use to be lower, but they can go up to 15 minutes
what is that circle to the bottom left of the input form doing?
it's an animated background
It’s a star
trickery
there ya go
that star doesn't look like the others
Looks fine but that border shadow is a little much
yeah i have to tone it down a bit
Could be a comet
But nah it looks fine
What do you guys think of the black form? Does it match with the dark purple?
i see, thanks for the feedback!
Are you making this for @quartz kindle 2034 astrology api
No, it's a discord bot i am trying to create a site for.
I know I was kidding
what's this tho
An api Tim has been saying he’ll make since 2020 or before hand
ok so when storing messages in an array to be deleted at the end of a game.. is it possible to set it to delete any message that contains a specific emoji?
i’ve been trying to do that and it isn’t deleting the messages
You can filter through the messages of a channel
Or if you have them in an array
See if they contain the emote
i may not have done it correctly then
Hard to say without knowing how you’re currently doing it
let me get it
so long story short, i created an egg hunt game that sends eggs around the server, and @analog patrol gave me the idea to have the eggs stored in an array so that it’ll be deleted after the game, but there’s another message that tells the users who found the egg when it’s found.. i tried to also have that in the array to be deleted and now it won’t delete, so i added the egg emojis to that message so that the bot will save every message containing the egg emoji and delete it afterwards
idk if that makes sense
I did? lol
wrong tim lmao
figured heh
can i see your code for this?
function splitNumbersEvenlyOptimized3(numbers) {
const totalNumbers = numbers.length;
const halfTotal = totalNumbers / 2;
let minDifference = Infinity;
let result = Array(halfTotal);
// Iterate over all possible bitmasks for the first list
for (let bitmask = 0; bitmask < (1 << totalNumbers); bitmask++) {
if (countSetBits(bitmask) !== halfTotal) continue; // Skip if the number of set bits is not halfTotal
let sum1 = 0;
let sum2 = 0;
// Distribute numbers based on the bitmask
for (let i = 0; i < totalNumbers; i++) {
const x = numbers[i];
if (bitmask & (1 << i)) {
sum1 += x;
} else {
sum2 += x;
}
}
// Calculate the difference in sums
const difference = Math.abs(sum1 - sum2);
// Update the result if the current difference is smaller than the minimum difference
if (difference < minDifference) {
minDifference = difference;
for (let i = 0, n = 0; i < totalNumbers; i++) {
if (bitmask & (1 << i)) {
result[n++] = numbers[i];
}
}
}
}
return [result, numbers.filter(x => !result.includes(x))];
}
// Function to count the number of set bits in a number
function countSetBits(num) {
let count = 0;
while (num) {
count += num & 1;
num >>= 1;
}
return count;
}
that code is so confusing
the countSetBits and bitmask < (1 << totalNumbers); part mostly
if (bitmask & (1 << i)) {
its using bits to iterate over combinations
ie
0b00001111 = check items 4 5 6 7 from the array
oh, that's a good way to iterate through all the combinations
ye
very tricky
then it increments the number
and checks if the bits do have the right number of items set
if not, skip that number
0001 -> 0010
and it doesn't need to store all the combinations, it just keeps the lowest until it's tried everything
exit out if it's 0 difference?
not a bad optimization
let me test
countSetBits(bitmask) !== halfTotal so this is making sure half the bits are 0 and half are 1 right?
yup
is that with random numbers?
ye
maybe it got lucky
i found a bug in my previous optimization lel
oh same numbers in both lists error right?
numbers.filter(x => !result.includes(x))
yup
new code (even better)
function splitNumbersEvenlyOptimized3(numbers) {
const totalNumbers = numbers.length;
const halfTotal = totalNumbers / 2;
let minDifference = Infinity;
let result = 0;
// Iterate over all possible bitmasks for the first list
for (let bitmask = 0; bitmask < (1 << totalNumbers); bitmask++) {
if (countSetBits(bitmask) !== halfTotal) continue; // Skip if the number of set bits is not halfTotal
let sum1 = 0;
let sum2 = 0;
// Distribute numbers based on the bitmask
for (let i = 0; i < totalNumbers; i++) {
const x = numbers[i];
if (bitmask & (1 << i)) {
sum1 += x;
} else {
sum2 += x;
}
}
// Calculate the difference in sums
const difference = Math.abs(sum1 - sum2);
// Update the result if the current difference is smaller than the minimum difference
if (difference < minDifference) {
minDifference = difference;
result = bitmask;
if(difference < 2) {
break;
}
}
}
const r1 = [];
const r2 = [];
for (let i = 0; i < totalNumbers; i++) {
const x = numbers[i];
if (result & (1 << i)) {
r1.push(x);
} else {
r2.push(x);
}
}
return [r1, r2];
}
// Function to count the number of set bits in a number
function countSetBits(num) {
let count = 0;
while (num) {
count += num & 1;
num >>= 1;
}
return count;
}
im running it lots of times in a random generated array and have yet to find a "non lucky" one
which means
this problem actually has multiple solutions, not only one
there are multiple arangements of numbers that have the same result
let me prove this
break;
}
lol
i did 100 iterations and it always matched
there we go
check this out
2140 combinations where the difference between sums is less than 2
i wonder how many are 0
What the hell are you guys doing
some cant have 0
if all mmrs combined are uneven, it cant be 0
so basically
we managed to improve performance by over 2000x
lmao
since you only need 1 combination, not all of them
that should be worth it
problem solved xDDDD
run a test case with thousands of randomized inputs
a match making system
from an array of mmrs, split them into two teams as evenly as possible
Is this for a discord bot
i ran it again, this one has over 3k possibilities
well
the bulk of them is literally the same numbers
just in different orders and/or groups
If this is all for a discord bot then wow
Didn’t think people would take it this seriously to implement mmr
ask ben about it lmao
mmr is serious business
if it were me i would just go with a naive function
Nothing I hate more than games implementing hidden mmr
Also mmr isn’t really needed if a rank system is in place, just match people based off rank
these probably have solutions with 0 elo diff too, but is it really worth it to try every combo just to balance by 2 more points
mmr systems protect noobs from us
it checks for diff < 2
so either 1 or 0
1 if total is uneven, 0 if total is even
even total cannot have a diff of 1
liekwise uneven cannot have a diff of 0
oh yeah, so should it check for difference === 2 instead of difference < 2?
Truth be told who cares about new players
you always need to check for both, even and uneven
It’s not a competitive game if you hand hold people
You won’t be able to stop smurfing by any means
So mmr is a toxic system
a high elo chess player vs a noob isn't going to be a fun game for either
It harms new players than it does help
Okay that’s not what an mmr system is for
You’d match people based off rank
that makes the matches more interesting
mmr is a system to "stop" smurfs from ruining the game for new players by ranking them up to get them back into their appropriate elo. Usually by measuring based off how good they do in a match
Which is a toxic system
Because what if a new player just happens to get some lucky wins and now they are facing people in the top 500 leaderboard (exaggerated example but point still stands)
Doing a rank based system is better off than mmr which is controlled solely based off match performance
mmr can be implenented in a bunch of different ways
Fair enough just don’t implement it poorly then
Cause it can and will create a toxic game play
Just look at riot games
mmr is just elo, nothing more nothing less
Their mmr is hidden and it creates a toxic environment for new players who happen to just be good enough at the game to excel in their rank but not good enough at higher ranks
the whole rank system was placed on top of it to make it more appealing
but under the hood its the same elo as it always was
Yet they are forced into gold lobby’s while still being at silver skill level
they just tweak how hard it scales every now and then
I think hidden mmr is the dumbest thing (a lot of games hide their mmr)
I also think the rank system in a lot of games are shit too
sometimes showing a leaderboard encourages noobs to cheat
and devs dont want to deal with it
it's up to the discord admins to stop cheaters
Not if you require them to visit a page before playing and tying their ip to their account /s
that wont stop you from win trading
It’ll stop you from having multiple accounts
vpns, multiple accounts, friends, paypal
the admins record matches, but they could still be tricked into fake recording matches
social engineering
Time to bribe the admins
Either way good luck
Hopefully your ranking system won’t be as bad as others
it's the chess ranking system
chess ranking is actually a pretty decent system
Most matches are pretty evenly matched when you have two players about 1000 elo playing each other
At low elos it's a little more unbalanced because it's often just chaos but still
why does this fail once the list is 32 numbers long? shouldn't it fail at 34?
this
#development message
i switched to bigint. i switched back
JavaScript tends to act weird with bitshifting large numbers
bigints are cursed
you should only use if absolutely necessary for example cryptography since you need massive prime numbers
64 bit ints should suffice for 99% of purposes anyways
js cant do bitwise on normal numbers bigger than 31 bits
since it uses signed ints, at 32 bit it becomes negative numbers
however, there is a way to do bitwise with math, this way you can trick js into doing bitwise operations correctly until its safe integer limit of 53 bits
How much do you earn per month for having a bot with premium functions (cost 10 euros)?
depends on how big your bot is, how popular, etc
For example the MEE6 bot?
you can estimate that around 1 every 1000-2000 users will pay for premium
if you have a million users, thats 500-1000 paying users
at this rate mee6 wouldn't be a fair comparison since it's basically a business at this point and discord bots are one aspect of it
So if 500 users are paying 10 euros per month, would they be earning 5000 euros?
In what ways do you keep your bots online/running?
we pay for a VPS
how mutch if i can ask that?
I pay 5 euros for more than my bot needs, so you can easily find a nice VPS for 3 euros
lifetime?
No, monthly
like 4.50 eur
there are some providers that offer free tiers, for example google, amazon, and oracle
can it run then how mutch bots you want?
google has a free forever 1gb ram vps
but they charge you for network usage if you use more than 1gb or internet per month
amazon gives you free trial for 12 months
Yes, I personally host one public and 4 private bots
it depends on how big your bots are, and how resource intensive they are
And I still have over 8GB of free ram
and you can run unlimetid if you want?
ow so not limetid
what for bots are that?
so it depends on how efficient your bot is
do you guys now what the largest bot is?
it used to be rhythm, but idk now
here
thx
do you have a link?
i cant find it
this:?
(i know its in dutch because i'm from belgium)
what is this?
when you create an instance, it has to be of type e2-micro, and it has to be in one of those 3 regions
otherwise its not free
so is it free in belgium ore not?
the regions are the place where the server is
not where you are from
Oh k thx man for youre help
I think it's worth noting that you'll have to get used to command line interface
there's no panel or one-click setup or anything, all done from terminal
watch them install windows server with gui and remote desktop
lul
Just install libxz, it’s basically Remote Desktop anyways ;^)
except that only one guy could access ur desktop and it's not u
sorry i meant to upload this last night and fell asleep.. lol
ok
Not all of us are developers here, if you need help with Top.gg support you can ping us but in here you need to ask your question and be patient about it
Eh someone made a patcher to modify the exploit to put your own pubkey instead of the attacker’s
You can always use that 😉
wait really 💀
Yeah
It was made for the purpose of researching the exploit
Not actually to infect computers
too soon lmao
you're trying to use discord.js but its not installed
you need to install it
are there any more discord libraries for js now
or is it still the same discord.js and eris landscape
bot devs are making their own discord libraries now
experienced devs maybe
but normal devs are pretty much still hogging discord.js
havent seen any mention of eris or others in a long time
go libless 
If I was going libless I'd probably switch to a new language
like Rus-
i havent touched any discord code ever since i moved to tiny-discord + webhook slash commands only
it feels like you finally get peace of mind
no need to worry about scaling or updates
new discord features can be added directly to the code, without needing any lib update
bot will pretty much never exceed 100-150mb ram usage, no matter how big it gets
and then there's dpp 
sure, but thats overkill at this point
