#development

1 messages · Page 2078 of 1

wheat mesa
#

Strings are also going to take up more storage in your database over time

#

Which if your bot grows may lead to a semi noticeable change in ram due to all the strings you’re caching

earnest phoenix
#

These types of optimizations would barely be noticable when running them a few times, since you're running them all the time in a Discord bot, it will be noticable, especially under heavy load

wheat mesa
#

As of right now you will notice no difference, but I’m sure you don’t want to continue writing it the same way and in the future have to rewrite all of it because you’re wasting performance

earnest phoenix
#

Regardless of them being noticable in your case or not, it's always better to optimize things

pine nova
#

are all discord channel ids 18 characters long?

wheat mesa
#

Think of your poor ram sticks seeing strings that should be bools

earnest phoenix
#

Unless it has a high risk of breaking something

wheat mesa
#

They would cry

quartz kindle
pine nova
#

i see

boreal iron
#

Older ones are shorter

earnest phoenix
pine nova
#

i see thank u

quartz kindle
#

but you can predict when the next length change will happen

ancient nova
#

okay I'll go rewrite everything

#

ig

wheat mesa
#

I believe there’s a utility class that has a helper function in djs that has a regex for checking if something is a snowflake

lyric mountain
#

imagine assuming snowflake is fixed length

wheat mesa
#

(I think?)

boreal iron
#

When saving them to a database just choose big ints

#

If that’s what you wanna know regarding char length

#

yay internet back oldEyes

boreal iron
near stratus
boreal iron
#

Tf

#

You’re crazy

wheat mesa
#

bigints take less memory!

boreal iron
#

Why not choosing longtext instead

#

I mean you can go for saving anything as binary data

sharp geyser
boreal iron
#

Then unhex any shit in any query you send

near stratus
sharp geyser
#

SnowflakeUtils came from Sapphire

ancient nova
#

so does parseBoolean exist in JS or not?

lyric mountain
#

why would u need it?

quartz kindle
#

snowflakes will become 19 characters long in a few days lel

#

22 jul

ancient nova
#

or is that a java only thing

quartz kindle
#

if my math is correct

lyric mountain
#

everything is a boolean in js already

boreal iron
ancient nova
#

what's the best way of casting "true" into a bool?

quartz kindle
#

yes

boreal iron
near stratus
boreal iron
ancient nova
#

😠

lyric mountain
#

aboose js' weak comparison

ancient nova
near stratus
earnest phoenix
ancient nova
lyric mountain
#

ah wait, it doesn't work

earnest phoenix
#

But that just considers the length of the string, not the content of it

quartz kindle
sharp geyser
#

eval("true") would give you the bool value

lyric mountain
#

ye just go with eval ig

ancient nova
lyric mountain
#

u could use jsfuck logic to unwrap it, but it's gonna result in lengthy code

ancient nova
quartz kindle
#

id just do this ```js
if(str.toLowerCase() === "true") { return true } else { return false }

sharp geyser
#

did you forget you shouldn't be the one doing this not them

ancient nova
lyric mountain
quartz kindle
#

and then saving the booleans instead

lyric mountain
#

then "people" is only you

quartz kindle
#

so in the future you just use booleans directly and not strings

boreal iron
#

Who tf saving booleans as strings in a database

ancient nova
#

bro I already told you

#

😠

boreal iron
#

My gosh save a number 1 or 0

sharp geyser
#

just use eval

#

😔

lyric mountain
#

my man doesn't trust himself to use eval

near stratus
#

evalGang

wheat mesa
ancient nova
sharp geyser
#

loop through all entries, change them to their actual bool values and then save

boreal iron
sharp geyser
#

what

lyric mountain
boreal iron
#

Shut up with your postgres

ancient nova
#

I'll just reset those values that need resetting

#

brb

near stratus
wheat mesa
lyric mountain
#

imagine leaking the token to yourself, you might invade your bot

boreal iron
#

My bad

earnest phoenix
#

My guy has internal demons telling him to leak his bot token or something

near stratus
#

TINYINT(1)

sharp geyser
#

fake I feel like you never read documentation

boreal iron
sharp geyser
#

people always bringing docs outt against you

boreal iron
#

Int 1 or 0

#

Yes tiny int to be really accurate

#

I see I need to be more specific

ancient nova
#

changed them from strings to bools

#

😉

lyric mountain
#

for a one-time refactor? eval is fine

boreal iron
#

But not boolean as type

lyric mountain
#

also I do use eval frequently in my bot, there are valid reasons

ancient nova
#

you do you I don't think I wanna risk having an eval in a place where people can mostly input their own stuff

lyric mountain
#

I didn't say "open" eval tho

lyric mountain
#

eval is just a tool, a way to execute arbitrary code during runtime

ancient nova
#

what?? but the point of my bots setting system is that they can customize what the bot can and can't do

earnest phoenix
#

Using eval in this case is extremely dumb and risky

lyric mountain
#

I mean, u definitely don't need to use eval for a simple setting toggle

near stratus
lyric mountain
#

we're saying that it's fine for using eval if you do need to

near stratus
#

tho I know better options

lyric mountain
#

it's not a "forbidden" feature

earnest phoenix
#

I don't think this is what they're trying to point out, they mean the users can input anything which they might pass to eval just to check if it's a boolean

ancient nova
near stratus
earnest phoenix
#

If they're just checking for the database values, they can indeed use eval to overwrite the values they need for the migration or whatever you want to call it, outside of it, just compare

ancient nova
#

😠

lyric mountain
#

just do ```js
if (feature) {
send("Feature was disabled")
} else {
send("Feature was enabled")
}

feature = !feature

ancient nova
#

I think that's fine. Definitely better than putting an eval there instead lol

boreal iron
#

It’s automatically false if it’s not a string being true?

#

That’s what you really want?

ancient nova
#

yes, that will make it if people put something like fuhh43t3t9th3h9h3th38 into my DB it's gonna be false

boreal iron
#

How tf can they put that in your database

#

Oh no no, FakE why did you ask

ancient nova
#

I said that they can put mostly anything there

near stratus
earnest phoenix
#

But let's consider an edge case, what if the user wants to put the value true as a string instead of a boolean

lyric mountain
ancient nova
#

what does it do?

boreal iron
#

For what sort of features or options people can set own values which being saved in your database?

earnest phoenix
#

Since you seem to allow them to put anything in there, and you also check for the boolean values directly by comparison, it becomes an edge case

lyric mountain
#

idk if js has that, it's literally what it reads

boreal iron
#

To clarify that

lyric mountain
#

it's an equal that ignores case

near stratus
lyric mountain
#

or else return _string === "true"

earnest phoenix
#

And the other operand being lowercase as well

lyric mountain
#

ye, I though js being js had something like java's equalsIgnoreCase

ancient nova
#

gonna be clearing the entire DB, lets not bother changing individual things

#

my bot isn't really that big for people to care

#

(I hope)

lyric mountain
#

the thing is```js
if (something) return true
return false

ancient nova
#

then what would you do?

lyric mountain
#

just return something

boreal iron
earnest phoenix
#

The main thing you're doing wrong here is letting user input anything they want, you're supposed validate them in some ways

ancient nova
boreal iron
#

Pretty much depends on the feature

ancient nova
#

I haven't sorted it much yet that's why it looks kinda ugly

lyric mountain
#

put all bool settings into a single field

#

separated by newline

ancient nova
#

if "true" convert to true if "false" convert to false if anything else leave it as string

earnest phoenix
#

This is also where slash-commands can help a lot, since by type of the values, the server-side validation of Discord can help narrow things down to make it as efficient and easy to work with as possible, but I suppose you aren't using slash-commands for whatever reason

ancient nova
#

fair right?

boreal iron
lyric mountain
#

that reminds me of reddit's isEven internal meme

ancient nova
quartz kindle
#

just return string lol

ancient nova
lyric mountain
quartz kindle
#

lmao

ancient nova
#

mine doesn't have 10 thousand if statements though

#

only 2

boreal iron
earnest phoenix
near stratus
boreal iron
#

But the way you designed that is already weird tbh

ancient nova
#

are you gonna torture me for the rest of my life for doing that now

#

relax

sharp geyser
#

you are the epitome of yandere dev

earnest phoenix
#

Gotta love how almost every problem ItsOkayBae encounters takes about an hour to resolve, literally almost every time

near stratus
#

I can I not harass you

ancient nova
#

now my thing doesn't regognize anything that used a bool input

quartz kindle
#

:^)

earnest phoenix
#

Sounds like the daily discord.js support channels

quartz kindle
#

susport

earnest phoenix
#

Well at least kudos for you to come up with problems that hard to resolve, must've taken you a long time

boreal iron
#

50% support nowadays for Bea a day

#

Wait till the message content is privileged

quartz kindle
#

ripperino

earnest phoenix
#

Oh lord, we'll be here helping them rewrite all their commands

quartz kindle
#

pepsi

boreal iron
#

‘My bot ain’t working anymore. Why?’

earnest phoenix
#

Coca-cope and Pep-seethe

boreal iron
#

Soon chargin cash for support will save your monthly income

#

Tim finally can afford to buy some food

ancient nova
#

🤨

sharp geyser
boreal iron
earnest phoenix
near stratus
#

Tim would be a billionaire

quartz kindle
#

lmao

#

if i charged for help, people would just leave

ancient nova
#

:[

near stratus
#

@ancient nova would be broke

earnest phoenix
#

Or let the owners of the server pay you so the people asking for help don't have to

ancient nova
#

anyway I got it working I guess

boreal iron
#

Last members left in topgg would just be some anime nerds

sharp geyser
#

fake

#

90% of the server is weebs

boreal iron
sharp geyser
#

so uh

#

too late?

boreal iron
#

I knew

#

I knew

ancient nova
#

what is the definition of a weeb

sharp geyser
#

even tim is a weeb

quartz kindle
ancient nova
#

🤨

earnest phoenix
boreal iron
sharp geyser
#

tim if you got paid 50 cents for every person you help but now you'd have millions

boreal iron
#

Only premium commands

ancient nova
boreal iron
#

And one not premium command telling you to buy premium

quartz kindle
#

xD

boreal iron
#

Take my words

#

You will see

ancient nova
boreal iron
#

dont even know any bots lol, just heard it's name quite some times

#

and no

#

that will be become the future of most of the bots

#

if this sort of feature will make it's way into discord

#

but since its about earning cash, it will most likely

round cove
#

OMEGALUL nice

sharp geyser
#

yea

#

but now idk how I wanna manage my bot

ancient nova
sharp geyser
#

poor planning

boreal iron
#

that's what they all say

ancient nova
#

with optional donations kek

sharp geyser
#

Don't rely on people to just donate

boreal iron
#

aye

sharp geyser
#

Chances are if they don't have to no one will

boreal iron
#

or you will end up like tim

ancient nova
boreal iron
ancient nova
sharp geyser
#

not really

#

a lot of them come from kickstarter or other websites like that

ancient nova
#

that's still just donations

#

most indie game devs don't make their games paid unless there's a big reason

sharp geyser
#

yes but that is with the promise of returning the product

#

if someone went on kick starter and didn't do what they said

#

shit would happen

ancient nova
#

twitter would cancel them lol

sharp geyser
#

there's probably legal consequences as well

ancient nova
#

yeah most likely

sharp geyser
#

Unless there is a valid reason as to why they couldn't achieve it

ancient nova
#

they would still have to give mooney back

#

or people would be mad 🤷‍♂️

#

wick wilding

#

it quarantines anyone who gets a role with even the slightest hint of permission

sharp geyser
#

makes sense

#

that role wick adds probably can only be removed by people with higher perms

#

at least that is the only reason i'd see it being a thing

#

it would prevent rouge staff from adding it to people

ancient nova
#

but also kind of annoying

#

why is it null?

sharp geyser
#

What did you change it to?

ancient nova
#

reset the nickname

sharp geyser
#

there ya go

#

problem solved

#

username !== nickname

ancient nova
#

ic

#

hold on

sharp geyser
#

I would recommend using displayName if it is still a thing

#

iirc it checks for a nickname first

#

then displays a username if there wasn't one

ancient nova
#

the syntax hightlight is freaking out

sharp geyser
#

like I said

#

displayName

sharp geyser
#

i'd use display name for both btw

#

in case the user comes from their username to a nick

pale vessel
sharp geyser
#

they already discovered that flaze

boreal iron
#

Why in the world do you pass arguments of your methods in new lines? then defining a var right behind it non using a new line?

sharp geyser
#

smh

boreal iron
#

my gosh

ancient nova
pale vessel
#

Just change it to [reset] or None

sharp geyser
#

well the prop is called .nickname...

pale vessel
#

Don't put the username

#

It's a nick lawl

sharp geyser
pale vessel
#

If it's reset it's reset

sharp geyser
#

🤷‍♀️

#

Don't see why it really matters

pale vessel
#

That shows the username if they have no nick, that's inaccurate

sharp geyser
#

it is just tracking what their name in the guild is

ancient nova
#

so if it's reset then the username shows up

#

if they have no nick it shows their username that's accurate, no?

pale vessel
#

But it's called nickname though

#

If they have no nickname then it should say so

#

Ykwim

sharp geyser
#

Nickname Changed -> Name Changed

#

ez

#

now flaze can shush /s

ancient nova
pale vessel
#

That's ambiguous

sharp geyser
#

ur ambiguous

pale vessel
#

😭

ancient nova
#

I don't log username changes as they're not related to the guild

#

I ony log nick changes

sharp geyser
#

also that anime you suggested flaze

#

kinda mid

ancient nova
pale vessel
#

Oh rip

#

I enjoyed it

sharp geyser
#

classroom of alites

boreal iron
#

but username changes also happen in guilds?!

sharp geyser
#

or whatever'

ancient nova
boreal iron
#

oh... why did I step in

ancient nova
#

ofc they do

pale vessel
#

The main character is really mysterious

#

Unknown backstory

sharp geyser
#

the main character gives me the vibes that he wants to kill himself 24/7

#

he never has his eyes open all the way

pale vessel
#

Maybe that's why I love it

sharp geyser
#

damn

pale vessel
#

I could relate

sharp geyser
#

flaze you ok?

pale vessel
#

/S

sharp geyser
#

wanna talk?

ancient nova
#

🤨

boreal iron
#

tf you're talking about

pale vessel
#

No I'm fine lol

sharp geyser
#

mhm sure

#

I mean ima watch it for now ig

boreal iron
#

must be some weird anime stuff

pale vessel
#

Still no anilist account?

sharp geyser
#

just kinda mid ngl

#

No

#

I don't remember all the anime i've watched so no reason

pale vessel
#

How

sharp geyser
#

I've watched so many

lyric mountain
#

I keep a gsheet of all I watch

#

gotta transfer to MAL one day but...too many for little motivation

near stratus
earnest phoenix
#

@near stratus Привет.. \ Hello..

near stratus
#

hello

ancient nova
#

I wanna make an invite logger, how exactly would that work?

near stratus
#

for every guild

ancient nova
#

maybe something that just tells who invited instead of saving invites?

near stratus
#

discord only provides guild info when someone joins

ancient nova
#

or just telling the user who joined from what invite?

near stratus
#

nope

ancient nova
#

also which one is better?

ancient nova
near stratus
#

not when someone joins with a invite

boreal iron
#

This event only triggers if the client has MANAGE_GUILD permissions for the guild, or MANAGE_CHANNELS permissions for the channel.

#

keep that in mind

#

Emitted when an invite is created.

near stratus
ancient nova
#

I see so there isn't an event to get information about who used what invite?

near stratus
#

not that I know

ancient nova
near stratus
ancient nova
#

okay I know it provides guild info I already use that event but can you somehow get out which invite was used?

boreal iron
#

You can find that out by yourself

#

Search the AuditLog for it

#

And the invites menu

near stratus
boreal iron
#

Neither this or that will show any informations about this

boreal iron
#

once you get limited or miss an invite it may count the member to the wrong invite

#

so pretty useless package

near stratus
#

cache all invites

user joins
fetch invites
check which one increased
check who created that invite

#

it's only option I can think

ancient nova
#

I don't actually want to count though, I just want to say which invite the person clicked to join the server

near stratus
#

you can't do that without counting

near stratus
#

It's just discord being gay over everything

boreal iron
#

You can only try to see which invite increaes it's count then assuming the last joined member used this invite

ancient nova
#

I see, then I'd rather not make that

boreal iron
#

there's no sense to determine this information

#

it might be important to who created an invite and maybe how many members joinend using it

#

much more information isn't important

ancient nova
#

I'll wait til discord maybe gives us the endpoint to check which invite was used cause I know for a fact that they log that since it shows up in the guild settings

boreal iron
#

they only tell you the amount of members joined using that invite

#

that doesn't mean they log the member who used which invite to join

lyric mountain
boreal iron
#

they just increase to number by one, once a member successfully joined

near stratus
boreal iron
#

join rewards

#

tf

#

there seems to be a weird idea for anything

#

´here get some virtual cookie emoji as reward´

#

smh

ancient nova
boreal iron
#

yes something the event also tells you

ancient nova
#

the event doesn't tell me that

#

you said so yourself

boreal iron
#

do you actually read your own messages before sending?

#

it also tells you who created the invite and the invite code which is exactly what I want

ancient nova
#

yeah the settings menu IN a guild not an event

boreal iron
#

the event tells you exactly who created it and gives you the code

#

tf you're arguing about

ancient nova
#

that's inviteCreate event?

lyric mountain
#

yes

#

it tells u exactly what invite was created

#

but u can't know when it's used unless u track it urself

ancient nova
#

that's fair

#

I can make an event for that

#

and emit when it increases

boreal iron
#

that's how the docs works

ancient nova
boreal iron
#

why this question

ancient nova
#

cause white mode bad

#

I'll call the event inviteUpdate, since I'll be tracking when the invite changes

boreal iron
#

read the requirement I've mentioned above

#

white mode is bad?

#

ok

ancient nova
boreal iron
#

and is generally bad

tf

#

blue light causes trouble

#

also i'm not using it at night

lyric mountain
#

the best thing to have

boreal iron
#

aye

#

just to summarize this

#

1min of searching around in the docs, will prevent 1h of discussion in here

#

just to say

#

life is short, same the time you can

#

tf is the difference

pine nova
#

there is select menu lesgo pepowot

boreal iron
#

smh

ancient nova
boreal iron
#

No

ancient nova
#

bruh u got my hopes up for nothing

pine nova
#

wot

#

thats a bot bro

#

u can do that

#

💀

boreal iron
#

it's an unannounced, still in testing feature

pine nova
#

bruh

#

but i am using it

boreal iron
#

not more and less

pine nova
#

copium

ancient nova
#

how to use that?

#

I would no cap update to v14 right now

pine nova
#

i am using v13

boreal iron
#

you pass a select menu component to your array of fields

pine nova
#

.8.1

ancient nova
#

NO WAY

#

AND I WON'T EVEN HAVE TO UPADTE???

#

GIVE DA CODE RN

#

I mean docs*

pine nova
#
const announcementModal = new Modal()
            .setCustomId('announcement-modal')
            .setTitle("Make an Announcement")
            .addComponents([
                new MessageActionRow({
                    components: [
                        new MessageSelectMenu()
                            .setCustomId("annpouncement-channel")
                            .addOptions([
                                {
                                    label: "Channel1",
                                    value: "Channel1",
                                }
                            ])
                    ]
                })
ancient nova
boreal iron
#

imagine using builders

ancient nova
ancient nova
pine nova
#

this is my code rn

ancient nova
boreal iron
#
{
            title: "title woo bad",
            custom_id: "custom_id_evil_evil",
            components:
            [
                {
                    type: 1,
                    components:
                    [
                        {
                            type: 4,
                            style: 1,
                            custom_id: "field1",
                            label: "label aurel also bad",
                            placeholder: "enter something or die",
                            max_length: 69,
                            required: true
                        }
                    ]
                }
            ]
        }
#

there you go a modal object as the api expects it

spark flint
pine nova
ancient nova
spark flint
#

like literally doesn't appear on mobile

ancient nova
#

nvm

forest drift
#

anyone here good with cloudflare? im struggling with setting up page rules to redirect

ancient nova
#

not gonna do that

spark flint
#

so if its required, it doesn't work

pine nova
#

yea its not working

#

not showing me the option

ancient nova
#

I'll maybe try doing that once it's no-longer-in-testing-and-is-fully-functional

#

but that's one of the only things I like about the interaction system ngl

boreal iron
#

soon 2032

pine nova
#

💀

boreal iron
#

maybe 2033 if people going crazy in the winter again cause of some covid flue

#

so... expect 2042

ancient nova
#

that's pretty freaking cool tho

boreal iron
#

well... you discovered now what people already been using for quite some time

#

reminds me of Kolumbus

ancient nova
#

so that's pretty freaking cool

boreal iron
#

i mean that button is quite useless but why not

#

you can just respond to a command interaction

ancient nova
boreal iron
#

wut

#

this looks "not cool"

#

?

ancient nova
boreal iron
#

you can just respond to a command interaction

#

i mean that button is quite useless but why not

#

you answered

#

yeah but it looks cooler this way soooo

#

i said pressing an additional button is useless

#

just open to modal on the command interaction

#

aka when sending the command

ancient nova
#

oh that's what you meant

#

it doesn't really make a difference for me tbh

#

button can be when the channel is locked

lyric mountain
#

when the file is not found

#

currently rewriting my image api, then this happened in dev

raw nest
#

I'm buildig a roles system.
How should I structure the DB?

like that?:

roles -> roles with their e.g. perms etc. (e.g. -> | role_id | name | perms |)
member_roles -> for each member's role a record (e.g. -> | user_id | role |)
lyric mountain
#

hmm...building a roles system?

#

roles for what? database? discord? formula 1?

raw nest
#

let's take Discord as an example. Roles like that

lyric mountain
#

ok, but is it going to be applied where?

raw nest
#

just as user management in the backend.

lyric mountain
#

well, simply have each role have an ID and a permission level

raw nest
#

yes and when a user gets a role (multiple possible) how do you track that? In the example above you create a record that the user got this role and has it now.

lyric mountain
#

have a third table to store user id-role relation

#

you didn't mention what kind of database it is

raw nest
#

mysql db

#

like 3 tables?:

  • roles
  • users
  • roles_of_users (user_id - role relation)
boreal iron
#

Yeah creating relations between your tables makes sense then is literally the basement of any permission and group system

lyric mountain
#

the relation will be N <-> N between users and roles, so u need a third table

boreal iron
#

Now this can be expanded with groups, users_groups, groups_roles etc

raw nest
#

ahh yes right! i then create a relation between them and if e.g. the role gets deleted the record where a user has this role also gets deleted.

boreal iron
#

To give you an idea

lyric mountain
raw nest
#

okay I understand. Thank you.

boreal iron
#

Just by joining other tables in your queries

raw nest
lyric mountain
#

just make sure to put the cascade on the correct side

raw nest
#

yes xD I will, ty

boreal iron
#

You can also add grant and negate values to your permissions defining which permission they can edit/delete for example

#

Like a multi layer permission system with grant and skip flags like TeamSpeak has

#

You can literally go crazy with that

raw nest
#

indeed! nice

boreal iron
#

Maybe you shouldn’t leak your API token

sharp geyser
#

Eh it's fine

#

;)

#

It'd be a pain to get the rest of it tbh

raw nest
#

nah you saw the repo and could just go to the file

sharp geyser
#

That's assuming it's even public

raw nest
#

ig it was ThinkO_O but idk anymore xD

#

doesn't matter either

analog bolt
#

e!setup

boreal iron
#

imagine not using slash commands

raw nest
#

Is a bitwise permission system enough scalable? Like if I would use int I would only be able to store 32 (or 31 I'm not sure) perms. Otherwise there's a bigint but that's only 64/63 too. ThinkO_O

cinder patio
#

well if you need more you could always use 2 numbers

lyric mountain
#

if u need more than 32 permissions u can always escalate to the next higher size

raw nest
cinder patio
#

2 32 bit integers

sudden geyser
#

If you have to use multiple numbers you've already lost.

lyric mountain
#

if bigint is not enough u can do as feud said, split the bitfield into 2 columns

cinder patio
#

still better than 64+ boolean fields

lyric mountain
#

there's a datatype that allows more than 64 digits iirc

#

we were discussing that last month

#

(or couple months, idrc)

sudden geyser
#

I'd rather a set of enum variants.

raw nest
lyric mountain
#

ah nvm, it was regarding another thing

#

anyway, decimal allows more digits than bigint

#

at the cost of having no decimal places

#

or u can store in a varchar

raw nest
lyric mountain
#

u can always partition a varchar into parseable numbers

raw nest
#

what?

lyric mountain
#

"12345678901234567890"
split
["1234567890","1234567890"]
parse
[1234567890,1234567890]

raw nest
#

ah yeah. ig I will use varchar. Probably most save on scale

lyric mountain
#

lemme say tho, it is HARD to think of more than 64 different permissions

raw nest
#

also true ThinkO_O xD

lyric mountain
#

like, it starts to get too specific after a certain amount of perms

#

discord being discord can fit everything into a bigint

raw nest
#

even Discord has only 37 perms ig xD

lyric mountain
#

close, 40

raw nest
#

really?

lyric mountain
#

the last perm

raw nest
#

okay

#

I took this to count lul

lyric mountain
#

actually, 41 cuz it counts from 0

raw nest
#

yeah but still not 64

#

true

#

but 0 must be a permission everyone has right?

lyric mountain
#

I meant index 0, not perm 0

#

this is the first perm

raw nest
#

ah well like that oh yeah xD

quartz kindle
#

theres still plenty of room to store permission bitfields in js numbers without using bigint

#

for those who want to optimize storage

lyric mountain
#

that'd be in db, not js specifically

urban cape
#

Is it possible to separate a video with 2 audio tracks. In a video without sound and 2 separate audio tracks.

spark flint
#

anyone know how to use maps with markers with Vue

#

really struggling to get it working kek

ancient nova
#

which one looks better?

#

the 2nd embed isn't actually functional it's just a test

lyric mountain
#

make the roles mentions

#

channels too

quartz kindle
#

i'd separate prefix and welcome message

lyric mountain
#

add the boolean checks to the right too

#

and ```diff

  • antiFish
  • antiPhish
#

what do u have against fish

quartz kindle
#

i dont like codfish that much

#

but i like tuna and salmon

urban cape
ancient nova
#

this is the actually functional version

ancient nova
quartz kindle
#

they dont have much relation to each other besides that

#

but whatever you prefer, its not a big deal

ancient nova
#

I'm just confused about putting them into 2 separate fields, I don't really have a title idea

#
            // CACHE_COUNT is the ammount of messages the user sent in a short timeframe
            if (CACHE_COUNT >= 10) {
                // Warn and mute the person for spamming after a warn.
            } else if (CACHE_COUNT === 5) {
                // Warn the person for spamming
            }
``` is this going to work?
#

if it's 5 warn, and then once it reaches more than 10 keep muting

#

I couldn't think of a better way of doing it

#

lol how do I check if something is a mention without regex

#

cause I know you guys would kill me if I used regex for that

#
        setEmbed.addField(
            "Roles",
            `modRole: ${roleRegex.test(serverSettings.modRole) ? serverSettings.modRole : `\`\`\`${serverSettings.modRole}\`\`\``}\nadminRole: ${roleRegex.test(serverSettings.adminRole) ? serverSettings.adminRole : `\`\`\`${serverSettings.adminRole}\`\`\``}\nmutedRole: ${roleRegex.test(serverSettings.mutedRole) ? serverSettings.mutedRole : `\`\`\`${serverSettings.mutedRole}\`\`\``}`
        );
        setEmbed.addField(
            "Channels",
            `modLogChannel: ${channelRegex.test(serverSettings.modLogChannel) ? serverSettings.modLogChannel : `\`\`\`${serverSettings.modLogChannel}\`\`\``}\nwelcomeChannel: ${channelRegex.test(serverSettings.welcomeChannel) ? serverSettings.welcomeChannel : `\`\`\`${serverSettings.welcomeChannel}\`\`\``}`
        );
``` lmfao
lyric mountain
#

...

#

yk backticks are multiline right?

#

...right?

ancient nova
#

I'm using it for individual strings

lyric mountain
#

no, u are using for a single string

ancient nova
#

for individual things in that string I mean

lyric mountain
#

exactly

ancient nova
#

but I'm going to revert it anyway I think it looked better without that

lyric mountain
#

backticks support multiline

#
let str = `
this
is
valid
`
ancient nova
#

yeah yeah I know

lyric mountain
#

know yet use \n with it freerealestate

ancient nova
#

I don't think that's a huge problem

quartz kindle
#

what if you put welcome message at the end in a code block

lyric mountain
#

for booleans u can use emoji form of \❌ and \✅

#

they look better than true or false

#

yeah, welcome message as a codeblock is a must

#

people love to set huge messages for it

quartz kindle
#

you can even color it

#

you can probably find a lang that has highlightng for {{}}

ancient nova
#

wait html has that?

urban cape
#

Is it possible to separate a video buffer with 2 audio tracks. In a video without sound and 2 separate audio tracks in javascript and how?.

quartz kindle
#

its an html template engine, similar to ejs

ancient nova
#

thanks for telling me that

earnest phoenix
quartz kindle
quartz kindle
earnest phoenix
#

(Won't work for mobile users sadly, ANSI is only available on Discord desktop and web)

earnest phoenix
quartz kindle
#

any example?

earnest phoenix
urban cape
quartz kindle
ancient nova
#

@quartz kindle I have a cool idea I'll send the finished embed here in a second

#

I hope it looks as good as i imagine it in my head

quartz kindle
ancient nova
#

I mean

#

@quartz kindle

#

is that better or worse I can't really tell

#

was it better when everything was sorted by type or now that I sort everything by modules

quartz kindle
#

since you already have "role", "welcomer", etc in the titles, you dont really need to repeat them

ancient nova
#

how would you structure the embed?

quartz kindle
#

Roles
mod:
admin:
muted:

welcomer module
enabled:
channel:
message:

ancient nova
#

I have to

#

I'll show you why

#

one second

#
{
  prefix: '-',
  modLogChannel: '[#734161576717844602](/guild/264445053596991498/channel/734161576717844602/)',
  modRole: 'Moderator',
  adminRole: 'Administrator',
  mutedRole: 'Muted',
  welcomeChannel: 'welcome',
  welcomeMessage: "Welcome {{user}} to {{guild}}. You're the {{memberJoinedCount}} user to join the server.",
  welcomeEnabled: 'false',
  allowNSFW: 'true',
  antiFish: 'true',
  antiSpam: 'false'
}
#

it goes like so: key, value
and it's case sensitive so I can't really do that

#

otherwise the user won't know how to change the key value

sudden geyser
#

How about asking the user for the specific setting they want to look at?

#

Right now it just looks like a control panel display.

ancient nova
ancient nova
#

since I'm not using slash commands ( and I don't plan to ) I can't really have it ask which specific settings the user want

#

cause I need the interaction system for that

sudden geyser
#

You can't do <prefix>settings <module> and have it, say, display current configuration?

ancient nova
#

yeah if you want to edit a module you do
<prefix>settings edit <modulename> <newvalue>

#

and the modules are very case sensitive so one mistake and it won't get recognized, most I can do is compare it with lowercases so typing welcomemessage will work the same as typing welcomeMessage, but that's about all I can do to for now at least

lyric mountain
#

why dont u make it case insensitive?

#

actually, why is that even an issue?

ancient nova
#

what do you mean?

lyric mountain
#

like, just make both lowercase as u said

#

casing shouldnt matter for commands

ancient nova
#

user has to type welcomeEnabled in order to change the welcomeEnabled value, how is that an issue?

ancient nova
lyric mountain
#

what if I want to type WelcomeEnabled?

#

(happens on mobile)

ancient nova
ancient nova
#

imagine this being the enmap

{
  prefix: '-',
  modLogChannel: 'mod-log',
  modRole: 'Moderator',
  adminRole: 'Administrator',
  mutedRole: 'Muted',
  welcomeChannel: 'welcome',
  welcomeMessage: "Welcome {{user}} to {{guild}}. You're the {{memberJoinedCount}} user to join the server.",
  welcomeEnabled: 'false',
  allowNSFW: 'false',
  antiFish: 'false',
  antiSpam: 'false'
}

now to comprae I usually do

enmapVariable["welcomeEnabled"] // will return it's value so false.
enmapVariable["welcomeenabled"] // will return undefiend since that value doesn't exist
#

do you see why it would be hard to make it not case sensitive?

lyric mountain
#

save it lowercase

ancient nova
earnest phoenix
rustic nova
#

nice length

ancient nova
#

let me quickly try writing this

earnest phoenix
#

I'm gonna wait until you come up with your abomination first before sending the simple solution

wheat mesa
#

Lmao

ancient nova
#

hold on let me eval what I wrote rq to make sure it works

wheat mesa
#

based voltrex

sudden geyser
#

God help you the moment you have a key that isn't directly set by the user

wheat mesa
#

It seems as though I’ve missed a good chunk of fun

ancient nova
#
const serverSettings = message.settings;
let serverSettingsLowerCase = [];
Object.entries(serverSettings).forEach(([key, value]) => {
     serverSettingsLowerCase.push([key.toLowerCase(), value.toLowerCase()])
});
serverSettingsLowerCase;
#

something like this maybe? @earnest phoenix

wheat mesa
#

The classic value.toLowerCase() for no apparent reason

ancient nova
#

read what we are talking about then you'll understand

wheat mesa
#

I did read

#

From what I understand you want the key to not be case sensitive

ancient nova
#

we are trying to convert message.settings array contents to lowercase?

ancient nova
#

someone just sent an invite

ancient nova
# wheat mesa ^?

yeah then voltrex suggested that we are to make all of the keys lowercase

wheat mesa
#

I don’t see why the value needs to be lowercased unless that’s what you intended

ancient nova
#

and the snippet above is my take on that

ancient nova
sudden geyser
#
  1. The value does not need to be lower case (nor will it always be)
  2. You should consider using an object and setting the key, rather than using an array of arrays as keys.
wheat mesa
#

You do understand how maps work, right?

#

Wait a minute array of arrays???

#

Wtf

earnest phoenix
ancient nova
#
let serverSettings = message.settings;
serverSettings = Object.fromEntries(Object.entries(serverSettings).map(([key, value]) => [key.toLowerCase(), value]));
serverSettings;
#

better?

earnest phoenix
#
Aurel is a good catgirl
ancient nova
#

discord accepts ansi escape codes?

lyric mountain
#

nah, that's the power of using metric system

rustic nova
#

works great on mobile

#

istg

#

always

lyric mountain
#

see, 31m, 0m, 33m

rustic nova
#

mobile being made redundant it's cring

lyric mountain
#

discord is made with react, they could literally use the web version to compile for mobile

#

that if discord was responsive at all

ancient nova
#

:c

#
Red! Green! Yellow! Blue! Magenta! Cyan! White!
Red Green Yellow Blue Magenta Cyan White
              
              
#

niceeee

earnest phoenix
ancient nova
#

never knew that worked with discord

earnest phoenix
#

can you upload in a txt file

earnest phoenix
ancient nova
# earnest phoenix this example
Red! Green! Yellow! Blue! Magenta! Cyan! White!
Red Green Yellow Blue Magenta Cyan White
              
              
#

just copy that

earnest phoenix
#

thx

#

hahaha

#

i can also see there

#

ok

earnest phoenix
#

@ancient nova

#

if i paste it

#

Red! Green! Yellow! Blue! Magenta! Cyan! White!
Red Green Yellow Blue Magenta Cyan White
      
      

#

this happens

ancient nova
#

u have to use markdown

earnest phoenix
#

k

#

Codeblocks.

#

which one ?

#

there are some like ini?

#
Red! Green! Yellow! Blue! Magenta! Cyan! White!
Red Green Yellow Blue Magenta Cyan White
              
            ```
#

LOL

quartz kindle
#

ansi

#
Red! Green! Yellow! Blue! Magenta! Cyan! White!
Red Green Yellow Blue Magenta Cyan White
            
            
earnest phoenix
ancient nova
#

it works @earnest phoenix

#

wanna test it out?

#

instead of server settings I lowered the case of the default settings and compared those when checking key validity

#

works better

ancient nova
#
communication_disabled_until: Could not parse +125148-01-28T18:20:00.698Z. Should be ISO8601.``` ms package trippin?
boreal iron
#

Just write something exclusively for the PC version

#

There ain’t much people using smartphones

iron vector
#

The money is not enough when the food cost is the maintenance cost or something.

quartz kindle
#

e

boreal iron
earnest phoenix
#

is there a way to get passed the channel.history limit? i said "none" but i feel like its...limited to x

vivid fulcrum
#

assuming you're using dpy

#

theoretically, there's no limit

#

in practice the API request allows up to 100 messages maximum

#

but you can pass more than that to dpy because dpy automatically batches requests depending on the amount of messages you want to get

#

i.e. for 100 messages it'll send one request, for 130 two requests, for 200 two requests, for 230 three requests and so on

pine nova
radiant kraken
raw nest
#

I want to create tests with jest for my DB.
Now I don't want it to write actually to the database. I read something about creating a whole database and the whole stuff and after the test drop the db. Is that a good option?? (mariadb)

pale vessel
#

You need to return status 200 or it'll keep sending the same payload

near stratus
#

Don't wanna be rude but that looks like Minecraft enchantment table language

torn topaz
pine nova
#

i am getting a warning can anyone tell me whats it about?

(node:1948) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
winged linden
#

yoo can anyone help, lets say 2 users did the command at once, first message wont get fully edited, any idea why?

near stratus
pine nova
#

i see

sharp geyser
#

cause 2 users ran the command at once

lyric mountain
#

well, my guess is either a faulty logic or hitting edit ratelimit bucket

pine nova
#

but shows edited on both embed so prolly not ratelimit

lyric mountain
#

I imagine u do 3 edits on each message, one for each slot right?

#

then it'd happen like this:

A = first message
B = second message

A1
B1
A2
B2
---- ratelimit prevents A3
B3
rustic nova
#

doesnt stuff wait then?

#

like it doesnt send A3 and B3, but after a bit sends both?

lyric mountain
#

for most libs, yes

rustic nova
#

if some library drops request

#

then that library is shid

#

if by default ofc

lyric mountain
#

they didn't specify what lib not showed any code, so this is just a blind guess

#

could also be some exception happening during prize calculation

pine nova
sharp geyser
lyric mountain
#

inb4: it's only random gibberish in the enchant table

hallow compass
#

How to make discord log in authorities in website

lyric mountain
#

identify scope to be precise

earnest phoenix
#

How to Make Music on cogs with Discord Py Lavalink

lyric mountain
fathom sonnet
#

Do you guys take notes of what u have to do or just rememeber everyshit

#

Like we doo on balkans

lyric mountain
#

I just remember what I remember and forget what I forgot

quartz kindle
fathom sonnet
#

xd

quartz kindle
#

lmfaoo

fathom sonnet
#

JOKE

sudden geyser
vivid fulcrum
stark abyss
vivid fulcrum
#

probably because you have two BrowserRouter instances

#

remove the one from index

winged linden
compact marsh
#

how i can return if a user is a bot

quartz kindle
wheat mesa
#

if(user.bot) return

#

lol

quartz kindle
#

ha

wheat mesa
#

beat me to it

quartz kindle
#

and out of all the ways to answer it, we both went for the exact same one

#

no code blocks, no context

#

lmao

#

no brackets

#

no semis

wheat mesa
#

I was too lazy for such an answer

#

Been racking my brain on regular expressions grammar for a while

compact marsh
# quartz kindle if(user.bot) return

if (!user.bot) return;
if i did this the bot dont send any message

if(user.bot) return
the bot sends message if the user is a bot or not a bot too

quartz kindle
#

then you're doing something wrong

#

show code

compact marsh
#

let user = interaction.guild.members.cache.get(args[0]);

quartz kindle
#

bots cant use interactions

#

afaik

wheat mesa
#

I think he's trying to see if a fetched user is a bot

compact marsh
#

yes

wheat mesa
#

It's probably crashing if I had to guess, since I don't think he's checking if the user is null or not

#

Do you have an error message of any sort?

compact marsh
#

no

wheat mesa
#

Can you show more code than just one line

compact marsh
#
  let user = interaction.guild.members.cache.get(args[0]);

    let bot = new MessageEmbed()
      .setColor('#2f3136')
      .setDescription(`${False} Please provide a **bot** only, not a **real user**`)
    
    if (!user.bot) return interaction.followUp({ embeds: [bot] });
compact marsh
quartz kindle
#

well guild.members.get will get you a Member object

#

Member doesnt have .bot

#

User does

compact marsh
#

ohhh yes

#

i forgot

#

@quartz kindle ty so much ❤️

#

@wheat mesa thx too

sharp saddle
#

Just to confirm

Discord.js v13

<guild>.me```

Discord.js v14
```js
<guild>.members.me```

is correct?
quartz kindle
#

👍

#

and also guild.members.fetchMe() if me is not cached

sharp saddle
#

ty Mac

#

Tim*

#

damm

#

I got confused

ancient nova
#

really???

lyric mountain
#

meanwhile jda: <guild>.getSelfMember()

#

idk why djs loves to add intermediary steps for everything

quartz kindle
#

guild.me has always been a nullable prop, only returning the bot member if it was cached

wheat mesa
#

There's a GET endpoint for your user for a reason mmLol

woeful pike
#

I don't really understand why djs is chasing the perfect API architecture

#

like these changes make the API feel cleaner but are they really necessary? idk

wheat mesa
#

djs devs are bored and want to continue getting paid

#

gotta find things to change

stark abyss
vivid fulcrum
#

try rendering in strictmode

#

you might get something useful

radiant kraken
#

wtf

#

imagine getting paid for maintaining an API wrapper

lyric mountain
#

Jda does, 1k bucks per month

stark abyss
#

uh ok

earnest phoenix
#

I need some help regarding the awaitMessages collector in djs

#

I literally have no idea how to cancel that nor avoid multiple of those awaitMessages stacking up

#

my goal is to have one awaitMessages running at a time

#

I tried the docs and stackoverflow but no results to my issue

uneven tartan
#

hi

#

@lyric mountain

#

or

#

anyone for that matter

#

is this valid

wheat mesa
#

I mean I would just use a ternary operator on the string rather than the object itself

radiant kraken
uneven tartan
#

thanks

earnest phoenix
#

np

pine nova
#

whats the permissions required to timeout members/users? like which permission to check

sharp geyser
#

Timeout Members

boreal iron
sharp geyser
#

I guess discord calls it differently internally

pine nova
# boreal iron

so if i check for perms in djs i type MODERATE_MEMBERS or TIMEOUT_MEMBERS?

boreal iron
#

There’s no timeout members permission

sharp geyser
#

That is just what discord calls it in the app

boreal iron
#

No

sharp geyser
#

Yes?

boreal iron
#

No

sharp geyser
#

tf

#

it is literally right there

boreal iron
#

The docs specify the permission name as moderate members

sharp geyser
#

Internally and externally are two different things fake

#

Internally it is MODERATE_MEMBERS externally it is viewed as Timeout Members

boreal iron
#

The display name doesn’t need to match the api value

sharp geyser
#

Mf

#

I just said that

boreal iron
#

Why are you bitching around then?

sharp geyser
#

I already corrected my mistake and said on discord it has a different name

boreal iron
#

There’s no timeout members permission

#

That’s it

sharp geyser
#

you're the one bitching mf

#

The permission name internally isn't timeout members but on discords application side it is called that

#

so I got mixed up

#

which I already corrected