#development

1 messages · Page 135 of 1

earnest phoenix
#

The hell

frosty gale
#

same reaction

lament rock
#

do it

frosty gale
#

oh wait i see what theyre doing

lament rock
#

execute order 66

frosty gale
#

theyre only using it to compare two roles

#

in a very weird way

#

this code hurts my head

sick agate
#

yeah same

proven lantern
earnest phoenix
hushed robin
#

whats a BigInt

frosty gale
#

yeah but cant they just do if id === id2

lyric mountain
#

a long

slender wagon
#

Is there a killsswitch for a discord rpc

frosty gale
#

but thats comparing ids not positions

frosty gale
#

what are these mfs cooking

lyric mountain
#

cache

lament rock
#

Soon, the JS Jedi temple will fall

frosty gale
#

i shouldnt expand that macro

pale vessel
#

motherfuckers

#

I'll do that for you

deft wolf
frosty gale
#

well he expanded it alright

earnest phoenix
#

How dare you say that Flaze, you shall be applied a pregnancy mute!!

sharp geyser
pale vessel
frosty gale
#

not necessarily some are open source contributions by normal people

lyric mountain
#

ids are longs

sharp geyser
#

ids are just stringified big ints are they not

frosty gale
lyric mountain
#

since always

sharp geyser
lyric mountain
#

we just use strings cuz they're more convenient

frosty gale
#

i mean its more efficient than strings but i thought they always used strings

proven lantern
lyric mountain
#

bigint in js case

proven lantern
#

strings of number characters

lyric mountain
#

I mean in discord side

lament rock
#

You cannot do math on strings in JS

frosty gale
lyric mountain
#

there're some shenanigans for calculating an id

#

it's not solely based on timestamp

lament rock
#

Snowflakes are complex

lyric mountain
#

nope

lament rock
#

Dates are the main contributer for IDs to overflow into character length

sharp geyser
lyric mountain
#

ids are constant, there's a field for role positions on the data discord sends

lament rock
#

0 is a valid ID btw, but nothing is attached to it

sharp geyser
#

isn't clyde ID 0?

hushed robin
#

why dont they just integrate big int with int

#

that way u just need to usue int

lament rock
#

clyde is fake. Not a user

earnest phoenix
#

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.

sharp geyser
#

I thought it still got an ID

#

wrong channel buddy

lament rock
#

The client fakes Clyde

neon leaf
#

why cant I use typescript parameter decorators in projects that emit declaration files? 🤔

frosty gale
#

it would be convenient if ints rolled over to bigints if large enough

lament rock
#

The only system account user ID is

#

643945264868098049

frosty gale
#

but might be annoying to keep checking

lament rock
#

If you ban System from your Discord, community updates stop

#

Discord#0000

sick agate
#

lol

sharp geyser
#

Sounds like fun

hushed robin
#

@urban karma

lament rock
#

You can fetch the user from the API

sharp geyser
#

What are you confused about

lament rock
hushed robin
frosty gale
#

i just accepted it at this point

pale vessel
#

it is

#

otherwise there's no need to use bigint

frosty gale
#

but ids are unique to a role and dont depend on role position?

pale vessel
#

that's only for the if statement

sharp geyser
#

I mean easiest way to find out why they did it is to ask in the djs server

frosty gale
#

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

pale vessel
#

;/

frosty gale
#

maybe the djs nerds know

#

actually ill try find code that uses that function

pale vessel
#

look at the return in the if block

frosty gale
#

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

pale vessel
#

not sure why they don't just return a 0?

lyric mountain
#

wonder how do u even get 2 roles at the same position

sharp geyser
#

yknow I was going to ask djs themselves but I can't be asked

frosty gale
#

assuming theyre both positive

pale vessel
#

by providing the same roles

frosty gale
#

which ids are positive

lyric mountain
#

I mean, yeah but there HAD to be some precedent for them to add that check

frosty gale
lyric mountain
#

it's like when people write ```java
if (somevalue == null) {
somevalue = null;
}

sharp geyser
#

It could be a fail safe in case shit like that happens

sick agate
#

likely

frosty gale
#

true

#

wtf is djs cooking

pale vessel
#

try checking the commits for that file

sick agate
#

discord js experience

pale vessel
#

maybe they explained why they did that

frosty gale
#

git blame to the rescue

earnest phoenix
# hushed robin why dont they just integrate big int with int

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

frosty gale
#

this is an old commit

sharp geyser
#

so each commit history gets wonky

lyric mountain
sharp geyser
#

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

frosty gale
#

but theyve renamed files so you cant be sure

lyric mountain
#

no, I mean the PR

proven lantern
lyric mountain
#

u can click on the hash number at the top

#

to see if anyone commented abt that line

frosty gale
lyric mountain
#

here

#

only 2 talking abt it

sharp geyser
# lyric mountain

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

earnest phoenix
# proven lantern any plans to switch the number type to DEC64?

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

lyric mountain
#

edge cases as lorax said

hushed robin
#

why don't you guys ask in the discord.js server?

#

they have a forum for stuff like this

lyric mountain
#

he speak for the trees d.js

sharp geyser
#

In case 2 roles where made at the EXACT same time

sharp geyser
#

Which is why its called an edge case, it isn't something likely to occur all the time

#

but still a possiblity

lyric mountain
#

reasoning for this (the one I mentioned) code is usually to prevent bit flips from cosmic rays

quartz kindle
#

although wiki says dec64's range is larger than bin64

keen juniper
#

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?

proven lantern
lyric mountain
#

bot is supposed to be your client instance

keen juniper
#

yes thats what i mean

lyric mountain
#

the one u used for login

earnest phoenix
sharp geyser
#

just pass whatever client instance you made when running the bot

keen juniper
#

alrigt

sharp geyser
#

@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

hushed robin
#

i made my own library

#

it's easy

lyric mountain
#

it's all fun and giggles until a cold gust comes and u notice there's nowhere to hide

sharp geyser
#

Its fun for the first 2s then you realize you shouldn't but you're already too invested to turn back

lyric mountain
#

then you see a polar bear (cloudflare) coming running at u

sharp geyser
#

and realize you've hit your 1000 login limit cause of a bug with your websocket send method

lyric mountain
#

1 day respawn timer

sharp geyser
#

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

hushed robin
#

guys

#

does anyone have an example of how to connect to the gateway

sharp geyser
#

Yes discord does!

hushed robin
#

where

sharp geyser
#

On their docs

hushed robin
#

link

sharp geyser
#

which you would know if you actually made your own library

earnest phoenix
# proven lantern what does it mean for rounding to be biased?

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

sharp geyser
pale vessel
sharp geyser
#

they have a .dev domain now?

pale vessel
#

they've always had it

sharp geyser
#

Really?

#

damn

hushed robin
#

i don't see code here

#

where's the code

lyric mountain
proven lantern
#

or before?

sharp geyser
#

you'll eventually find it

hushed robin
#

theres no code examples

lyric mountain
#

lmao

#

ofc there aren't

#

I mean, there's one

#

in python KEKW

sharp geyser
#

Okay maybe I exaggerated there isn't really any code on how to connect

#

but it tells you how

lyric mountain
#

too bad battle is allergic to python

sharp geyser
#

with a neat diagram

hushed robin
#

i need code example

lyric mountain
hushed robin
#

i've never worked with websockets before

sharp geyser
#

basically you wanna be spoon fed

#

ye no thanks

hushed robin
#

it doesn't make snese

lyric mountain
#

damn that sucks

pale vessel
#

python is literally pseudocode 😭

hushed robin
#

would i use this websocket

lyric mountain
#

python is a runnable yaml

hushed robin
#
sharp geyser
#

not to mention that has comments

sharp geyser
hushed robin
#

ok

sharp geyser
#

that's what I used for my lib

lyric mountain
#

rust devs sweating

frank pollen
#

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.

earnest phoenix
sharp geyser
#

they just dont like telling people

frank pollen
#

Could it be related to the Discord API?

quartz kindle
frank pollen
#

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(`![alert](https://cdn.discordapp.com/emojis/1099237393728553000.webp?size=128 "alert") 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"
  };```
proven lantern
lyric mountain
frank pollen
#

i will test it 1 second.

pale vessel
#

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

hushed robin
#

um

pale vessel
#

that command seems really spammy though

hushed robin
#

maybe hes getting ratelimited?

#

lmao

deft wolf
#

I will wait 4-5 seconds before adding role to next member

pale vessel
#

it's even better to await it

hushed robin
#

probably is

#

lol

deft wolf
#

On big servers it's gonna take some time but yes

frank pollen
#

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.

earnest phoenix
# quartz kindle this is what wiki says:

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

frank pollen
#

I agree, it seems that Discord does not allow instant role assignment.

hushed robin
hushed robin
#

so you don't get ratelimited

solemn latch
#

👀 what is tast.wait() ?

#

task*

pale vessel
#

roblox dev moment

hushed robin
#

roblox :lego:

frank pollen
#

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!

proven lantern
earnest phoenix
#

But having a lower limited precision is worse, where it's required in lots of places like I mentioned at the end

quartz kindle
#

i still dont get it, it says both have 16 digits of precision

sharp geyser
#

this is most commonly used in loops in lua

earnest phoenix
#

If you need mostly accurate comparisons then you would need to use an approximation with an epsilon of correct size to do it right

hushed robin
#
await new Promise(resolve => setTimeout(resolve , 250));
#

you can do something like that to mimic it

frosty gale
#

reset your mongodb login

hushed robin
#

🧌

maiden gazelle
#

fr

solemn latch
#

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 👀

earnest phoenix
frosty gale
pale vessel
earnest phoenix
#

Yep, epsilons are pretty important

quartz kindle
frank pollen
#

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.

hushed robin
#

thats basically it

hushed robin
#

quartz kindle
#

i still largely dont get binary floating points

#

they use a bunch of math tricks

#

i hate math

frosty gale
#

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

grim aspen
#

i hate math too

solemn latch
quartz kindle
#

14

grim aspen
frosty gale
#

theyre represented in twos complement too

proven lantern
#

0.1 + 0.2 < 0.3 + Number.EPSILON && 0.1 + 0.2 > 0.3 - Number.EPSILON
new JS idiom. i will do this everywhere

quartz kindle
#

but it uses base 10 exponents

#

because idk how to do it with base 2

hushed robin
#

why do people use moment.js so much if it's not getting updated anymore

frosty gale
#

they like to live in the moment

maiden gazelle
#

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] })
      
}
}
earnest phoenix
maiden gazelle
proven lantern
frosty gale
#

yeah have to fetch it

hushed robin
maiden gazelle
#

oh

frosty gale
#

is data.channel the id of the channel?

lyric mountain
#

In groovy we just ```groovy
someArray.each {
...do stuff
}

maiden gazelle
hushed robin
#

lmao is discord down?

frosty gale
#

check if channel exists though!!

deft wolf
lyric mountain
#
someArray.each {
    Thread.sleep(millis)
} 
earnest phoenix
hushed robin
#

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

lyric mountain
#

Not unlimited no

hushed robin
#

u need to apply for priviliged intents

lyric mountain
#

After a certain point u kinda do another verification

hushed robin
#

uncapped

#

no more stuck at 100

lyric mountain
#

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

hushed robin
#

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

maiden gazelle
hushed robin
#

.setThumbnail(interaction.guild.iconURL()) i think

maiden gazelle
tulip ledge
#

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

frosty gale
maiden gazelle
earnest phoenix
lyric mountain
#

There's a soft cap

#

Where u can no longer login from the sheer amount of requests

lyric mountain
#

They have that expanded limits program exactly for such big bots

earnest phoenix
lyric mountain
#

Yeah, it's not like a hard cap

hushed robin
lyric mountain
#

But unless u get approved for expanded limits ur kinda stuck at that limit

hushed robin
#

they just can't use it

#

🧌

hushed robin
lyric mountain
#

If you manage to get denied you're stuck at that limit

hushed robin
#

so

#

your bot is basically done for

#

wym

#

if you can't login

#

then it's done for

lyric mountain
#

You can login with most shards

#

But the last shards won't connect

hushed robin
#

oh

lyric mountain
#

Cuz you've hit the daily limit

hushed robin
#

i see

#

i get it

earnest phoenix
#

I have not seen a single large bot get denied for higher ratelimits, you must do something incredibly stupid to be denied for it

lyric mountain
#

And iirc the bot is reduced to a crawl from the remaining ratelimits

lyric mountain
earnest phoenix
#

Yeah I know

hushed robin
#

whats stopping people from lying in their verification application

grim aspen
#

being banned from discord

#

jk idk

lyric mountain
#

ToS and the fact that they track your requests

frosty gale
#

but thats usually because it can be managed by the bot itself

lyric mountain
#

So they can audit if what ur saying is true

frosty gale
#

something like doing 2 requests instead of 1 or delays

hushed robin
#

probably not

grim aspen
#

no

earnest phoenix
frosty gale
#

they wouldnt deny them just because they want to though

earnest phoenix
lyric mountain
#

When u hit the CONNECT limit u can't login at all for 1 day

frosty gale
#

they reserve that for bot verification

earnest phoenix
#

Note that the login limit is 1,000 per day by default

maiden gazelle
hushed robin
#

🗿

earnest phoenix
frosty gale
#

lol

maiden gazelle
frosty gale
#

i swear glitchs dying now that it got acquired by some company and they basically killed bot hosting

#

forums are almost dead

lyric mountain
#

I mean, glitch was 80% discord bots

quartz kindle
#

and repl.it captured all the leavers

#

lmao

frosty gale
#

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

grim aspen
#

there's a reason we(not me)don't use glitch anymore

hushed robin
#

i assume u have it in your database?

frosty gale
#

they also suspend any project automatically that has an npm library that automatically handles uptime robot pings lmao

sick agate
#

Lmfoa

#

fun fact

grim aspen
#

reminds me of when youtube ratelimits API requests on discord bots

hushed robin
#

just get a cheap server

maiden gazelle
frosty gale
#

wont be surprised if they sent an email to everything saying "its been fun"

sick agate
solemn latch
#

👀 replit will go the same way, I mean locking down bot hosting

sick agate
#

possible

grim aspen
#

i still use a vps

frosty gale
#

they also downsized massively they used to have a few forum support staff now theres only one

solemn latch
#

heroku went that way too

hushed robin
quartz kindle
#

a few years ago

#

lmao

sick agate
#

a few years ago

grim aspen
#

issue with replit being a host is that if your project is public basically it's free real estate

sick agate
#

yup

earnest phoenix
sick agate
#

free real tokens

frosty gale
#

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

hushed robin
grim aspen
#

basically like github

hushed robin
#

for like $5 a month

grim aspen
frosty gale
lyric mountain
#

U have to be stupid to buy glitch premium

hushed robin
quartz kindle
frosty gale
#

well maybe i dont wanna buy a whole yaer

grim aspen
#

a VPS is cheaper than replit and glitch premium combined

hushed robin
#

for $5 / month u can just get a real server

#

soooooooooo

sick agate
#

yup

hushed robin
#

i agree

grim aspen
#

screw glitch

frosty gale
#

galaxygate with their $3 a month vps hosting:

hushed robin
#

I love galaxygate

solemn latch
#

👀 how would they make money off ads?

earnest phoenix
hushed robin
#

been with them for awhile

grim aspen
#

digital ocean is good (not promoting)

frosty gale
#

yeah galaxygate is great

grim aspen
frosty gale
#

UwU im allowed bc im girl

#

sorry thats not inclusive

lyric mountain
hushed robin
#

are you sexist?

#

😱

grim aspen
#

wtf

frosty gale
#

no im so sorry 😭

#

i didnt mean it

earnest phoenix
#

DigitalOcean is generally the best one you're gonna get if you can afford it

sick agate
#

UwU

grim aspen
#

it's what i use

frosty gale
solemn latch
#

Lets make a host like glitch just for this

hushed robin
#

i've had 0 downtime in 6 months with do

sick agate
#

genius

grim aspen
#

but also if you can't afford to pay digital ocean vps then you can easily get blacklisted

sick agate
#

imagine ads in nuke bots

hushed robin
#

why doesn't discord allow u to advertise on your bot

#

that would be a perfect money maker for big bots

lyric mountain
#

They do allow wdym

hushed robin
#

no

lyric mountain
#

U just can't shove it

grim aspen
#

tfym they do allow it

hushed robin
lyric mountain
#

U can put ads if they're not intrusive

hushed robin
grim aspen
#

p2w games

lyric mountain
grim aspen
lyric mountain
#

That's called shoving

grim aspen
#

we meant like putting it on bot bio or something

lyric mountain
#

Or in a profile image or smth

hushed robin
grim aspen
#

^

hushed robin
#

why don't popular bots do this

#

sell advertising

lyric mountain
#

Because they're popular

#

They're already worth their weight in donations

oak cliff
#

Discord doesn't allow you to target users with advertisements

hushed robin
#

so can u or not

grim aspen
#

but you can put ads in your bot's bio

oak cliff
#

So you can't put sponsors or partners in the footers of embeds

grim aspen
#

bro what

#

i think that's contradiction

oak cliff
#

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

hushed robin
#

hm ok

grim aspen
#

that makes sense now

oak cliff
#

So a !partners command is fine to have as the user has to run the command to see it

hushed robin
#

is that how carl gets away with their /play roblox command

#

lmao

lyric mountain
#

hm, a bit weird but makes sense

oak cliff
#

But in the footers of other responses is not allowed as the user isn't consenting or soliciting the ad

lyric mountain
#

kinda of how we use -vote for asking to vote in topgg

oak cliff
#

They've talked about it a lot in the dev server

lyric mountain
#

that's technically ads

oak cliff
#

Anything relates to the bot you can promote freely, such as a support server or website

#

But anything else isn't allowed

spark flint
#

Absolute moment

oak cliff
#

That would be fine yeah

hushed robin
#

so can i theoretically have a button for a user to watch an ad to get a reward?

oak cliff
#

I remember someone saying something about it

spark flint
#

Bluestacks also advertised their targeted sponsors thing that used discord message data, until they had to close it down

oak cliff
#

Idk I'm not discord lmao

spark flint
#

But it would still be unsolicited since it’s advertising a completely different platform/bot

oak cliff
#

Probably have to ask in the ddevs server

spark flint
#

Anyways discord doesn’t enforce bot tos

oak cliff
#

I know we've declined those survey type reward bots before

#

Fill out surveys for cash and then redeem it

spark flint
#

Discord dev compliance team confirmed Mushroom violated tos regarding something I can’t disclose yet and then didn’t take action against them

oak cliff
#

Oopsie poopsie

spark flint
#

Actually i can probably disclose soon

grim aspen
spark flint
#

Been nearly 90 days

grim aspen
#

like i mean have surveys in topgg

oak cliff
#

They have let bigger bots/companies in the past slightly skew tos in their favor lmao

spark flint
#

Yeah

oak cliff
#

But that's a company making money for you

grim aspen
#

unless i don't remember properly

frosty gale
#

but you should ask

spark flint
#

Well this was serious violation and privacy issue

oak cliff
#

Making exceptions to make money 💰

hushed robin
#

was just wondering

#

🧌

frosty gale
#

a few bots got banned personally by the dev team manager or whoever that is for advertising on discord lol

#

because people kept complaining

hushed robin
#

also i can't even cus i'm sadly banned from the discord developers server

#

i wish there was a way to appeal

frosty gale
#

well didnt get banned they just had their verification taken away

oak cliff
#

Email discord support?

#

Idk if they take appeals that way

grim aspen
#

lmao battleless banned from discord devs

hushed robin
#

i sent too many emojis and automod banned me 😭

grim aspen
#

imagine

earnest phoenix
#

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

frosty gale
lyric mountain
#

battle basically tried to act like he does here

oak cliff
#

Lmao

lyric mountain
#

which is "no" or "why" or "😐"

frosty gale
#

now you need to get banned from discord itself

lyric mountain
#

except ddevs is no topgg

grim aspen
hushed robin
#

🫠

lyric mountain
hushed robin
#

i didn't

#

i was just sending emojis to express my emotions

#

and kept forgetting automod deletes them

lyric mountain
oak cliff
#

Emotes are more useful in messages with context snd not by themselves

#

Imo at least

earnest phoenix
hushed robin
#

they for some reason said emojis will not be allowed in hyperlinks

#

so i wanted to know why

spark flint
hushed robin
#

no sympathy

lyric mountain
hushed robin
#

it did affect my bot a lot

lyric mountain
#

I can see why they severely limited hyperlinks, the possibilities of scam are endless

hushed robin
#

most the things are in hyperlinks

#

i was very emotionally angry

lyric mountain
#

just use regular links

#

or use buttons

hushed robin
#

will look cluttered and more ugly

hushed robin
grim aspen
#

for me i agree with kuu and hyperlinks, i can mask a scam link in a hyperlink easily

hushed robin
#

let me show you my bot

#

theres really no good way to do this without hyperlinks

#

without it looking weird

lyric mountain
#

remove the emojis and they still work

hushed robin
#

hyperlinks still work even with emojis

#

they said they wouldn't tho

lyric mountain
#

it's not like ur bot will die with the changes

hushed robin
#

maybe they changed their mind

lyric mountain
#

they likely didn't push the changes yet

#

or applied only to user hyperlinks

#

as those are the most likely to be scams

hushed robin
#

it takes over 2 months to push a change?

#

🧌

lyric mountain
#

discord took a year to push modals

#

and did it half-assed

hushed robin
#

they should update modals

#

and add text input buttons

spark flint
#

they added dropdowns for a bit

#

i used to use em

#

there is iframes coming though

hushed robin
#

but they were very broken

#

and didn't even work on mobile

spark flint
#

it passes user session because it uses oauth

spark flint
#

and were then removed

hushed robin
#

that happened awhile ago

#

why is it taking so long to add back

hushed robin
#

sometimes modals are too overkill for a simple input

frosty gale
#

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

hushed robin
#

cus discord is focusing on useless updates no one asked for

#

👿

earnest phoenix
#

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

frosty gale
#

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

earnest phoenix
#

They made super reactions instead, who the hell asked for them!?

frosty gale
#

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?

spark flint
#

yes

spark flint
#

they are adding some new thing

hushed robin
#

literally

spark flint
#

lemme grab what its called rq

frosty gale
#

theyre even jumping on the ai bandwagon with their clyde ai or whatever

spark flint
#

they are adding collectibles

hushed robin
#

did reddit end up changing the pricing of the API

spark flint
#

no

frosty gale
#

no theyre still sticking to it

hushed robin
#

lol

spark flint
#

but they got hacked

hushed robin
#

💀

frosty gale
#

imagine discord makes the api paid

spark flint
#

and are being held for 4.5 million and the data revert

hushed robin
#

thats crazy

sharp geyser
frosty gale
#

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

sharp geyser
#

A paid api means no shitty bots

#

or less shitty bots

spark flint
#

they are adding premium through Discord

frosty gale
#

oh right they did

spark flint
#

so either guilds or users can be premium

frosty gale
#

are they forcing bots to use that instead of their website?

spark flint
#

they would make like 5% profit per subscription, imagine how big bots are

lyric mountain
#

isn't premium nitro already?

sharp geyser
#

I think its optional

spark flint
#

no they are just giving access to large bots

spark flint
#

so not to be mixed with nitro

lyric mountain
#

they're adding turbo then

frosty gale
#

theyll prob start forcing premium stuff to be done on their paltform

spark flint
#

probably

#

look at how much dyno and mee6 and bloxlink etc make

#

now imagine 5% which discord is missing out on KEKW

frosty gale
#

but thats fair because not all large bots are very profitable giants

spark flint
#

makes you wonder why only the large bots were given access

frosty gale
#

some just want to provide a service and have enough to keep running

hushed robin
#

i mean having it builtin is also good for developers too

#

makes it easier

sharp geyser
#

dyno mee6 and bloxlink make way more then to keep it running

frosty gale
#

well yeah not those bots

maiden gazelle
# hushed robin when you have array of servers ```js for (const server of servers) { ... } `...

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!" })
      
  }
}
sharp geyser
#

majority of the large bots out there that are decent make way more than to keep afloat

spark flint
sharp geyser
#

Largely due to donations or premium features

hushed robin
#

then interaction.editReply(...)

maiden gazelle
hushed robin
#

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?

maiden gazelle
#

guild

#

checks if a guild has it enabled

hushed robin
#

if it only returns the guild how are you doing server.channel

#

server is not a guild id

hushed robin
#

log and and send a screenshot here

#

so i know what you're working with

earnest phoenix
hushed robin
earnest phoenix
hushed robin
#

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

earnest phoenix
#

I don't really use Reddit either, though I've stumbled upon multiple helpful posts that are now in private subreddits

lyric mountain
hushed robin
#

yeah I sometimes find some answers to my issues on reddit

lyric mountain
#

some subs agreed to reopen but now are only posting shit

earnest phoenix
#

Yeah

lyric mountain
#

malicious compliance iirc what it's called

#

loved it

maiden gazelle
hushed robin
maiden gazelle
#

how would you check if servers have it enabled

hushed robin
#

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

maiden gazelle
#

yea idk how i can loop through it

deft wolf
#

I'm always using for let loop

hushed robin
deft wolf
#

I don't know, forEach is kinda tricky for me

hushed robin
#

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

maiden gazelle
hushed robin
#

...

#

i highly doubt it's a guild object

#

because .channel wouldn't exist on it

maiden gazelle
#

channel is that it would send the add to a specific channel in the server

hushed robin
#

can you tell me what it is

#

what is inside it

maiden gazelle
#

you okay if i send a sourcebin link of how i set it up

hushed robin
#

well

solemn latch
#

I dont think thats needed

hushed robin
#

or you can just console.log(server) and send what it returns

maiden gazelle
#

okay

hushed robin
#

(inside the loop)

solemn latch
#

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

hushed robin
#

😵‍💫

hushed robin
#

ok

#

so u can't get the guild from the cache with that

#

bc that's not a guild id

maiden gazelle
#

its only sending the ad in the server where it has been interacted

hushed robin
#

also, what's the point of this? you should be able to access all that with server.description and server.invite

hushed robin
hushed robin
#

🫠

solemn latch
#

I kind of regret learning typescript, makes things like this painful.

#

f

#

automod

hushed robin
#

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

solemn latch
#

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.

hushed robin
#

oh wait, i think i misunderstood what you're trying to do

solemn latch
#

But yeah, passing it between files is better ^-^

solemn latch
hushed robin
#

sexy mongo url 🥵

quartz kindle
#

lies, mongo cant be sexy

hushed robin
#

sqlite is better

#

🧌

lyric mountain
#

damn mongoose killed python

earnest phoenix
#

PostgreSQL best 🗣️💯🔥

hushed robin
frosty gale
#

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

earnest phoenix
frosty gale
#

i will benchmark

hushed robin
frosty gale
#

😠

#

thanks for backing me up

#

we will fact check voltrex

earnest phoenix
#

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

lyric mountain
#

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

earnest phoenix
hushed robin
earnest phoenix
#

Easier but much less efficient

hushed robin
#

It’s very efficient

#

I’ve been using it for all my projects and it works wonderfully

quartz kindle
#

plus this benchmark uses an ORM :puke:

earnest phoenix
#

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

lyric mountain
#

also is sqlite really easier?

#

like, once u have both set up they're mostly the same

quartz kindle
#

also people never factor in sqlite's unfair advantage of not having a network stack

lyric mountain
#

except postgres adds a bunch of (good) stuff on top of the basic sql

quartz kindle
#

benchmarking sqlite against other dbs is not a simple thing, its very hard to produce a fair comparison

earnest phoenix
#

True

hushed robin
#

I have no idea how to setup a postresql database

#

but I can easily setup a SQLite one

quartz kindle
hushed robin
lyric mountain
hushed robin
quartz kindle
#

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

hushed robin
#

my data is written a lot

hushed robin
quartz kindle
#

social networks

#

chaf apps

hushed robin
#

🤨

quartz kindle
#

banks

earnest phoenix
lyric mountain
hushed robin
#

cap

#

your bot doesn’t make millions of operations per minute

lyric mountain
#

1 million per minute is measly 16k ops per second

hushed robin
#

unless it’s mee6s size

lyric mountain
#

nope

hushed robin
#

tell me how your bot is making millions of operations a minute

lyric mountain
#

mee6 would be in billions per minute

hushed robin
#

your bot is relatively small

lyric mountain
hushed robin
#

I doubt the number is that large

lyric mountain
#

large? lmao

#

1 million per second is large, but per minute is just regular database usage

hushed robin
#

nah

#

your capping

quartz kindle
#

anyway, its a matter of knowing the right tool for the job

lyric mountain
# hushed robin nah

to give you a sense of scale, let's say we have 100 users across 10 servers, that's 1000 users

quartz kindle
#

sqlite is pretty much the best thing you can get, up to a certain limit, beyond that you have no choice

lyric mountain
#

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

quartz kindle
#

of course you have caching and batching, right? :^)

lyric mountain
#

yep, the lib I use handles that

quartz kindle
#

gotta love eventual consistency

lyric mountain
#

plus postgres also has a cache layer

hushed robin
lyric mountain
#

my bot is in 7792 servers

hushed robin
#

show me real statistics

#

these are made up

lyric mountain
#

top is servers, bottom is users

hushed robin
#

i am not a Spanish speaker

lyric mountain
#

not discord users mind you, users registered on the database

quartz kindle
#

lmao

lyric mountain
hushed robin
#

maybe 1% of those million are sending a message every minute

#

that’s nothing

lyric mountain
#

???

#

who tf sends 1 message per minute?

hushed robin
#

someone who says hi then leaves?

#

it’s very common

lyric mountain
#

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)

quartz kindle
#

my bot was getting arround 200 messages per second at 9k servers, if i remember correctlt

spark flint
#

mine gets around 50-75 per second at 1.87k servers

#

and it scans each one using regex KEKW

quartz kindle
#

lmao

hushed robin
#

so in conclusion that’s not even near millions

spark flint
#

and has to check scam links, invite links etc for each one

hushed robin
#

🤨

hushed robin
#

discord has auto mod now

spark flint
#

...because its an antiscam bot

#

ok and

#

its not that effective

hushed robin
#

ok

#

use discords built in one

lyric mountain
spark flint
#

lol

hushed robin
spark flint
#

yes and

#

i can't constantly update every server for every scam domain or server invite

hushed robin
#

how much more effective can it get

spark flint
#

the bot has stopped 50k scams in the last year

quartz kindle
#

i remember skmeone here was getting 500+ messages per second on a 2k bot or something, bexause of a handful of very large guilds

hushed robin
lyric mountain
#

sounds like something you'd do

hushed robin
#

I do do it

#

my bot made 94550 transactions yesterday

quartz kindle
#

thats a lot of trans action

#

:^)

lyric mountain
#

well, told ya it's something you'd do

hushed robin
#

to know my statistics

lyric mountain
#

until you notice that logging every transactions doubles the amount of transactions

lyric mountain
#

it does tho

hushed robin
#

how

lyric mountain
#

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

hushed robin
#

no I don’t do that

lyric mountain
#

then ur not logging

hushed robin
#

It’s on a discord message that I update every 25 transactions

hushed robin
#

🤨

lyric mountain
#

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

hushed robin
#

so

#

I only need to know daily

#

also

#

I can just divide by 24 to find that

lyric mountain
#

it'll only be an average, no peaks or valleys

#

worth shit nothing for statistics

hushed robin
#

average is ok

slender wagon
#

Battleless seems like a good guy until you scroll up

pale vessel
#

explain

hushed robin
hushed robin
#

does anyone know where I can find a large amount of 5 letter words

solemn latch
#

Do you just want all 5 letter words?

hushed robin
#

479k is crazy

#

we really got that many words lol

solemn latch
#

the crazy part is its only 6.5mb for the entire file

pale vessel
#

bro is creating the next wordle

hushed robin
#

tbh it’s impressive how i can remember 479k words

hushed robin
#

also guys

#

when should you use single quotes and double quotes

pale vessel
#

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)

pale vessel
#

nah

#

you can still use either and escape any conflicting characters

hushed robin
#

ok

lament rock
#

fuck it we template literal everything

hushed robin
lament rock
#

I do code professionally, but am I a professional at code? To be debated

hushed robin
#

you are indeed a pro coder

pale vessel
#

@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

https://discord.gg/fireship

🔗 Resources

...

▶ Play video
proven lantern
pale vessel
#

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

proven lantern
#

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

slender wagon
#
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

quartz kindle
#

thats fucking 59mb per frame lmao

slender wagon
#

the apng it self is like 10mb

#

i compressed it and everything

quartz kindle
#

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?

slender wagon
#

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?

quartz kindle
#

lmao

quartz kindle
slender wagon
#

also since telegram is timing out

quartz kindle
#

a compiled language would probably be able to process them faster, but it will still use a lot of memory

slender wagon
#

i plan into turning this into a web function

#

via the websocket i can let the user know of the progress

quartz kindle
#

cant you downscale the images?

slender wagon
quartz kindle
#

well thats not a good idea since it introduces a resource starvation vulnerability

slender wagon
#

ik but only 1 person is going to use it eitherway

quartz kindle
#

not a problem as long as you can handle it

slender wagon
frosty gale
slender wagon
#

i don't think it will unless i do it before taking the frames

slender wagon
#

also wifi

#

suckk ittt

frosty gale
slender wagon
frosty gale