#development

1 messages ยท Page 1625 of 1

crimson vapor
#

@slim heart what does your lib do for timeouts?

slim heart
#

hm?

crimson vapor
toxic jolt
#
console.log(`Launched shard ${shard.id}`)```How can I write how many shards to start here?
e.g: Launched shard 1/26
slim heart
#

i wait 5s between each shard start

deep plover
#

๐Ÿ˜„

green kestrel
#

does this work @toxic jolt

console.log(`Launched shard ${shard.id}/${shard.totalShards}`);```
toxic jolt
#

oh thanks so much <3

slim heart
#

each shard start is centralized on the master

crimson vapor
#

pog

slim heart
#

so it just goes down the list meaning it wont get ratelimited

green kestrel
#

btw its a guess! i don't use discord.js myself

#

so please let me know if it works

toxic jolt
#

My bot uses a lot of ram and processor, how can I fix this? Is there a way to start Node.js with ram setting?

opal plank
#

move to c langs for less ram

#

or use detritus

#

#notSponsored

green kestrel
#

yw ๐Ÿ™‚ @high bobcat gave me the answer ๐Ÿ˜„

high bobcat
#

oh sorry

green kestrel
#

๐Ÿ˜„

high bobcat
#

what did you ask

#

oh

crimson vapor
#

@green kestrel is there a c++ lib? lmao

high bobcat
#

im dumb

green kestrel
#

bkahnwald, you indirectly gave me the max shards property ๐Ÿ˜‰

opal plank
toxic jolt
#

6 gb ram?

green kestrel
crimson vapor
#

githib

toxic jolt
#

:D

crimson vapor
#

how many guilds

toxic jolt
#

...

opal plank
#

in only 2k servers

toxic jolt
#

what theee...

opal plank
#

d.js ftw

crimson vapor
#

djs KEKW

green kestrel
#

oh, i cache everything, too

deep plover
#

๐Ÿ˜„

toxic jolt
#

im using 2 vds ....

opal plank
#

unoptimised crap ngl, frick d.js

crimson vapor
#

I kinda wanna learn c++ ngl

#

seems like effort tho

green kestrel
#

you should! its a fun language

toxic jolt
#

first vds

crimson vapor
#

no clue even where to start

opal plank
#

should move to detritus

crimson vapor
#

me?

opal plank
#

not that hard of a port

#

if you use ts, yeah

toxic jolt
#

I guess other vds are dead

#

not connecting

crimson vapor
#

I just rewrote to discord-rose

high bobcat
#

activate windows

#

not expected

opal plank
#

yikes, using libs that arent even released

#

for prod at that

crimson vapor
#

bro

misty sigil
#

lol

crimson vapor
#

my prod has like 3 important servers

toxic jolt
#

system... why....

crimson vapor
#

and this is one of them

opal plank
crimson vapor
#

you wish you were me

#

77 servers

#

20mb memory

misty sigil
#

417 servers

opal plank
#

best i can do is 2.5k at 900mb

crimson vapor
#

damn

misty sigil
#

80mb

green kestrel
#

gonna flex... this is my current usages

opal plank
#

actually, my bad, 824

misty sigil
#

nah

#

thatโ€™s fuckin cool

lament rock
#

What's the max char length of all permission bitfields ORd together, currently?

opal plank
misty sigil
#

look at that panel

opal plank
#

im still trying to figure out a way to graph it dynamically

misty sigil
#

Does the panel update automatically?

green kestrel
#

yes

earnest phoenix
#

i have 4k servers and this

crimson vapor
#

does it fetch an api?

green kestrel
#

its a hack, it just does a meta refresh ๐Ÿ˜„

toxic jolt
misty sigil
#

omg

#

thatโ€™s a hot panel

toxic jolt
green kestrel
#

@toxic jolt easy... use an external db like mysql or redis, get each shard to push status and metrics into the db, and query the db to display the page

crimson vapor
#

WHAT THE FUCK

#

12 cores

toxic jolt
#

and this

copper cradle
crimson vapor
#

bro your bot must be shit

#

ngl

#

if its using that much cpu

toxic jolt
#

@crimson vapor yeah :D

green kestrel
#

hes got 22k servers?

crimson vapor
#

ye

toxic jolt
#

like this bro

#

this vds is died

lament rock
#

running a bot on windows. Kinda weird unless it's some windows only dependency

green kestrel
#

isnt that sort of thing expected with node and djs with many servers?

toxic jolt
#

now

opal plank
crimson vapor
#

erwin you are poggers

toxic jolt
opal plank
#

METRICS

misty sigil
#

oh god

#

DATA

#

MMMM

earnest phoenix
opal plank
toxic jolt
#

you how make it this

#

omg...

#

i so like it :C

misty sigil
#

I love data

opal plank
#

grafana and a shit ton of work

misty sigil
#

data is cool

green kestrel
crimson vapor
#

ima setup grafana soonโ„ข๏ธ

opal plank
#

yeee boi

#

i wanna add cluster/shards status ontop

crimson vapor
#

just gotta work on process communication to get stats

toxic jolt
misty sigil
#

I wish I could do that

opal plank
#

but making ti dynamic has been provindg to be quite the task

green kestrel
#

oh god, THE PAIN

#

quick.db with tens of thousands of servers

#

๐Ÿคฎ

misty sigil
#

OH GOED

crimson vapor
#

isnt quick.db blocking??

opal plank
#

postgres ftw

misty sigil
#

OH MY

lament rock
misty sigil
crimson vapor
#

bro Kyoso does like 22k requests to his db a second or some shit

green kestrel
#

yes, quick.db locks the sqlite db to make an update

high bobcat
#

wio.db the best

umbral zealot
#

yes but very fast.

misty sigil
#

I need to rewrite my db

toxic jolt
copper cradle
#

slow.db ftw

misty sigil
#

Iโ€™ve got the data transferred from mongo to postgres

opal plank
#

i was hitting 120k a second with Leviatahn on twitch

crimson vapor
#

why don't you cache???

misty sigil
#

now I need to read from postgres

#

fuck cache

#

database go brr

#

and itโ€™s gonna fucking deal with it

opal plank
#

actually

#

where is it

crimson vapor
#

my db code isn't too shit

opal plank
#

one sec

crimson vapor
#

oh erwin

misty sigil
#

my db code is shit

crimson vapor
#

do you think you could help me with an issue im having

lament rock
#

database go brrr

opal plank
crimson vapor
#

reeee

earnest phoenix
#

go brrrr

opal plank
#

needless to say my bot managed to clog postgres

crimson vapor
#

bro

#

ok

misty sigil
opal plank
#

that was the reason i went to cassandra

crimson vapor
#

"how to solve race condition"

opal plank
#

what im amazed is that it didnt block it

#

it was actually maintaining

copper cradle
#

therw u go

opal plank
#

postgres is awfully powerfull

lament rock
#

Did you batch queries together

copper cradle
#

wasn't that easier?

crimson vapor
#

basically when a user runs a command as their first message, there will be no data in the DB so it creates it. but it also creates it on the first message, creating the issue where the bot is erroring because of a duplicate unique data in the DB

modest maple
#

just need to actually set it up correctly :P

opal plank
#

INSERT () VALUES() RETURNING *

#

who would win?

#

a fast performance database

copper cradle
#

lol

opal plank
#

or a return * boi?

crimson vapor
#

so erwin do you know a possible solution to my issue?

opal plank
#

look, some stuff was generated, so i had to return some generated values

opal plank
#

all problems gone

opal plank
#

was about to link that

crimson vapor
#

mongodb tho

pale vessel
#

mongo has it too

crimson vapor
#

ah

opal plank
#

or move to postgres and join the cool kids gang

lament rock
#

erwin. Your genshin bot broke postgres in <3k guilds?

pale vessel
#

updateOne(filter, doc, { upsert: true })

crimson vapor
#

@opal plank rewrite my db code and ill do it

opal plank
#

no, hell naw

pale vessel
#

well, mongoose or whatever

opal plank
#

leviathan

green kestrel
#
INSERT INTO table ON DUPLICATE KEY UPDATE ....``` ^ myqsql
lament rock
#

how many guilds

opal plank
#

that bot managed to get 98% of twitch's global traffic

#

levitahan is a twitch/discord bot

#

i was testing my caching library on it

opal plank
#

managed to pull around 5 million live viewers

green kestrel
#

and you can kill postgres with a 1 million row table, same as mysql, if you dont properly index your fields

#

if every time you touch that table its doing a full table scan, you WILL kill your queries

opal plank
#

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#

this

lament rock
#

Working on primary keys first, then gonna add multi column indexing

green kestrel
#

never ever use replace into if you care about performance, try doing 100,000 of them on a huge table, and comparing to insert on duplicate key update, and see the difference

crimson vapor
lament rock
#

Probably why Maria died trying to be a cache

opal plank
crimson vapor
#

no im not doing that

earnest phoenix
#

i will shard my bot 19 times because why npt

copper cradle
#

damn

crimson vapor
#

im not switching my db nor my lib

#

unless someone rewrites everything for me

green kestrel
#

but that one doesnt do "on duplicate key update" because its guaranteed unique

lament rock
#

wish postgres supported ? as prepared statement identifiers

modest maple
#

I just always use INSERT INTO x with CQL mmLol

#

who needs update amiright

crimson vapor
#

@green kestrel is there a reason you put the license at the top of every file?

modest maple
lament rock
#

but I do like how you can de-dupe data sent by specifying index of prepared

#

Yes. That's what I do

green kestrel
opal plank
#

be the better man, use query().catch(() =>{}) , if you cant see the problem, there isnt one

modest maple
#

the point of the place holders is you can have server pointers to the same value

#

e.g.

#

SELECT bob FROM thing WHERE foo = $1 AND baz = $1 AND x = $2

#

this query might be completely invalid btw i cant remember if it's AND or if it supported comma seperation

#

but same principles mmLol

lament rock
#

That's the use I found from switching to psql from maria.
Just a slight annoyance going and changing literally all of my sql statements

#

was nicer moving from sqlite to maria

opal plank
#

sqlite !== psql

lament rock
#

I'm aware

slender thistle
lament rock
#

They're both based on SQL, so I expected more compatibility, I guess

latent heron
#

@modest maple did you end up getting your DB to work?

slender thistle
#

I wanted to output Hello World! initially but seems I did something better

modest maple
#

yeah

#

i gave in trying to run a single local instance

#

its just running in cluster mode now

#

so my pc is just a datacenter connection rn

latent heron
#

lmao

#

well congrats

modest maple
#

fun fun fun

nimble kiln
#

Looking into indicies right now. Lets say I have a table with millions of chatlogs, where this gets saved:
ID - Date - Time - Username - Message

would it make sense to create an index for the username column, if I'm retrieving log entries by username alot?

lament rock
#

ye

modest maple
#

yes

nimble kiln
#

mhm!

#

Cause I do have a log table with millions of entries KEKW

lament rock
#

How long does a single query take

modest maple
#

I hope you delete those messages after the user leaves your scope bloblul

#

data protection intensifies

nimble kiln
modest maple
#

still

nimble kiln
modest maple
#

that's pretty poor performance for a few million rows

nimble kiln
#

16695305

#

almost 17 million apparently

modest maple
#

yikes data protection is yikes

lament rock
#

Yikes

nimble kiln
#

I use the logs to provide leaderboard and such

#

how many messages a user said, how many kills, deaths etc.

#

Cause I have to get them by chat

lament rock
#

what kind of data do you store

nimble kiln
#

ID, Date, Time, Username, Message

#

ID is primary key auto_increment

lament rock
#

oh right. You did provide the column def previously. What exactly do you do with the message content column if I might ask? amandathink

nimble kiln
#

There's one command which shows you the last 5 messages written

lament rock
#

Ah okay. I see. It would make sense to store that, then

nimble kiln
#

Also a !quote command to get 1 random quote from a user

#

Lets break my table by adding an index I guess? ๐Ÿ‘€

lament rock
#

Everything will be fine hippo

modest maple
#

what db is it?

nimble kiln
#

MariaDB

modest maple
#

is that even gonna survive altering 17 million rows

nimble kiln
#

Guess I'll find out? ยฏ_(ใƒ„)_/ยฏ

lament rock
#

Maria is pretty resilient

cinder patio
#

Ah, scaling, when will I get to do it ๐Ÿ˜ญ

lament rock
#

Growth is slow initially

#

but when it hits you, it hits hard

fluid basin
#

@viscid gale

const waiter = () => new Promise((r, j) => r(1));

(async () => {
  const start1 = Date.now();
  for (let i=0; i<999999; i++) {
    await waiter();
  }
  console.log('Async:', Date.now() - start1, 'ms');
})();

const promise_func = (i) => {
  if (i === 999999) {
    console.log('Promise:', Date.now() - start2, 'ms');
    return;
  }
  waiter().then(() => promise_func(i + 1));
}
const start2 = Date.now();
promise_func(0);
fluid basin
#
Promise: 386 ms```
lament rock
#

not bad

quartz kindle
#

promises are slow af

cinder patio
#

Though, in the second test you have recursion, which is generally slower than a regular loop

lament rock
#

Doesn't some engines spawn promises on another thread?

quartz kindle
#

this is why its not recommended to use them everywhere

#

only use promises when actually needed

modest maple
#
func walkRoutes(r chi.Routes, path []string, base string) []string {
    routes := r.Routes()
    if len(routes) == 0 {
        return path
    }

    var route chi.Route
    for i:=0;i<len(routes);i++ {
        route = routes[i]
        if route.SubRoutes != nil {
            path = walkRoutes(route.SubRoutes, path, base + route.Pattern)
        } else {
            path = append(path, base + route.Pattern)
        }
    }

    return path
}```

Fun times with go recursion
modest maple
#

what

quartz kindle
fluid basin
#

yeah lol async is faster kek @modest maple

cinder patio
#

Use recursion for the first test too

modest maple
#

thats probably gonna depend on the eventloop and runtime itself

fluid basin
#

yeah I should

cinder patio
#

Also use performance.now() instead of Date and possibly run them separately

fluid basin
#

its just a demonstration

crystal wigeon
#

djs message obj and stuff never get garbage collected?

#

it keeps growing as many people keep typing commands

thick nexus
#

how is i use multiple prefixes

crystal wigeon
#

put the prefixes in array []

thick nexus
#

ok

crystal wigeon
#

and then you can just [].findIndex to check for the prefix

nimble kiln
#

MariaDB is having fun indexing the column mmLol

#

Oh hey finished after 85seconds, nice

modest maple
# fluid basin its just a demonstration
const waiter = () => new Promise((r, j) => r(1));

const async_func = (async (i) => {
  if (i === 999999) {
    console.log('Async:', Date.now() - start1, 'ms');
    return;
  }
  await waiter();
  await async_func(i + 1);
});
const start1 = Date.now();
async_func(0).then(() => {
  const promise_func = (i) => {
    if (i === 999999) {
      console.log('Promise:', Date.now() - start2, 'ms');
      return;
    }
    waiter().then(() => promise_func(i + 1));
  }
  const start2 = Date.now();
  promise_func(0);
})```
#

Async: 1222 ms
Promise: 59 ms

fluid basin
#

uh what

#

this better

#
const waiter = () => new Promise((r, j) => r(1));

const async_func = async (i) => {
  if (i === 999999) {
    console.log('Async:', Date.now() - start1, 'ms');
    return;
  }
  async_func(i + await waiter());
}
const start1 = Date.now();
async_func(0);

const promise_func = (i) => {
  if (i === 999999) {
    console.log('Promise:', Date.now() - start2, 'ms');
    return;
  }
  waiter().then(r => promise_func(i + r));
}
const start2 = Date.now();
promise_func(0);```
nimble kiln
#

POGGERS That's way faster

fluid basin
#

chrome wtf HAHAHAHA

cinder patio
#

^ Same, that doesn't look right

#

Looks like .then is faster

fluid basin
#

hrm

#

yeah wot

#

but in nodejs its a different story

modest maple
#

dont think so

#

they should always be faster

fluid basin
#

hrm makes sense

#

ok so we conclude promise is much faster

#

but honestly async/await and recursive func is quite dumb

cinder patio
#

but it makes the test fair

modest maple
#

every time you add to that callstack youre slowing everything down

earnest phoenix
#

can you add more than 1 value to object, NameValueCollection c#

#

see what i mean

cinder patio
#

You can only store strings in a NameValueCollection, use a Dictionary and store a List of strings

earnest phoenix
#

ah

#

ait ill look it up

crystal wigeon
#

someone help?

earnest phoenix
#

with what

cinder patio
#

Nobody can help until you ask your question

fathom frost
#
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
(Use node --trace-warnings ... to show where the warning was created)

Does someone know what this means?

cinder patio
#

You have too many event listeners

fathom frost
#

Explain yourself

cinder patio
#

That usually happens when you create an event listener inside another event without destroying it

#

or a loop

umbral zealot
#

Either you've created too many message handlers, or you have a client.on("message") inside another event

fathom frost
#

Ohhhh

#

So like

#

An event inside an event?

cinder patio
#

could be, or inside a loop, or you just have too many event listeners in general

#

we can't tell exactly without looking at the code

fathom frost
#

hhmmmmm wait

#

I will try to delete a suspect one

#

And tell you what happen

#

ok didnt work

#

@cinder patio So I need to create another file, or smth?

#

if i want to create more events?

earnest phoenix
#

did u create that many listeners

cinder patio
#

no

fathom frost
#

so what do i need to do?

earnest phoenix
#

does that msg popup when u start bot?

cinder patio
#

You either

  1. Increase the max event listener size
  2. Destroy listeners after you don't need them / Combine multiple listeners of the same type into one
light fossil
#

Hi

cinder patio
#

increasing the size is only good when you are 100% sure you need all the event listeners

fathom frost
#

ok ty for your help

#

Wait wait wait!!

cinder patio
#

yeah?

fathom frost
#

If I use emitter.setMaxListeners() i can make more events?

cinder patio
#

yes, but like I said, use it only if you are sure you need the event listeners

fathom frost
#

oh ok

cinder patio
#

It's better to just show us where you define your listeners

#

So we can find where all those listeners get created from

fathom frost
#

wait

#

Let me try one thing

#

And if doesnt work

#

๐Ÿƒโ€โ™‚๏ธ

#

Um wait...

#

@cinder patio If I create a lot of commands in just one event, that would help, right?

cinder patio
#

of course

#

Are you creating a new message event for each command?

#

You should use only one message event

surreal sapphire
#

Oรง

#

Amk

#

Piรง

cinder patio
#
on("message", message => {
   switch(message.content) {
     case "~help": ... 
     case "~defef": ...
     //etc
}
}
summer torrent
#

@flat pelican

cinder patio
#

You can also use a command handler, which is cleaner than switch statements

sudden geyser
#

and allows for arguments

fathom frost
wide wharf
#
  if (message.content.toLowerCase().startsWith(prefix + "avatar")) {
    const embed = new Discord.RichEmbed()
      .setTitle("Your Avatar")
      .setAuthor("Its_IsmailZ#8826", "https://cdn.discordapp.com/avatars/643091174243958814/9ec6fc0169e8c4658d87765b1d663efe.png?size=128")
      .setColor(0x00AE86)
      .setDescription("Your Avatar")
      .setImage(message.author.avatarURL)
      .setTimestamp() 
  message.channel.send({embed});
``` Why doesn't this work?
sudden geyser
#

avatarURL is a method.

wide wharf
cinder patio
#

call it

umbral zealot
#

It's a function.

#

like, y'know, ()

wide wharf
sudden geyser
umbral zealot
#

it's the same thing

crystal wigeon
#

hey umm

umbral zealot
#

A method is a function in a class.

crimson vapor
#

can we get a stackoverflow post on how to call a function

#

I think thats needed

crystal wigeon
#

how would you find out if an object is being stored outside of heap that doesnt get garbage collected?

#

how do you identity these

fierce ether
#

any idea why it dosent find the nested property? return member[values] if values is "plugins.verified"?

crystal wigeon
#

global variables? i doubt

earnest phoenix
#

I believe thats not a thing.

sudden geyser
#

Like shouldn't Ismail have received a noisy error detailing what went wrong

summer torrent
#

is that v11 guy

wide wharf
#

I'm new...

edgy tapir
#

how to check if a guild member can receive dm's?

earnest phoenix
sudden geyser
summer torrent
#

send dm and catch errors

cinder patio
#

It's one of the common reasons for memory leaks

#

But it's not "stored outside of the heap"

sudden geyser
#

Don't debuggers like Node.js' default one already show this

wide wharf
# sudden geyser Like shouldn't Ismail have received a noisy error detailing what went wrong
/home/container/index.js:57
        const embed = new Discord.RichEmbed()
                      ^

TypeError: Discord.RichEmbed is not a constructor
    at Client.<anonymous> (/home/container/index.js:57:16)
    at Client.emit (events.js:326:22)
    at MessageCreateAction.handle (/home/container/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (/home/container/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
    at WebSocket.onMessage (/home/container/node_modules/ws/lib/event-target.js:132:16)
    at WebSocket.emit (events.js:314:20)
    at Receiver.receiverOnMessage (/home/container/node_modules/ws/lib/websocket.js:825:20)
pale vessel
#

oof

cinder patio
#

It just doesn't get sweeped by the garbage collector because there's an object pointing to it

sudden geyser
#

Error #1: RichEmbed is not a thing anymore. Poof!

#

You're probably looking for MessageEmbed.

wide wharf
sudden geyser
#

In fact a lot of your code is based on v11 conventions.

edgy tapir
#

u should read the docs

pale vessel
#

erwin be like

wide wharf
edgy tapir
#

Yes

wide wharf
#

ok

#

thx

umbral zealot
sudden geyser
#

dang it

#

beat me to it

pale vessel
#

jinx

#

i be like

safe creek
#

lol

wide wharf
pale vessel
#

yea

#

username and tag

wide wharf
#

okay ty

edgy tapir
#

how to make the bot ignore a specific id ? like if(member.id == " ") ignore or smth like that

cinder patio
#

check if the ids are the same, and if they are just return

edgy tapir
#

if i return the command will stop and i don't want that, i just want the bot to continue executing the command for other members ( i make an announcement command for my yt videos and i want the bot to send a message to a member like every 10 seconds )

sudden geyser
#

Are you DMing every member

edgy tapir
#

yes, i know that if i do this at a certain amount of time it does not break the tos

sudden geyser
#

No, you shouldn't be doing it in general.

edgy tapir
#

Even if i'm the only 1 who has acces on the command ? i had some other bots with this command included and there was not any problem

sudden geyser
#

Instead, how about using @ everyone or @ here (since you want to message a number of users)

boreal iron
#

If you donโ€™t wanna return the function then execute your code if the statement is true

if(member.id != "12345")
{
doEvilShit();
}

edgy tapir
sudden geyser
#

Yes, that's why developers like to DM instead. But you should use @ everyone instead. If you don't want a certain list of members from seeing those announcements, you can restrict their access to the channel you post it in (unless it's a channel with other stuff in it). Your issue from the start was probably using a raw loop and breaking (return) out of it, compared to something else like forEach or continue or doing what Fake said.

wide wharf
#

The token isn't visible ig

#

lemme double check

#

ok it's safe

lyric mountain
lyric mountain
#

thx

wide wharf
lyric mountain
#

ok, so first of all

#

wtf

umbral zealot
#

you're not closing the condition

#

the avatar command isn't "closed"

lyric mountain
#

two listeners too

wide wharf
edgy tapir
#

}

wide wharf
#

okay ty all

umbral zealot
#

you would need to maybe learn javascript and proper syntax...

wide wharf
umbral zealot
wide wharf
#

I started again with a new script all over again cus my old one had some bugs (prob a } forgotten)

lyric mountain
#

and you don't need those two lines in red

wide wharf
lyric mountain
#

and the part circled in blue could be put inside the earlier if check

lyric mountain
# wide wharf why not?

because you've already asserted user is not a bot, and you don't use prefix for anything there

#

also I don't think message.bot is a thing

wide wharf
#
/home/container/index.js:90
}}});
 ^

SyntaxError: missing ) after argument list
    at wrapSafe (internal/modules/cjs/loader.js:931:16)
    at Module._compile (internal/modules/cjs/loader.js:979:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
    at Module.load (internal/modules/cjs/loader.js:879:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
    at internal/main/run_main_module.js:17:47
#

nvm

severe pike
#

Does anybody have the invite for the discord for developers server

lyric mountain
#

oh fck

crimson vapor
lyric mountain
#

ah, yeah

severe pike
#

thats it, thanks!

lyric mountain
#

TIL there are both /developers and /developer invites

spare portal
#

im trying to make a command that disables keyword responses for my bot, but the variable isn't changing

client.on('message',async msg => {
    const curServer = msg.guild.id;
    with(curServer) {
      serverToggle = true;
    }
[ ... ]
if (msg.content.toLowerCase() === ",,togglekeywords") {
    with(curServer) {
      serverToggle = !serverToggle;
      msg.channel.send(`${msg.guild.name} has keywords ${serverToggle}`)
      console.log(serverToggle);
    }
}

i want it to be its own setting for every server it's in, instead of having every server with the same setting, so that's why im trying to use curServer to get individual server IDs. is there an easier way to do this

crimson vapor
#

you should realistically be using a db for any settings but you can make a map, Map<guildID, boolean>

#
map.set(guild.id, true | false)
map.get(guild.id) // true or false or undefined```
spare portal
#

ah ok

misty sigil
#

bot dies

#

aw fuck my database was wiped

crimson vapor
#

yeah exactly

regal jacinth
#

can someone help me understands how channel position works
i tried to make the bot re-arrange the channels according to a dict
like

channel_positions = {channel_id: position_number}
for channel in ctx.guild.text_channels:
     position = channel_positions.get(channal.id)
     await channel.edit(position=position)```
but sometimes the positions don't get right
like the channel that supposed to be on top sometimes it goes down to middle or bottom
and when i check the positions of the channels with another command they get back to their original position
latent heron
#

i have no idea what you're trying to do

regal jacinth
#

re-arrange channels in a certain category

latent heron
#

alright so

#

how are you trying to re-arrange them

regal jacinth
#

i have a function that moves channels to a certain category if it's active
when it goes non-active it should go back to it's previous position but when i try to that it messes the other channels in the same category
so i am trying to re-arrange them

regal jacinth
wispy holly
#

not installing errors

latent heron
#

that's not what i meant

#

are you trying to arrange them as in sort them?

wispy holly
#

ฤฑ installed but when ฤฑ say node that gives error

regal jacinth
#

yeah
like
{channel1: 0, channel2: 1, channel3: 2} and etc

latent heron
#

so

#

here's how you can do it

regal jacinth
#

but sometimes they get messed up as channel1 goes to bottom or middle instead of top

wispy holly
#

quick.db says these:
Error: Could not locate the bindings file. Tried:
โ†’ C:\Users\nedim\OneDrive\Masaรผstรผ\KBILGIbot\node_modules\better-sqlite3\build\better_sqlite3.node
โ†’ C:\Users\nedim\OneDrive\Masaรผstรผ\KBILGIbot\node_modules\better-sqlite3\build\Debug\better_sqlite3.node
โ†’ C:\Users\nedim\OneDrive\Masaรผstรผ\KBILGIbot\node_modules\better-sqlite3\build\Release\better_sqlite3.node
โ†’ C:\Users\nedim\OneDrive\Masaรผstรผ\KBILGIbot\node_modules\better-sqlite3\out\Debug\better_sqlite3.node
โ†’ C:\Users\nedim\OneDrive\Masaรผstรผ\KBILGIbot\node_modules\better-sqlite3\Debug\better_sqlite3.node
โ†’ C:\Users\nedim\OneDrive\Masaรผstรผ\KBILGIbot\node_modules\better-sqlite3\out\Release\better_sqlite3.node
โ†’ C:\Users\nedim\OneDrive\Masaรผstรผ\KBILGIbot\node_modules\better-sqlite3\Release\better_sqlite3.node
โ†’ C:\Users\nedim\OneDrive\Masaรผstรผ\KBILGIbot\node_modules\better-sqlite3\build\default\better_sqlite3.node
โ†’ C:\Users\nedim\OneDrive\Masaรผstรผ\KBILGIbot\node_modules\better-sqlite3\compiled\14.15.1\win32\x64\better_sqlite3.node
โ†’ C:\Users\nedim\OneDrive\Masaรผstรผ\KBILGIbot\node_modules\better-sqlite3\addon-build\release\install-root\better_sqlite3.node
โ†’ C:\Users\nedim\OneDrive\Masaรผstรผ\KBILGIbot\node_modules\better-sqlite3\addon-build\debug\install-root\better_sqlite3.node
โ†’ C:\Users\nedim\OneDrive\Masaรผstรผ\KBILGIbot\node_modules\better-sqlite3\addon-build\default\install-root\better_sqlite3.node
โ†’ C:\Users\nedim\OneDrive\Masaรผstรผ\KBILGIbot\node_modules\better-sqlite3\lib\binding\node-v83-win32-x64\better_sqlite3.node
at bindings (C:\Users\nedim\OneDrive\Masaรผstรผ\KBILGIbot\node_modules\bindings\bindings.js:126:9)
at Object.<anonymous> (C:\Users\nedim\OneDrive\Masaรผstรผ\KBILGIbot\node_modules\better-sqlite3\lib\database.js:9:24)

#

when i say node command

#

help pls

latent heron
#

chs = []
c = 0
for ch in ctx.guild.text_channels:
  c += 1
  chs.append({ch.id: c})

return chs.sort()```
#

is this what you're trying to do?

regal jacinth
#

hmm

#

pretty much

latent heron
#

you'll have to access it like chs[0][id]

regal jacinth
#

but, it sometimes put the channel that's supposed to be on top at the bottom

#

that's my issue

latent heron
#

are you trying to sort by c or by ch.id

#

the above method will only sort by ch.id

regal jacinth
#
channel_positions = db.get().val()
for channel in ctx.guild.text_channels:
     position = channel_positions.get(channal.id)
     await channel.edit(position=position)```
#

like this

#

it's a dict where i get the channel_position from the database

latent heron
#

can i see what channel_positions outputs?

regal jacinth
#

okay lemme print it

#
OrderedDict([('718842573426524200', 101), ('718842591902302218', 103), ('718842604912902174', 104), ('718842619131854878', 106), ('718842629315362836', 107), ('718884729658802186', 102), ('720093709227786290', 108), ('804699003585167400', 105)])```
here they are, the position starts from `101`
they get back to their normal positions which is `19` ig
i suppose channels have to fill the gaps or smth
#

@latent heron

latent heron
#

so the 2nd value in the lists is what you want to sort by, correct?

tired panther
latent heron
#

ohh you're working with a DB table

#

at that point there's no point trying to sort by the 2nd

latent heron
#

just run .sort() when you append the whole list by the position it shares in the Database

#

that will solve your problem

tired panther
cinder patio
#

oh I misread the question

lyric mountain
#

well, you gotta split it

latent heron
#

JS i think rounds up by default

cinder patio
#

ms does that?

#

yeah you can't input things like that

#

either 1h or 30m

latent heron
#

you can't do half

#

you need to handle both separately

lyric mountain
#

1.5h

#

but it's gross

cinder patio
#

and kinda hard to parse

tired panther
#

does to much npm packages make my bot slow?

cinder patio
#

easier to just split by an empty space

lyric mountain
tired panther
#

ms in human

cinder patio
#

depends on the npm packages you're using

lyric mountain
#

that's from ms lib

#

nonetheless, just split by space after letter

#

(?=[a-zA-Z])\s

tired panther
lyric mountain
#

no

#

if you split it that way just process every part separately

#

then sum everything afterwards

#

if you input 1h 30m it'll become ['1h', '30m']

tired panther
#

but when the usr pass 2hours 20 minutes?!

lyric mountain
#

it'll become ['2hours', '20 minutes']

#

that regex will only split if there's a space preceded by a letter

tired panther
#

2h30m , will the regex check to?

lyric mountain
#

it'll not split

#

I'll not give you a "fit all" regex

#

I gave you the base to it

#

adjust it to your needs

tired panther
#

ok will^^

dusky harness
#

cclient.on('message', message => {
const userID = '698183217215176783';
if (message.author.id !== userID) { return message.channel.send("bunu yapamassฤฑn")
}
client.on('message', message => {
if (!message.guild) return;
if (message.content.startsWith('!kick')) {
const user = message.mentions.users.first();
if (user) {
const member = message.guild.member(user);
if (member) {
member
.kick('Optional reason that will display in the audit logs')
.then(() => {
message.reply(รœye baลŸarฤฑyla atฤฑldฤฑ ${user.tag});
})
.catch(err => {
message.reply('รœyeyi atamadฤฑm');
console.error(err);
});
} else {
message.reply("Bu kullanฤฑcฤฑ bu sunucuda deฤŸil!");
}
} else {
message.reply("Kullanฤฑcฤฑ bulunamadฤฑ");
}
}
}
});
what's my fault

merry grove
#

what error comes up?

solemn latch
#

cclient

#

๐Ÿ‘€

earnest phoenix
#
triggerarray.push(String("`"+element.trigger+"`"))```
why does this return  Cannot read property 'push' of undefined
solemn latch
#

events declared in events

earnest phoenix
#

the element exist and i can console it

dusky harness
# merry grove what error comes up?

SyntaxError: missing ) after argument list
โ†[90m at wrapSafe (internal/modules/cjs/loader.js:979:16)โ†[39m
โ†[90m at Module._compile (internal/modules/cjs/loader.js:1027:27)โ†[39m
โ†[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)โ†[39m
โ†[90m at Module.load (internal/modules/cjs/loader.js:928:32)โ†[39m
โ†[90m at Function.Module._load (internal/modules/cjs/loader.js:769:14)โ†[39m
โ†[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)โ†[39m
โ†[90m at internal/main/run_main_module.js:17:47โ†[39m
C:\Users\Hp\Desktop\bot\efe.js:32
message.reply(รœye baลŸarฤฑyla atฤฑldฤฑ ${user.tag});

merry grove
#

You forgot the `` in the ()

#

@dusky harness

lyric mountain
#

show remaining code

earnest phoenix
lyric mountain
#

yes

merry grove
#

It should be

message.reply(`รœye baลŸarฤฑyla atฤฑldฤฑ ${user.tag}`);

@dusky harness Try that

earnest phoenix
#
 let triggerarray, triggertypearray, tokenarray, filenamearray =[];
data.forEach(element => {
console.log(element.trigger) //outputs valid
triggerarray.push(String("`"+element.trigger+"`"))           triggertypearray.push(String("`"+element.triggertype.replace("word","message").replace("join","join/leave")+"`"))
tokenarray.push(String("`"+element.token+"`"))
filenamearray.push(String("`"+element.filename+"`"))
            });
lyric mountain
#

lemme format that properly

#
let triggerarray, triggertypearray, tokenarray, filenamearray = [];
data.forEach(element => {
    console.log(element.trigger) //outputs valid
    triggerarray.push(String("`" + element.trigger + "`"))
    triggertypearray.push(String("`" + element.triggertype.replace("word", "message").replace("join", "join/leave") + "`"))
    tokenarray.push(String("`" + element.token + "`"))
    filenamearray.push(String("`" + element.filename + "`"))
});
#

hm, huge variable names, just a sec

#
let triggers, types, tokens, files = [];
data.forEach(element => {
    console.log(element.trigger) //outputs valid
    triggers.push(String("`" + element.trigger + "`"))
    types.push(String("`" + element.triggertype.replace("word", "message").replace("join", "join/leave") + "`"))
    tokens.push(String("`" + element.token + "`"))
    files.push(String("`" + element.filename + "`"))
});
#

much better

#

first of all, switch forEach to a normal for call

earnest phoenix
#

okay

lyric mountain
#

second, do you really need String()?

earnest phoenix
#

i just use it to test if it works

lyric mountain
#

remove them

earnest phoenix
#

same error Cannot read property 'push' of undefined
i am trying with normal for

lyric mountain
#

ah, true

#

let triggers = types = tokens = files = [];

#

try that

crystal wigeon
earnest phoenix
sudden geyser
#

A debugger is probably more reliable in this instance.

earnest phoenix
#

embed inline why is the last downvote

lyric mountain
#

inline: false

opal plank
#

max 3 per inline too

earnest phoenix
#

oh thx for the info

#

now it looks better

crystal wigeon
#

how would i serialize this

#

:c

nimble kiln
earnest phoenix
nimble kiln
#

Exactly! >:D

crimson vapor
#

its a bit annoying

#

but not much you can do unless you want to do canvas stuffs

wispy holly
#

Guys ฤฑ need help my music bot is not workng that always says u must ente a voice channel but ฤฑ was already in the voice channel why?

craggy pine
wispy holly
#

hhere

tired panther
#
const moment = require("moment");
require('moment-duration-format');
const ms = function(value){return moment.duration(value, "milliseconds").format("d[d] h[h] m[m]")}
``` When I parse the time with ms(value) . it gives me 8h 0m, how can I remove the 0?
solemn latch
#

7kb radio command ๐Ÿ‘€

tired panther
shy turret
#

im trying to play with numbers but 276497792526974996 == 276497792526975000...

#

how do i fix this

tired panther
solemn latch
#

looks like the code is for v11 too

#

not v12

crimson vapor
#

thats just how js does numbers @shy turret, you can use strings tho

tired panther
#

"4568790675467890"

shy turret
#

doesnt work

#

well

solemn latch
#

because they are ints

#

use strings

shy turret
#

i want to detect if it's a valid snowflake

solemn latch
#

JavaScript numbers cannot be as large as snowflakes need to be so it has to be a string

shy turret
#

is there a way to detect a valid snowflake?

solemn latch
#

other than length, and checking if the snowflake has a valid timestamp, i dont think so

#

its a combination of a few things

#

not just date

crimson vapor
#

sad @quartz kindle why join and leave like that

quartz kindle
#

accident

crimson vapor
#

oh

#

lmao

solemn latch
shy turret
#

haha i suffer

zenith terrace
#

@solemn latch petpetwoo

solemn latch
#

hihi

zenith terrace
#

im getting ez karma rn on reddit

#

wait this is development

solemn latch
#

developing reddit

#

reddit account*

zenith terrace
#

lol

earnest phoenix
#

how would i add a space

#

between the two fields?

#

sorry im new to coding

tired panther
earnest phoenix
#

i just use better discord

tired panther
tired panther
umbral zealot
#

I hope you know BD is against the discord terms of service, right?

umbral zealot
#

as in, could potentially get you banned for using it

earnest phoenix
#

oop im deleting rn i rly didnt know

umbral zealot
#

"Modifying the discord client" is against the ToS, and that's what betterdiscord does.

earnest phoenix
#

oh i didnt know im sorry ill change it rn

tired panther
slender thistle
earnest phoenix
slender thistle
#

Can't have customizable spaces

earnest phoenix
tired panther
slender thistle
#

I doubt that will help

#

But, I mean

#

You'll have to use zero-width-space character for both field name and value for that

tired panther
earnest phoenix
#

i thought it would work

lyric mountain
slender thistle
#

You'll have to do it via template strings instead

earnest phoenix
#

now this happens after adding emty field

earnest phoenix
lyric mountain
#

you can't leave it empty

slender thistle
lyric mountain
#

you gotta put two strings in it

tired panther
slender thistle
#

or that

tired panther
#

@earnest phoenix

#

you can bold it with **!**

earnest phoenix
safe creek
#

how would i keep staying motivated when i feel quite unmotivated

edgy tapir
#
const embed = new MessageEmbed()
            .setColor("GREEN")
            .setFooter(message.guild.me.displayName, client.user.displayAvatarURL)
            .setDescription("**Reactioneaza pentru a incepe jocul!**")
            .setTimestamp();

        const m = await message.channel.send(embed);


        await m.clearReactions();

m.clearReactions is not a function

clearReaction was also changed in v12?

cinder patio
#

it's reactions.clear

#

afaik

edgy tapir
#

๐Ÿคจ

#

Ok, i'll try

cinder patio
#

No

quartz kindle
#

i dont remember clearReactions ever being a thing

cinder patio
#

it's actually .removeAll

tired panther
#

yes alol

edgy tapir
tired panther
#

msg.reactions.removeAll().catch(e =>null);

#

@edgy tapir

edgy tapir
#

Ty

earnest phoenix
tired panther
#

I spoonfeed to much lol 3551_haha_laugh_sign_bean

tired panther
lyric mountain
#

note, this WILL put a hole in your embed

earnest phoenix
tired panther
lyric mountain
#

button?

tired panther
tired panther
cinder patio
#

That's a planned feature

lyric mountain
#

not embeds tho, they'll make a form-like feature

tired panther
lyric mountain
#

and client-side messages

tired panther
#

are there already sneakpeaks ?

lyric mountain
#

only a poor af demo they made

#

here's the full post

tired panther
#

thx Shiba_Heart

earnest phoenix
#

man it still wont work @tired panther

#

in html it is <br>

#

how is it for bots?

lyric mountain
#

show full code

earnest phoenix
#
const Command = require('../Command.js');
const { MessageEmbed } = require('discord.js');

module.exports = class FindIdCommand extends Command {
  constructor(client) {
    super(client, {
       name: 'love',
      usage: 'love <user mention>',
      description: 'Shows how much All About Ishaan loves you!',
      type: client.types.OWNER,
      ownerOnly: true,
      examples: ['love  @โ™ฅยฐโ€ขLexieโ€ขยฐโ™ฅ']
    });
  }
  run(message, args) {
    const target = this.getMemberFromMention(message, args[0])
    if (!target) 
      return this.sendErrorMessage(message, 0, 'Please mention a user, role, or text channel');
    const embed = new MessageEmbed()
      .setTitle('All About Ishaan loved someone!')
      .addField('He loved:', target, true,)
      .addField('I hope he loves you forever! I am wishing you a wondeful day!', target, true)
      .setImage('http://38.media.tumblr.com/9204649fd84d3df7223feb6712a89444/tumblr_n8pc8badUs1sg0ygjo1_500.gif')
      .setFooter(message.member.displayName,  message.author.displayAvatarURL({ dynamic: true }))
      .setTimestamp()
      .setColor(message.guild.me.displayHexColor);
    message.channel.send(embed);
  }
};
#

i want a link break between the two fields

lyric mountain
#

just set both to inline: false

#

if there're only 2 fields

craggy pine
#

true, that comma isn't needed I'm pretty certain

lyric mountain
#

?

#

what was written?

#

gtranslate couldn't tell me

craggy pine
#

idk I told parm tho

scenic kelp
#

no clue

earnest phoenix
lyric mountain
#

see my last image

earnest phoenix
craggy pine
earnest phoenix
#

ok

earnest phoenix
craggy pine
#

.addField('I hope he loves you forever! I am wishing you a wondeful day!', target, true) <-- false

#

for both

earnest phoenix
#

oh ok let me try

tired panther
craggy pine
tired panther
#
.addField('I hope he loves you forever! I am wishing you a wondeful day!', target)
craggy pine
#

I always define true / false

#

I can remove some un needed words then in my own stuff

tired panther
lyric mountain
#

ah, yes, seems legit

tired panther
#

lol

earnest phoenix
#

THANKS SO MUCH

lyric mountain
#

TIL gtranslate sucks at arabic

tired panther
edgy tapir
#
 if (typeof options !== 'object') return Promise.reject(new TypeError('INVALID_TYPE', 'options', 'object', true));
                                                           ^

TypeError [INVALID_TYPE]: Supplied options is not an object.

What does this mean ? ๐Ÿคจ

quartz kindle
#

it means you didnt give it an object

earnest phoenix
#
message.members.permissions.has

is this correct?

edgy tapir
#

message.member*

earnest phoenix
#

a typo

agile steppe
#

i bought a ovh vps but idk how to run 24/7 my bot there

solemn latch
#

use a process manager

agile steppe
#

Process manager?

solemn latch
#

manages processes

agile steppe
#

Like MobaXterm?

quartz kindle
#

thats a terminal

tawny cosmos
#

How is everything with you guys in here I know I've been away for a couple of hours I'm just going over services policies

agile steppe
#

Ahh

agile steppe
quartz kindle
#

a terminal is used to connect to the vps and run commands on it

tawny cosmos
#

And how could I maintain the safety for the rest of you guys in here that's all just doing the right thing

quartz kindle
#

a process manager is something that you can run with a command, and it keeps running even after you close the terminal

agile steppe
#

Ahh

#

what one should i use

quartz kindle
#

a popular process manager for node.js bots is pm2

#

also works for python

quartz kindle
#

lmao wat

agile steppe
#

Oh ty

lyric mountain
#

it needs access to that

#

sudo it

agile steppe
lyric mountain
#

sudo npm i -g pm2

agile steppe
lyric mountain
agile steppe
solemn latch
#

its a good idea to read about pm2, theres a few things about it that knowing how it works helps.

#

for example, you must manually configure it for restarting automatically on reboot.

#

or auto restarting when you push new files to the folder

edgy tapir
#

throw new DiscordAPIError(request.path, data, request.method, res.status);
^

DiscordAPIError: Invalid Form Body

What could cause this ?

umbral zealot
#

what`s your code?

edgy tapir
#

wait

#

so i;m trying to make a report bug command, and the bot will send me the bug

lyric mountain
#

what's up with that formatting?

edgy tapir
#

wdym ?

#

oh

#

idk

#

i was just messing up with embeds

#

=))

#

i kinda like that format

lyric mountain
#

well, my guess is that you're passing wrong data to some field

#

check the docs

edgy tapir
#

ok

umbral igloo
#

I'm a new bot developer, and am trying to access the names of all channels that the bot has access to in my testing server. I am using the discord.js interface, but cannot figure out how to list the names of the channels. I've looked up a few pages on the discord.js guide and some reddit / stackoverflow posts, but cannot figure this out.

Does anyone have any tips?

slender thistle
#

First you would need to get the guild object of your testing server

umbral igloo
#

I've gotten it.

#

At least I would hope I have.

tiny quartz
#

uhhh try looping over all the channels and checking if you have permissions in that channe;

#

*channel

#

you should able to get the channels of each type

#

like all text channels

#

and all voice channels

umbral igloo
tiny quartz
#

uhhh

#

i dont do JS i do py

#

but you could send that snippet?

#

wait

#

actually

#

found something

umbral igloo
#
const Guild = await client.guilds.fetch("812507862030614538");
        Guild.channels.forEach(channel => {
          if(channel.permissionsFor(message.author).has('VIEW_CHANNEL')) listedChannels.push(channel.name);
        });
        message.channel.send(`You have access to: ${listedChannels.join(', ')}`);
``````txt
TypeError: Guild.channels.forEach is not a function
tiny quartz
#
var textChats = message.guild.channels.cache
        .filter((ch) => ch.type === 'text' && ch.topic === 'volturnbot')
        .array()
#

try that

#

for you you can remove the message. I believe

quartz kindle
#

guild.channels is a ChannelManager object, not the channel list itself

#

the actual list its accessible via the .cache property

#

guild.channels.cache

umbral igloo
#

Ah

umbral igloo
#

Thanks

#

I just started with js last night.

#

So this interface is very confusing to me.

quartz kindle
#

you're already doing a lot better than most people who ask for help here

#

lmao

lyric mountain
#

just a tip: halt bot development and try to become more familiar with the language itself

umbral igloo
#

I'm native to C++ and lua

quartz kindle
#

ah cool

lyric mountain
#

there are discord libs for both btw

quartz kindle
#

if you're comfortable with c++, you could try getting straight into typescript

#

its kind of a javascript framework/superset with strict typing

#

that compiles to js

lyric mountain
umbral igloo
#

lol

#

I'll check it out.

lyric mountain
#

non-typed was an error right from the start

umbral igloo
#

Is there an introductory video to how TypeScript works somewhere?

quartz kindle
#

lmao

#

should be plenty of them

#

its very popular

umbral igloo
#

I see.

#

Just looked it up.

#

On another note, are users cached to the bot's <client>.users.cache as soon as they join?

#

Or do I have to do something special here.

quartz kindle
#

not exactly

#

recently discord applied new measures to protect users and members from bot scrapping

#

if you dont have the "guild members" nor the "presences" intents enabled in your developer portal, you will only see users after they interact with discord

#

offline and inactive users wont be available from the start

#

you can individually obtain them whenever you need them

#

but you cant obtain them in mass, you are limited to 100 members per request

#

if you have "presences" enabled in your dev portal, then you will additionally see all online members, even if innactive

#

and you will obtain them as they come online

umbral igloo
#

I'm in my dev portal, where can I find intents?

quartz kindle
#

if you have the "guild members" intent, then you will be able to get all members from a single guild at once

#

and optionally do it for all guilds at startup

#

should be under your "bot" section

#

privileged intents

umbral igloo
#

found it, thanks

quartz kindle
#

although beweare

#

users and members cost a lot of memory

umbral igloo
#

If I'm just using these intents to loop through members, would that be intensive?

quartz kindle
#

yes

umbral igloo
#

I see.

quartz kindle
#

you need them all cached, aka downloaded, to be able to loop through them

#

they dont take up much space by themselves, but they quickly amount to a lot of memory when your bot joins a few large guilds

umbral igloo
#

Is there a way to skip the caching, but still store the IDs of members to say a JSON file array?

quartz kindle
#

you can do that yes

umbral igloo
#

can I still interact with users without caching?

quartz kindle
#

the fetch method allows you to prevent caching them

#

guild.members.fetch({cache:false})

umbral igloo
#

does that fetch the entire array of members?

#

or just one member

quartz kindle
#

if you dont specify an id, it will fetch all of them

umbral igloo
#

ah, I was under the impression that fetch required an id.

#

that's helpful

quartz kindle
#

you can find more info here

umbral igloo
#

Ah, this fetch has different parameters than a user/channel fetch.

quartz kindle
#

yup

umbral igloo
#

So many things to learn lol. Time will tell I guess.

#

Thanks for the help, I definitely gained some insight here.

tawny cosmos
#

So many things to learn yes I'm coming to school here to advance in my coding and people skills

#

I would like to talk to some of you guys personally for tutor or not

#

I just signed up for classes myself and I'm looking for healthy and positive relationships during this growth in school

quartz kindle
#

cool

solemn leaf
#

What would be the best way to store data for getting top message sends and reacters in a channel

solemn latch
#

i would just have a counter for each user for each message sent, or reacted to, then just sort it

solemn leaf
#

so say like I did

#

channelid, messagcount, reactcount, user

#

is that what you had in mind

solemn latch
#

yeah that works,
I would do a shared primary key(if your db supports it) between userid and channelid so you can have multiple of each

solemn leaf
#
{
"channel_1": [
"user: {msgcnt, reactcnt}",
"user2: {msgcnt, reactcnt}",
],
"channel_2": []
}
#

what if I did something like that

solemn latch
#

json db? ๐Ÿ‘€

solemn leaf
#

no

#

an example I will ahve in my db lol

lyric mountain
#

kinda sus tho

solemn latch
#

mongodb doesnt support composite keys? eyes_shaking

solemn leaf
#

IM not gonna use mongo

solemn latch
#

oh i wasnt suggesting it

lyric mountain
#

sql then?

solemn leaf
#

yes

solemn latch
#

i just was looking it up out of curiosity

lyric mountain
#

why tf u example a sql table with json?

solemn leaf
#

idk

lyric mountain
#

just use two tables then, one for user and one for channel, msgs and reactions

#

1 ----< N

solemn latch
#

i still suggest compound keys

#

so it all goes in one table

lyric mountain
#

compount keys in sql are a nono

solemn latch
#

since when ๐Ÿ‘€

lyric mountain
#

since sql convention rules

solemn leaf
#
channel: { messages: { aki: number }, reacts: { aki: number } }

can I do something like that

lyric mountain
#

don't remember the exact number

#

maybe it was 2 or 3

solemn latch
#

everyone seems to say its fine online

pallid quail
#

"Data should depend on the key, the whole key, and nothing but the key, so help me Codd"

#

which I think means BCNF 2 for "the whole key"

solemn leaf
#

should I make the channel id the key

#

that counds like a good idea

sterile lantern
#

i forgot what this was called, but what's the function to make fiSheR into fisher

#

i think it was to lowercase

#

and can you do that to an arrya

#

array*

nimble kiln
#

.toLowerCase()

#

maybe?

sterile lantern
#

e.g: let array1 = .toLowerCase(['array1'])

#

ima try

nimble kiln
#

I guess it's only for strings?

sterile lantern
#

oh

#

ripp

pallid quail
#

I think you want MEMBER_ROLE_UPDATE

sterile lantern
nimble kiln
#
console.log(words);```
#

Maybe that

sterile lantern
#

oh

#

that works

#

thanks

nimble kiln
#

Or if you loop through the array

#

you could do array[i].toLowerCase() I guess?

#

But if my other code snippet works, good ๐Ÿ˜„

sterile lantern
#

hmm

#

i want like any args they say to be lowercased

nimble kiln
#

How are you checking if your word is in the array?

sterile lantern
#

oh wait i can just lowercase their args

#
if(!validitems.includes(args[0])) {```
pallid quail
#

you could also do the other way around, make array = ['fishing pole', 'laptop'] and then check if it contains arg.toLowerCase()

nimble kiln
#

ok yeah saving the validitems lowercase

#

and lowercasing the args is probably the smart way

sterile lantern
#
if(!validitems.includes(args[0].toLowerCase)) {```
#

this doesnt work