#development
1 messages · Page 135 of 1
same reaction
oh wait i see what theyre doing
execute order 66
theyre only using it to compare two roles
in a very weird way
this code hurts my head
yeah same
if the roles are equal then they should return 0
Sir yes sir, "force people to use Rust to make websites by breaking the web"
whats a BigInt
yeah but cant they just do if id === id2
a long
Is there a killsswitch for a discord rpc
but thats comparing ids not positions
👍
what are these mfs cooking
cache
Soon, the JS Jedi temple will fall
i shouldnt expand that macro

well he expanded it alright
How dare you say that Flaze, you shall be applied a pregnancy mute!!
woah woah woah, you shouldn't do that to mothers!
IDs could go over the maximum safe integer so they have to turn them to bigints before they could compare them
not necessarily some are open source contributions by normal people
but ids are strings?
ids are longs
ids are just stringified big ints are they not
wtf since when
since always
js has longs?
we just use strings cuz they're more convenient
i mean its more efficient than strings but i thought they always used strings
they are strings
bigint in js case
strings of number characters
I mean in discord side
You cannot do math on strings in JS
its a canon event i cannot interfere
there're some shenanigans for calculating an id
it's not solely based on timestamp
Snowflakes are complex
nope
Dates are the main contributer for IDs to overflow into character length
ids are constant, there's a field for role positions on the data discord sends
0 is a valid ID btw, but nothing is attached to it
isn't clyde ID 0?
clyde is fake. Not a user
Snowflake IDs, or snowflakes, are a form of unique identifier used in distributed computing. The format was created by Twitter and is used for the IDs of tweets. The format has been adopted by other companies, including Discord and Instagram. The Mastodon social network uses a modified version.
I fucking love youtube shorts. Its not like tiktok https://youtube.com/shorts/Pagl1zg0j4A?feature=share
The client fakes Clyde
why cant I use typescript parameter decorators in projects that emit declaration files? 🤔
good question
it would be convenient if ints rolled over to bigints if large enough
but might be annoying to keep checking
lol
Sounds like fun
@urban karma
You can fetch the user from the API
What are you confused about
me?
i just accepted it at this point
but ids are unique to a role and dont depend on role position?
that's only for the if statement
I mean easiest way to find out why they did it is to ask in the djs server
theres no reason to subtract 2 ids from each other even if youre doing it to read some snowflake value youd break the snowflake by doing that
;/
look at the return in the if block
wait wtf
if the 2 roles have the same position
they must be the same role?
in that case its always 0?
then why not return 0?
because 2 same numbers subtracting each other is 0 assuming theyre positive
not sure why they don't just return a 0?
wonder how do u even get 2 roles at the same position
yknow I was going to ask djs themselves but I can't be asked
assuming theyre both positive
by providing the same roles
which ids are positive
I mean, yeah but there HAD to be some precedent for them to add that check
exactly LMAO
it's like when people write ```java
if (somevalue == null) {
somevalue = null;
}
It could be a fail safe in case shit like that happens
likely
try checking the commits for that file
discord js experience
maybe they explained why they did that
git blame to the rescue
JavaScript numbers are represented as IEEE-754 double-precision (64-bit) floating point numbers, because of this it limits their precision heavily
Because of that it only gives you 53-bits of precision for integers for the size of the available mantissa
Meanwhile BigInts are integer-only, no floating point numbers can be represented by them, and so they can provide you with an arbitrary-precision
Have a read to one of our blogs explaining it entirely:
https://v8.dev/features/bigint
BigInts are a new numeric primitive in JavaScript that can represent integers with arbitrary precision. This article walks through some use cases and explains the new functionality in Chrome 67 by comparing BigInts to Numbers in JavaScript.
this is an old commit
They've apparently renamed that file like 20 times
so each commit history gets wonky
see if there's a PR linked to it
this is the only thing that shows up on git blame https://github.com/discordjs/discord.js/commit/1e00fc200173686f7fdc50405e63c894077e9d59
yknow while this is interesting, I learned not to question discord.js fuckery after deep diving into their library to try and see if I can model my own after it
but theyve renamed files so you cant be sure
no, I mean the PR
any plans to switch the number type to DEC64?
u can click on the hash number at the top
to see if anyone commented abt that line
go click on it yourself lazy !!!!
yea so like I said, it was a fail safe in case some extreme edge case occured
I mean
It does the job
discord.js is the defintion of overengineered and bloat
what can you expect
Makes sense they did it tho
While its rare it is still a possiblity
It would take some serious occurances but
No
-
It has significantly less exponent range than IEEE decimal64 (it effectively throws away almost three bits in order to have the exponent fit in a byte; 2^56 is ~7.2E16, which means that it can represent some, but not all, 17-digit significands; the effective working precision is 16 digits, which actually requires only ~53.15 bits)
-
Even if you weren’t going to use those extra bits for exponent, they could be profitably used for other purposes
-
Lack of infinity is a mild annoyance
-
Rounding is biased for add/sub/mul, broken for divide
-
It's not significantly more computationally efficient than the IEEE formats, despite handwaving by the author of the format
edge cases as lorax said
why don't you guys ask in the discord.js server?
they have a forum for stuff like this
he speak for the trees d.js
In case 2 roles where made at the EXACT same time
like this ^
Which is why its called an edge case, it isn't something likely to occur all the time
but still a possiblity
reasoning for this (the one I mentioned) code is usually to prevent bit flips from cosmic rays
i actually searched for pros and cons between both formats and couldnt really find anything, ty for explaining
although wiki says dec64's range is larger than bin64
i want to post my guild count, im using python
bot.topggpy = topgg.DBLClient(bot, d_token)
do i need to pass the commands.Bot class for bot?
what does it mean for rounding to be biased?
uhh, wdym?
bot is supposed to be your client instance
yes thats what i mean
the one u used for login
That's technically incorrect
just pass whatever client instance you made when running the bot
alrigt
@lyric mountain I remember when I tried making my own discord lib, this was when I thought libless was the best

It worked rather well but the hassel of maintaining it was annoying so I threw it away
going libless is like surviving in the arctic naked
it's all fun and giggles until a cold gust comes and u notice there's nowhere to hide
Its fun for the first 2s then you realize you shouldn't but you're already too invested to turn back
then you see a polar bear (cloudflare) coming running at u
and realize you've hit your 1000 login limit cause of a bug with your websocket send method

1 day respawn timer
Lmfao
I was trying to incorporate a rate limit handler into my send method
it ended up sending the login thing like 1000 times in 2s
Yes discord does!
where
On their docs
link
When rounding is biased, it means that there is a tendency for the rounding to consistently favor numbers in a certain range or direction
This can occur when there is a specific rule or method of rounding that is used consistently, regardless of the actual value being rounded, for example, a rounding method that always rounds up to the nearest 10 could be biased towards larger numbers, even if the number being rounded is closer to a smaller value
This bias can affect the accuracy and fairness of calculations and may need to be adjusted or corrected in order to ensure consistent and unbiased results
google it
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
they have a .dev domain now?
they've always had it
that rounding thing is especially annoying with banks
so after 16 decimal places the rounding would be biased?
or before?
https://discord.com/developers/docs/topics/gateway start reading here
you'll eventually find it
im here
theres no code examples
Okay maybe I exaggerated there isn't really any code on how to connect
but it tells you how
too bad battle is allergic to python
with a neat diagram
i need code example
^
i've never worked with websockets before
damn that sucks
python is literally pseudocode 😭
would i use this websocket
python is a runnable yaml
not to mention that has comments
yes
ok
that's what I used for my lib
rust devs sweating
I have created a command for my Discord bot to give everyone a role, and the code is correct.
However, it only assigns the role to 5 people every time I use the command.
I don't think it's related to the server permissions because I have tested it on different servers, and it only assigns the role to 5 people in all of them.
That depends on the rounding method that is used, in general, rounding after 16 decimal places is unlikely to introduce a high amount of bias, but can and that's not a good thing when you rely on accurate calculations
jokes on you discord is made in rust
they just dont like telling people
Could it be related to the Discord API?
this is what wiki says:
Okey i will send
const Discord = require("discord.js");
const client = new Discord.Client();
exports.run = async (client, message, args) => {
if (!message.member.permissions.has("MANAGE_ROLES")) {
return message.channel.send(` Bu komutu kullanabilmek için "\`Rolleri Yönet\`" yetkisine sahip olmalısın.`);
}
const roleMention = message.mentions.roles.first();
if (!roleMention) {
return message.reply("Lütfen bir rol etiketleyin.");
}
try {
await message.guild.members.fetch();
message.guild.members.cache.forEach(async (member) => {
if (!member.roles.cache.has(roleMention.id)) {
await member.roles.add(roleMention.id);
}
});
message.channel.send(`Herkese ${roleMention} rolü verme işlemi tamamlandı.`);
} catch (err) {
console.error("Hata oluştu:", err);
message.channel.send("Herkese rol verirken bir hata oluştu.");
}
};
exports.conf = {
permLevel: 0,
aliases: ["herkese-rol-ver"],
komut: "herkese-rol-ver"
};```
the office space guys could write a program to collect all the fraction of pennies into an acount. that could be an issue
async in forEach is never a good thing
i will test it 1 second.
you don't need to but u should
but yeah, use a for loop instead of forEach
it's a good practice, plus for error handling
um
that command seems really spammy though
I will wait 4-5 seconds before adding role to next member
it's even better to await it
On big servers it's gonna take some time but yes
When I use the command to give roles to everyone, the bot is slowly assigning them. But it seems like Discord is not allowing instant role assignment.
That's just incorrect, here's why:
IEEE 754 is a standard for numerical representation of floating-point numbers that supports both single-precision (32-bit) and double-precision (64-bit) formats, allowing for larger range and precision than DEC64
The single precision format can represent numbers up to 3.4 × 10^38 with a precision of about 7 decimal digits, while the double precision format can represent numbers up to 1.8 × 10^308 with a precision of about 16 decimal digits
Meanwhile, DEC64 is a decimal floating-point format that uses 64-bits to represent decimal numbers, it was designed to provide exact decimal representation and decimal arithmetic without any loss of accuracy
However, its range is more limited than IEEE 754, with only about 16 significant digits of precision and a maximum value of approximately 10^384, while its precision is higher than IEEE 754 in the decimal domain, it is not suitable for scientific and engineering applications that require the larger range and binary precision of IEEE 754
I agree, it seems that Discord does not allow instant role assignment.
probably cus discord.js is queuing them
i agree with this ^
so you don't get ratelimited
roblox dev moment
roblox :lego:
I can do it as follows:
The bot will retrieve the number of members in the server.
It will calculate the time based on the number of members.
It will assign roles at a rate of one role per second, for example, 495x1=495.
The message to the user would be:
I will have assigned roles to all members within 495 seconds!
having exact decimal representation would be a nice thing. 0.1 + 0.2 === 0.3 would be nice
But having a lower limited precision is worse, where it's required in lots of places like I mentioned at the end
i still dont get it, it says both have 16 digits of precision
think of task.wait as a way of telling the process to stop until a certain amount of time has passed
this is most commonly used in loops in lua
If you need mostly accurate comparisons then you would need to use an approximation with an epsilon of correct size to do it right
await new Promise(resolve => setTimeout(resolve , 250));
you can do something like that to mimic it
reset your mongodb login
🧌
fr
ah, you're probably writing code like you would in lua but using js.
If I tried to write like I do in js but using lua Id probably have the same complaints 👀
You've misunderstood it, DEC64 has 16 decimal digits, but has 14 digits of precision
ayo ive learnt about exponents and mantissas in computer science
i nerver knew this was a thing
you can also just require const { setTimeout } = require("timers/promises"); and await setTimeout(250);
Yep, epsilons are pretty important
ah i see, i dont remember seeing that in the wiki
That makes sense, so it will be a clean code. But in order to define this time, I will have to set up a full minute of waiting and then determine how many members received roles within that minute.
look here
thats basically it
Very good
✨
i still largely dont get binary floating points
they use a bunch of math tricks
i hate math
If you make exponent bits smaller you reduce the range/size of the float number and if you make the mantissa smaller you reduce the precision
veryc ool
i hate math too
whats 9 + 10 though?
14
32
yeah had to learn it in cs
theyre represented in twos complement too
0.1 + 0.2 < 0.3 + Number.EPSILON && 0.1 + 0.2 > 0.3 - Number.EPSILON
new JS idiom. i will do this everywhere
i did come up with a variable float representation tho, that can fit into 1-8 bytes, for my srializer
but it uses base 10 exponents
because idk how to do it with base 2
true though
why do people use moment.js so much if it's not getting updated anymore
they like to live in the moment
does somebody know why my console is saying this
const Discord = require('discord.js')
const { Database } = require("quickmongo");
const db = new Database('my beautiful mongo login');
module.exports = {
name: 'bump',
description: 'bump the server',
category: 'bumpsystem',
run: async(interaction, bot, args) => {
await db.connect()
const data = await db.get(`advertisement-${interaction.guild.id}`)
let channel = data.channel
let description = data.description
let invite = data.invite
await db.push(`bumps`, {
channel: `${interaction.channel.id}`,
time: `${Date.now()}`,
guild: `${interaction.guild.id}`,
user: `${interaction.user.id}`
})
const embed = new Discord.EmbedBuilder()
.setTitle(`${interaction.guild.id}`)
.setDescription(`**Description:** ${description}
**Members:** ${interaction.guild.memberCount}
**Invite:** https://discord.gg/${data.invite}`)
.setColor("#B468FF")
await channel.send({ embeds: [embed] })
}
}
There's Luxon.js which is recommended by Moment.js, it had the same API as Moment.js but improved and also has additional features
its for my own bumping system
channel is a data object. no functions
you cant store the channel itself in the database
yeah have to fetch it
let channel = bot.channels.cache.get(data.channel);
oh
is data.channel the id of the channel?
In groovy we just ```groovy
someArray.each {
...do stuff
}
Ye
lmao is discord down?
then ye this will work
check if channel exists though!!
Kinda
someArray.each {
Thread.sleep(millis)
}
Though the need for date manipulation libraries will mostly be gone as we implement the Temporal APIs to the JavaScript programming language
if (!channel) return interaction.reply('channel no exist')
why try?
if they have the Guilds intent all channels will always be cached, if it's undefined then it doesn't exist
oh
you should try catch in the handler
just a tick
and unlimited server count
besides that it doe snothing
actually makes it harder on u
Not unlimited no
u need to apply for priviliged intents
After a certain point u kinda do another verification
well u get what i mean
uncapped
no more stuck at 100
U find another wall at around 100k guilds or so
U need to do another verification to get expanded limits once u reach that threshold
no, you can keep the intents while your bot is verified but others will not be able to invite it
till you're either approved or no longer have them enabled
and does somebody know how i get the server pfp on the top right of a embed
setThumbnail
.setThumbnail(interaction.guild.iconURL()) i think
ty i will try
Are you initiating a new Database in every command?
You should probably connect to your database once in your main file and save it to the client object
otherwise you have like 20 different connections and it could mess up data
didnt even notice that lmao
i already fixed it
There's no limit on how many servers a Discord bot can join after verification
int32 integer precision:
They have that expanded limits program exactly for such big bots
Oh you're talking about the ratelimits, not exactly the amount of servers a bot can join
Yeah, it's not like a hard cap
i mean people can still invite your bot then
But unless u get approved for expanded limits ur kinda stuck at that limit
what happens if you get denied
If you manage to get denied you're stuck at that limit
oh
Cuz you've hit the daily limit
I have not seen a single large bot get denied for higher ratelimits, you must do something incredibly stupid to be denied for it
And iirc the bot is reduced to a crawl from the remaining ratelimits
That's why I said "if u manage to get denied"
Yeah I know
whats stopping people from lying in their verification application
they do sometimes decline them
ToS and the fact that they track your requests
but thats usually because it can be managed by the bot itself
So they can audit if what ur saying is true
something like doing 2 requests instead of 1 or delays
probably not
no
Correct though I haven't seen any of them being denied myself
they wouldnt deny them just because they want to though
That's either network issues or the Discord API being #starboard message
When u hit the CONNECT limit u can't login at all for 1 day
they reserve that for bot verification
Note that the login limit is 1,000 per day by default
it should send the advert in every server it has been setup in but it only sends it in the interacted server
because your only sending it to one channel
🗿
Nah more like Replit
lol
do you maybe know how i can do that
i swear glitchs dying now that it got acquired by some company and they basically killed bot hosting
forums are almost dead
I mean, glitch was 80% discord bots
they also added these "project hours" so if you use an amount of hours in your project a week/month overall in all your projects you cant have them running anymore
there's a reason we(not me)don't use glitch anymore
just loop through the servers with it enabled
i assume u have it in your database?
they also suspend any project automatically that has an npm library that automatically handles uptime robot pings lmao
reminds me of when youtube ratelimits API requests on discord bots
just get a cheap server
yea the problem is idk how to do that tbh
wont be surprised if they sent an email to everything saying "its been fun"
👀 replit will go the same way, I mean locking down bot hosting
possible
i still use a vps
they also downsized massively they used to have a few forum support staff now theres only one
heroku went that way too
when you have array of servers
for (const server of servers) {
...
}
didnt they post a big ass message claming they would never do that
a few years ago
lmao
a few years ago
issue with replit being a host is that if your project is public basically it's free real estate
yup
Also
free real tokens
honestly its their fault they should just let people host projects forever with some restrictions isntead of having to use uptime robot which probably ddosses them every 5 minutes
not if you buy their premium thing
basically like github
for like $5 a month
we don't talk about their premium
thats the yearly price monthly is like $10
U have to be stupid to buy glitch premium
same thing
i cant speak arabic
well maybe i dont wanna buy a whole yaer
a VPS is cheaper than replit and glitch premium combined
yup
i agree
screw glitch
galaxygate with their $3 a month vps hosting:
I love galaxygate
👀 how would they make money off ads?
But you can speak catgirl language like a precious one you are :^)
been with them for awhile
digital ocean is good (not promoting)
yeah galaxygate is great
that made me phisically cringe
UwU
grown man btw
UwU im allowed bc im girl
sorry thats not inclusive
Force users to add a d.js code for sending ads randomly during usage smh
wtf
DigitalOcean is generally the best one you're gonna get if you can afford it
UwU
I like this plan
yah
it's what i use
please dont take me to twitter.com and cancel me
Lets make a host like glitch just for this
i've had 0 downtime in 6 months with do
genius
but also if you can't afford to pay digital ocean vps then you can easily get blacklisted
imagine ads in nuke bots
why doesn't discord allow u to advertise on your bot
that would be a perfect money maker for big bots
They do allow wdym
no
U just can't shove it
tfym they do allow it
😵💫
U can put ads if they're not intrusive
p2w games
Do not target
i don't think that's what we meant'
That's called shoving
we meant like putting it on bot bio or something
Or in a profile image or smth
so i can put an advertisement on every message in the footer?
^
Discord doesn't allow you to target users with advertisements
so can u or not
but you can put ads in your bot's bio
So you can't put sponsors or partners in the footers of embeds
Vine boom sound effect
Twitter: https://twitter.com/BusinessGoose12
Instagram: https://www.instagram.com/businessgoose12/
Discord: https://discord.gg/rkCvgkZy
You can't have unsolicited ads. So if a user solicits them, then u can have them. Like running a command to see ads is fine
Them showing in other responses is unsolicited
hm ok
that makes sense now
So a !partners command is fine to have as the user has to run the command to see it
hm, a bit weird but makes sense
But in the footers of other responses is not allowed as the user isn't consenting or soliciting the ad
kinda of how we use -vote for asking to vote in topgg
They've talked about it a lot in the dev server
that's technically ads
Ye
Anything relates to the bot you can promote freely, such as a support server or website
But anything else isn't allowed
Then Carlbot breaks tos advertising Piggy and their crypto shit in status and random responses
Absolute moment
That would be fine yeah
so can i theoretically have a button for a user to watch an ad to get a reward?
I think they're owned by the same company or something? So it's fair game
I remember someone saying something about it
Bluestacks also advertised their targeted sponsors thing that used discord message data, until they had to close it down
Both owned by Botlabs
Idk I'm not discord lmao
I'm not sure on this one
But it would still be unsolicited since it’s advertising a completely different platform/bot
Probably have to ask in the ddevs server
Anyways discord doesn’t enforce bot tos
I know we've declined those survey type reward bots before
Fill out surveys for cash and then redeem it
Discord dev compliance team confirmed Mushroom violated tos regarding something I can’t disclose yet and then didn’t take action against them
Oopsie poopsie
Actually i can probably disclose soon
didn't we use to do that?
Been nearly 90 days
😵💫
like i mean have surveys in topgg
They have let bigger bots/companies in the past slightly skew tos in their favor lmao
Yeah
But that's a company making money for you
unless i don't remember properly
i think discord considers this okay as long as youre not showing the ads without consent and on their platform
but you should ask
Well this was serious violation and privacy issue
Making exceptions to make money 💰
nah I don't actually plan on doing it
was just wondering
🧌
a few bots got banned personally by the dev team manager or whoever that is for advertising on discord lol
because people kept complaining
also i can't even cus i'm sadly banned from the discord developers server
i wish there was a way to appeal
well didnt get banned they just had their verification taken away
lmao battleless banned from discord devs
i sent too many emojis and automod banned me 😭
imagine
Time to make a Discord bot that works like those fake generator websites that ask you to complete multiple surveys to earn something, and then not give them anything after
what did you even do 😭
battle basically tried to act like he does here
^
Lmao
which is "no" or "why" or "😐"
now you need to get banned from discord itself
except ddevs is no topgg
funny how those work, usually free giveaway sites that uses surveys actually sell information
not as a response to every other message
i didn't
i was just sending emojis to express my emotions
and kept forgetting automod deletes them
Yeah, though I remember that one of my friends found one of those fake generator websites that... actually worked, first ever time we saw something like that work
yeah I asked why because it's a valid question
they for some reason said emojis will not be allowed in hyperlinks
so i wanted to know why
I actually said this to a ddevs and DJS mod and they said lol
bruh
no sympathy
not when you start talking like this
bro i'm simply conversating with a user
it did affect my bot a lot
I can see why they severely limited hyperlinks, the possibilities of scam are endless
will look cluttered and more ugly
those will look odd
for me i agree with kuu and hyperlinks, i can mask a scam link in a hyperlink easily
let me show you my bot
theres really no good way to do this without hyperlinks
without it looking weird
it's not like ur bot will die with the changes
maybe they changed their mind
they likely didn't push the changes yet
or applied only to user hyperlinks
as those are the most likely to be scams
it passes user session because it uses oauth
yes because they were beta
and were then removed
this is also a much needed component
sometimes modals are too overkill for a simple input
discord for some reason hates text based inputs
theyre really hesitent on adding them even tho literally everyone wnats them
took a while to add modal text input
Gonna take Discord years to implement the remaining stuff for interactions, like date picker type, variadic arguments, arguments that can be used multiple times, more interactions for modals, etc etc
Just like usual
discord really turned to focusing on monetizing the platform
it is a business at the end of the day but at least make it less obvious
i still remember their humble days
They made super reactions instead, who the hell asked for them!?
they are the most useless thing ever
they dont fit the platform
what are they gonna add next? gifting people with discord tokens like tiktok live?
and reddit?
yes
not a single soul
they are adding some new thing
literally
lemme grab what its called rq
theyre even jumping on the ai bandwagon with their clyde ai or whatever
did reddit end up changing the pricing of the API
no
no theyre still sticking to it
lol
but they got hacked
💀
imagine discord makes the api paid
and are being held for 4.5 million and the data revert
thats crazy
That would be heaven
honestly wouldnt be surprised if discord eventually starts asking very large bots to start paying for api access
because theyre very profitable
most of them anyways
and discord receives little to nothing in return for all the traffic the bot uses
they do now
they are adding premium through Discord
oh right they did
they do
so either guilds or users can be premium
are they forcing bots to use that instead of their website?
they would make like 5% profit per subscription, imagine how big bots are
isn't premium nitro already?
I think its optional
no they are just giving access to large bots
this would be another endpoint
so not to be mixed with nitro
they're adding turbo then
theyll prob start forcing premium stuff to be done on their paltform
probably
look at how much dyno and mee6 and bloxlink etc make
now imagine 5% which discord is missing out on 
but thats fair because not all large bots are very profitable giants
makes you wonder why only the large bots were given access
some just want to provide a service and have enough to keep running
dyno mee6 and bloxlink make way more then to keep it running
well yeah not those bots
it is saying the interaction did not respond without an error
const Discord = require('discord.js')
const { Database } = require("quickmongo");
const db = new Database('sexy mongo url');
module.exports = {
name: 'bump',
description: 'bump the server',
category: 'bumpsystem',
run: async(interaction, bot, args) => {
await db.connect()
const servers = await db.get(`advertisement`);
if (!servers) return;
for (const server of Object.values(servers)) {
const guild = bot.guilds.cache.get(server);
if (!guild) return;
const channel = guild.channels.cache.get(server.channel);
if (!channel) return;
const data = await db.get(`advertisement-${server.guild}`);
const description = data.description;
const invite = data.invite;
await db.push(`bumps`, {
channel: `${interaction.channel.id}`,
time: `${Date.now()}`,
guild: `${interaction.guild.id}`,
user: `${interaction.user.id}`
});
const embed = new Discord.EmbedBuilder()
.setTitle(`${interaction.guild.name}`)
.setThumbnail(interaction.guild.iconURL())
.setDescription(`**Description:** ${description}
**Members:** ${interaction.guild.memberCount}
**Invite:** https://discord.gg/${data.invite}`)
.setColor("#B468FF")
await channel.send({ embeds: [embed] })
}
await interaction.reply({ content: "Success!" })
}
}
majority of the large bots out there that are decent make way more than to keep afloat
you should defer the interaction
Largely due to donations or premium features
yeah do this
then interaction.editReply(...)
okay
also
i assume server is not a server id
so you can't do const guild = bot.guilds.cache.get(server);
what does server actually return?
if it only returns the guild how are you doing server.channel
server is not a guild id
Look at what they said to the r/programmarhumor mods
https://media.discordapp.net/attachments/505003632308125696/1120458020313378979/image.png
Though they do have a free tier
https://mods.reddithelp.com/hc/en-us/articles/16693988535309
what happens if they decline to reopening
The current mods get removed and are replaced by ones chosen by Reddit themselves
yikes
reddit really not letting these guys get to them
lmao
luckily i don't really use reddit so i could care less what happens to it
it's fun to watch this undergo
I don't really use Reddit either, though I've stumbled upon multiple helpful posts that are now in private subreddits
did u see what they're doing now?
yeah I sometimes find some answers to my issues on reddit
some subs agreed to reopen but now are only posting shit
Yeah
how would you do it
wym
how would you check if servers have it enabled
idk how your database is setup?
if only servers with it enabled are what you get
const servers = await db.get(`advertisement`);
then just loop through it and send the messages
also there's really no need to get the server from the cache
you can just get the channel
yea idk how i can loop through it
I'm always using for let loop
i mean you are already i think?
I don't know, forEach is kinda tricky for me
i can't really help because i don't know what server is in the loop
that's why i asked you to log it
my own server and my test server
channel is that it would send the add to a specific channel in the server
yes but a guild object wouldn't have that property
can you tell me what it is
what is inside it
you okay if i send a sourcebin link of how i set it up
well
I dont think thats needed
or you can just console.log(server) and send what it returns
okay
(inside the loop)
this is whats set, right?
await db.push(`bumps`, {
channel: `${interaction.channel.id}`,
time: `${Date.now()}`,
guild: `${interaction.guild.id}`,
user: `${interaction.user.id}`
});
no wait 👀 thats for bumps
kek
I'm paying attention
😵💫
this is
its only sending the ad in the server where it has been interacted
also, what's the point of this? you should be able to access all that with server.description and server.invite
and .guild isn't even a property on server, because you're not setting it here
it should be interaction.guild.id i think
🫠
lmao
i don't think connecting to the db everytime the command is ran is good
you should connect once and export then import it
you can just also connect outside the export realistically
const db = new Database('sexy mongo url');
await db.connect();
module.exports = {
...
You could then check if it is connected before allowing the command to run.
Well you might be able to do that, quickmongo only has half their documentation working so who really knows.
oh wait, i think i misunderstood what you're trying to do
But yeah, passing it between files is better ^-^
'sexy mongo url'
Yeah, its in the original code ^_^
sexy mongo url 🥵
lies, mongo cant be sexy
damn mongoose killed python
PostgreSQL best 🗣️💯🔥
who is faster SQLite or PostgreSQL?
sqlite by a long shot
well not a long shot
but sqlites more designed for smaller local applications
for bigger projects you should use a server db like postgressy
PostgreSQL is generally faster than SQLite
i will benchmark
cap
There's a good reason why, PostgreSQL is packed to the brim with very useful features and improved capabilities which the database itself uses as well
Though this might've changed, it's been a long time since I've benchmarked them
Although when you use either you shouldn't care about performance because both of them are incredibly fast, you should care about other factors like customizability, features, ease of use, and whatnot
sqlite is faster but is less efficient than postgresql
by "performant" I'm talking about rows/s rate
that's cuz sqlite is practically direct access to the database, while postgresql has more layers to it, but that's also the bane of sqlite as it can only have 1 write operation at any time
Seems like Twilio did some benchmarks
https://www.twilio.com/blog/sqlite-postgresql-complicated
SQLite is much easier to use than postresql
Easier but much less efficient
It’s very efficient
I’ve been using it for all my projects and it works wonderfully
people never mention sqlite's WAL mode and turning synchronous writes off when benchmarking, nor do they mention enabling mmap
plus this benchmark uses an ORM :puke:
SQLite can only have a single writer thread per operation, it works well for small projects, but as your project gets bigger that's where it falls
PostgreSQL is basically the God of efficiency in the world of databases, and scalability while also being incredibly fast
also is sqlite really easier?
like, once u have both set up they're mostly the same
also people never factor in sqlite's unfair advantage of not having a network stack
except postgres adds a bunch of (good) stuff on top of the basic sql
benchmarking sqlite against other dbs is not a simple thing, its very hard to produce a fair comparison
True
yeah it is
I have no idea how to setup a postresql database
but I can easily setup a SQLite one
ita easier in the sense that it doeant require any setup, while pg must be separately jnstalled and managed
my SQLite database is big and works really well
but then it's not the database that's easier, it's the setup
that’s part of the experience
it doesnt really matter how big it is
what matters for dbs is how often data is written and accessed
sqlite will never beat pgsql if you have millions of operations per minute
my data is written a lot
who has millions per minute
🤨
banks
The platform you're sending your messages on right now
per minute? easily my bot
1 million per minute is measly 16k ops per second
unless it’s mee6s size
nope
tell me how your bot is making millions of operations a minute
mee6 would be in billions per minute
your bot is relatively small
xp system alone reaches that
I doubt the number is that large
large? lmao
1 million per second is large, but per minute is just regular database usage
anyway, its a matter of knowing the right tool for the job
to give you a sense of scale, let's say we have 100 users across 10 servers, that's 1000 users
sqlite is pretty much the best thing you can get, up to a certain limit, beyond that you have no choice
let's say all are sending 1 message per second
that's 1000 msgs/s
so in my case 1000 xp increases per second
which is 60k operations per minute
of course you have caching and batching, right? :^)
yep, the lib I use handles that
gotta love eventual consistency
plus postgres also has a cache layer
that’s not millions a minute
that's only 100 users on 10 servers
my bot is in 7792 servers
i am not a Spanish speaker
not discord users mind you, users registered on the database
lmao
top is servers, bottom is users
they are removed from the database after some time
also if 1% of those (18.536 users) sent 1 message per second, which is lowballing, that's already over a million per minute (16.666... msgs/s)
my bot was getting arround 200 messages per second at 9k servers, if i remember correctlt
mine gets around 50-75 per second at 1.87k servers
and it scans each one using regex 
lmao
so in conclusion that’s not even near millions
and has to check scam links, invite links etc for each one
🤨
why
discord has auto mod now
just take the L buddy, u have a shit sense of scale and we know it
lol
it has regex tho
yes and
i can't constantly update every server for every scam domain or server invite
how much more effective can it get
the bot has stopped 50k scams in the last year
i remember skmeone here was getting 500+ messages per second on a 2k bot or something, bexause of a handful of very large guilds
no you have no statistics to back up these claims
I don't log every single transaction yeah, that'd be stupid
sounds like something you'd do
well, told ya it's something you'd do
yeah cus it’s smart
to know my statistics
until you notice that logging every transactions doubles the amount of transactions
no?
it does tho
how
imagine you have a pen and 2 papers
for every line u write in one paper, u also write in the other paper "I wrote a line"
so u always have to write 2 lines cuz of that
no I don’t do that
then ur not logging
It’s on a discord message that I update every 25 transactions
...that's worse than I expected honestly, but that's not logging transactions either
what if u wanted to know how many trans u made between hours X and Y?
u cant cuz u only have a single number
average is ok
Battleless seems like a good guy until you scroll up
explain
I am a good guy
does anyone know where I can find a large amount of 5 letter words
Do you just want all 5 letter words?
https://github.com/dwyl/english-words/blob/master/words_dictionary.json
Could just download this, and filter it for all 5 letter words.
the crazy part is its only 6.5mb for the entire file
bro is creating the next wordle
yea i am
tbh it’s impressive how i can remember 479k words
doesn't matter on JS
for me at least I use double quotes for everything except if the string has a double quote in it (then I'd use single quote since I hate escaping them)
is this the proper way
ok
fuck it we template literal everything
are you a pro coder?
I do code professionally, but am I a professional at code? To be debated
I just saw your bots code
you are indeed a pro coder
@proven lantern have you heard of this? it seems convenient for your use case https://youtu.be/JY_d0vf-rfw
SST serverless stack is an open-source infrastructure-as-code tool for building on AWS with TypeScript. Learn how to easily manage resources on AWS and handle deployments for JS frameworks like Next.js, Astro, Svelte, and more.
#webdevelopment #javascript #100secondsofcode
💬 Chat with Me on Discord
🔗 Resources
...
that's pretty similar to what i'm using now i think, but it bootstraps a lot of stuff i did manually
it has a dev command that runs everything locally though, it seems like
are those you doing some janky workaround for that?
especially for the interaction handling, I dunno
yeah, i have a fancy workaround to get it working on localhost
but it's just because discord wont wait
i use localstack to emulate the dynamodb tables locally
Decoded APNG image: 3840 x 3840, 107 frames
Processed frame 1/107
[Function: Uint8ClampedArray]
Processed frame 1/107
holly shit this is taking foreverrr
umm what could be a solution to this
well its a big fucking image
thats fucking 59mb per frame lmao
ye, but once uncompressed it inflates like crazy
raw image bytes are basically 4 bytes per pixel for RGBA
3840 x 3840 x 4 = nearly 59 million
how much ram is your process using while processing those frames?
look man i am not home i am in a shitty device atm lmfao
this is without running the program
would another programing language like rust handle this better?
lmao
possibly, but thats just the cost of working with raw images
a compiled language would probably be able to process them faster, but it will still use a lot of memory
i plan into turning this into a web function
via the websocket i can let the user know of the progress
cant you downscale the images?
the thing is i expect all kinds of large images and i want the watermark to be able to take any size
well thats not a good idea since it introduces a resource starvation vulnerability
ik but only 1 person is going to use it eitherway
not a problem as long as you can handle it
would getting the image size and chopping the apng the right size for the input image make a difference
what do you mean your laptop doesn't have 32gb of ram?
i don't think it will unless i do it before taking the frames
stop flexing on me smh
also wifi
suckk ittt

I have ethernet too

