#development

1 messages · Page 1512 of 1

cerulean ingot
#

any suggestions?

sacred aurora
#

Umm hyperlink?

#

in a string of course

solemn latch
#

Galaxygate

severe inlet
#

what language is the code of ur bot?

cerulean ingot
#

python?

severe inlet
cerulean ingot
#

mhm

severe inlet
#

come to dms

#

^^

earnest phoenix
cerulean ingot
#

they just did -_-

solemn latch
#

That is the example

cerulean ingot
#

lmfao

sacred aurora
cerulean ingot
#

yeah ik

earnest phoenix
#

@sacred aurora just give some code

cerulean ingot
#

delete that

sacred aurora
#

Hmm wdym

cerulean ingot
#

im going to see if they copy the code

earnest phoenix
#

I don't need the code

cerulean ingot
#

ok

#

then what do you need

earnest phoenix
#

He just wants to imagine how it will happen

#

I can't figure it out

cerulean ingot
sacred aurora
#

Sorry but im on a phone rn :v

earnest phoenix
#

👍

#

thanks

fierce ether
#

app.set('/views', '../dashboard/views'); this dosent set views?

solemn latch
#

The galaxy gate has double the memory, and unlimited bandwidth for 50 cents more a month.

#

And 5gb more ssd space

cerulean ingot
#

oh wait it does have more ssd

#

i thought it had less

#

lol thank you

solemn latch
#

If your ip isn't being shared, you probably won't be ddosed.

cerulean ingot
#

hmm

solemn leaf
#

yeah why the hell would you need ddos protection

gilded olive
#

bc people are stupid

cerulean ingot
#

what

gilded olive
#

I remember carl bot got ddosed one time

solemn leaf
#

how do you ddos a bot

cerulean ingot
#

you can ddos a vps

solemn leaf
#

hey do you get the bot to open your link

#

legit

#

how would you get the ip from nothing

quartz kindle
#

ddos protection is only relevant for public facing services

#

a discord bot is not public facing

#

but a dashboard for a discord bot could be

cerulean ingot
#

yeah theres no db

gilded olive
solemn leaf
#

try

#

true

gilded olive
#

but I doubt that would be the actual IP

solemn leaf
#

image generation like using canvas too

vagrant mist
#

Owo

true ravine
#

Are there the equivalent of sql injection attacks on mongodb or can I just throw whatever info I want into it?

cinder patio
#

whatever info you want

umbral zealot
#

apparently it can be a thing

#

no system is perfectly safe. It's best not to pretend they are, and start doing research on them.

earnest phoenix
true ravine
earnest phoenix
#

Has this been coded right LMfao?

sand condor
#

no

earnest phoenix
#

@sand condor I knew that lol

sand condor
#

ok

cinder patio
#

suure

earnest phoenix
#

@cinder patio yes I knew it wouldn’t work bruh

cinder patio
#

then why did you ask?

earnest phoenix
#

Just to make sure

umbral zealot
#

If you want to see if code works, run it

solemn leaf
#

why do you format like that

earnest phoenix
#

Well, I tried to make my own command for the first time by documents LOL

umbral zealot
earnest phoenix
#

Where can I see the format?

solemn leaf
#

well most of the time

umbral zealot
#

you'd need a proper editor that's not a browser on an iPhone for that

solemn leaf
#

you would put .then on the function

#

#().then().catch()

crimson vapor
#

umm

sand condor
#

it is on the function

crimson vapor
#

().then(() => {}).catch()

#

yea

earnest phoenix
#

Is there a place where I can view the uh

#

Formats?

solemn leaf
#

I meant for makign it look nice

crimson vapor
#

formats for what?

#

code?

earnest phoenix
#

@crimson vapor commands like, mute, unmute, unban like not the coding but the format

umbral zealot
#

That's something you can learn from experience, how to make your code readable

#

Unless you mean the features available in discord.js which is just... in the documentation.

crimson vapor
#

like

function() {
code().then(() =>{
})
}``` looks ugly
earnest phoenix
#

I am still learning

crimson vapor
#

and should be formatted?

earnest phoenix
#

No, I mean like

crimson vapor
#

if vsc just press shift alt f iirc

earnest phoenix
#

You see this right?

#

I’m iPad

umbral zealot
#

ok but what do yo umean

solemn leaf
#

you could use beautify

umbral zealot
#

what exactly are you asking

earnest phoenix
#

Like,

umbral zealot
#

How to make it prettier?

earnest phoenix
#

Like,

#

Uh

#

No

#

Not that

#

Uh it’s kinda hard to explain

umbral zealot
#

So what, use your words....

earnest phoenix
#

Like mute it starts with something and goes all the way down like a format like that to show me which line I should put the coding to make it work

#

Yea it’s kinda hard to explain

crimson vapor
#

then give an example

#

for ping or something

earnest phoenix
#

Like purge

cinder patio
#

That's not what's meant by format

umbral zealot
#

do you mean the spaces on the left of the code?

true ravine
#

I think they want a "fill in the blanks" of the commands

earnest phoenix
#

Nope

#

It’s kinda hard to explain

#

But nvm lol

cinder patio
#

format is just how your code looks.

solemn leaf
#

Should I make a file for handling mutes in a db

cinder patio
#

where to put the code is the logic

umbral zealot
#

And how to use the special characters like () or [] or . is called "syntax"

#

It's a bit like grammar for code

mellow kelp
#

hm yes

earnest phoenix
#

@cinder patio like, if I put the lines randomly then it wouldn’t work like I need to use a format kinda. So like that

mellow kelp
#

gramer

earnest phoenix
#

Get what I mean?

crimson vapor
#

eslint?

#

thats what you mean?

umbral zealot
#

"put the lines randomly"? wat

#

It sounds like you're asking how to learn programming, as a whole.

earnest phoenix
#

No it’s not that

true ravine
#

One of the key things for beginners to learn is how async works because it's different to the synchronous code you may have learned at school or something

umbral zealot
#

And that's done by actual experience and literal learning which you still haven't done

earnest phoenix
#

Ima try to explain it with the best words I got

crimson vapor
#

your first language is english?

umbral zealot
#

IF you can't even express your problem it means you don't understand enough about programming to even form that sentence, and that means you still gotta lot to learn

earnest phoenix
#

@crimson vapor what??.

cinder patio
#

I know what you mean - code gets executed from top to bottom

#

you don't put your code randomly - you put it in an order that makes sense

crimson vapor
#

I had that problem with I was trying to type something in ts

#

I didn't know enough to explain what I wanted

earnest phoenix
#

That’s what I mean

crimson vapor
#

turs out it was just export = class

umbral zealot
#

Oh christ, I mean, it's not hard, code is executed from top to bottom

#

smh

crimson vapor
earnest phoenix
#

Yea well, bot how would I know lol?

umbral zealot
#

Experience.

#

And Logic.

crimson vapor
#

should you check if a user is cached or if there are args first?

craggy pine
#

Learning the coding language

crimson vapor
earnest phoenix
#

I’m still learning

craggy pine
earnest phoenix
#

Uh lol

true ravine
#

You don't put a cake in the oven before you've mixed the ingredients in a bowl, it's common sense to a certain extent

solemn leaf
#

@umbral zealot I think its left to right

umbral zealot
#

what

#

I mean it's both

#

it's top to bottom, left to right

#

just like english

crimson vapor
#

not really

#

it follows math rules

#

so

#

grouping

mellow kelp
#

bruh imagine a programming language that reads code from bottom to top and right to left

solemn leaf
#

nah my code is writen in manga

mellow kelp
#

someone ought to create that

earnest phoenix
#

@umbral zealot can ya send the uh documents again? I can’t find them

crimson vapor
#
umbral zealot
earnest phoenix
#

@umbral zealot @crimson vapor thanks

crimson vapor
#

oh that

#

tip btw

#

learn how to read docs

earnest phoenix
#

Hm

#

Well

#

Uh

#

Lol

crimson vapor
#

made learning the language 100x easier

#

once I figured out how to read it

fair axle
#

+1

mellow kelp
#

watch fireship's yt channel too

earnest phoenix
#

@mellow kelp who’s that?

mellow kelp
#

the guy's videos are really simple to understand

fair axle
#

don't watch any video just read docs

earnest phoenix
#

Hm, I’ll see

#

Imagine me making my own codes lol

fair axle
#

It is the best way to learn

crimson vapor
#

@mellow kelp btw I got my bot using 6mb heapUsed

craggy pine
#

I never suggest any "Bot making tutorials" without knowing the coding language first.

craggy pine
earnest phoenix
#

@craggy pine I’m still learning I won’t really like to uh change my mane :(.

crimson vapor
#

my bot got me into js so imo its not bad

earnest phoenix
#

Name*

craggy pine
earnest phoenix
cinder patio
#

Before you learn in what order to put the code, you must know what it does

crimson vapor
#

but you need to understand how to search problems

#

and understand answers

#

my internet slow

mellow kelp
#

learn how to google

earnest phoenix
#

Yes yes

mellow kelp
#

thats really important ngl

earnest phoenix
#

Mm tasty

solemn leaf
#

hey

#

uh

#

tryhackme has a really good course on how to google stuff

nocturne flint
#

Any one python developer here

solemn leaf
#

send code

nocturne flint
gilded olive
nocturne flint
#

@gilded olive you are a python developer

gilded olive
#

ye

#

well that's my main lang rn

solemn leaf
#

just send you code

#

we can help

gilded olive
#

grammar 101

#

👍

opal plank
#

okay now this is fun

solemn leaf
#

wdym

opal plank
#

auto generated types

#

from my database

#

simply input the table name, and the primary column name, and it generates a full d.ts file for the declarations

trim saddle
#

@crimson vapor could you send me an example of the body you send to when sending a file

opal plank
#

never again updating code to adjust for new character nor updates for it, add to database and let the rest handle it dynamically

crimson vapor
#
      // message = new FormData();
      const req = await this.#shard.client.api().channels[this.id].messages.post({
        method: 'POST',
        body: message,
        headers: {
          'Content-Type': message.getHeaders()['content-type']
        },
        parser: (_) => (_)
      });

      if (req.code !== undefined) throw new Error(req.message)
      return new (require('./Message'))(req, this.#shard);```
trim saddle
#

no i mean the body

crimson vapor
#

body is just formdata

fast trench
#

why won't this delete the message I send? First time ever having this problem

client.on(`message`, async message => {
    console.log(1)
    if (message.author.bot) return;
    const channel = message.guild.channels.cache.find(c => c.id === '797559702783131680')
    console.log(2)
    const embed = new MessageEmbed()
        .setTitle(`Suggestion by: ${message.author.username}`)
        .setDescription(message.content)
        .setFooter(process.env.FOOTER)
        .setColor(process.env.COLOR)
        .setTimestamp()
    console.log(3)
    let msg = await channel.send(embed);
    console.log(4)
    await msg.react(`👍`);
    console.log(5)
    await msg.react(`👎`);
    console.log(6)
    await message.delete;
});```
trim saddle
#

message.delete is a function

fast trench
#

oh my god I'm stupid 🤦‍♂️ lol

#

i get it now

nocturne flint
pulsar sonnet
#

can anyone assist me with python code I'm not a bot developer but I payed for someone to make one for me and I can't seem to fix the error codes nor do I understand them.

nocturne flint
#

@gilded olive Bro how can get a person how invite the members

buoyant aspen
#

anyone know if Google will index URLs that 301 redir to a discord login page?

eternal osprey
#

hey guys

eternal osprey
#
   notification.notify(
                title = "Price of your stock is below " + buyPrice,
                message = "Current price is " + str(price),
                app_icon = "test.jpg",
                timeout = 100
            )
            b=b+1
            s=0
    
    elif(float(price) > float(sellPrice)) :
        if(s==0):  
            notification.notify(
                title = "Price of your stock is above " + sellPrice,
                message = "Current Stock price is " + str(price),
                app_icon = "test.jpg",
                timeout = 100```
#

why is it giving me that error?

cinder sandal
#

are you sure that the image exists

eternal osprey
#

yup

pulsar sonnet
stark abyss
#

i found a selfbot that's streaming anime 24/7 anime

eternal osprey
stark abyss
#

yes

eternal osprey
#

ah you are just using it to test or something.

#

I guess it is good then?

#

Idk tbh. Have fun tho 😉

solemn leaf
#

illegal?

stark abyss
#

banned from discord

solemn leaf
#

doesnt make it illegal

stark abyss
#

or something

#

discord illegal

rustic nova
gilded olive
#

no cringe

cerulean ingot
#

best vps hosting under $5?

solemn leaf
cerulean ingot
#

which one do you recommend from that list

solemn leaf
#

well

#

glaxygate I think is the best

cerulean ingot
#

but it doesnt have ddos protection

misty sigil
#

slap it behind cf

cerulean ingot
#

you can do that with a vps?

#

oh yeah

misty sigil
#

if you're hosting a site on it, yea

cerulean ingot
#

what

misty sigil
#

or you're hosting a site elsewhere and wanna just slap a dns record to it

mellow kelp
#

yes

#

slap

pulsar sonnet
#

anyone willing to fix some python code im willing to pay.

solemn leaf
eternal osprey
sudden geyser
valid holly
#

Did anyone try to figure out a way to assign roles after the member screening feature ?

eternal osprey
cerulean ingot
#

with ddos protaction

#

which one should i buy

true ravine
#

Do you need DDoS protection?

cerulean ingot
#

1st is bultr second 2 are galaxygate

#

not sure

true ravine
#

If you don't need it right now there's no point paying for it

#

If you need it in a couple months most hosting sites let you add it on

cerulean ingot
#

i wonder if i can upgrade later

#

ooo

#

alright thanks

true ravine
#

If they don't you can always just copy and paste everything over, although galaxygate do allow upgrades without having to do that

#

Idk about vultr because I've never considered them

cerulean ingot
eternal osprey
#

i have bought the vps too

#

w/o ddos protection as i won't really need it..

solemn latch
#

Its the name of the vps.

cerulean ingot
#

oh

true ravine
#

Yeah Tim says good things about galaxygate

cerulean ingot
#

so i can make it anything

true ravine
#

Ye ^

solemn latch
#

Almost everyone says good things about galaxygate.

cerulean ingot
#

yeah lmao

eternal osprey
#

Galaxygate has great support and help you out with all problems

solemn latch
#

^

eternal osprey
#

for more info

cerulean ingot
#

what ubuntu version should i use

true ravine
#

Is that a server advertisement?? :o

cerulean ingot
#

no

eternal osprey
#

when i actually uploaded my first website they gave me a free domain name lmao

valid holly
#

Galaxygate restocked vps services ?

solemn latch
#

Any recent lts version

eternal osprey
solemn latch
#

They restock a few times a month typically

true ravine
#

It really doesn't make any difference as long as it gets security updates

#

18.04 works fine, but 20.04 also works

eternal osprey
#

The only thing you have to do when you receive your VPS is updating everything.

#

the node, packages, etc were really outdated

valid holly
#

I prefer galaxygate over other providers for the bandwith cap

eternal osprey
#

anyone here good with py?

true ravine
#

My aws instance is so broken because I'm running at like 90% disk usage so I can just about update packages KEKW

marble juniper
solemn latch
#

They also don't install fail2ban or firewalls by default, which i kind of prefer

marble juniper
#

or ur stupid and do a cross origin leak

cerulean ingot
eternal osprey
cerulean ingot
#

mhm

cerulean ingot
eternal osprey
#
notification.notify(
                title = "Price of your stock is below " + buyPrice,
                message = "Current price is " + str(price),
                app_icon = "test.jpg",
                timeout = 100
            )
            b=b+1
            s=0
    
    elif(float(price) > float(sellPrice)) :
        if(s==0):  
            notification.notify(
                title = "Price of your stock is above " + sellPrice,
                message = "Current Stock price is " + str(price),
                app_icon = "test.jpg",
                timeout = 100```
eternal osprey
cerulean ingot
#

what librarys this

#

are you sure test.jpg is in the path youre saying its in

true ravine
#

I've been trying to load my repository into vscode with the extension but it only loads the main branch and not the one I actually want. I've deleted and re-tried about 5 times now and it's not fun anymore

#

It works fine on my other repo

#

Just not the one I want to use ffs

silent cloud
#

Yo guys

#

Can somebody help me pls

#

I have this error

#

When im using command *pokemon

#

I need to guess Pokémon

#

If it doesn't this what i wrote

#

It should write about this, but i have an error

sudden geyser
#

The error means you tried to do something on a message that didn't exist.

silent cloud
#

Hmmm

#

Delete?

#

Lets try

true ravine
#

It might be because you're not correctly giving it your guess message

silent cloud
#

See code

silent cloud
true ravine
#

For that kind of thing I use a messagecollector instead

#

Rather than awaitmessages

silent cloud
#

Collector can do a memory leaks

sudden geyser
#

actually nvm

silent cloud
#

Oh

#

Doesnt saw

#

Can again plz 😂 or in dm

sudden geyser
#

Nah, it was wrong.

silent cloud
#

Oh, ok

true ravine
#

Finally I fixed my vscode ffs

#

That's like a bit of my life I'll never get back ;(

sudden geyser
#

vsc is annoying to config

true ravine
#

Don't you just love getting locked out of your own repo by vscode

#

It's my favourite situation

pastel horizon
#

Hey guys please who know a free VPS just for hosting a bot?

pure lion
#

Pay.

true ravine
#

If you have a debit or credit card you can use AWS free tier for a year

pastel horizon
#

Ooooooof

pure lion
#

Check the pins

true ravine
#

The only good free ones are the free trials of the paid ones

pastel horizon
#

Paying on a VPS than we don't know it's sure

true ravine
#

Yeah pins

eternal osprey
hasty mulch
#

Does VSC work with Linux? Specifically a Raspberry Pi?

fierce ether
#

req.session.guildsif this returns undefined what could it means?

silent cloud
#

Pls do not use FREE VPS

#

ITS A TRAP

#

:D

solemn latch
#

If your using a free vps, Google f1 micros are decent low end for being free.

hasty mulch
pastel horizon
#

I'll see

#

But ye no free VPS

solemn latch
pastel horizon
#

I just don't have bank card and no PayPal money

hasty mulch
solemn latch
pastel horizon
#

Mhmmmm

#

Yes

pulsar sonnet
#

Anyone familiar with hosting on a rasp pi

lucid prawn
#

im having errors
it said
cannot load default config file
and it going offline

silent cloud
#

What i can use to delete last message?

#

Discord.js

#

Msg.delete used, but doesnt helps

mellow kelp
#

what do you mean by last message

silent cloud
#

It deletes *pokemon, but i need next

#

Just look

mellow kelp
#

what exactly do you want to delete

silent cloud
#

It deleting *pokemon command, but i need to delete new message

#

Newer

mellow kelp
#

do you mean deleting the user's response?

silent cloud
#

Yea

mellow kelp
#

just call delete() on the user's response message

silent cloud
#

Msg.delete

#

Deletes *pokemon command

#

:/

mellow kelp
#

yeah because you're calling it on the command message

#

you have to call the delete() method on the user response, not the command

silent cloud
#

msg.author.delete();?

crimson vapor
#

No

lucid prawn
#

im having errors
it said
cannot load default config file
and it going offline

mellow kelp
#

like

lucid prawn
#

how i fix

mellow kelp
#

do you use awaitResponse?

silent cloud
#

Yes

mellow kelp
#

and you're using it to get the user response right?

silent cloud
#

Yep

mellow kelp
#

so

#

you have to use delete() on the message you collected

silent cloud
#

You crashed my windows (head)

#

How i can delete this :/

mellow kelp
#

you should have a message object with the user response

#

or something like that

#

what's your code?

silent cloud
#

I can give

#

Thats old

#

I changed sent to msg

mellow kelp
#

okay so

#

you see attempts.first() right?

#

that's a message

#

since you're directly accessing the message content, it'd be better to store the actual message in a variable first

#

then you can call delete() on that message

silent cloud
#

ohhhh i neex answer.delete();?

mellow kelp
#

if that's how you'll name the variable, yes

silent cloud
#

Ok, ty

mellow kelp
#

np

silent cloud
#

Answer.delete is not a function :/

mellow kelp
#

what do you have in your answer variable?

silent cloud
#

Okay, lets try that

#

Do you saw code ye?

mellow kelp
#

yeah

silent cloud
#

See 24 line

#

I have const sent

#

Lets try sent.delete();

#

I have an error

mellow kelp
#

that doesn't delete the user's response

silent cloud
mellow kelp
#

that deletes the bot's own message

#

you know what a method is or anything?

silent cloud
#

Yea

long marsh
#

Out of curiosity, does anyone see a slight increase in ram usage overtime using DiscordJS? When I restart the application, it always reset it back to the baseline 38 - 45% memory usage. But, overtime, it increases forever until it physically runs out of memory.

silent cloud
#

Memory leaks

long marsh
#

Definitely

solemn latch
#

or just caching without ever clearing it.

long marsh
#

I just don't know the proper ways of debugging a Discord bot using NodeJs 😬

silent cloud
#

Im just made a cache cleaner

long marsh
#

I've checked every single one of my Cache-based functions. They all either have setTimeout ... or leverage the built-in removal function (KeyV)

solemn latch
#

what about discord.js's cache

long marsh
#

👀

#

Great suggestion, Woo! Is there any referenced documentation on that?

solemn latch
#

well, djs is known for not giving a lot of cache clearing options.

long marsh
#

😢

solemn latch
#

which is why its really not recommended for medium to large bots.

long marsh
#

Interesting.

#

What do most bots use? Or do they just write their own library to interface with the Discord API?

#

"Great control", I guess

solemn latch
#

discordjs-lite is super op for dealing with it until you start getting to large bots.

silent cloud
#

My friend very popular bot using C#

#

:D

#

He said thats rly trash code, and trash language

long marsh
#

C#, trash? I don't necessarily agree with that.

silent cloud
#

Xd

long marsh
#

My bot, as of right now, is roughly in 115 servers.

silent cloud
#

Khm

solemn latch
#

how much ram are you using 🤔

long marsh
#

Before I do a planned marketing campaign, I didn't want to blow up my server 😬

silent cloud
#

6.000 only on 1 shard

#

Him

#

15 shards

long marsh
#

Btw, I do appreciate your help / advice on this

#

Heh, 1GB

solemn latch
#

do you happen to have the load all members on startup thing on?

long marsh
#

Is that referring to the privileged intent?

long marsh
#

Damn, let me check that. I don't believe so. I'm also not exclusively using DiscordJS. I'm also leveraging Commando.

#

Negative.

solemn latch
#

well, even with discord.js you probably shouldnt hit 1gb of ram on 115 guilds.

long marsh
#

Keep in mind, I'm also running docker.

solemn latch
#

ah, whats your ram usage just for the bot.

long marsh
#

You know, that's a great question that I'm not certain I have too much insight too.

#

I'm sure I do, I just don't have the reporting methods in place.

solemn latch
#

then it might not even be your bot using all that ram.

long marsh
#

Here is my memory usage for both docker + the bot. It's also technically running a webhook port as well. Each one of those 'dips' are when an automated update happened (DevOps pipeline that takes the GitHub release code and pushes out a new container / removes the existing)

#

It always steadily increases.

#

And it always dips back down to roughly 38% (except most recently)

#

CPU is only at like .2% lol

solemn latch
#

so the memory usage drops significantly every time the container is restarted?

long marsh
#

Oh, sorry. Ha

#

Makes me believe it's a memory leak.

solemn latch
#

so then its the container probably not the bot?

long marsh
#

But the bot itself + cache runs within the container 🤔

solemn latch
#

oh, you where saying the bot + the container

#

i thought it was outside

long marsh
#

Oh, my fault.

#

I don't expect you to know the answer or anything. I was really just wondering if anyone else had these pitfalls when developing on DiscordJS / CommandoJS. I'm starting to think it's something peculiar that I'm doing. Probably one of the scenarios of 'you got a memory leak here, idiot'.

#

I could slap a bandaid on it and have a CRON job destroy the current container and such, but that's not scalable.

solemn latch
#

honestly, if it was me, i would setup a test bot that's just a clone of the bot, and remove the main likely causes for this problem and slowly add them until you find the root cause.

#

Or, someone smarter than me will be around eventually with a better plan.

long marsh
#

Heh, I appreciate your advice! Yeah, these types of issues seem difficult to pinpoint.

long marsh
#

Hello!

pulsar sonnet
#

Still looking for help if anyone knows anything about hosting python on raspberry pi

crimson vapor
#

you should be able to just put ubuntu server on it then run it like you normally run something

silver lintel
#
let board = [];
    for (let i = 0; i < 12; i++) board.push(["_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_"]);
    board[randomNumber(0, 11)][randomNumber(0, 11)] = "O";
    
    function spawnApple() {
      let options = [];
      for (let i = 0; i < 12; i++) {
        for (let j = 0; j < 12; j++) {
          console.log(i, j) // 0 0
          if (options[i][j] === "_") options.push({ x: j, y: i });
        }
      }
      if (options) {
        let chosen = options[randomNumber(0, options.length)];
        board[chosen.y][chosen.x] = "a";
      }
    }
    
    spawnApple();
``` give an error `(node:127) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '0' of undefined`
solemn latch
quartz kindle
#

show your randomNumber function

silver lintel
#

if (options[i][j] === "_") options.push({ x: j, y: i });

#

ok

#

randomNumber: (min, max) => Math.round(Math.random() * (Number(max) - Number(min))) + Number(min)

quartz kindle
#

nvm, i already see the issue

#

its not the random number

#

its options

crimson vapor
#

hello Tim

silver lintel
#

wait oh yes

crimson vapor
#

nested loops yikes

#

2d array tho I assume

quartz kindle
#

you have options[i][j] while options is still []

mellow kelp
#

ah yes, nested loops

#

the source of our doom

silver lintel
#

yes, i emant to put board

crimson vapor
#

nested loops are O(n^2) right?

mellow kelp
#

yeah im pretty sure

crimson vapor
#

yikes

pulsar sonnet
#

@crimson vapor is there a guide I can follow?

crimson vapor
#

for?

quartz kindle
#

what is the operating system installed in your PI?

pulsar sonnet
#

unbuntu

crimson vapor
#

oh

quartz kindle
#

then just google how to install python in ubuntu

crimson vapor
#

best bet search digital ocean python on ubuntu

#

thats what I do

#

digitial ocean X on ubuntu 16.04

#

since im on 16.04

pulsar sonnet
#

mine is default on debian

crimson vapor
#

if you are using raspian you can just search intall python on raspian

pulsar sonnet
#

Maybe I wasn't be specific enough I'm running it on python code on raspian already it runs and the bot can run like 1 command the rest has error

solemn latch
#

sounds like your codes erroring, which typically isnt because of your platform.

lyric mountain
#

if it has one, then it will give u estimate memory usage of each function

solemn latch
pulsar sonnet
#

I'm running it via thonny all i know is that it can't find the folder cog

#

sorry if it's a bad picture it's on the raspberry pi so i can screenshot

#

can't*

long marsh
quartz kindle
#

js profiling is a pain tho

long marsh
solemn latch
quartz kindle
#

you need to run node in inspect mode, and then connect to it from a chrome-based browser, then use dev tools to inspect the node process remotely

long marsh
#

Your bot was developed in JS, right? Did you experience any problems such as that?

quartz kindle
#

i had issues with discord.js caching, thats why i made discord.js-light

pulsar sonnet
long marsh
#

imagine

#

It may have been a bad decision to opt for CommandoJS; however, it really helped speed up development.

earnest phoenix
#

How I get the bot developer role

quartz kindle
#

i've never used commando so i cant say anything about it, but im pretty sure it shouldnt be leaking

lyric mountain
#

I like making command managers, like, you can be very creative about it

quartz kindle
long marsh
#

Next question: "How do I add a bot to top.gg"

#

😄

earnest phoenix
quartz kindle
#

@long marsh how much ram is your bot using? and how many guilds?

quartz kindle
long marsh
#

115 guilds, 1GB server

lyric mountain
#

my current manager creates command classes at runtime, then destroy after usage

long marsh
#

But, I'm also running Docker.

quartz kindle
#

1gb total or 1gb used?

lyric mountain
#

was trying to make it hotswap, but I don't want to step in hell

quartz kindle
#

how much is it actually using? ie: try evaling process.memoryUsage()

long marsh
#

Oh, sorry. Using about 39% when the container is freshly created ... creeps up indefinitely (about 1% per every few hours)

#

But, that's inclusive of everything ... not exclusively the bot.

quartz kindle
#

are you using intents?

long marsh
#

Nope

quartz kindle
#

do you have members/presences enabled in your dev portal?

long marsh
#

My bot isn't verified - so a lot of that was unavailable. Let me check.

quartz kindle
#

they should be available while the bot is unverified

#

they become unavailable once the bot is verified, unless the bot specifically asks for them during verification and its accepted

long marsh
#

NOTE: Once your bot reaches 100 or more servers, this will require Verification and whitelisting. Read more here

#

I can't enable it, lol

lyric mountain
#

you can enable the intents after approval, but it'll lock the bot if you didn't ask for permission

#

been there, done that

long marsh
#

I've never enabled them, and they're still 'greyed' out

lyric mountain
#

weird

quartz kindle
#

eitherway its fine

long marsh
#

Right

quartz kindle
#

better have them disabled

lyric mountain
#

does JS have a garbage collector?

quartz kindle
#

yes

long marsh
#

They temporarily lifted the server maximum to 250 and closed down the applications

#

For the holidays

quartz kindle
#

ah

#

i see

lyric mountain
#

you could call GC once every hour

quartz kindle
#

you cant call gc

lyric mountain
#

meh

quartz kindle
#

js's gc is abstracted and automated, there is no access to it

long marsh
#

What language are you using, Kuu, that allows for that?

lyric mountain
#

java

quartz kindle
#

unless you use some special flags to expose it in node

long marsh
#

Java gives you access to the garbage collector? Ngl, I kinda forget about that if that's the case.

lyric mountain
#

you can't "force" gc, but you can make it rerun

long marsh
#

I don't want to mess with the garbage collector directly though ... seems like bad practice ... even for monitoring purposes.

lyric mountain
#

which effectively garbage collects

quartz kindle
#

@long marsh you said you were running some functions to clean up some caches?

lyric mountain
#

like, I call it every hour because I never reach anywhere near my memory limit, so GC stays sleeping most of the time

#

just to clean stuff

long marsh
#

Every single instance of Cache.set() (only like 3) has a setTimeout(Cache.delete(), whateverTime) ... and every single KeyV Cache.set(k, v, duration) 'set' operation has a duration.

#

In my code, I mean.

lyric mountain
#

oh, wow

quartz kindle
#

i mean djs caches

#

you're using discord.js right?

long marsh
#

Yeah, what do you mean though?

#

How do I access djs cache?

quartz kindle
#

discord.js caches everything

long marsh
#

Tim: "You can't"

#

😄

quartz kindle
#

client.users.cache, client.channels.cache, client.guilds.cache

#

guild.members.cache

long marsh
#

Hmmm...

quartz kindle
#

channel.messages

#

etc

#

all of those are stored in memory

#

and discord.js keeps them there

long marsh
#

Those inevitably grow over time right?

quartz kindle
#

stuff like messages for example keep increasing

#

until a limit

long marsh
#

Oh, wait. It caches messages?

quartz kindle
#

i think the default limit is 200 messages per channel

#

yes

long marsh
#

Oh, damn. That could very well be the problem.

lyric mountain
#

200 per channel is a lot

long marsh
#

Can I modify that limit?

quartz kindle
#

yes

#

in the client options

long marsh
#

I honestly don't need to cache more than like ... 5

#

Does it directly read the latest 200 messages in a channel .. or does it cache the messages 1-by-1?

quartz kindle
long marsh
#

As they happen, I mean.

lyric mountain
#

I cache 64 per channel

#

for snipe

quartz kindle
#

it caches as they happen

lyric mountain
#

and mod logs

long marsh
#

I figured.

quartz kindle
#

it doesnt load past messages

long marsh
#

Yea, that's seems bad to do.

quartz kindle
#

same for users/members

long marsh
#

Right. See, I don't use snipe at all. Would there be a point to caching any messages

lyric mountain
#

well, no

quartz kindle
#

with the recent changes with intents, you no longer start with online members cached at login

#

you start only with your bot and voice channel members

#

so as your bot receives messages, it caches the users and members as they come

long marsh
#

This has been incredibly insightful, Tim. I appreciate that. I bet that's honestly what it is.

lyric mountain
long marsh
#

The things you learn from reading documentation ... IMAGINE.

quartz kindle
#

setting to 0 and -1 too

lyric mountain
#

nice

#

-1 is no-limit right?

quartz kindle
#

ye

lyric mountain
#

dangerous stuff

long marsh
#

0 would mean ... cache nothing ... right?

quartz kindle
#

ye

long marsh
#

I really don't see the point in caching messages 🤔 ...

quartz kindle
#

also, stable still has messageEditHistoryMaxSize

long marsh
#

With my bot's implementation, of course.

quartz kindle
#

which they removed in master

#

but for now better set messageEditHistoryMaxSize to something like 1 or 0 too, because its -1 by default

long marsh
#

Tim, do you still have that documentation handy? If not, I can simply google the client API reference.

#

If it's still open on a tab though, that would be great if you could slip it to me 😄

quartz kindle
#

well its just the djs docs lol

long marsh
#

Yeah, I know. I didn't know if you had that specific link handy.

#

Pure laziness on my part.

#

Thanks!

quartz kindle
#

lul

long marsh
#

messageCacheLifetime .. set to 0 by default?

quartz kindle
#

should be fine

#

but you can also set it to remove them by time

long marsh
#

Gotcha, I got it now.

#

That would be the reason to change that to something else.

#

If you wanted to sweep yourself.

#

I gotcha 👍

quartz kindle
#

like if limit is 200, and you're at 50, and from those 50, 20 are older than 60 seconds, and you set lifetime to 60 seconds and sweep time to 60 seconds

long marsh
#

Sounds legit

quartz kindle
#

every minute will also check for that, and remove the 20 older out of the 50, even if not close to the limit yet

long marsh
#

Sounds like it would add a lot of processing overhead, though.

#

Maybe not too much, but some 🤷‍♂️

quartz kindle
#

a bit yeah

long marsh
#

Tim, I bet your right though. I was sitting over here thinking I had a memory leak (which is still plausible) ... but this will hopefully show some results.

quartz kindle
#

discord.js is famous for being a memory leak by itself

#

xD

long marsh
#

Lol, so is discordpy

quartz kindle
#

discordpy is even worse

#

lmao

long marsh
#

I know, lmao

trim saddle
long marsh
#

Debatable

earnest phoenix
#

anyone here use python? I Need help 😦

long marsh
#

CommandJS is a nice read

quartz kindle
#

before djs-light, my bot went up to 800mb ram regularly

#

and my vps only has 1gb

trim saddle
#

have you looked inside d.js code

#

compared to d.py code

long marsh
#

I switched from discordpy to discordjs. I developed much more quickly on it.

#

And, I'm a Python Developer in my day job role 😄

#

If anything, I lacked NodeJS experience and still ended up developing on it way more quicker.

quartz kindle
#

bot developing is much better now after the discord changes

trim saddle
#

i write typescript and i work at mcdonalds

long marsh
#

Believe it or not, I actually have a friend who is a software developer for McDonalds 😄

trim saddle
#

as someone building his own lib and looked at other libs for examples, d.py's code seems more readable

long marsh
#

Outside of the restaurant chain, the company benefits are great.

trim saddle
quartz kindle
#

even if the libraries still stack memory like crazy, the fact that intents exist and that members and presences are no longer enabled by default in the dev portal makes it so that most bots out there should run significantly lighter today that they would last year

long marsh
#

Yep, agree.

quartz kindle
long marsh
#

You guys should see my deployment pipeline 😄

long marsh
quartz kindle
#

cool stuff

long marsh
#

Even the music in the restaurant is powered by something that the Developers did.

quartz kindle
#

wants there a guy who figured out a way to get a free burger with POS?

long marsh
#

Oh, and the self kiosks too.

#

That's what my friend works on.

#

But seriously, he has discounted McDonalds lol

quartz kindle
#

the guy figured out that if you got a cheeseburger but removed all ingredients from it, the grand total would be minus 10 cents or something

long marsh
#

He never uses it though ... because that food is borderline poison.

crimson vapor
#

good poison

#

tho

long marsh
#

🤷‍♂️

quartz kindle
#

so he bought 10 chesseburgers with no ingredients, and 1 normal cheeseburger

crimson vapor
#

especially the hashbrowns

quartz kindle
#

and the grand total was 0

long marsh
#

LOL

#

That's where it's at.

crimson vapor
#

did the 10 with nothing go -?

quartz kindle
#

yes

long marsh
#

So, Tim, leveraging the messageCacheSize: 0 or something should clear up my ram issues for now?

#

I should probably screw around with that ... idk what side effects that has.

quartz kindle
long marsh
#

LOLOLOL

long marsh
#

My friend doesn't work with that system, so, not his problem 🤷‍♂️

quartz kindle
#

xD

#

djs's caching issues come from several places, some of the worst offenders are users, members, channels, presences and messages

long marsh
#

May I entertain you with another question, Tim?

#

Or at least, another question for your insight?

quartz kindle
#

ya

long marsh
#

I'm leveraging the Patreon Bot & my 'community' server to handle the paid role access. My bot is going to load all the members with those specific roles upon startup (requires a privileged intent) ... then is going to listen out for "onRoleGiven" (or whatever the api call is 😄 )

#

The thing is, how will I know which shard that particular sever is on?

#

Do I need to run an if/else condition across all the shards upon start up?

#
if (server id is in the cache of the shard){
    const members = loadAllDemMembersWithTheRoleBoi();
    addToCacheBois(members);
}
quartz kindle
#

guilds have a .shardID prop

long marsh
#

👀

#

But, how do you know which shard contains the guild?

#

Can you just do a guild lookup and it'll tell you which shard it's on?

quartz kindle
#

you can use the formula for sharding

long marsh
#

Even if you're doing the lookup from a shard it's not on?

quartz kindle
#

i believe discord.js added it recently to the shard class

#

let me check

#

client.shard.shardIDForGuildID

#

assuming you're using the sharding manager

long marsh
#

Wow!

#

That's awesome.

#

Yeah, I'm using the shardingmanager

#

This is great, man. I appreciate that!

quartz kindle
#

if you have the members with the roles stored in a database, you dont need the members intent to fetch them

long marsh
#

Yeah, but how would you recommend I go about that 👀

stark abyss
#
let emojis = {C2: '![C2](https://cdn.discordapp.com/emojis/797542645030453268.webp?size=128 "C2")', C3: '![C3](https://cdn.discordapp.com/emojis/797542677477326889.webp?size=128 "C3")'}
[ 'H2', 'C4' ] --> player array 
console.log(emojis.player[0])  
TypeError: Cannot read property '0' of undefined

Unsure how to fix

#

if I just do emojis.H2 it works

sudden geyser
#

But emojis is a key/value object

quartz kindle
stark abyss
#

yeah what about it?

sudden geyser
#

It doesn't have a player key

stark abyss
#

player[0] = H2
I want to do emojis.H2

quartz kindle
#

emojis[player[0]]

sudden geyser
#

oh that's what you wanted

stark abyss
#

oh thank you

long marsh
quartz kindle
#

thats why i said, if you had them saved in a database or something

long marsh
#

Ah, I'm sorry. I originally was asking, how would you go about placing premium members into a database without first knowing if they're assigned the role?

#

Patreon possibly has a webhook that could send me the information over ... but that's slightly unreliable.

#

I just didn't see a better programmatical way of determining who's a premium user without first looking at the role 🤔

quartz kindle
#

you will need to fetch all members to find out which of the existing members have a role

#

there is a way to do that without the intent, but its limited to 100 members at a time

long marsh
#

Instead of fetching all members from the server ... can I just exclusively fetch only specific roles? It may not work like that though 😢

quartz kindle
#

unfortunately discord does not offer a way to fetch members by role

long marsh
#

Lame

#

imagine

#

I'm legit only enabling that intent for the community server. It won't physically require fetchingAllUsers except for that one use case ... which kinda sucks.

mellow kelp
#

yea kinda sucks

#

i guess it needs the intent because it implicates fetching members without a specific id

quartz kindle
#

if you dont have lots of people with the role, start it by manually adding them to a database

#

then continue from there

#

and have future members be automatically added

mellow kelp
#

or maybe do a register command or something like that

#

nah nvm

long marsh
#

But, you guys do agree that intent is required to basically make it programmatical ... right?

quartz kindle
#

let me test something

mellow kelp
long marsh
#

😢

mellow kelp
#

cri

solemn latch
#

i know patreon lets you fill in your discord name, do they have an endpoint for that?

long marsh
#

As far as I know, they allow individual users to link their discord account to their patreon profile. Then, when a tier is purchased, their bot (which sits in my server) adds them. They do expose an endpoint for that, but I'm not sure I would receive that information is the user isn't already linked.

#

Ah, yeah. I could comb through the pledge api.

#

Hmmmmm.... good suggestion.

#

Possibly worth a try.

solemn latch
#

well, they allow you to fetch all supporters

long marsh
#

Yep

#

This may actually be a suitable replacement.

solemn latch
#

then just use the webhook while its online.

#

periodically maybe refetch them all too just in case.

long marsh
#

Eh, I may just fetch them all every interval / so often

#

I don't want to rely on the 'push' architecture ... since it relies heavily on the bot being up & the communication being solid between Patreon / me

#

Damn, look at me .. getting straight tunnel vision on this problem. Yeah, I forgot that Patreon allows me to comb through the pledges. Thanks for thinking outside the box on that one, Woo!

quartz kindle
#

ye apparently discord disabled access to the members endpoint in the rest api

long marsh
#

Yep

quartz kindle
#

so its no longer possible to fetch members without the intent

long marsh
#

Yeppers

#

That's what I was saying earlier 😄

#

It was greyed out for me.

#

It requires that intent.

quartz kindle
#

ye but i was still able to do it a few months ago

#

lul

long marsh
#

It was a super recent change 👍

mellow kelp
#

yea probably

long marsh
#

Dec, maybe

mellow kelp
#

it makes sense tho

long marsh
#

Definitely

mellow kelp
#

fetching the WHOLE list of members from a guild definitely isn't something a malicious bot should be able to do

long marsh
#

Yep.

#

Makes sense to me

#

Honestly, I'm surprised it went this long being the way it was.

mellow kelp
#

yea true

quartz kindle
#

discord was supposed to be a platform that offers complete freedom

#

but when you get big, people start pressuring you into applying rules

mellow kelp
#

but at least i think this one makes sense

quartz kindle
#

ye

mellow kelp
#

some other, nah

quartz kindle
#

because when you get big, you also become a target for evil doers

mellow kelp
#

yea

#

i still cant understand why it's necessary to give away a citizen id just to verify a bot tho

quartz kindle
#

to hold bot owners accountable

mellow kelp
#

the 100 server cap is kinda low

quartz kindle
#

another way to handle premium roles without the intent is to require them to be active

#

as soon as they send a message in your server, your bot will get their data

#

or even react to something

mellow kelp
#

yeah

quartz kindle
#

for example: "make the donation and then react to a message in my server to get your benefits"

#

but if you want to fully automate the process, you will need the patreon api

long marsh
#

Yeah, I'd ideally like to fully automate the process.

#

Thanks for the suggestion, though!

#

I think I'm just going to page through the pledge list for now ... that seems easiest to begin with. Possibly leverage their webhook later.

quartz kindle
#

my donations are fully manual because icba setting up patreon and paypal apis

long marsh
#

icba?

quartz kindle
#

i cant be arsed

#

xD

long marsh
#

Lol

zenith terrace
#

hi tim

quartz kindle
#

hi

long marsh
#

Patreon API seems fairly simplistic to implement though .. especially for the 'poll' of the pledges

#

Quick question, how do you guys run express servers along side your bot? Do you physically start two process by doing node server && node index ... or do you perhaps start the server in the same file as the sharding manager?

zenith terrace
#

how you doing tim, been a while

quartz kindle
#

i cant really transition to patreon anymore because i already had paypal donations in place before, which is a one time donation for a permanent feature

long marsh
#

Yikes, yeah

quartz kindle
#

turning everything into a subscription instead of permanent would be a giant fuck you

long marsh
#

The only 'one time' donations I'm going to allow are for purchasing 1-time purchases of coins.

quartz kindle
long marsh
#

100,000 for $2 ... for example

quartz kindle
#

i have one subscription feature but nobody buys it

#

xD

earnest phoenix
#

There are too many bots with commands to add money, so that economy probably will not be used.

long marsh
#

🤷‍♂️

#

That's negative perspective, sure. Lol

zenith terrace
#

discord doesnt allow bump bots to have any sort of pay feature that gives other users a boost/advantage KEKW

long marsh
#

'bump' bots?

earnest phoenix
zenith terrace
long marsh
#

Oh, I'm not using anything like that lol

#

This is purely for the economy system that's implemented in my bot.

quartz kindle
#

its basically a server-wide feature

long marsh
#

Tim, how many guilds is your bot in?

quartz kindle
#

"enable all users in your server to use X"

earnest phoenix
#

So it benefits the entire server?

#

Oh

quartz kindle
#

ye

quartz kindle
earnest phoenix
#

Mmmm

long marsh
#

Ah, yeah. I don't expect any subscription-based purchases before 50k guilds lol

earnest phoenix
#

Try making it more exclusively

#

Like a self benefit

long marsh
#

I would love for someone to review my subscription tiers, but only if you want 👀

earnest phoenix
#

If you buy it, that feature is only for you.

quartz kindle
#

mine are trash too lmao

long marsh
#

That's how my tiers operate.

#

Barnie, do you have an economy-based bot?

quartz kindle
#

my personal features are 1-time permament, so most people just use paypal

zenith terrace
long marsh
#

Honestly, most of the economy-based bots are simplistic in nature. Gambling, some type of 'work', and gifting

earnest phoenix
quartz kindle
#

however i've had many donations that were bigger than what i ask for the feature

#

so it aint that bad

long marsh
long marsh
# earnest phoenix That's true

More on that, my discord bot actually allows you to collect rent from a town (draws out the town using emojis), gamble, work, fish, mine, hunt, etc.

#

I'm not looking for a gold star or anything, just explaining how my bot would differentiate itself from the others 😄

earnest phoenix
#

Ph

#

Oh

#

I want it on my server

zenith terrace
long marsh
#

Unless I'm missing your point entirely?

zenith terrace
#

nah im just saying cause we were talking about premium features before lol

long marsh
#

Ahhhh, gotcha.

#

Yeah, I'd imagine Discord shouldn't deny my verification process. I don't break TOS in any way .... or, at least, not to my knowledge 😄

zenith terrace
#

im sure you dont

#

im currently making a economy bot but with a catch

long marsh
#

My bot allows for you to study for college 👀

#

lol, I kid you not

zenith terrace
#

nice

long marsh
#

Sorry, everyone. I'll stop talking about my bot and unrelated-development topics.

zenith terrace
#

this channel is used for talking about bots, channel description

#

not just coding help lol

long marsh
zenith terrace
#

maybe @quartz kindle knows

mellow kelp
#

i just run the bot and the server on the same process

#

that works out for me

earnest phoenix
#

patreon api is anything but simplistic 😔

#

it's such an insane mess

solemn latch
earnest phoenix
#

v1 is semi usable but it doesn't contain a lot of useful data
v2 does contain useful data but it's insanely unorganized and undocumented

#

it might've changed since i worked with it

#

but when i did

#

i developed ptsd 😭

long marsh
#

Lol

#

It can't be that bad right 👀

shy turret
#

it's pretty poggers

mellow kelp
#

bruh

#

i think im gonna make another one of those fake-social-media-preview sites KEKW

zenith terrace
#

already did and uninstalled and reinstalled discord

shy turret
#

lmao

#

andriod alpha had a ton of bugs

summer torrent
#

i can't see server icons

#

and members' color on their names

shy turret
zenith terrace
#

and it always crashes on me

shy turret
#

@summer torrent you can see server icons now

#

it didnt crash ever though

#

well

#

it did in the one im in