#development

1 messages · Page 1656 of 1

toxic jolt
#

Which country do you live in?

lyric mountain
#

well, no, unless you can work cache-less

#

that is, solely based on api calls

wooden rover
toxic jolt
#

16 GB Ram and Amd ryzen 5900x 1.157,28 Rupi

lyric mountain
#

also, why are those bars cut?

carmine summit
#

I just took a break from coding for 6 months and totally forgot everything about javascript

toxic jolt
#

I don't know your economy, is it expensive or cheap.

carmine summit
#

clap clap

lyric mountain
#

if it means you gotta work below 50%, forget about it

wooden rover
lyric mountain
#

using caches I expect you go go upto 500 maybe 750 servers

#

without cache about 1500-2000

#

but it'll be slow af

toxic jolt
#

My friend has a hosting company

wooden rover
toxic jolt
#

no problem

#

I used to be like you so I understand

#

I used glitch for 1 years

wooden rover
#

O nice

toxic jolt
#

My bot didn't hold glitch so I decided to buy vds

#

currently located on 1 million users and 30 thousand servers

#

Reached 30 thousand servers from 10 servers

lyric mountain
#

don't use users as a metric smh

wooden rover
#

Nice

#

I don’t think glitch can’t maintain many servers

lyric mountain
#

wait, 1 million -> 30k servers?

#

that doesn't sum up

#

but anyway

#

just try to save a lunch money once a month

toxic jolt
#

what

lyric mountain
#

vps cost about $4

toxic jolt
boreal iron
#

In JavaScript, you cannot pass parameters by reference; that is, if you pass a variable to a function, its value is copied and handed to the function (pass by value). Therefore, the function can't change the variable. If you need to do so, you must wrap the value of the variable (e.g., in an array).

God damn... JS sucks

empty forge
#

How to check if someone voted for my bot on top.gg ?

toxic jolt
#

I live in Turkey

#

If I do not eat anything for 30 days, I only get vds money.

toxic jolt
#

The economy sucks

lyric mountain
#

like, objects are passed by reference

empty forge
#

I know a free vps

lyric mountain
#

you can't do object = new object obviously

#

but you can do object.setSomething(something)

wooden rover
sly grotto
boreal iron
# lyric mountain that's kinda misleading
test("test", 123, "abc");

function test()
{
  test2(arguments);
//  for(let i = 0; i < arguments.length; i++) console.log(arguments[i]);
}

function test2(a, b, c)
{
  console.log(a, b, c);
}

Just as example. Then u know what I mean.

empty forge
pale vessel
#

"free VPS"

#

uh oh

empty forge
#

you Can buy

#

but it's free

sly grotto
#

what do you all prefer for hosting your discord bot

#

example

wooden rover
sly grotto
#

i use heroku

lyric mountain
#

@boreal iron

empty forge
pale vessel
#

Heroku's 512mb ram might not be enough as your bot grows

wooden rover
lyric mountain
#

I could change the object's parameter because objects are passed by reference

pale vessel
#

but other than that, it's good

lyric mountain
#

else it'd still be empty

pale vessel
#

used it for more than a year until switched to a VPS

lyric mountain
#

what's not passed by reference are primitives

wooden rover
tulip ledge
#

Is it worth learning TS or should I stick with JS?

pale vessel
#

Depends

#

If you're willing to learn it & love type safety, why not?

tulip ledge
#

why is TS better then js?

boreal iron
# lyric mountain <@!243443167704121344>

I'm not trying to pass an array or object as argument. You basically can't call the function and pass the raw arguments to it using another function. Doesn't work in JS.

#

Crap

pale vessel
#

Type safety

tulip ledge
#

what is type safety?

pale vessel
#

It makes sure you use correct types for everything

empty forge
#

How to check if someone voted for my bot on top.gg ?

lyric mountain
pale vessel
#

from objects (you use interfaces and classes) to parameters

lyric mountain
#

like, objects are always pass-by-reference

pale vessel
#

of course all of this are transpiled to pure JS

#

so end of the day it's still JS

#

The compiler is 🏳️‍⚧️

tulip ledge
#

alright ty I'll probably learn it

boreal iron
# lyric mountain define "pass raw arguments"
test("test", 123, "abc");

function test()
{
  test2(arguments);    // > Object { 0: "test", 1: 123, 2: "abc" } undefined undefined
  test2(arguments[0], arguments[1], arguments[2]);    // > "test" 123 "abc"
}

function test2(a, b, c)
{
  console.log(a, b, c);
}

It's not possible to pass the dynamic amount of arguments - from test() - to test2()

#

In a raw form - the data type they are - without passing all arguments as array or object

lyric mountain
#

ohhhh that's what u mean

boreal iron
#

Seems like there's no way to make it work in JS

lyric mountain
#

btw, define arguments there

boreal iron
#

I can't change test2()

#

That's my issue.

#

If so it wouldn't be an issue.

lyric mountain
#

what's arguments in that example?

#

js built-in way of retrieving args?

boreal iron
#

Any kind of args, each data type

#

as in my example

lyric mountain
#

can't u do ...arguments?

boreal iron
#

argument a could be a string, int or float, array or obj

#

that's how it is lmao

lyric mountain
#

I can't really understand that example

#

what is "arguments"?

#

give an example with actual variables please

boreal iron
#

arguments is a js static var

lyric mountain
#

and they represent?

wooden rover
#

I am making a second bot

lyric mountain
#

the method's input variables?

boreal iron
#

They represent the arguments you pass to a function.
Makes sense to use the static var for functions you're passing a dynamic amount of parameters.

lyric mountain
#

ok, now that's clear

#

is there any lang that allows u to pass args that way?

#

like, js is the most arbitrary lang I've ever seem

boreal iron
#

but as I said... I read a little about it and well js doesn't support a native way like PHP does for example

wooden rover
#

Glitch banned uptime robot

lyric mountain
#

glitch/heroku aren't meant for bots

#

that's why

pale vessel
#

You can use Heroku's worker dyno for bots

#

You just need a remote database since Heroku has ephemeral storage

lyric mountain
#

yeah but like, it's just a matter of time before heroku does something similar

empty forge
#

How to check if someone voted for my bot on top.gg ?

pale vessel
#

They wouldn't, worker dynos don't sleep

#

So you don't need to do anything

lyric mountain
#

no, I mean, before they do something about bot hosting

pale vessel
#

I doubt it

#

They give you 512mb of ram and CPU for you to use (they have no reason to limit it)

#

Plus if you use too much memory they restart your app

#

yeah

lyric mountain
#

before or after discord verification?

earnest phoenix
#

after of course

lyric mountain
#

then it's good

lyric mountain
#

also glitch being plug-n-play

earnest phoenix
#

Is it normal that other bot copy's your description

lyric mountain
#

no

#

like, carbon-copy?

earnest phoenix
#

nah just keywords copy and features

lyric mountain
#

like, if it is a legit copy you can call mods to review that

earnest phoenix
#

I hate bots, which tell that they have the feature but they do not have it in fact

earnest phoenix
dusk scarab
#

Is anyone here able to help me modify my command handler to support subfolders?

empty forge
#

...
do you know how to check if someone voted for my bot on top.gg ?

dusk scarab
#

yup

empty forge
#

yes but how

umbral zealot
dusk scarab
#

which guide?

#

oh

#

thanks

#

LOL

empty forge
#

ok thanks

dusk scarab
umbral zealot
#

Of course it is

dusk scarab
#

I have a handlers folder with command_handler.js

#

and event_handler.js

umbral zealot
#

This is example code, adapt it to your needs.

dusk scarab
#

ok ill keep trying

solemn leaf
#

Can someone help me with fonts on canvas

#

they wont work

carmine summit
#

how do I know if a message is from a dm???

lusty quest
#

check the channel type

earnest phoenix
carmine summit
#

what is the conditioni?

#

ok thanks

earnest phoenix
#

nP

solemn leaf
#

nice spoonfeed

wooden rover
#

97% cpu usage bruh

lusty quest
#

you can write a entire python program in one line

#

but its possible

solemn leaf
#

I can make my whole bot 1 line

#

in js

#

uh what

#

I can write whole java programs in 1 line

lusty quest
#

it doesnt change how it works, its just the readability of the code

solemn leaf
#

it all gets complied to machine code anyways

cinder patio
#

java gets compiled to bytecode

dusk scarab
#

guys, thats literally not spoonfeeding tho

solemn leaf
#

it is

dusk scarab
#

if he sent his entire bot file like here ya go an entire command, thats spoonfeeding

#

bruh so ur telling me this entire channel is spoonfeeding?

solemn leaf
#

@rustic nova

dusk scarab
#

lol

#

Anyways I came here to ask, how do I do it so that my help command goes like:
-help mod to show the moderation commands?

solemn leaf
#

yyou need categories

#

for your commands

#

then you need to map it

carmine summit
#

uhh

dusk scarab
#

hrm, ok

#

i shall try

carmine summit
#

client.users.cache.get(index[1]).send()

#

ive checked index[1], its my discord id

solemn leaf
#

okay cool

cinder patio
#

probably not cached

cinder patio
solemn leaf
#

google

#

can you point me to the direction of where I can get a fonts file

carmine summit
#

let user = client.users.fetch(index[1])?

#

then

#

user.send("HI!")

pale vessel
#

await, yes

carmine summit
#

correct??

#

ok ok thanks

solemn leaf
#

flaze

hushed wraith
#

I randomly get disconnected from discord, I read online that this is an old problem with DJS.
Does anyone know how to avoid it ? or fix it ?
could not login to discord (AbortError: The user aborted a request.)

earnest phoenix
solemn leaf
#

I know

#

I fixed it

carmine summit
#

what is the function to convert 12345 to 12,345 ??

hushed wraith
carmine summit
#

I know there is, I just dont remember the function

solemn leaf
#

then google it

rustic nova
#

simply saying "google it" doesn't help

solemn leaf
#

learning google dorking always help when you want to start developing

rustic nova
#

still not a solution just saying "google it"

solemn leaf
#

@carmine summit would you look at that #toLocateString

carmine summit
#

toLocaleString?

#

ok

feral aspen
#

.toLocaleString()

solemn leaf
#

or numberFormat

feral aspen
#

Oi

carmine summit
#

numberFormat sucks

feral aspen
#
.setThumbnail("../images/image.png")
#

Is this possible?

lyric mountain
#

no

#

you gotta send the image as a file then do attachments://image.png

feral aspen
#

I want to save the picture locally to the files then use roots to require it.

lyric mountain
#

still

#

send the file with the message then use attachments://image.png

#

discord can't access your local files

feral aspen
#

Well, alright I guess.

lyric mountain
#

omfg

#

ok, lets consider you're hosting on a lettuce

#

still

#

send the pic

#

use attachments://image.png

feral aspen
#

Alright, thanks.

#

👍

lyric mountain
#

you cannot use local paths for discord-related stuff

slate oyster
#

I have too many members documents...

#

I plan to just drop them all when I finish my rewrite

lyric mountain
#

guess you should consider moving to sql if you have member/channel/guild stuff

#

those stuff are 99% the time related to each other

slate oyster
lyric mountain
#

yeah but like, you're using a non-relational database for relational stuff

slate oyster
slim heart
#

the increase in rss is likely the overhead that comes with two processes,

lyric mountain
#

if you say so...

earnest phoenix
#

i like mongodb mysql is trash

lyric mountain
#

mysql is

#

sql is not

earnest phoenix
#

nah sql with connection :C

lyric mountain
#

??

earnest phoenix
#

that would be cool if you have quick.db with connection

#

i mean seperated hosted db like mongo

lyric mountain
#

you do know sql is supposed to be hosted remotely right?

slate oyster
#

@lyric mountain What's the benefit of a relational DB over just using a long (and an int, in V4) to keep track

earnest phoenix
lyric mountain
lyric mountain
earnest phoenix
#

mongodb has a faster insert speed

quartz kindle
#

speed depends on many things

slate oyster
quartz kindle
#

not only the database software you chose

lyric mountain
#

it's easier to fix now while the hole is small

lyric mountain
#

actually, any database can

slate oyster
lyric mountain
#

you're not approved yet

#

once you get approved on top.gg you'll see a faster growth

slate oyster
lyric mountain
slate oyster
#

Oh, ok

earnest phoenix
#

it depends on the idea.If it is not unique it will never grow

lyric mountain
#

it will

#

trust me

quartz kindle
#

it will because top.gg users are stupid

lyric mountain
#

remember:

quartz kindle
#

they just randomly add bots for no reason

slate oyster
lyric mountain
#

isThirteen() is an actual npm package

#

do you think you can get more redundant than that?

earnest phoenix
#

@slate oyster what is your bot about?

slate oyster
lyric mountain
#

think u can compete againt that? KEKW

earnest phoenix
#

lol

earnest phoenix
lyric mountain
#

you see, no matter what your bot do, you can't get too generic

#

there'll always be people to invite it

slate oyster
#

My only concern about it is rate limits, but webhooks should help with that a tiny bit if I ever decide to support them

lyric mountain
#

but really, you should consider sql

slate oyster
# earnest phoenix you can await them

Java doesn't have the await keyword Thonk
Discord4J automatically handles rate limits, but it doesn't prevent my bot from freezing, so I want to implement load balancing

earnest phoenix
slate oyster
#

Yea

earnest phoenix
#

jda is trash

lyric mountain
#

it's not tho

slate oyster
#

Never tried JDA tbh

earnest phoenix
#

with await i mean to set a timeout and execute it later

lyric mountain
#

jda handles quite well ratelimits

#

lori right?

#

also mantaro

slate oyster
#

Groovy switched to D4J iirc

earnest phoenix
#

jda lib bugs sometimes

lyric mountain
#

define "bug"

earnest phoenix
#

like the onready event does not get executed sometimes

#

but that is a long away

#

i will never leave my lovely js

earnest phoenix
slate oyster
earnest phoenix
#

lol

#

. gets deleted

lyric mountain
#

and djs handles shards as separate proccesses KEKW

#

but anyway

#

java has jpa, which can make your sql stuff easy af

earnest phoenix
#

have to go off 👋

slate oyster
lyric mountain
#
EntityManager em = Manager.getEntityManager();
AMember mb = em.find(AMember.class, id);
#

like this

slate oyster
lyric mountain
#

I know, but as I said

#

it's not meant for relational data

slate oyster
lyric mountain
#

what's a reactive stream?

#

like, give an example

slate oyster
#

Here's some of my code using them (V4)

lyric mountain
#

where should I look at?

#

nvm, just say what it does

slate oyster
lyric mountain
#

that's...vague

lyric mountain
#

just say what it does smh

#

what does it have to do with mongo?

slate oyster
lyric mountain
#

ok, I'll consider that RS stuff to be like java's stream api

#

where are you using mongo there?

feral aspen
#
        const image = new MessageAttachment('../../other/images/attitude_white_background.png', 'attitude_white_background.png')

        const embed = new MessageEmbed()
        .setTitle("Bot Information")
        .setColor(cyan)
        .setImage("attachment://attitude_white_background.png")
``` Did I do something wrong?
slate oyster
feral aspen
#

It doesn't send the pic.

lyric mountain
#

you didn't send the image

umbral zealot
#

you didn't attachFile()

lyric mountain
#

but like

umbral zealot
slate oyster
lyric mountain
#

let's leave that here for a second:

public static void saveMember(AMember mb) {
  EntityManager em = Manager.getEntityManager();
  
  em.getTransaction().begin();
  em.merge(mb);
  em.getTransaction().commit()

  em.close();
}

public static void getMember(User u) {
  EntityManager em = Manager.getEntityManager();

  try {
    return em.find(AMember.class, u.getId());
  } finally {
    em.close();
  }
}
#

and let's consider I want to update AMember xp

slate oyster
#

return em.find(AMember.class, u.getId());

#

In V4 I actually use multiple IDs though

lyric mountain
#

that's my example in jda

slate oyster
#

I have the user ID
And then the client ID (0 for Discord, 1 for Nertivia)

lyric mountain
#

let me finish

#
User usr = //lets say you got a user object somewhere

Stream.of(usr)
  .map(MemberManager::getMember)
  .peek(m -> m.addXp(10))
  .forEach(MemberManager::saveMember);
#

(Stream's forEach is not normal forEach btw)

#

normal forEach is bad

#

that code would retrieve AMember object, add 10 xp then return to database

slate oyster
#

Iirc

lyric mountain
slate oyster
lyric mountain
#

dude

#

do you know what "example" means?

slate oyster
#

Oh, ok

final lynx
#

ik that making embeds are probably easy, but im having trouble making one. can anyone help

lyric mountain
#

you didn't tell me exactly what RS is, so I supposed to be similar to Stream api

final lynx
#

javascript

#

im on vscode, im using discord.js, and javascript

lyric mountain
#

couldn't you point me to a less oracle info? KEKW

final lynx
#

d o e s n o t c o m p u t e

lyric mountain
final lynx
#

i need it so when i say

slate oyster
final lynx
#

so

#

if i have

lyric mountain
#

maybe, but you get the idea

final lynx
#

(prefix + 'commands')

#

then the embed will appear

lyric mountain
#

my point is, with jpa you can abstract much of that SQL queries

#

so migrating to sql might be a lot easier

final lynx
#

the only problem with that is

lyric mountain
final lynx
#

yes

#

i had

lyric mountain
#

then read that guide

#

it'll show exactly how to work with embeds

final lynx
#

then

#

makes enbed*

#

and idk how to put it together

lyric mountain
#

the guide

final lynx
#

ill look again

lyric mountain
#

don't look

#

read

#

it'll not give you a hot-from-the-oven example

final lynx
#

this is what i have

#

when i look at it

#

it says

#

if you say, ()commands

#

then the bot will make a embed

#

and say it

#

but it does not work

earnest phoenix
#

what is the channel?

final lynx
#

shouldnt it just respond to my message

earnest phoenix
#

use message.channel.send

final lynx
#

like this?

earnest phoenix
#

No, you did msg, do msg there

#

like

#

msg.channel.send

#

and try

final lynx
#

this?

earnest phoenix
#

yes

final lynx
#

ok

#

ill try it

lyric mountain
final lynx
#

it didnt work

earnest phoenix
#

chechk the console log

final lynx
#

ok

#

this is what i have btw

earnest phoenix
#

no look the cmd

final lynx
#

it says

earnest phoenix
#

There must be an error in the log

final lynx
#

message not defined

earnest phoenix
#

can you show me the error

#

oh

#

okay

#

message.content

#

do msg.content

final lynx
#

i blurred my name

earnest phoenix
final lynx
#

where should i put message.content

earnest phoenix
#

if (message.content.startsWith
if (msg.content.startsWith

final lynx
#

ok

#

like this?

earnest phoenix
#

yes

final lynx
#

ko ill try it

#

ok*

#

thank u

earnest phoenix
#

you are welcome

lyric mountain
#

that's example's embed KEKW

#

why do people always do this

final lynx
#

ya

#

it is

#

why does that matter

lyric mountain
#

because you didn't learn how it works

#

you just copied

final lynx
#

b u t

#

it didnt work

earnest phoenix
#

😄

final lynx
#

until @earnest phoenix help me fix it

lyric mountain
#

which wasn't embed issue at all but message check

final lynx
#

w h a t e v e r

#

s m h

lyric mountain
#

"be polite until you get the fix, then show middle finger to everyone"
------ this channel in a nutshell

neat harness
#

Lmao

pale vessel
lyric mountain
#

imagine when you meet delphi

final lynx
small tangle
final lynx
#

this is it complete

#

and here is the final script for it

lusty quest
# final lynx

you might want to look into a dynamic help command, makes stuff much easier

final lynx
#

i like it

#

i might change the embed color

lusty quest
#

a dynamic help command will adjust to new commands without the need to edit the embed

final lynx
#

yea

#

but i only start a new cmd

#

when im done with another

#

and part of my check list

#

is add the command name to the embed

#

if it starts getting annoying ill do that

lyric mountain
#

or 6000 characters in the whole embed iirc

final lynx
#

well

#

thats about 250 cmds

#

and i doubt ill have that many

lyric mountain
#

250?

#

you mean 25 right?

final lynx
#

wait

#

oh yea

#

oof

lyric mountain
#

also anything above 10 fields gets annoying unless using inline

final lynx
#

so how should i do it

lyric mountain
#

also I see you're still using the exact same embed from the guide

lyric mountain
final lynx
#

also i changed ever value except the color

#

but i like the blue

lyric mountain
final lynx
#

i mean in the scrcipt

lyric mountain
#

guide's

final lynx
#

script*

lyric mountain
#

guide example is not a template

#

it's an example that's supposed to be understood then implemented your own way

final lynx
#

well

#

i understand how it works

#

and what the values mean

#

if i did i wouldnt have been able to change so many factors

boreal iron
final lynx
#

this is the template

#

this is mine

neat lance
#

Hi.........

#

I'm new

final lynx
#

hi

earnest phoenix
#

This is not chat

livid lichen
neat lance
#

Oh

livid lichen
neat lance
earnest phoenix
#

Ah stop it already

final lynx
livid lichen
final lynx
#

you can go there if you want

earnest phoenix
#

Yeah!

final lynx
#

but its fine if u want to stay here

earnest phoenix
#

But don't chat :)

final lynx
#

your chatting

#

has a thick brain***

#

anyways, @lyric mountain , how would i make it so i can go over 25 fields

modest maple
#

I find it ironic how the two whitenames who have less than 400 message between them are tell people to go to specific chats to talk bloblul

#

you also cant go over 25 fields

#

hence why it's call

#

a LIMIT

final lynx
#

also

#

if i cant go over that amount

#

should i add reaction rolls

earnest phoenix
#

how many people here use python

#

all i see is js

final lynx
#

and they open organized lists

modest maple
final lynx
#

like fun cmds, moderation, help, ex

boreal iron
final lynx
#

lol

earnest phoenix
#

lol

livid lichen
#

const Leader = Leaderboard.map(data => `\`${data.position > 3 ? data.position : ":firstplace" }\`. **${data.username}#${data.discriminator}** - Level ${data.level}`) Alright so I made a level leaderboard and it works. However, I want first, second & third to have metal emojis next to their name. I'm very stuck lol (🥇).

final lynx
#

you should add a message

#

next to the top places

#

like

reef pike
#

use text version

#

of

#

emoji

final lynx
#

"congrats, ${user.tag}, you are third place!"

#

then you can put the emoji in there

livid lichen
reef pike
#

:first__imagr:

final lynx
#

you dont have a text tho

#

also

#

shouldnt it be

willow river
#

is it possible to set up a webhook to send a msg on my server when someone votes for the server on top.gg? I'm not really sure how webhooks work with top.gg and i think i got told i can't use discord webhook links in the top.gg webhook area

final lynx
#

<= 3

#

instead of > 3

#

if you want to place it next to first, second, and third place

livid lichen
#

@final lynx Example ^^^^^

final lynx
livid lichen
#

oh lol

#

Thanks.

final lynx
#

lol

#

im big brian now >:))

livid lichen
#

Indeed, fellow robloxian.

final lynx
#

did it work

#

:O))

lyric mountain
final lynx
#

ya

#

thats what i said

lyric mountain
#

It really boils down to how many commands you expect to have

#

Like

final lynx
#

thats the thing

#

i prob wont have a lot

lyric mountain
#

Instead of using 1 field per command, you can create categories

#

And use 1 cat per field

final lynx
#

ya

#

with reaction rolls that open new embeds

lyric mountain
#

Then put its commands on the field description

lyric mountain
final lynx
#

ya ik

cinder patio
#

Hey @opal plank I finally started using your lib, and one of the disabled caches is preventing the bot from sending messages:

            channels: {enabled: false},
            emojis: {enabled: false},
            members: {enabled: false},
            messages: {enabled: false},
            presences: {enabled: false},
            users: {enabled: false}

When I run the bot with the above configuration, it doesn't send any messages, when I don't, it sends messages just fine

final lynx
modest maple
#

you have messages disabled mmLol

final lynx
#

you disabled people from using it -_-

modest maple
#

messages: {enabled: false}, bloblul

final lynx
#

also messages disabled lol

modest maple
cinder patio
#

Shouldn't that just disable the message caching? Doesn't make sense to disable the entire message sending feature

final lynx
#

iqhc8qhciqu f98qh

#

well eeeexxxuuuussse me

modest maple
#

well if he's hooking into the intents with it

final lynx
#

but yea

modest maple
#

it'll close the message intent

final lynx
#

everything is disabled

modest maple
#

that would be my first go to would probably check the intents being sent off

final lynx
#

try enabling messages

#

and if that doesnt work

#

enable

#

e v e r y t h i n g

cinder patio
#

I'll try setting the intents myself

#

If I have to cache messages in order to send messages that's kinda shit ngl

boreal iron
#

aye, it's probably just missing the default intents

final lynx
#

in the words of @modest maple ,

cinder patio
#

Aren't all intents enabled by default though, except the ones you have to request

livid lichen
#
const Leader = Leaderboard.map(data => `${data.position == 3 ? ":first_place:" ? data.position == 2 ? ":second_place" ? data.position == 2 ? "third_place" : `${data.position}. **${data.username}#${data.discriminator}** - Level ${data.level}`)
``` Well, I tried this but didn't work lol. Anyone know what I did wrong?
boreal iron
#

they should, yeah

cinder patio
#

So the lib must be removing some of em

boreal iron
#

excluding MEMBER_INTENT etc

modest maple
#

well it would be smart for the lib to change them

#

because not having the cache makes the intent pointless

boreal iron
modest maple
#

same reason why disabling certain intents in D.py will automatically disable certain caches

boreal iron
#

${data.position == 3 ? ":first_place:" ? data.position == 2 ? ":second_place" ? data.position == 2 ? "third_place"

wtf

livid lichen
#

It's my first time using the :? constructor. Okay? And I'm very bad at it lol.

cinder patio
#

Wait... I thought intents only limited the events you received

#

not the API endpoints you could use

earnest phoenix
#

can somebody help me to optimize my short description?

boreal iron
#
(data) => ((data.position == 3) ? ":first_place:" : ((data.position == 2) ? ":second_place:" : ((data.position == 1) ? ":third_place:" : `${data.position}. **${data.username}#${data.discriminator}** - Level ${data.level}`)))
#

hopefully I'm not missing a ) smirk

boreal iron
#

huh I'm missing a few

#

hold on

cinder patio
boreal iron
cinder patio
#

It's from the channel cache

boreal iron
#

happens if you type things in Discord rather than in your IDE

cinder patio
#

You cannot send messages when you have the channels cache disabled

boreal iron
#

wtf

cinder patio
#

which makes absolutely no sense

#

@opal plank Come here and defend detritus

boreal iron
#

the message obj is being send within the message event

#

including the channel

cinder patio
#

To send a message you only need a channel_id, and you get it from the message event

final lynx
#

:))

cinder patio
#

oh I misread it

boreal iron
#

shame on u

cinder patio
#

I guess I'll cache channels until Erwin comes here

final lynx
#

is this discord.js and javascript?

#

i cant tell

long crow
#

yes

final lynx
#

both of them

long crow
#

discordjs && javascript === true

final lynx
#

hazza

pale vessel
#

why are you comparing them both

boreal iron
#

one note for the last example
if(a) "a true" else if(b) "b true"

livid lichen
boreal iron
#

there's no else for a possible with short statements

livid lichen
#

oh

boreal iron
livid lichen
#

Oh! Thanks again.

boreal iron
livid lichen
crimson vapor
livid lichen
#

Once again, thanks for the help!

boreal iron
# livid lichen Once again, thanks for the help!
(data) => ((data.position == 3) ? ":first_place: " : ((data.position == 2) ? ":second_place: " : ((data.position == 1) ? ":third_place: " : "${data.position}. "))) + `**${data.username}#${data.discriminator}** - Level ${data.level}`
#

just for the context

livid lichen
#

How does this look?

red badge
#

Nice

pale vessel
#

that's a lot of unneeded parenthesis

#

but looks nice though

boreal iron
#

Oh... icons instead of the position. God damn... I should read more carefully.

final lynx
#

i think it looks good

crimson vapor
#

mhm

livid lichen
boreal iron
#

yeah, alright

red badge
livid lichen
#

The code on it's own won't work.

red badge
#

Ok thx

livid lichen
red badge
#

I am developer in python and json

final lynx
#

did u do <= 3 to make it work

#

am i the thickest brain

pale vessel
livid lichen
final lynx
#

rip me

livid lichen
#
const Leader = Leaderboard.map((data) => ((data.position == 3) ? `:third_place: **${data.username}#${data.discriminator}** - Level ${data.level}` : ((data.position == 2) ? `:second_place: **${data.username}#${data.discriminator}** - Level ${data.level}` : ((data.position == 1) ? `:first_place: **${data.username}#${data.discriminator}** - Level ${data.level}` : `${data.position}. **${data.username}#${data.discriminator}** - Level ${data.level}`))))

  const LeaderboardEmbed = new Discord.MessageEmbed()
    .setTitle(`${message.guild.name}'s Level Leaderboard`)
    .setDescription(Leader.join("\n"))
    .setFooter(Bot.user.username, Bot.user.AvatarURL)
    .setColor(Bot.Config.Embed.EmbedColor)

  message.channel.send(LeaderboardEmbed)

Messy lol.

red badge
final lynx
#

lol

#

a

#

== 3

livid lichen
#

a

pale vessel
red badge
livid lichen
#

That's not a thing lol

boreal iron
final lynx
#

lol

boreal iron
livid lichen
#

(not trying to crush your bubble)

crimson vapor
pale vessel
final lynx
#

B)

livid lichen
livid lichen
boreal iron
#

wut

final lynx
#

also

#

i hear that a lot of people have trouble with ban cmds

boreal iron
#

It works! hashflushed

final lynx
#

and i didnt have any trouble with one

#

so

#

ready to spoon nutrients

livid lichen
#

lol

final lynx
#

jajaja ez

#

also to make it work, you need a prefix value

livid lichen
#

I just looked up a whole lot of github repos & learned how it worked from there.

final lynx
boreal iron
#

@livid lichen

const Leader = Leaderboard.map((data) => ((data.position == 3) ? ":first_place: " : ((data.position == 2) ? ":second_place: " : ((data.position == 1) ? ":third_place: " : "${data.position}. "))) + `**${data.username}#${data.discriminator}** - Level ${data.level}`);
final lynx
#

lol

pale vessel
#

((()))))())) AHHH JUST REMOVE THEM

boreal iron
#

NO!

final lynx
#

((()))()()()))((()))(()))()))(()))

pale vessel
#

🧠

#

you only need them for concatenating

boreal iron
#

That's called style

pale vessel
#

although if you're using a linter it might error

crimson vapor
#

(() => (0))()

final lynx
#

(()({{)()))}(}())[)(())(]))](])()({{)())}}}))))(((()))){))))({)}

boreal iron
#

stop your useless spam dude or move to #general

final lynx
#

bruh

boreal iron
livid lichen
final lynx
#

-_-

boreal iron
#

They're not needed

livid lichen
#

e

boreal iron
#

But it creates a better look and overview in my opinion.

#

Imagine 20 short statements in one line... horrible to find the one you're looking for

final lynx
#

i gtg

#

ill be back tho

#

;)))

copper cradle
#

idk why so many people use an if statement for something as easy as that

boreal iron
#

doesn't make a different but one line more creating the array

pale vessel
#
Leaderboard.map(data => `${[":first_place:", ":second_place:", ":third_place:"][data.position - 1] ?? data.position} **${data.username}#${data.discriminator}** - Level ${data.level}`)```😳
boreal iron
#

ew

pale vessel
#

not enough parentheses for you

#

unfortunately

boreal iron
#

I'm missing a minimum of 10 ( and )

livid lichen
#

lol

boreal iron
copper cradle
#
let emotes = [":first_place:", ":second_place:", ":third_place:"];

const leader = Leaderboard.map((data) =>`${emotes[data.position-1]} **${data.username}#${data.discriminator}** - Level ${data.level} `);
#

my dude I was doing the ssme

#

why would u do that

copper cradle
#

it's called indexing things from an array

#

I saw a dude on tiktok do the same, but it was wayy bigger, like 40 lines of pure if else if else if, I told them to use an array and do this, they said it was "the same"

#

had to be fucking new to this

#

tho I'd store the emotes in a separate variable rather than just declaring it there

#

for readability purposes

pale vessel
#

micro-optimization mostly

earnest phoenix
#

Hey does anyone know how can i do

SomeClassThatExtendsEventEmitter.on("")

And it shows list of events when typing in between the double quotes?

copper cradle
#

jsdoc

#

I think

pale vessel
#

or typings

livid lichen
#

@copper cradle Uh oh

copper cradle
#

oh yeah, typings

copper cradle
lyric mountain
pale vessel
#

you forgot to give position as fallback to emote

livid lichen
#
const Leader = Leaderboard.map(data => `${Emotes[data.position - 1]} **${data.username}#${data.discriminator}** - Level ${data.level}`)

  const LeaderboardEmbed = new Discord.MessageEmbed()
    .setTitle(`${message.guild.name}'s Level Leaderboard`)
    .setDescription(Leader.join("\n"))
    .setFooter(Bot.user.username, Bot.user.AvatarURL)
    .setColor(Bot.Config.Embed.EmbedColor)

  message.channel.send(LeaderboardEmbed)
boreal iron
#

@livid lichen You really need to read carefully

pale vessel
#

don't just copy paste

livid lichen
#

3 worked

pale vessel
#

if you're using below node 14 use ||

copper cradle
#

btw, use proper naming conventions

boreal iron
#

Snail just forgot to add the position if no item was found in the array

copper cradle
#

you're in js, camelCase for variables, PascalCase for classes

lyric mountain
#

kebab-case for projects

pale vessel
livid lichen
#

|| data.position

lyric mountain
#

SCREAM_SNAKE_CASE for constants

livid lichen
#

This should work. Correct?

pale vessel
copper cradle
#

yes

pale vessel
#

muh dude

earnest phoenix
#

Here is what i have but it doesn't seem to work... Am i doing something wrong?

boreal iron
#

nope for this case ?? data.position

copper cradle
#

I'd use ?? but idk if your node version supports it

boreal iron
#

?? ISSET and IS NOT NULL

pale vessel
lyric mountain
#

oh those old eslint requires...

dire obsidian
#

just a stupid question, is there a way so the links wont be blue?

pale vessel
#

nop

lyric mountain
#

is that in an embed?

dire obsidian
#

yes

livid lichen
#

Any other ideas?

crimson vapor
#

its a link tho

copper cradle
#

then you can't

boreal iron
pale vessel
#

if you make it white you can't click it anymore

lyric mountain
dire obsidian
#

no i mean i dont want it to be clickeable

#

well, better if not

lyric mountain
#

just don't use [this](link)

livid lichen
boreal iron
#

god damn... REMOVE the protocol (HTTP(S))

earnest phoenix
#

Its in discord...

dire obsidian
#

hmm

pale vessel
#

amandathink then why did you make it a hyperlink

dire obsidian
#

OOHHHH

#

YE

lyric mountain
livid lichen
#

And add default text.

#

OH

#

You mean-

boreal iron
earnest phoenix
#

He wants to show usage on hover

#

¯_(ツ)_/¯

livid lichen
#

Ooooh

earnest phoenix
#

without having links clickable

lyric mountain
#

no way then

dire obsidian
#

the color of the link

#

just that

earnest phoenix
#

just make it text

boreal iron
leaden lake
#

how can I add a on_raw_reaction_add(payload) event in a command ? ctx.payload.emoji doesn't work when waiting for a reaction

python btw

lyric mountain
#

just use [text](/ "whatever u want")

#

will not redirect at all

dire obsidian
#

k

boreal iron
lyric mountain
#

oh, yeah, nvm

#

it doesn't becomes links

dire obsidian
#

change var to let

lyric mountain
#

var is hoisted

#

and causes a ton of issues

boreal iron
lyric mountain
#

tho

pale vessel
copper cradle
#

if it's not a link then what's the fucking point, the alt text will not show

lyric mountain
#

because readFile is async

copper cradle
#

and what they want is the text to be white but still show the alt text

boreal iron
#

wut? [...] the last form?

pale vessel
#

readFile takes a callback

lyric mountain
#

that's not the point

copper cradle
#

if the link is not recognized as an url then the alt text will not be shown

pale vessel
#

if you want async readFile require "fs/promises"

copper cradle
#

reading comprehension -101

lyric mountain
#

you're missing the point of "readFile is async"

#

you cannot return

#

because the result will be defined AFTER you return the value

boreal iron
#

wtf are you talking?

lyric mountain
#

in read, the normal flux

#

in blue, what will be executed independently of the red state

earnest phoenix
#

console.log(result) to test?

pale vessel
#

just use async readFile

#

no more headaches

earnest phoenix
#

oh

copper cradle
#

damn fake's discrim is 0037, now that's luck

earnest phoenix
#

result ne to be what?

lyric mountain
#

await readFile

pale vessel
#

@copper cradle @blissful bridge 's is #1000

#

crazy

copper cradle
#

damn

lyric mountain
#

or use readFileSync

#

(if that exists)

pale vessel
copper cradle
boreal iron
lyric mountain
#

mine is 7337

copper cradle
#

everyone's discrim is randomized, and most people get 4 non 0 digits

lyric mountain
#

one digit off from 1337

earnest phoenix
#

I get the same error @earnest phoenix, you need a callback

boreal iron
earnest phoenix
lament rock
#

alternatively, just get used to es6 style programming and use Promise based functions

lyric mountain
#

meh

copper cradle
#

I almost got 5555

earnest phoenix
pale vessel
copper cradle
#

my old discrim was 7904

sour flame
#

How to add a footer here is my code. Tell me where to put it ```js
const Client = require('../structures/Client');
const { Messege, ReactionUserManager } = require('discord.js');
module.exports = {
name: help,

/**
 * @param {Client} client
 * @param {Message} message
 * @param {String[]} args
 */
run: async(client, message, args) => { 
    const msg = await message.channel.send(`Getting Commands`);
    await msg.edit(client.embed({
        color: 3447003,
        title: `Commands`, 
        fields: [{
            name: "Fun",
            value: "ping"
          },
          {
            name: "Discord Server",
            value: "Check out the discord server [here](discord.com)"
          },
        ],
          timestamp: new Date(),
          setFooter: {
            icon_url: client.user.avatarURL(),
            text: "© Universal" 
        }
    }, message));
    await msg.edit("");
}

}

copper cradle
#

I changed it with nitro and then when it expired it set to 5755

#

almost 5555

lyric mountain
#

like

pale vessel
#

it's not setFooter, it's footer

earnest phoenix
#

@sour flame it's footer

boreal iron
lyric mountain
#

if only one of either is equal it doesn't matter

earnest phoenix
#

replace setFooter by footer

sour flame
copper cradle
#

that's why ids exist, you know

lyric mountain
#

apart from that

#

discrims can be equal

boreal iron
copper cradle
#

yeah

lyric mountain
#

what cant be is having both username and discrim equal to someone else

pale vessel
#

or both

sour flame
#

both

boreal iron
#

it may has changed over time but aye name and discrim were unique afaik, at least at the beginning

pale vessel
#

try changing icon_url to iconURL

earnest phoenix
pale vessel
#

icon_url should work too

#

so I don't think that's the cause

sour flame
boreal iron
# copper cradle not really

Discord uses usernames to identify its users. However, instead of a username becoming unavailable after just 1 person uses it, Discord allows 9999 people to share the same username. It does this by using the combination of a name (unicode string) and a discriminator (4 digits) as a Discord tag.

sour flame
#

What working

boreal iron
#

He's right.

pale vessel
lament rock
#

They are unique. You cannot have the same name and discrim under any circumstances. People with DB access could change, but that would break friend request sending. If you update your name and your current discrim matches someone else's with the name you're changing to, your discrim will change

lyric mountain
boreal iron
pale vessel
#

use russian characters while you're at it too

earnest phoenix
#

Idk why i get 1337, i changed my tag to #1337 and when my nitro expired i still have the tag

boreal iron
#

at least you and I was right, what a triumph smirk

pale vessel
#

how long has it been

#

more than that?

earnest phoenix
#

1 month

pale vessel
#

🤔

earnest phoenix
#

I think sometime discord doesn't reset your #

lyric mountain
#

your discrim might be leet, but mine is teet

earnest phoenix
#

I saw a lot of people with 0001 # and without nitro

lament rock
#

If your old discrim is used by someone else, you keep your nitro discrim

earnest phoenix
#

Oh

pale vessel
#

but discord randomizes it after your nitro expires, no?

boreal iron
#

I wonder who's paying Discord money for icons

lament rock
#

It reverts back to what it was before

boreal iron
#

and a changeable tag

lyric mountain
#

and more stickers

pale vessel
#

This is wrong?

boreal iron
#

stickers? god damn... that's worth to send some money to Discord.... hahaha KEKW

lament rock
#

From what I've observed on multiple occasions, no one has had theirs randomized post fact. Just reverted

pale vessel
#

I see

timber ivy
#

I just published my first bot! I'm excited and nervous and worried

pale vessel
#

Good luck.

timber ivy
#

ty

boreal iron
sour flame
#

I changed my name to Draco and I looked up Draco#3211 (My old discrim) and yes someone pops up

lament rock
#

Then you'll most likely keep 9999 if your nitro runs out given the other Draco doesn't change their discrim or their account gets disabled/banned

lyric mountain
#

here's a fun thing to try

boreal iron
#

all the discussion just because he wondered about my tag, lmao

lyric mountain
#

find 9998 people who have nitro about to expire

#

have all of them and you choose a discrim then change the username to the same thing

#

won't discord randomize the discrim? will everyone get yeeted?

boreal iron
#

shhh, it's forbidden to talk about tags right now

lament rock
#

Depends on when their nitro expires

#

if it's exactly the same time, database chaos may ensue

lyric mountain
#

even if it's in different times

lament rock
#

Also, there's an idea. Create a guild where only someone with a specific name is allowed

lyric mountain
#

it's the same username

#

a server with exactly 9999 people

boreal iron
#

I'm sure there're a few thousand name-whitelist bots pandasad

lament rock
lyric mountain
#

9999 people and a webhook

#

because webhooks are 0000

lament rock
#

You can have infinite webhooks with the same name pretty sure

sour flame
#

lol

tired panther
#

can you provide in .replace() a array of string, which should be replaced?