#development

1 messages Β· Page 1511 of 1

opal plank
#

hmmmm

#

concat would be worse than that one

#

im not sure if js has a handy method to recursively do it

#

i could shorten it with forEach, but i dont think that'd be wise

willow mirage
#

wait what is faster

#

for() or forEach()

opal plank
#

for

slender thistle
#

Write it all in one line inb4

#

for is

bleak spire
#

guys i want code for a intervall message

opal plank
#

frEach is suprisingly slow

opal plank
#

we dont spoonfeed people code here

willow mirage
lusty quest
opal plank
#

money?

#

thats a good reason to not quite a job

willow mirage
#

xD

opal plank
willow mirage
#

xDDD

lusty quest
#

with the downside to fricking die

bleak spire
willow mirage
#

I just wrote a code that took me 2h

opal plank
#

what does it do?

willow mirage
#

and i released that i made wrong exercise number

lusty quest
#

i wrote a web scraper for 2 hours and than realized they have an API

willow mirage
#

xD

opal plank
#

those fucks updated their website

#

and broke my shit

willow mirage
#

does Google search have an API ?

lusty quest
#

google API

willow mirage
#

google search

#

not those Youtube, translate api

lusty quest
#

not google api Google Offers an API

willow mirage
#

smh

#

i didn't meant that

#

i mean

lusty quest
#

there is an API backend for Google Search

willow mirage
#

It google API have a google search thing

earnest phoenix
#

google search api sucks ass

willow mirage
#

ah ok

#

why

earnest phoenix
#

scrape duckduckgo instead

lusty quest
#

bcs the entire Google API sucks

willow mirage
#

ye the way to connect api

earnest phoenix
#

they have restrictive limits like on everything else ^

willow mirage
#

I hate the way ppl connect to google api

#

i prefare to use a simple Token and done

earnest phoenix
#

Help please...

#

They’re not even 14 days old

true ravine
#

The newest messages may not be, but if one of those 99 messages is over 14 days old discord will say the entire thing is not allowed

lusty quest
#

are you sure all of them are not?

earnest phoenix
#

Wtf

#

How does dyno do it then???

cinder patio
#

just don't send a message when you encounter the error

#

simple

earnest phoenix
#

Dyno doesn't use bulk delete to delete messages older than 14 days

#

So can I use anything else than bulk delete?

#

And to filter the messages that are older than it, use filterOld option in <TextChannel>#bulkDelete()

true ravine
#

Yeah was about to say that lol

earnest phoenix
#

The normal <Message>#delete() can however delete messages older than 14 days

true ravine
#

Use filters to make sure that it only tries to delete valid ones

quartz kindle
#

the use case for mixing them is if you want to return a value on catch

opal plank
#

wdym?

quartz kindle
#
let a = await bla().catch(e => {
  console.log(e);
  return 10;
});
console.log(a) // 10 if error
opal plank
#

yeah, but equally that wouldnt make sense

quartz kindle
#

it does

opal plank
#
let thing;
try {
thing = await something
} catch(e) {console.log(e); thing = 10};

///////

let thing = await something.catch(e => {console.log(e); return 10});
#

theres absolutely no difference

quartz kindle
#

there is no difference, but its a much simpler syntax

cinder patio
#

I think the second one is cleaner

opal plank
#

most people are telling me the opposite

earnest phoenix
#

@earnest phoenix so I just replace it with that?

opal plank
#

that the first is cleaner

earnest phoenix
quartz kindle
#

imagine this then

opal plank
#

i know mostly its preference, but idk if theres an actual reason NOT to mix await/chains apart from readability

earnest phoenix
#

I’m confused @earnest phoenix you said that message delete is better but can only delete a single message?

#

If you want to delete messages older than 14 days you have to fetch messages and iterate through them while calling <Message>#delete() on them but that's API abuse

#

But then dyno...

#

This ruins the purge command kinda

quartz kindle
#
let guild;
try {
  guild = await client.guilds.fetch(id)
} catch {
  guild = null;
}

let channel;
try {
  channel = await client.channels.fetch(id)
} catch {
  channel = null;
}

let user;
try {
  user = await client.users.fetch(id)
} catch {
  user = null;
}
``` does this look clean?
opal plank
#

thats what i said tim, APART from redability, is there a reason NOT to mix async/chains ?

quartz kindle
#

not afaik

#

the reason its not recommended is because people can get confused about what the code is actually doing

opal plank
#

cuz most places recommend not mixing them, but it infers that you shouldnt, rather than a cleaning recommendation

quartz kindle
#

ie if they dont understand promises very well

earnest phoenix
#

Hm

opal plank
#

okay that makes sense

cinder patio
#

The only time I mix them is when I have to use the fetch api
const body = await fetch(...).then(res => res.json());

opal plank
#

thats fair, i use that commonly too

quartz kindle
#

people often dont understand that await returns the final value of the entire chain, and that you can return something from inside a .then that way

#

so they end up doing confusing shit and not know why

pure lion
#

i hate it when people mix async and sync in literally any other situation

quartz kindle
#

i think its very useful as a circuit breaker for invalid/error-prone functions

pure lion
#

then again, breakpoints and try-catch

quartz kindle
#

for example ```js
await database.get(something).catch(() => null) // if database throws an error if item is invalid or not found

#

with discord its very popular to use it for fetching

#
user = await client.users.fetch(id).catch(() => null)
if(!user) return message.channel.send("user not found")
opal plank
#

that makes sense, ty @quartz kindle

fathom slate
#

I entered correctly token id

#

πŸ€”

#

help me pls :<<<

earnest phoenix
#

computers don't lie

#

so... you entered an invalid token

wary mason
fathom slate
#

πŸ€”

#

i don't understand

earnest phoenix
#

you didn't if it's complaining about an invalid one

fathom slate
#

hmm

wary mason
#

and when i dont use the lewd endpoint, i can use the rest? @opaque fern

#

I had trouble with nekos.life just because i was using it and not using the endpoint so idk if i can use this instead

#

hadn't any of these in my bot

wary mason
#

not from neko

#

gotta code my own api

#

problem is that i'm developing everything for the bot alone. its a lot tho

#

yea

#

when i do it, i'll code an entire api

#

i have a friend that is developing his own, may we can create a api that we can use for both

#

thank you xD

zealous egret
#

Hello how to setup roles per voting?

rocky hearth
#

@quartz kindle can u answer this

zealous egret
#

And how to do it because I don t know Can you help me?

quartz kindle
#

but "freezed" is not valid english

#

xD

zenith terrace
rocky hearth
#

But when I call moves().
It says this is undefined

quartz kindle
#

show code

zealous egret
#

I have server

#

?

#

a lot of server have it

rocky hearth
# quartz kindle show code

It's fairly a large code, but I tried doing like -

const move = (currentSquare.isFreezed ? this.freezedMove : this.vectorMove).bind(this);
move() // No Error!

And then it worked fine!
Is there any more clean way, or It is already fine?

zealous egret
#

But i want to make - 10 votes = role 10 votes - you know?

#

how please tell me

quartz kindle
zealous egret
#

Can anyone else tell me how to create roles per voting??

zealous egret
#

I don t know programming man so asking for how to create it without i msut creating the code for it

zealous egret
zealous egret
#

when i create webhook the bot created what is it?

#

and some name and channel i don t understand

#

this happens

#

i created it on discord server

opal plank
#

without coding

zealous egret
#

yes

#

And how? i don t know nothing about coding

opal plank
#

just add @pliant gorge to your server and setup the roles via it, ask in #support for more info

zealous egret
#

so I only asing can i make it easy?

opal plank
#

no coding

zealous egret
opal plank
#

once again, @pliant gorge has it

zealous egret
#

And i have bot in my server and what to do now?

opal plank
#

i've heard about it somewhere

zealous egret
#

in support they say me to write here

#

please someone finally help me because I don t know nothing about coding

opal plank
#

i've read somewhere about rewarding roles with Votes via DSL

zealous egret
stuck pike
#

U need vps

#

And Api

#

And code

#

Duh we need

#

O then it's changed

#

O

#

Then my bsd

#

Bad

zealous egret
#

Someone say I need VPS someone say I don t need nopthing - what I actually need?

opal plank
#

isnt this exactly what they want?

opal plank
#

oh, then yeah, you need coding for that

#

or find a bot that does that already

zealous egret
opal plank
#

i personally dont

#

theres quite a few bots that deal with voting for stuff like that

#

but if you were to ask for a name, i woulnt be able to tell you one. There are hundreads of thousands of bots out there, i dont know every single one of them to be able to give you a definitive answer

zealous egret
#

K

opal plank
#

coding is possibly your best alternative

#

be it hiring someone or learning yourself for free

earnest phoenix
#

Do you know any trusted and secure websites that offer free bot hosting?

opal plank
#

the word "free" already implies bad

#

secure and trusted? sure

#

glitch and heroku

#

good? none

#

both of them have limitations

#

your best bet is AWS or f1 micro

#

f1 being free forever

earnest phoenix
#

Oooo

opal plank
#

AWS being free only for the first couple months

earnest phoenix
#

I have one

stuck pike
#

O

opal plank
#

you can use even an old phone to host ur bot

#

any 2010 ish piece of hardware and higher should have no problems hosting a bot

#

most of them you would install linux and run it

stuck pike
earnest phoenix
#

Do you know what the ping is roughly when you host with a raspberry pi on a 100 megabit internet?

stuck pike
#

I m thinking to double boot my pc

#

With linux

opal plank
#

i personally hate linux for personal use

earnest phoenix
#

umm

#

response

#

time

stuck pike
#

@opal plank I agree

opal plank
#

it takes up so much time to setup stuff that windows makes so basic

stuck pike
#

Omg my bot is at 90%

#

Of being verified

earnest phoenix
#

ok, ty πŸ™‚

opal plank
#

i think my bot got 40+ servers today

stuck pike
#

Wot

opal plank
#

wdym pro?

stuck pike
#

Pro in the sense of marketing the bot

#

That growth is great

opal plank
#

nah, im not doing ads in topgg

stuck pike
#

O the

#

Then?

opal plank
#

just good bot

#

people are recommending it all over the place

stuck pike
#

I have 78 commands

opal plank
#

more commands usually = bad

#

bad for the user to remember most of them, and it usually indicated a multi purpose bot

#

which is dying nowadays

#

it does

#

more usuaully affects negatively your bot

stuck pike
#

OwO

opal plank
#

few = better

#

not really

rocky hearth
opal plank
#

the avarge user wont be using that many commands nor remembering most of them

#

its plain annoying to remember all commands

#

users want a bot that does whats its meant to be doing, and be good at what it does

#

tons of commands usually tens to tip over the multi purpose bot

#

unless most of your commands are targetted to the area you set it to fill

#

thats where what i said falls in place

opal plank
#

there are use cases

#

but the trend of multipurpose bots has ended quite a while ago

#

hoping into discovery with a multipurpose bot is shooting yourself in the foot

#

wanna see an example?

#

here

earnest phoenix
#

unless your bot is original or pure quality it's doomed to fail and go into the garbage can

opal plank
#

read around here

earnest phoenix
#

If I’m not wrong people are splitting their bits

opal plank
#

people want MORE bots, not an ALL IN ONE bot

earnest phoenix
#

Yup

#

Ksi

#

#1

opal plank
#

they want a bot that does it job, and does a good job at nat, not garbage that is meh on all areas it tries to be in

earnest phoenix
#

Plus it’s an advantage for the devs as well

rocky hearth
#
abstract class Piece {
  abstract readonly pieceType: PieceType;

  constructor() {
    /* Abstract property 'pieceType' in class 'Piece' cannot be accessed in the constructor. */
    const a = this.pieceType; // not working
  }
}

Is there any workaround for this?

pure lion
#

when making a messaging platform, is it faster to send strings or send buffers?

cinder patio
#

buffers

pure lion
#

oki ty

solemn leaf
#

@cinder patio yo

cinder patio
#

ye

solemn leaf
#

how is your day also there is a program that can translate the duration on files bytes

cinder patio
#

nice

atomic vault
#

How to get user account created date in js

crimson vapor
#

What library?

atomic vault
#

discord.js

solemn latch
earnest phoenix
#

Wtf did I just make???

atomic vault
solemn leaf
#

you can easily search that

#

it has a search box

#

smh

atomic vault
#

i know

solemn leaf
#

guides can be found on the front page

solemn latch
#

Whatcha mean discordjs.guide link

atomic vault
#

means discordjs.guide website page which has that info

#

its link

solemn latch
#

Why do you need a guide for a property.

atomic vault
#

?

old latch
crimson vapor
#
solemn latch
#

I just realized the djs guide doesn't explain properties. They expect you to understand them before using the lib.

#

Didn't know that

pale vessel
#

Yeah, it's "guide", not "documentation"

solemn latch
#

Yeah, it just seems to go over basics pretty decently. Honestly always figured it would be in there somewhere.

plucky hemlock
solemn leaf
#

how are you a bot developer

solemn latch
#

The role means nothing other than they have an approved bot

solemn leaf
#

Ik

atomic vault
summer torrent
solemn leaf
#

@atomic vault @summer torrent They prob are using js and got rate limited for ytdl so its sending nothing but it is still playing something on discord just to clear things up.

earnest phoenix
#

hearing and streaming are two different things

#

"hearing" is just bots receiving audio data from other members

solemn leaf
#

thats just an educated guess

earnest phoenix
#

streaming is sending audio data to discord

solemn leaf
#

Im pretty sure if you just do #play it will just show the green line

crystal wigeon
#

hey guys

#

how do i get the user

#

from id?

solemn leaf
#

guide member

crystal wigeon
#

guild.guildmembers.get?

earnest phoenix
#

uh

solemn latch
#

Why not just use the member property

crystal wigeon
#

or message.guildmembers

#

i want the member by id

solemn leaf
earnest phoenix
#

Pepega

solemn leaf
#

that returns guild member

earnest phoenix
#

<Guild>#members#cache#get()

solemn leaf
#

volt

crystal wigeon
#

it says members.get is not a func

fierce ether
#

Error: secretOrPrivateKey must have a value anyone know what this means?

solemn latch
#

Looks like your private key wasn't given a value.

earnest phoenix
#
let user = await <client>.users.fetch("ID");
#

That just fetches a user

solemn latch
#

That's a user

crystal wigeon
#

yeah

#

i want guild member

earnest phoenix
#

Refer to my message

#

oh

crystal wigeon
#

i keep forgetting cache

earnest phoenix
#

Why did you use # instead . ?

#

Notation

solemn latch
#

Its a way of saying class rather than variable name afaik.

quartz kindle
#

is there a standard for hash notation? i've never seen that anywhere

earnest phoenix
solemn latch
#

Oh pog

quartz kindle
#

but is that something djs came up with?

#

or is there a standard for that?

earnest phoenix
#

I have no idea, i've seen them use it all the time but i don't think it's a standard way of writing notation

umbral zealot
#

I don't recall every seeing that notation anyone else either.

#

So no, it's not really standard.

#

Standards would be.. y'know... known, and common πŸ˜‚

quartz kindle
#

considering they have a bunch of shit they came up with already...

earnest phoenix
quartz kindle
#

djs is a "special" thing

#

dont even look at their channel.startTyping implementation

earnest phoenix
#

I have and i regret it

#

"My eyes burn"

earnest phoenix
#

java, c# etc

#

Man

umbral zealot
#

So C# implements the Class#method notation? lol

earnest phoenix
#

yeah

#

people in the c# guild use it too

umbral zealot
#

badum-tss

earnest phoenix
#

Hey, how does top.gg work in using discord api? As I understood there is a rate limit here but top.gg never gets rate limited although plenty of people or visiting website...

quartz kindle
#

i mean

earnest phoenix
#

C#, more like Class# notation

quartz kindle
#

c# has a hash in its own name

#

not surprising it would hash other things

earnest phoenix
#

and a lot of discord-related queries are done with your bearer token

earnest phoenix
# earnest phoenix caching

but it doesn't really do caching, the point is for example the picture of my server gets updated instantly after I change it

umbral zealot
#

You mean after you go edit the page on top.gg

earnest phoenix
#

no, when I change the picture of my server

#

it's still... caching

#

the DSL bot receives GUILD_UPDATE dispatch event

#

it gets updated instantly after changing my picture

quartz kindle
#

you're talking about top.gg server list? dont you have the DSL bot in your server?

quartz kindle
#

so, see what cry said

umbral zealot
#

What does the picture have to do with that anyway, it's an image, grabbing images from the CDN isn't rate limited.

earnest phoenix
solemn latch
#

But dsl just gets the event

earnest phoenix
#

why are you ignoring what i said lmfao

umbral zealot
#

No for the image it's because it gets the GUILD_UPDATE event like cry said.

solemn latch
#

I'm taking credit cry

quartz kindle
#

cry me a river

earnest phoenix
#

i need a colored name πŸ˜”

earnest phoenix
quartz kindle
#

no

umbral zealot
#

guild_update doesn't require privileged intents

earnest phoenix
#

^

quartz kindle
#

GUILD_UPDATE is GUILDS intent

#

the first one

fierce ether
#

TypeError: fetch(...).json is not a function how is it not a function?

earnest phoenix
umbral zealot
quartz kindle
umbral zealot
#

everyone can use normal intents

quartz kindle
#

DLS is verified

#

they approved it

earnest phoenix
#

my bot is verified so no worries about it

umbral zealot
#

The 2 priviledge intents are GUILD_MEMBER and PRESENCE . Every other intents is perfectly open to literally every bot out there.

earnest phoenix
#

oh really?

#

damn

umbral zealot
#

Yes, really.

earnest phoenix
#

thanks man you are a life saver

fierce ether
#
  const data = await fetch(`${_config_json__WEBPACK_IMPORTED_MODULE_3__["dashboard"].dashboardUrl}/api/guilds`, {
    headers: {
      Auth: cookies === null || cookies === void 0 ? void 0 : cookies.token
    }
  }).json()``` so how can i turn it into json @umbral zealot
hidden lynx
#

how can you disable it that users cannot react with own emotes to a certain message of a bot?

earnest phoenix
#

call it on the result of the resolved promise

#

right now you're calling it directly on the promise

umbral zealot
fierce ether
#

oh thanks

earnest phoenix
umbral zealot
#

Though why the hell are you directly working on the webpack output? Thonk

hidden lynx
earnest phoenix
#

πŸ™„

quartz kindle
#

you cant disable reactions on a specific message i believe, only in a specific channel, or in the entire server

earnest phoenix
#

oh they meant per message

hidden lynx
#

so i actually have to delete em everytime if sb adds something

quartz kindle
#

or just ignore them?

hidden lynx
#

discordjs btw xD

#

yeah

#

i was just wondering

earnest phoenix
#

there's also another kind of dumb way

#

fill up the reaction limit on the message with unique emojis

solemn leaf
#

@umbral zealot did you even make the reload command in your git?

umbral zealot
#

uhhhh yes?

quartz kindle
#

dafuq

solemn leaf
#

really

#

how are you supposed to do this when all the commands are in folders

(`./${commandName}.js`)
#

you cant

old latch
#

well then you cant

solemn leaf
#

so I say you didnt make it

#
    if (!args || args.size < 1) {
        return message.reply("Must provide a command name to reload.");
    }
    const command = args[0].split('/');
    if (!bot.commands.has(command[1].split('.')[0])) {
        return message.reply("That command does not exist");
    }
    Reflect.deleteProperty(require.cache, require.resolve(`../${command[0]}/${command[1]}`));
    bot.commands.delete(command[1].split('.')[0]);
    const props = require(`../${command[0]}/${command[1]}`);
    bot.commands.set(command[1].split('.')[0], props);
    message.reply(`The command ${command.join('/')} has been reloaded`);
#

now this would work

umbral zealot
#

Does it though

solemn leaf
#

it didnt work

umbral zealot
#

So... what's your point

solemn leaf
#

you put code meant for a command handler without sub folders on a git with a command handler with them

umbral zealot
#

Do you have any idea what ```js
Reflect.deleteProperty(require.cache, require.resolve(./${commandName}.js));

*actually* does?
solemn leaf
#

nope

old latch
#

lol

umbral zealot
#

so you have no fucking clue what your talking about on why it doesn't work you ungrateful litlte shit πŸ˜›

fierce ether
#
if (dashboard?.enabled) 
SyntaxError: Unexpected token '.'```
#

wat am i doing wrong?

solemn leaf
#

didnt know errors compiled to js @fierce ether

umbral zealot
fierce ether
#

wait do i?

old latch
#

yeah I had that problem too

umbral zealot
#

Yep!

#

Node 14 is best node version ❀️

solemn leaf
#

have fun updating

earnest phoenix
#

babel

solemn latch
#

I thought we all agreed optional chaining is too slow

umbral zealot
#

I might not have been part of this global decision making πŸ˜‚

fierce ether
#

where do i even download v14

solemn leaf
#

node site

#

download

old latch
#

idc about slowness I use it a lot

umbral zealot
#

I was part of the meeting when we said "If you're worried about performance in JavaScript you're using the wrong language, fool"

solemn latch
#

True

solemn leaf
#

thats pretty self explanatory

solemn latch
#

I thought it was like painfully slow.

umbral zealot
fierce ether
#

ive downloaded v14 15.4

solemn leaf
#

what

#

that isnt a version

fierce ether
cinder patio
#

Optional chaining in pure javascript is probably very optimised

umbral zealot
#

That's 14.15.4

solemn leaf
#

so you downloaded v14.15.4

fierce ether
#

yh

solemn leaf
#

not v14 15.4

umbral zealot
#

Yeah so you're good

solemn leaf
#

version 15 doesnt work some times

fierce ether
#

oh yeh i meant that

opal plank
#

wait what

#

is this the actual b1nzy?

fierce ether
#

is there anything that dosent work with v14?

opal plank
#

πŸ‘€

#

nah

#

fake one

umbral zealot
#

There's nothing that break irrevocably in 14, you're safe using it

#

Node updates major versions when they break anything and that could be something you've never even heard of in your life - that's usually the case for me.

opal plank
#

i do recall some libs breaking with node 15 and some targetting specific 14 or lower, so i guess not all libs updated, but i havent ever encountered an issue with node 15 personally

solemn leaf
#

@opal plank canvas

solemn latch
solemn leaf
#

life

umbral zealot
#

"oh we've flipped a bit in the Buffer() option.xyx MUST RELEASE NEW VERSION" lol

solemn leaf
#

chalk

opal plank
#

actually, not even canvas i dont think

#

also, like i mentioned, LIB issue isnt node issue

solemn leaf
#

canvas does break

umbral zealot
# solemn leaf chalk

You're confusing "nodejs broke" with "some modules have not yet updated to node-gyp working with that version"

opal plank
#

dont fault node for the lib

umbral zealot
#

NodeJS itself, and javascript code you wrote yourself, usually doesn't break on major updates.

solemn leaf
#

im pretty sure every lib I have ever used isnt up to v15

fierce ether
#

wait chalk breaks?

umbral zealot
#

I'm pretty sure it's not every lib

solemn leaf
#

I have used

opal plank
#

also bs

umbral zealot
#

No you're just being overly dramatic.

opal plank
#

im using node 15 rn with canvas

solemn leaf
#

how

opal plank
#

by using properly updated shit

#

update canvas u dummy

#

when you update node

solemn leaf
#

I did

opal plank
#

clearly not

#

cuz im using it

umbral zealot
#

You also need to re-build every node-gyp install

#

by deleting node_modules and running npm i again

solemn leaf
#

I did

opal plank
solemn leaf
#

that took forever

umbral zealot
#

Yes, it does take forever.

opal plank
#

iirc canvas doesnt even run on node

#

its cpp isnt it?

fierce ether
#

you guys must have tons of modules mine takes like 15 secs

opal plank
#

the it uses to generate the images and shit

solemn leaf
#

@umbral zealot no it was funny and didnt let me delete it

quartz kindle
#

the problem with node 15 is npm 7 which is buggy af

opal plank
#

i could be horridly worng about it though

solemn leaf
#

I had to reset the security on some of the modules to delete it

umbral zealot
#

canvas, sqlite, and a whole lot of other things are written in native C++ and require python and the C++ build tools to make it run on node, and that's exactly why it requires a rebuild every time you switch node version

earnest phoenix
#

Hey, so I got into another problem here, how does DSL handle member count?

umbral zealot
#

literally a property on guilds that Discord provides

solemn leaf
#

first tell me how many stab wounds

earnest phoenix
umbral zealot
#

No, it does not

opal plank
#

^^

earnest phoenix
#

lmao

umbral zealot
#

member_count is given by the API

opal plank
#

for ALL members you do

quartz kindle
#

and if you had GUILD_MEMBERS denied, you can occasionally guild.fetch() and use approximate_member_count

opal plank
#

for member COUNT, you dont

umbral zealot
#

It really feels like you're trying to get an "AHA! GOTCHA!" moment here where you tell us something about DSL we don't already comprehend fully πŸ˜‚

earnest phoenix
#

all it takes is a few seconds of ✨ research ✨

umbral zealot
#

there's no cheat going on.

quartz kindle
#

he is partially right tho

#

guild.memberCount relies on GUILD_MEMBERS to keep itself updated

umbral zealot
#

no it doesn't, actually

quartz kindle
#

it does

opal plank
#

πŸ‘€

umbral zealot
#

I'm like 99% certain it uses the approximate_member_count

earnest phoenix
#

well I just need approximation I don't want accurate number

umbral zealot
#

at least it does in discord.js

quartz kindle
#

no, they are separate things

#

djs has both memberCount and approximateMemberCount

opal plank
#

when you recieve guild object you always recieve it, im fairly certain you dont need to fetch it, sounds like more of a no-caching issue

umbral zealot
#

My point is, there is an approximate member count provided by the API and that's what DSL uses

#

I was using memberCount as an example

quartz kindle
#

which is what i said lul

earnest phoenix
#

member_count is received only on GUILD_CREATE so it relies on the intent to keep itself updated

quartz kindle
#

if you have members denied, just occasionally fetch the approximate one

umbral zealot
#

as in they haven't figured out that basic thing about approximate member count πŸ˜‚

opal plank
#

hmmmm

#

yeah i was checking that rn

quartz kindle
#

how is that a library problem lol

earnest phoenix
#

lol its dpy

#

famous man

quartz kindle
#

there isnt any gateway event that gives you approximate member count

#

you get that by fetching

opal plank
quartz kindle
#

no lib is gonna do automated fetching behind the scenes

opal plank
#

this is always sent though, any message or interaction that comes shipped with guild should have this updated on their end

umbral zealot
#

No, you're right, libs don't fetch behind the scene

#

that's why they use the member_count provided by the API directly, if they're smart

#

Β―_(ツ)_/Β―

solemn latch
#

Some pretty pog conversations in dev today, actually things I dont know about.

quartz kindle
#

which only comes in guild create

#

and no other event

umbral zealot
#

I'm just saying whatever the reasoning, it's actually a thing that the API can provide without privileged intents.

#

The details are not that important

quartz kindle
#

yes but i am talking about the details lmao

opal plank
#

lmao

earnest phoenix
#

the difference is that one is received over the gateway and isn't updated without the privileged intent
the other one is REST only

opal plank
#

which gets sent on every message basically

earnest phoenix
#

πŸ‘

opal plank
#

you COULD fetch it if you dont have ANY events coming though

earnest phoenix
#

thx

quartz kindle
#

if a person codes an app that uses guild.memberCount, and they dont have the members intent, if they leave the app running for 1 month without restarts/disconnects, their member count value will be wrong

opal plank
#

usually whenever you recieve some events via REST i'd be smart to cache stuff like that

earnest phoenix
#

events via REST

#

πŸ€”

earnest phoenix
opal plank
#

i mean without fetching, coming from a MESSAGE or some other event like presence

earnest phoenix
#

you don't get the full guild object though

#

do you?

opal plank
#

correct

#

though you get the approx

#

like you mentioned, the count only gets sent on CREATE

#

but you could constantly update aprox based on the messages/presences you receieve

umbral zealot
#

Getting it through updates on messages and such is plenty sufficient for most people anyway

fierce ether
#

can a jwtSecret be anything?

umbral zealot
#

and I'm sure it's sufficient for DSL

umbral zealot
solemn latch
#

So member count is updated on every message?

earnest phoenix
#

it isn't

fierce ether
#

what should i use?

umbral zealot
#

literally cookies

#

they've been around for decades and they're still the safest way to store a session ID on the user side

earnest phoenix
#

you don't get a guild object at all

#

you get the guild id

opal plank
#

wait what?

earnest phoenix
opal plank
#

the docs mention on guild_Create you get the full guild

fierce ether
#

i really cant be arsed to switch now

opal plank
fierce ether
#

rather just use jwt rn

umbral zealot
opal plank
earnest phoenix
#

yes

opal plank
#

so you should be recieving a full guild object

umbral zealot
#

You're opening yourself up to injection attacks, on top of making your system slower and take more memory for absolutely no benefit.

opal plank
#

not only an id

earnest phoenix
#

not on a message

#

because that is MESSAGE_CREATE

opal plank
#

oh really?

opal plank
#

presences should come through, but that requires intents as well

#

which is what we trying to avoid

#

hmmm, yeah, you only recieve member

#

i guess it makes sense, it'd be horribly slow to be sending guild every message

#

though i was under the impression guild came shipped with it too

solemn latch
#

So is guild sent with events with the guild intent? Right?

solemn leaf
#

so self bots require intents

earnest phoenix
#

they don't

#

user accounts are different from bot accounts

#

in many many ways

opal plank
#

^^

solemn leaf
#

self bot yourself all the data

#

lol

earnest phoenix
#

the way they receive guilds is completely different

opal plank
#

i DID think about doing that btw

#

at one point

solemn leaf
#

LOL

#

why

opal plank
#

theres quite a few things that user can access that could be used to aid a bot

#

i can give quite a few good examples

solemn leaf
#

maybe on a different chat app

opal plank
#

no, not at all

solemn leaf
#

no I mean talking about it

earnest phoenix
#

you would have to build a library from scratch, pretty much no other lib supports user tokens anymore and the gateway flow for user tokens became different from bots

solemn latch
#

Imagine if bots had search pogey

earnest phoenix
#

they were supposed to

opal plank
#

search is the shittiest of my ideas

earnest phoenix
#

but night is a retard

#

making a bunch of empty promises

cinder patio
#

What would bots use search for though

umbral zealot
#

same thing users use it for

opal plank
#

fetching user linked accounts gets rid of literally 90% of auth methods people do. You need to connect to your twitch? simply scan the user accs. Youtube? github integrations? all that.

I was thinking of forcefully adding a user everytime the bot would join a server to be able to fetch stuff like that, never again bother with AUTH

umbral zealot
#

lol

solemn leaf
#

you mean litke ctrl f

#

that would be useful

earnest phoenix
opal plank
#

search is the least useful stuff i can think of that bots would access

solemn latch
#

I know some people want bots to be able to see how many messages users have sent to determine punishments

opal plank
#

none of that requires search

solemn leaf
#

woo I would use it to find messages sent from a user on a date

opal plank
#

store into a database

#

guild/channel/count/user

solemn latch
#

What if your server is old

solemn leaf
#

I wouldnt want to store

opal plank
#

better yet, just channel/count/user

#

no need to store context

#

just how many messages were sent

#

stuff like that is child's play

#

scanning auth accounts seems far more useful

earnest phoenix
#

Lmao

solemn latch
#

I dont see how you get message count on an preexisting server

earnest phoenix
opal plank
#

fetch() looped

solemn latch
#

Api aboose

opal plank
#

how come?

#

respecting ratelimts and only once since you'd be dumping that into the db, its not automation, its a one time thing

#

'ive seen quite a few bots that download the whole history without most of the useless shit, just timestamp, userid, guildid, and channel id

#

storing content is bad, both regarding disk space and privacy

solemn latch
#

For each user? Every time your bot joins a guild

earnest phoenix
#

Imagine fetching all messages from each user and the bot is in 2k guilds

solemn latch
#

And some guilds having millions of messages

earnest phoenix
#

Ya

opal plank
#

who said for each user?

#

channel.messages.fetch()

#

just fetch with 100 limit and the last message id you got

#

i had a crawler that did that once

umbral zealot
#

I mean, like, if I was able to do guild.search("from:136583532972605440").then(r => r.count) just to get the number of messages sent by a user, I don't need to fetch them to know how many they had.

#

Β―_(ツ)_/Β―

opal plank
#

you'd be looping per channel

#

theres a 100 limit per query

earnest phoenix
#

that can take days to finish

opal plank
#

correct

#

but only once

solemn latch
#

Per guild

opal plank
#

per channel

#

yes

umbral zealot
#

lol

#

didn't need to fetch them all πŸ˜„

opal plank
#

if i were to tell you i personally know someone who scanned ALL Dapi history, would you believe me?

#

took 2 days

umbral zealot
#

That wouldn't surprise me that at least one bot did that

opal plank
#

not one

#

i know of 3

umbral zealot
#

well that's at least one πŸ˜‚

earnest phoenix
#

and 1 that escaped sandbox and deleted all channels mmLol

opal plank
#

lmao, fair

#

though it is a possibility

#

LMAO

#

yes

#

cry know sbaout it

solemn latch
#

I'm honestly surprised these bots don't get temp banned for api abuse.

opal plank
#

there 2 others that i know of too

gilded olive
opal plank
#

too bad discord limits per key, not connection

#

otherwise you could create multiple ws connections or possibly ip rotation

earnest phoenix
#

probably

#

not sure

#

sec

opal plank
#

try it

#

and check who's the author

earnest phoenix
#

LMFAO

opal plank
earnest phoenix
#

the fact that discord didn't even properly implement CSRF tokens until late 2018

#

that's when the bots attacked discord a lot

#

they weren't even bots, well, they were, but stolen accounts

#

because you could scrape off the token

opal plank
#

i remember hearing about shit like that

stuck pike
#

Evie name change @umbral zealot ?

umbral zealot
#

it's a nickname

#

for memes

#

see the user list on the right

stuck pike
#

Lol

#

Yea

#

Tommorow is my bot review date

#

Scared ;-;

solemn leaf
#

charen

fierce ether
#

Cannot read property 'cache' of undefined what does this mean?

solemn leaf
#

evie

#

thing before cache is undefined

fierce ether
#

its only just started happening?

#

<% cli.guilds.cache.forEach((guild) => { %> cli is client?

solemn leaf
#

guilds is undefined

#

idk

fierce ether
#

res.render('servers', { user: req.session.user, guilds: req.session.guilds, cli: client })

solemn leaf
#

req.session.guilds is null

pure lion
#

i wouldn't send the client

fierce ether
#

hows it null

#

it cant be

solemn leaf
#

well ob it is

fierce ether
#

i just logged it

#

and its not

pure lion
#

what did it log

fierce ether
#
 size: 0,
  timeout: 0,
  url: 'https://discordapp.com/api/users/@me/guilds',
  status: 200,
  ok: true,
  redirected: false,
  statusText: 'OK',
  headers: {},
  body: {```
#

and so on

pure lion
#

that looks like a raw http request

fierce ether
#

wdym

pure lion
#

what you logged

fierce ether
#

yes

solemn leaf
#

.cache is a thing in that

fierce ether
#

do i remove cache

pure lion
#

why do you want to remove cache

fierce ether
#

well why isit undefined?

pure lion
#

show the full log

fierce ether
#
TypeError: C:\views\servers.ejs:11
    9|       <div class="servers">
    10|                   <h1 class="title">Servers you can manage: </h1>
 >> 11|                   <% djsclient.guilds.cache.forEach((guild) => { %>
    12|                         <% if (!guild.member(user.id)) return %>
    13|                         <% const member = guild.members.cache.find(p => p.id === user.id) %>
    14|                         <% if (!member.hasPermission('ADMINISTRATOR')) return %>

Cannot read property 'cache' of undefined```
earnest phoenix
#

cache isn't undefined

#

it's guilds

#

confirm the type of djsclient

fierce ether
#

wdym confirm

earnest phoenix
#

...to confirm that it's your actual discord client

fierce ether
#

oh wait yeh its not

earnest phoenix
#

console.log it

fierce ether
#

its just this

#

{}

earnest phoenix
#

an empty object

fierce ether
#

but why?

earnest phoenix
#

πŸ€·β€β™‚οΈ

fierce ether
#

const client = require('../bot.js')

#

@earnest phoenix

#

how isit undefined then?

earnest phoenix
#

well

#

are you exporting it

fierce ether
#

module.exports = client;

earnest phoenix
#

hastebin your entire bot.js

pure lion
#

bing bonk

tight plinth
#

i'm trying to do a dashboard for my bot using ejs, but i acually never used ejs

pure lion
#

ejs is really easy

fierce ether
tight plinth
#

@pure lion learn me everything k thx

#

and also how to make it interact w/ my client

#

and shit

fierce ether
marble juniper
pure lion
#

rendering text => <%- %>
rendering code stuff => <%= %>

marble juniper
#

the array has empty values

solemn leaf
#

doubt

#

wait wha

#

if I remove the prefix it works

#

wait nvm

marble juniper
#

also

#

why are you making it a map inside of a map

#

couldn't you just make it a map

#

once

pure lion
#

or even better

#

wait nvm

#

just map the categories silly

solemn leaf
#

wqait

marble juniper
#

he maps it which he then maps it again

#

and the first map wont have a string

#

lol

#

so empty values

pure lion
tight plinth
#

how to make ejs interact with bot client

pure lion
#

you will need

#

oauth implementation
an api

mellow kelp
#

Make a rest api

#

Ejs itself doesnt make the thing interactive or anything

#

Its just like

solemn leaf
#

@marble juniper what should I do

mellow kelp
remote cedar
#

Who can teach me html

solemn leaf
#

@remote cedar ok

marble juniper
#

you replace the first .map with a .forEach

#

also you need a value to store the map in

remote cedar
#

I cant write long descriptionxd

pure lion
#

just use markdown

mellow kelp
#

You can use markdown

pure lion
#

xd

marble juniper
#

lol

remote cedar
#

Whats that

solemn leaf
#

dsicord uses markdown

marble juniper
#

h o w

solemn leaf
#

markdown

#

markdown

pure lion
#

this
is
markdown

solemn leaf
#

markdown

mellow kelp
#

A markup language to simplify html

marble juniper
#

all those extra features you see

#

like

mellow kelp
#

this shows a title

marble juniper
#

bold text

mellow kelp
#

this shows another title

marble juniper
#

thats markdown

pure lion
#

means h1, ## means h2 etc

solemn leaf
#

link

mellow kelp
#
  • list
  • of
  • stuff
gilded olive
#

Markdown ||is|| very cool

earnest phoenix
#

alternatively

mellow kelp
marble juniper
#

Markdown is a lightweight markup language for creating formatted text using a plain-text editor. John Gruber and Aaron Swartz created Markdown in 2004 as a markup language that is appealing to the human users in its source form. Markdown is widely used in blogging, instant messaging, online forums, collaboration software, documentation pages, an...

solemn leaf
#

@marble juniper bot.categories.foreach((command, category)

#

markup

#

make it a thing

marble juniper
#

uh no

earnest phoenix
#

forEach 🀒

marble juniper
#

pretty sure forEach only returns a singular value

mellow kelp
#

forEach doesnt return anything

earnest phoenix
#

forEach doesn't return anything

#

^^

pure lion
#

foreach is an iterator

marble juniper
#

lol

mellow kelp
#

You probably want .map()

pure lion
#

lo

solemn leaf
#

h.

mellow kelp
#

Or reduce

marble juniper
#

he has a map function inside of a map function

earnest phoenix
#

seems like a case for flatMap

remote cedar
#

Uh

mellow kelp
#

Hmm

#

flatMap is still experimental or something i think

pure lion
#

cant you ...

marble juniper
#

thats why I said foreacj

earnest phoenix
#

it's stable

marble juniper
#

ffs

#

lol

tight plinth
#

@pure lion can u do liveshare to show me how it works bc im dumb

earnest phoenix
#

flatMap is supported in node as of v11

pure lion
#

@tight plinth no u

solemn leaf
#

uh

mellow kelp
#

The mdn docs say flatMap is experimental

#

o

tight plinth
#

i dont

#

know

#

how to learn

earnest phoenix
solemn leaf
#

so what do I do

#

you guys all talking is confusing as an fyi

marble juniper
#

lol

mellow kelp
#

What did you want to do again?

marble juniper
#

help command

#

lol

mellow kelp
#

Yeah but what about it

marble juniper
#

display commands

#

and he had something like
, , , ,

#

thats his whole issue

#

lol

solemn leaf
#

so

marble juniper
#

maybeeee u wanna show the code again

#

aki

solemn leaf
#

bot.categories.flatMap()

#
module.exports.run = async (bot, message, args, embedconf, { prefix } ) => {
    const helpMessage = bot.categories.map((commands) => {
        commands.map(command => `${prefix}${command}`).join(", ")
    });
    return message.channel.send(`\`\`${helpMessage.join(", ")}\`\``);
};
marble juniper
#

there u have it

pure lion
#

what's the ... operator for anyway

marble juniper
pure lion
#

im retro

#

8')

solemn leaf
#

ps6

#

psa5

pure lion
#

πŸ…±οΈs6

#

πŸ…±οΈcma script

solemn leaf
#

link

#

making the first a flatmap then?

pure lion
#

is bot.categories a map?

solemn leaf
#

yes

marble juniper
#

lemme show u an example dice

#

of what ... can be used for

solemn leaf
#

ree

pure lion
#

You cant map a Map afaik

solemn leaf
#

it worked before

umbral zealot
#

unless you use a discord.js collection

#

or enmap πŸ˜‚

pure lion
marble juniper
#
const input = { x: 1, y: 2, a: 3, b: 4 }
const { x, y, ...z } = input

x // 1
y // 2
z // { a: 3, b: 4 }
#

example of using ...

pure lion
earnest phoenix
solemn leaf
#

uh

marble juniper
#

when destructing an object ... allows you to collect the remaining properties of an object to a new object

#

basically

earnest phoenix
#

That bot is useful i see

pure lion
#

that's so es5

earnest phoenix
#

Just dm me with the invite link pls

solemn leaf
#

barnie

pure lion
#

its not public

solemn leaf
#

all you seen is an eval

umbral zealot
#

Eval is literally a thign you can have in your bot and should ONLY be for owners.

marble juniper
#

... is ES2018

#

lol

umbral zealot
#

even if you had that bot you wouldn't be able to use the eval

solemn leaf
#

@umbral zealot safe eval sandbox can be

pure lion
#

i have a code command but for some reason it wont register map (notevil)

umbral zealot
#

A safe eval sandbox is pointless.

solemn leaf
#

no not

pure lion
#

i was bored

marble juniper
umbral zealot
#

because it wouldn't have access to all the things we use them for as bot owners.

solemn leaf
#

its for users

marble juniper
#

docker containers

solemn leaf
#

not owners

umbral zealot
#

Why would I give someone else eval anyways. it's pointless.

marble juniper
#

true

#

aeon lets you execute code

#

lol

umbral zealot
#

if you want an eval sandbox just CTRL+SHIFT+I and type away, mate.

pure lion
#

thats what the command is for

marble juniper
#

but its not an eval

marble juniper
#

rusty dusty

solemn leaf
#

uh

#

can I get help again

#

or we talking about safe eval

pure lion
#

you cant map a map

#

you can map a discord Collection

pale vessel
#

c

pure lion
#

@solemn leaf understand?

dull blade
#

d

marble juniper
#

since u can't map a map I said foreach

#

lol

#

but everyone was like ew

solemn leaf
#

ok

blazing ravine
solemn leaf
#

isnt there api to send when your bot is online

dusky sundial
#

Did you just start the bot? It might take a while for it to update

solemn latch
#

Top.gg doesn't track bot presences anymore since bots have been kicked from the server.

blazing ravine
#

ok

earnest phoenix
cerulean ingot
#

hey guys whats the best cheap vps hosting?