#development

1 messages · Page 989 of 1

tulip ledge
#

loadbalance?

lusty quest
#

i have now a MongoDB cluster running on 3 VPS servers. i can define to Write over the Master Node and Read only over the Secondary nodes

tulip ledge
#

But like the 300MB ram is when it's on it's peak with 20 people doing commands at once

#

Oh I see

lusty quest
#

and this is still a basic setup

tulip ledge
#

But ram shouldn't be a problem I have a full gig and can get more if I want to

lusty quest
#

iirc you can shard the nodes to read and write over mutiple nodes

tulip ledge
#

I see

lusty quest
#

mysql can be sharded but with complex stuff

tulip ledge
#

question

#

You can turn a VPS into nodes right?

lusty quest
#

define nodes

tulip ledge
#

like

#

Split up a VPS

#

Like sharding a bot

#

Bot then "sharding" a VPS

lusty quest
#

not that i know

tulip ledge
lusty quest
#

and never heard it

tulip ledge
#

Cuz I've seen hosting services have multiple nodes

lusty quest
#

You get Mutiple VPS server that Communicate with each other

tulip ledge
#

Oh yeah thats prob it

lusty quest
#

a different thing is it when you use Kubernetes

tulip ledge
#

dont know what that is

lusty quest
#

a complete Overkill system for managing Mutiple Services on Mutiple servers

tulip ledge
#

oh lol

lusty quest
#

bots like Mee6 use it for managing the Shards

tulip ledge
#

oh

lusty quest
#

bcs they have a few thousand shards on mutiple servers

tulip ledge
#

I don't know whats to special about Mee6

#

It doesn't really do alot

woeful pollen
#

It does voice

lusty quest
#

the bot just got large enought to hit the limit

woeful pollen
#

oh no i keep getting this error. I tried majking more bots and messing around with it and keep not working :(
discord js error [voice_connection_timeout]: connection not established within 15 seconds

lusty quest
#

you have a timeout

#

its possible that your Internet is to slow

woeful pollen
#

Oh

tulip ledge
#

Should I shard my bot before making it public? Or wait untill I maybe hit 2000 servers to then shard it?

#

Cuz sharding is required if you have like 2500 servers right?

lusty quest
#

wait until you hit 1800 then make plans about it

tulip ledge
#

Alright

lusty quest
#

at 2000 start sharding

tulip ledge
#

Alright

woeful pollen
#

How do I make my internet faster

lusty spade
tulip ledge
#

Get a better provider

lusty quest
#

or get a server

woeful pollen
#

But will the music commands work for other ppl

tulip ledge
#

Data @ ID: "warnings_720997710479491123_709293157279334431" IS NOT A number

lusty quest
#

@lusty spade you try to set a string as a number

tulip ledge
#

IS NOT A number

lusty spade
#

but the amount = 1 also does not work

lusty quest
#

bcs it can get the 1 as a string

tulip ledge
#

^^

lusty spade
#

so how do i fix it?

lusty quest
#

javascript can do 1+1 = 11

woeful pollen
#

1 += 1

lusty quest
#

did you get the ID from a Database?

lusty spade
#

javascript can do 1+1 = 11
oh i didnt knew that

tulip ledge
#

@woeful pollen if 1 is a string that will still result in 11

lusty quest
#

or did you want to save it to a database?

lusty spade
#

i want to save it

tulip ledge
#

save it where

lusty quest
#

your field expects a number make it a string

lusty spade
#

to a database

lusty quest
#

mysql?

lusty spade
#

quick.db

tulip ledge
#

Dont think thats mysql

lusty quest
#

idk never used quick.db

tulip ledge
#

me neither

lusty spade
#

ah ok

lusty quest
#

does it uses mysql syntax or models

lusty spade
#

idk im not sure

tulip ledge
#

How do you query certain statements?

#

Yeah it's not MySQL syntax

lusty quest
tulip ledge
#
db.fetch(`logchannel_${message.guild.id}`);

lusty quest
#

key and value

tulip ledge
#

Yup

#

And somewhere you are adding a value that needs to be a number but you're passing a stringµ

lusty spade
#

this requires a table

lusty quest
#

ohh right @tulip ledge if you want to try mongodb i think you can get a free mongodb instance

tulip ledge
#

Nah I'm good

#

I'm sticking with MySQL

lusty quest
#

mysql is fine but i think you will run into issues if you get a certain amount of Requests

tulip ledge
#

I'm getting my own VPS soon so yeah

#

I'll see what happens

#

Those are concerns for later

#

I'm sure MySQL can hold up

lusty quest
#

sure but the most common way to scale a Mysql Database is getting more powerful hardware

tulip ledge
#

I mean the VPS's we have now has an Intel Xenon with 10 cores

#

60 GB Ram

#

100% SSD

lusty quest
#

larger companies run a 64 Core Epyc with a ton of ram for Mysql

tulip ledge
#

Oh dang

#

I'll see what happens

lusty quest
#

you will be fine

#

but if you hit 2 million Guilds i dont think you can pay for the hardware you need for running Mysql

tulip ledge
#

Well the thing is guilds aren't being saved

#

It's users that are being saved

lusty quest
#

so if every of the 2 million guilds get about 2k users you have a shitton of data

tulip ledge
#

It's only users that use a certain commands tho

#

And they get saved over 5 different tables

lusty quest
#

well there is some space for error

white anvil
#

its sometimes better at that stage to write your own user objects that contain micro optimisations to save bytes per object

#

for example using an int for discriminator and storing user ids as bigint instead of strings

tulip ledge
#

I don't get what you mean

#

But idk

lusty quest
#

its smart

#

but i dont think that he saves the entire userobject

tulip ledge
#

No

quartz kindle
#

you'd only need that if you actually get to millions of users

tulip ledge
#

I save the ID and then like 20 other columns

white anvil
#

ya

#

with smaller caches the difference is barely noticable

tulip ledge
#

In 5 different tables

#

Maybe when I start sharding I should rewrite everything and use MongoDB

#

Or is that not a good idea

quartz kindle
#

at small scale it doesnt really matter what you use, everything will be fine

#

small scale being less than 100k guilds or something like that

tulip ledge
#

I wonder what database pokecord used

woeful pollen
#

Quickdb

tulip ledge
#

quickdb?

honest perch
#

doubt it

quartz kindle
#

i seriously doubt pokecord used quick.db lol

lusty quest
#

isnt it sqlite like?

tulip ledge
#

Yeah no way he used duickdb

honest perch
#

maybe mongo?

lusty quest
#

would guess Mongo, Mysql or Postgres

quartz kindle
#

quick.db is a wrapper for sqlite

tulip ledge
#

Isnt mongo worse then mysql?

calm saddle
#

¯_(ツ)_/¯

woeful pollen
#

Which one does dank memer use?

lusty quest
#

mongodb is faster

tulip ledge
#

postgres is the fastest db right?

quartz kindle
#

mongo is not worse, its different

lusty quest
#

atleast if you have a setup for this

honest perch
#

mongo is nice as you can edit/see changes

woeful pollen
#

What's bad about quickdb

honest perch
#

so you see if its working correctly

calm saddle
#

i use mongo its not bad

lusty quest
#

it stores locally and it has a rescource overhead

woeful pollen
#

Oh

quartz kindle
#

there is no clear cut between best/fastest databases, they are all equally good, and have their own pros and cons

#

what changes is how they are structured

tulip ledge
#

So MySQL is bad when you have too much data?

quartz kindle
#

not necessarily

calm saddle
#

What's bad about quickdb
@woeful pollen can get corrupted if your bot is in lot of servers

woeful pollen
#

Oh really

lusty quest
#

MongoDB makes it easyer to shard the database

woeful pollen
#

Frick

calm saddle
#

yea

tulip ledge
#

And sharding the database is the best idea?

quartz kindle
#

once again depends

tulip ledge
#

But the thing is I don't save guilds, I save users

lusty quest
#

if you have alot of Bot Shards it can speed up querys for each bot shard

tulip ledge
#

My bot is an RPG style game bot

lusty quest
#

since it can get its own Database Shard

tulip ledge
#

yeah but shards is for guilds right

#

Not for users

#

Since a user can use the bot in multiple guilds

quartz kindle
#

the reason to go for mongo is not the sharding or replication, is the database style

#

mongo is a nosql document-based store

tulip ledge
#

I use MySQL since it's what my dad thought me a few years ago

#

And have always used it

quartz kindle
#

you need to read about the differences in how databases operate, in order to chose one

#

mysql is fine, nothing wrong with it

#

mongodb is not magically better than mysql

tulip ledge
#

So even with alot of data?

lusty quest
#

i currently switch from Mysql to MongoDB, the differences are there and for now l like it. Having a better fallback for the database.

quartz kindle
#

even with a lot of data

tulip ledge
#

And when I'm saying alot I mean ALOT

quartz kindle
#

even sqlite can handle thousands of requests per second

lusty quest
tulip ledge
#

Oh yeah I doubt I'm gonnaa need to handle a thousand per second

lusty quest
#

this is maybe helpful

calm saddle
#

which one do u use @quartz kindle ?

tulip ledge
quartz kindle
#

i use sqlite

calm saddle
#

oh

#

mongo doesnt corrupt

quartz kindle
#

@tulip ledge json-like doesnt mean json

tulip ledge
#

What bot are you developing?

#

Oh ok

calm saddle
#

it looks like json

quartz kindle
#

mongodb uses document structures, which means all data is stored in a similar way to how a json file is organized, in objects, keys, values and nesting

#

mysql uses relational tables, which is the whole tables and columns setup

calm saddle
#

oh

tulip ledge
#

And actually I prefer tables and columns

quartz kindle
#

so stick with it

lusty quest
#

depending on the usage the document style can be faster than the relational tables

quartz kindle
#

no reason to switch

tulip ledge
#

with phpmyadmin I can easily access them and get an easy overview

lusty quest
#

i use mysqlworkbench

tulip ledge
#

ew I hate workbench

lusty quest
#

phpmyadmin got a few security flaws

tulip ledge
#

I use either command line or phpmyadmin

calm saddle
#

mongo is easy to use

lusty quest
#

mysqlworkbench is fine

tulip ledge
#

mysql too if you know SQL

lusty quest
#

but MongoDB Compass is cleaner

tulip ledge
#

and sql is literally just english

pale vessel
#

ok then stick with it

#

i use mysql

quartz kindle
#

i tried mongo once and didnt really like it, but thats just personal preference

tulip ledge
#

So you should choose your database on personal preference mostly?

pale vessel
#

all comes down to personal preference

calm saddle
#

i use mongoDB atlas

woeful pollen
#

I use quickdb because I was unable to use any of the other databases

lusty quest
#

if you first step into mongo it can be overwhelming but if you get your structure going its relatively easy to use

tulip ledge
#

I feel like it's the same with mysql aswell

lusty quest
#

@calm saddle i build my own MongoDB cluster

calm saddle
#

oh

tulip ledge
#

big brain plays

calm saddle
#

i use one cluster in 2 diff bots

tulip ledge
#

Alright ty very much!

calm saddle
#

i can access each other too

quartz kindle
#

i have a dedicated sqlite instance for each bot

lusty quest
#

i pay 15€/Month for having 3 Nodes with 1GB ram

#

its enought for a few bots accessing it

calm saddle
#

i use free

quartz kindle
#

i pay $3/month for everything

calm saddle
#

M0

lusty quest
#

its cheaper than getting the free MongoDB

#

and 2x the Ram

#

wait?

calm saddle
#

im okay with the free M0 cluster

lusty quest
#

wtf did i write there

quartz kindle
#

no idea

#

lmao

lusty quest
#

sleeping 2 hours is not a good idea

quartz kindle
#

go sleep

lusty quest
#

its 13:40 for me

quartz kindle
#

rip

hasty sparrow
#

Paid is cheaper than free

calm saddle
#

wow he knows the secrets of the universe lmao

lusty quest
#

@calm saddle does the free Cluster offers Replication?

earnest phoenix
#

Hey so I'm trying to make functions but how can i make them like this
"hey".toProperCase()
instead of
toProperCase("hey")?

autumn summit
#

oops wrong servre

earnest phoenix
#

Lol

tight plinth
#

hmmmm

#

@modern sable not sure this emote is allowed

earnest phoenix
#

Lol

tight plinth
#

lol

calm saddle
#

@calm saddle does the free Cluster offers Replication?
@lusty quest wut?

modest maple
#

SQL can be quite easily scaled with k8s and stateful sets

#

infact kubernetes use MySQL as their example for user cases

earnest phoenix
#

So this is my toProperCase() function i made but how can i make it "String".toProperCase() instead of toProperCase("String")

let sptp = [];
for(w of string.toString().split(" ")){
for(wts of w.split("")[0]){
sptp.push(`${wts.toUpperCase()}${w.slice(1)}`);
}
}
return sptp.join(" ");
}```
lusty quest
#

@calm saddle my Cluster Replicates the Data on the Master Node to 2 Secondary nodes. If the masternode goes offline a Secondary Node gets elected as master node

quartz kindle
#

@earnest phoenix you can add it to the string prototype

cinder patio
#

Attach it to the prototype

String.prototype.functionName = function() {
   
} 
earnest phoenix
#

Oh

#

Thanks

lusty quest
#

if the offline Master Nodes Comes back online it stays as a Secondary node

#

and replicates the data that is missing

calm saddle
#

@calm saddle my Cluster Replicates the Data on the Master Node to 2 Secondary nodes. Of the masternode goes offline a Secondary Node gets elected as master node
@lusty quest wait hold up lemme get some more brain cells to understand that lmao

lusty quest
#

did you know what Raid is?

quartz kindle
earnest phoenix
#

Oh... Thanks

lusty quest
quartz kindle
#

@calm saddle basically it means this:
you have 2 copies of the database, a main copy and a backup copy. everything the main database does, its copy makes a copy of it. if the main database dies, the backup automatically takes its place

#

and when the main database revives, it gets revived as a copy instead and now copies everything the new main database (the one that took its place) does and did while it was offline

lusty quest
#

gg

#

discord doesnt support svg

restive furnace
#

it supports gif, png, jpg and webp

lusty quest
earnest phoenix
#

@quartz kindle it works but is this good?

let sptp = [];
for(w of this.toString().split(" ")){
for(wts of w.split("")[0]){
sptp.push(`${wts.toUpperCase()}${w.slice(1)}`);
}
}
return sptp.join(" ");
}```
hasty sparrow
#

Are you trying to capitalize a string?

pure lion
#

can i have some help with image resizing for embed thumbnails?
code:

      .setThumbnail(song.url({dynamic: true, size: 1012}))

its says that 'url is not a function'

quartz kindle
#

you shouldnt need this.toString() since this is already a string

earnest phoenix
#

Trying to uppercase every single first letter of the words in the string @hasty sparrow

quartz kindle
#

there are easier ways to do that

calm saddle
#

@calm saddle basically it means this:
you have 2 copies of the database, a main copy and a backup copy. everything the main database does, its copy makes a copy of it. if the main database dies, the backup automatically takes its place
@quartz kindle ooohh okay thnx for the knowledge

quartz kindle
#

also, how do you want to handle multiple spaces?

hasty sparrow
#

Gotcha

earnest phoenix
#

Oh good question

#

Lol

quartz kindle
#

you can simply do something like this btw

#

return this.split(" ").map(word => word[0].toUpperCase() + word.slice(1)).join(" ")

earnest phoenix
#

Oh wait that's better

#

Lemme see

quartz kindle
#

that should leave multiple spaces unaffected

#

otherwise you can use the regex / +/ instead of " " when splitting if you want multiple spaces to be reduced to a single space

earnest phoenix
#

Oh well it works better now, thanks tim and thanks to all that helped

earnest phoenix
#

Anybody know what's wrong here?

let can = 1;
return this.map(e => ${can++} + e);
}

["Something", "Another thing"].toCountArray()```
=>
`can't read the property 'toCountArray' of undefined`
tulip ledge
#

Array.prototype is undefined

earnest phoenix
#

But how's it undefined tho

tulip ledge
#

Idk

#

Wait no

#

["Something", "Another thing"] is undefined

#

You can see what line gives the error in the console

#

Then you'll see wich one is undefined

earnest phoenix
#

It doesn't... I'm using eval

tulip ledge
#

oh

earnest phoenix
#

Lemme try something

tulip ledge
golden condor
#

Hi there, I am trying to use nodemon like pm2 so I can exit the cli and have it still running. Is there anyway to do this?

#

like

tulip ledge
#

nodemon can't do that

golden condor
#

oh

tulip ledge
#

nodemon restarts when ever your file gets edited

#

pm2 keeps your bot running

golden condor
#

So

#

It can't run in a similar way to pm2 gotcha

restive furnace
#

use both of them

earnest phoenix
golden condor
#

use both of them
@restive furnace what lol

earnest phoenix
#

@tulip ledge try ` before and after ${can++}

pure lion
#

@earnest phoenix EH????

restive furnace
#

pm2 start nodemon index.js

earnest phoenix
#

Lol

restive furnace
#

prob would work

pure lion
#

Send code

earnest phoenix
#

No

golden condor
#

No I don't need the editing stuff

#

I just wanted a good alternative to pm2 that's all

#

is there any that u could recommend

#

I just wanted to use chalk colours with something

tulip ledge
#

@earnest phoenix

#

Idk if thats the expected output tho

earnest phoenix
#

Oh... So it doesn't accept direct arrays... It only accepts arrays from a variable

#

Why tho

tulip ledge
#

idk

lusty quest
#

any idea how to have this behaving non caching? javascript bot.guilds.cache.size

jovial nexus
#

Does someone know a tutorial for recording audio on a voice channel ?

lusty quest
tight plinth
cinder patio
#

FLAGS is a static member afaik

neat ingot
#

ok, so I have this bot that seems to have completely crashed. The web host shows a spike in cpu and ram (upto around 50% cpu at the time of crash), and the bot was not online in my guild at all, the bot seemed to reboot itself and come back online in the server, and it thinks its been online for over 5 hours

#

anyone got any idea what may have caused such a thing to happen?

lusty quest
#

memory leak?

tight plinth
#

check logs

golden condor
#

discord gateway went fucking crazy

neat ingot
#

is it possible my bot somehow only went offline for certain servers?

#

logs show nothing abnormal

tight plinth
#

yes it is

golden condor
#

Discord was returning 500 the other day

#

is it possible my bot somehow only went offline for certain servers?
@neat ingot if you shard then yes

tight plinth
#

FLAGS is a static member afaik
@cinder patio ?

neat ingot
#

only single shard atm

golden condor
#

oh

#

so

#

you get different uptime in different servers?

neat ingot
#

less than 120 servers too lol

golden condor
#

Could have been a discord thing

cinder patio
#

FLAGS is a static member, meaning it's accessed from the class itself, not an instance of the class

tight plinth
#

oof

#

so it dont work with roles?

golden condor
cinder patio
#

so like,

const Discord = require("discord.js");

console.log(Discord.Permissions.FLAGS); // SHould return an object 
#

Wait no, that wouldn't work cause Permissions isn't exported

lusty quest
#

any idea to get this in a non caching way? bot.guilds.cache.size

neat ingot
#

use a different lib 😄

pure lion
#

Lol

marble scaffold
lusty quest
#

module not found

pure lion
#

Is ber an npm?

neat ingot
#

index.js at line 6

marble scaffold
#

There is nothing on line 6

lusty quest
#

you request /ber/index somewhere

#

is the path correct?

#

its possible that you need ../ber/index

pure lion
#

^

marble scaffold
#

Oh, where do I add that

lusty quest
#

the file where you request /ber/index

marble scaffold
#

In the pathway?

lusty quest
#

you have somewhere require("./ber/index")

pure lion
#

require*

lusty quest
#

add a . infront of the path

#

require("../ber/index")

pure lion
#

Wait if it's a module

#

Nvm

marble scaffold
#

where is this located? I cant find it

autumn compass
#

(node:7488) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'get' of undefined fix?
code const member = message.mentions.members.first() || message.guild.members.cache.get(args[0]) || message.member;

lusty quest
#

im not sure if guild.members is a manager

marble scaffold
#

Yeah?

lusty quest
#

try without cache

#

@marble scaffold you wrote the code. you should know where you import a module

marble scaffold
#

It's in the node_modules?

lusty quest
#

no the file you want to load

marble scaffold
#

Yeah by using terminal

lusty quest
#

the error want the file index in the folder ber

#

not a npm module

restive furnace
marble scaffold
#

Ahh yes I see the ber

#

Just add 2 dots infront?

restive furnace
#

thats actually basic filesystem knowledge

marble scaffold
#

hmm I know now

golden condor
#

Hi there, not sure if this is relevant but I am gonna ask, could I use ngrok as an alternative to a static IP like have it tunnel to my IP? Would that work?

faint spade
#

How can I make the event if the bot cannot find the message with the ID I specified?
I need > if the message is deleted or not found
if(!message.channel.messages.fetch(id)) does not work and gives unknown message error (i'm using V12)

solemn latch
#

.catch?

#

@golden condor are you trying to mask your ip for a website or something? Or what are you trying to do?

golden condor
#

Well

#

My ip is dynamic you see

#

I use cloudflare so the ip is hidden anyway

#

i just want try and use my rpi for hosting something

#

and ngrok seemed like it might work

solemn latch
#

Dynamic dns services might be what your looking for

torn ravine
#

does anyone here use lavalink

#

Need help setting up

robust moth
digital ibex
#

try removing the .ejs not sure if that'd change anything but

#

¯_(ツ)_/¯

#

@robust moth ^

robust moth
#

Ok

pale vessel
#

it won't

robust moth
#

How can I fixed it?

digital ibex
#

try using <%= include('partials/head') %>

#

@robust moth ^^

long yew
#
client.on('message', message => {
    if (message.content === `${prefix}start sobble`) {
      message.channel.send(new Discord.MessageEmbed()
      .setColor(`RANDOM`)
      .setTitle('You chose Sobble!')
      .setDescription(`Take good care of Sobble.`)
      .setImage('./commands/816MS.png/'({ dynamic: true, size: 2048, format: 'png' }))
      )}
    });
#

i get that

#

can anyone help?

earnest phoenix
#

It's not a function.

long yew
#

i want to have the file 816MS.png to be as the image

#

U know how?

earnest phoenix
#

Attachfiles?

long yew
#

yeah

#

how do i?

pale vessel
#

use attachFiles()

#

plus MessageAttachment

#
embed.attachFiles(new Discord.MessageAttachment("./commands/file.png", "example.png"))
.setImage("attachment://example.png");```
#

oh wait i think you can directly use MessageAttachment to setImage()

#

anyway, something like that

earnest phoenix
#
let attach = new Discord.Attachment(message.author.avatarURL,"asdad.png")
embed.attachFiles(attach)
return embed.setImage('attachment://asdad.png')
}``` This can work?
pale vessel
#

you can pass the url directly to setImage

#

since it's a remote file

earnest phoenix
#

So, it will work?

pale vessel
#

for your function, not sure

#

haven't tried it

earnest phoenix
#

hmmz i will try ..

quartz kindle
#

attachFiles takes an array

wicked pivot
#

how do we get this array?

{"674275671878402063":{"bump":2,"author":"363402633752477696","link":"https://discord.gg/","bumpauthor":["363402633752477696","363402633752477696"]}}```

```js
if(!bump[message.guild.id].bumpauthor.includes(message.author.id)){
                        bump[message.guild.id].bumpauthor.push(message.author.id)
                    }```
quartz kindle
#

looks correct

long yew
#

how do i make it so when i write .start sobble it also adds sobble to my mons.json file?

quartz kindle
#

you need to add it to the object then write it to the file with fs.writeFile

long yew
#

oh idk how i'm new to json

quartz kindle
#

did you read the json file in your code yet?

restive furnace
#

also why theres 2 message listeners?

wicked pivot
#

ow i did that for nothing .. i didn't understand what you wanted xD

client.on('message', message => {
    let args = message.content.split(" ").slice(1)
    if (message.content.startsWith(prefix + "start")) {
        if (args[0] === "sobble") {
            ....
        } else {
            ...
        }
    }
})```
quartz kindle
#

or you just made a json file and not do anything with it?

long yew
#

i haven't done anything with it

#

actually i did that

quartz kindle
#

ok so you need to add it to mons

#

how does your file look like?

long yew
#

my mons file?

nocturne grove
#

With sharding, how can you easily post stats to the top.gg page? With an interval manually getting the guild size and posting that one? Or is there a better option?

restive furnace
#

you can literially post an array

#

of guild count and shards

nocturne grove
#

but I can't use the autoposter?

solemn latch
#

dont they also have a shard number parameter?

restive furnace
#

it should work

#

with autoposter too

nocturne grove
#

yeah you can also post shard stats, you're right

#

okay thanks. I will check the modules really quick and see

still merlin
#

I was testing something with my bot and my bots saying I didnt mention someone but my bot should say I cant kick without a reason, can someone help

nocturne grove
#

is that user in your server?

still merlin
#

the code for the reason is


Defined Args:  let args = message.content.substring(prefix.length).split(" ");

Reason: const reason = args.slice(2).join(" ");  

If no reason: 
      if (!reason)
        return message.channel.send(
          `**error** You can't ban ${user} without a reason!`
        );```
#

yes the user is on my server

solemn latch
#

your on discordjs?

still merlin
#

yea

hardy vector
#
const Command = require('../../Structures/Command')
const { MessageEmbed } = require('discord.js')
module.exports = class extends Command {
    constructor(...args) {
        super(...args, {
            aliases: ['snip'],
            category: 'Moderation'
        })
    }

    async run(message, args) {
        const msg = this.client.snipes.get(message.channel.id)
        if(!msg) message.reply(":x: there arent any recently deleted messages for me to show you")
        const embed = new MessageEmbed()
        .setAuthor(msg.author)
        .setDescription(msg.content)
        if(msg.image)embed.setImage(msg.image)
        message.channel.send(embed)

    }
}```when i do -snipe i get this error
still merlin
#

oh apparently the user left when I had the mention .-.

hardy vector
#

(node:6468) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'author' of undefined
at module.exports.run (C:\Users\kenra\Desktop\Frosty Rewrite\src\commands\Moderation\Snipe.js:15:24)
at FrostyClient.<anonymous> (C:\Users\kenra\Desktop\Frosty Rewrite\src\Structures\FrostyClient.js:42:13)

solemn latch
#

message.mentions.members.first() @still merlin

still merlin
#

I have that

solemn latch
#

^ this gets the first mention of a user

#

well whats your code

still merlin
#

just the user left quickly when they saw the backfire .-.

solemn latch
#

oh

nocturne grove
#

@restive furnace it doesn't seem like it's getting the guild size from all shards:

async postStats(serverCount, shardId, shardCount) {
    if (!serverCount && !this.client) throw new Error('postStats requires 1 argument');
    const data = {};
    if (serverCount) {
      data.server_count = serverCount;
      data.shard_id = shardId;
      data.shard_count = shardCount;
    } else {
      data.server_count = this.client.guilds.size || this.client.guilds.cache.size;
      if (this.client.shard && this.client.shard.count) {
        if (this.client.shard.ids && this.client.shard.ids.length === 1 && this.client.shard.count > 1) {
          data.shard_id = this.client.shard.ids[0];
        } else {
          data.shard_id = this.client.shard.id;
        }
        data.shard_count = this.client.shard.count;
      } else if (this.client.shards && this.client.shards.size !== 1) {
        data.shard_count = this.client.shards.size;
      }
    }
    const response = await this._request('post', 'bots/stats', data, true);
    return response.body;
  }```
It's only setting the server_count to the one you gave it or client.guilds(.cache).size
digital ibex
#

@hardy vector which line in the provided code?

hardy vector
#

.setAuthor(msg.author) this returns the error

digital ibex
#

wait what

hardy vector
#

thats line 15

digital ibex
#

you're passing message but using msg

hardy vector
#

no look closer

digital ibex
#

what is client.snipes

hardy vector
#
client.snipes = new Map()
client.on('messageDelete', function(message, channel) {
    client.snipes.set(message.channel.id, {
        content: message.content,
        author: message.author.username,
        image: message.attachments.first()
    })
})```
#

in my main file ^

nocturne grove
#

why are you doing that?

#

you're storing the last message of each channel

#

oh no nvm it's the messageDelete event

solemn latch
#

like pls snipe of dank memer

nocturne grove
#

lol idk that bot really well 😂

solemn latch
#

which is why i never invite dank memer anywhere

nocturne grove
#

what does the command do?

solemn latch
#

grabs the last deleted message in a channel

#

and posts it

nocturne grove
#

bruh

solemn latch
#

its really terrible

nocturne grove
#

that's not how message deletion works

solemn latch
#

it grabs it from a cache

hardy vector
#

so

#

what do i do tho

solemn latch
#

like client.snipes

nocturne grove
#

yeah but still. If I'm deleting my message I don't want it to be visible for any user by a bot

solemn latch
#

people really like it

quartz kindle
#

lots of bots do it lol

nocturne grove
#

bruh

solemn latch
#

ive seen people delete a message with a password, and then someone snipes it

#

and then no mods delete it

quartz kindle
#

lmao

hardy vector
#

thats tuf

#

but how do i fix it

nocturne grove
#

see that's what I mean lol

solemn latch
#

its should be an opt in feature imo

#

by each user

nocturne grove
#

what should be fixed then?

quartz kindle
#

most logging bots still log deleted messages in log channels anyway

nocturne grove
#

yeah but most log channels are staff only (afaik)

solemn latch
#

^ that also imo should be opt in by each user

hardy vector
#

wait but how do i fix then

quartz kindle
#

@hardy vector anyway whats the issue again?

hardy vector
#

snipe cmd returns error

solemn latch
#

is it because of this.client?
wouldnt it be message.client?

hardy vector
#

uh my cmd handler needs this infront of stuff

digital ibex
#

ok im back

hardy vector
#

i think it does

digital ibex
#

woo, its because he's using classes

hardy vector
#

so can i not use that cmd then

quartz kindle
#

the problem is that you dont return when there is no message

#

so the code continues even if there is no message

hardy vector
#

but if there is no message it tells them it couldnt find any recently deleted messages

quartz kindle
#

yes, but continues the code anyway

lusty spade
quartz kindle
#

fetchBans() returns all bans, you can use fetchBan() instead to only get one and not need to bans.get(args[0])
anyway, the ban object contains a user and a reason. you need to pass the user to the unban method, not the ban object

#

ie: .unban(banned.user)

lusty spade
#

oh ok thanks for the explaination

hardy vector
#

now when i delete a picture and try to snipe it, it gives me this error (node:5028) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.image.url: Could not interpret "{'attachment': 'https://cdn.discordapp.com/attachments/724469899413553213/725384172335530015/pixel.jpg', 'name': 'pixel.jpg', 'id': '725384172335530015', 'size': 9592, 'url': 'https://cdn.discordapp.com/attachments/724469899413553213/725384172335530015/pixel.jpg', 'proxyURL': 'https://media.discordapp.net/attachments/724469899413553213/725384172335530015/pixel.jpg', 'height': 620, 'width': 620}" as string.

#

is it possible for me to show the image that they deleted

#

or no

quartz kindle
#

you 're saving the entire attachment and giving it to setImage

#

you need only the url

cinder dove
#

Is it possible to update a bot while having the node process active and 0 interruptions? 🤔 I don't think so but there's some smart people out here.

quartz kindle
#

it is

cinder dove
#

Really? How?

#

😮

quartz kindle
#

if your code is based on required files, you can invalidate the require cache and force it to re-require said files

cinder dove
#

Ohhh wait so i can actually make it refresh basically.

quartz kindle
#

yup, thats how many bots implement command refresh commands

cinder dove
#

Thank you a lot.

solemn latch
#

I have a restart command.
since my bot is mainly games, theres a 3 minute no new games from when the restart command was run, and then it restarts.
so no ones game gets lost.
I need to do the same for refreshing commands i just havent yet

#

due to lazyness

pure lion
#

How do I make a bot restart command in eval? Last time I destroyed the client then logged back on but it didn't work:

bot.destroy().then(() => bot.login(token))

digital ibex
#

you could possibly try that, or just await it

solemn latch
#

are you using pm2?
you can just process.exit()

#

well sharding hmmm

quartz kindle
#

client.destroy() just logs out, doesnt end the process

pure lion
#

you could possibly try that, or just await it
Didn't work last time

quartz kindle
#

if you want a full restart, you need process.exit()

pure lion
#

Ooooooo

digital ibex
#

not sure, i haven't had a reason to have a restart command so i don't really know mmulu

pure lion
#

^:)

lusty spade
restive furnace
#

or if you just want release the cache, just set client to null and create new one :DD

pure lion
#

I literally wanna log out then log back in-

quartz kindle
#

whats your code now zhon

solemn latch
#

wait, was the error that token didnt exist? @pure lion ?

pure lion
#

Nope

lusty spade
pure lion
#

Not sure actually

#

Brb

solemn latch
quartz kindle
#

@lusty spade you need to give fetchBan() the id of the user

#

so it knows which ban to fetch

lusty spade
#

so i need to place the banned user's id in the brackets?

quartz kindle
#

yes

#

basically instead of fetchBans(); bans.get(id); you directly do fetchBan(id)

lusty spade
#

ok

#

is there a way to do unban few users without going in to the code and changing the user id?

pure lion
#

@solemn latch yeah, request to use token but it was unavailable

quartz kindle
#

theres no way to unban multiple users at once, but you can make your code call members.unban() multiple times

#

either from a list of ids, or from a list of bans

solemn latch
#

You'd have to get the token from the configuration file I would think

reef mantle
#

Hello

lusty spade
#

oh ok thanks, so i can log banned members into a db then get the members id from the db

quartz kindle
#

sure

reef mantle
#

I can help too I am not a pro but I can help

lusty spade
#

ok thanks

reef mantle
#

Btw hi Dice and Woo

pure lion
#

You'd have to get the token from the configuration file I would think
Where? bot.destroy?

#

Oh hey

reef mantle
#

Hi

#

Can someone tell me how to add an inventory system?

pure lion
#

Uh

spare goblet
#

use a database

reef mantle
#

What's a database?

pure lion
#

Store items as IDs and use a db

reef mantle
#

Sorry I am still noob

pure lion
#

Uh

spare goblet
#

store user id snowflake and then in another property their items

#

google it

pure lion
#

Idk, never used quickdb

reef mantle
#

Umm nvm

#

Bye

spare goblet
#

quickdb is not the only database that exists

#

bye

reef mantle
#

Can someone tell me a easy code for my bot?

#

I don't have ideas of what to add next?

earnest phoenix
#

anyone here can shard in discord.js?

spare goblet
#

Use discord.js in built sharding manager i guess

reef mantle
#

What's that?

#

Oh you guys talk

#

I'll go grab something to eat

earnest phoenix
#

can i show you something?

spare goblet
#

sharding is a method to split processes into multiple smaller processes to handle guilds

reef mantle
#

runs as flash cause cknat understand a fuck

earnest phoenix
spare goblet
#

it is required after 2.5k servers before your bot no longer works (aka doesnt login properly)

reef mantle
#

comes with Burger,Fries and Soda

earnest phoenix
#

i am sharding?

spare goblet
#

please stop roleplaying

reef mantle
#

distributes and sees

#

Sorry

spare goblet
#

Idk if you are

#

you could also simply be posting console.log('Shard 0 launched') kekw

#

but by the looks of it, perhaps?

earnest phoenix
#

Do you guys know why this would not make a square but a square like that?

ctx.moveTo(255, 150);
ctx.lineTo(295, 150);
ctx.lineTo(255, 195);
ctx.moveTo(255, 195);
ctx.lineTo(295, 195);
ctx.moveTo(295, 150);
ctx.lineTo(295, 195);
ctx.stroke();
ctx.closePath();```
quartz kindle
#

you want to make a square?

earnest phoenix
#

Yea

quartz kindle
#

then do 4 lineTo's

spare goblet
#

it's because when you

#

run the lineto function, it's also moving

earnest phoenix
#
const { ShardingManager } = require('discord.js');
const manager = new ShardingManager('./index.js', {
    totalShards: 'auto', 
    token: process.env.token
});
manager.spawn();
manager.on('shardCreate', (shard) => console.log(`Shard ${shard.id} launched`));
#

here

#

Confused

quartz kindle
#

moveTo(255,150); lineTo(295,150); lineTo(295,195); lineTo(255,195); lineTo(255,150)

spare goblet
#

like

quartz kindle
#

@earnest phoenix yes that will shard automatically when needed

earnest phoenix
#

nice

#

i am sharding now

#

its said

#

Shard 0 launchd

spare goblet
#

congrats

earnest phoenix
#

cool

#

i dont need to update any code at index.html

#

due to shard right>?

restive furnace
#

if you need to

spare goblet
#

I don't understand why you utilise an html file in discord.js?

#

confused

earnest phoenix
#

what?

#

where

vale garden
#

hi

earnest phoenix
#

@quartz kindle that worked but so like... I don't need to use moveTo() many times?

vale garden
#
 TypeError: Cannot read property 'execute' of undefined
#

why am i getting this error

#
module.exports = {
  name: 'math',
  description: "used to perform mathematical operations",
  cooldown: 0.01,
  execute: (message, args) => {
}
}```
#

looks normal to me

earnest phoenix
#

Are you sure it's coming from there?

vale garden
#

its happening when ido that command so

spare goblet
#

@earnest phoenix you didn't have to use moveto because when you were drawing the line, you were also "moving" the "pen" or the "dot"

#

if that makes sense

earnest phoenix
#

Oh i see

vale garden
#

even my index.js looks normal

#
    case 'math':
    bot.commands.get('math').execute(message, args);
    break;
earnest phoenix
#

That's where it comes from

vale garden
#

but its normal

spare goblet
#

It usually says what line its on, you might wanna double check

earnest phoenix
#

It can't get the command

spare goblet
#

are you caching bot.commands properly?

vale garden
#

yea

#

all the other commands are working

#

wait

spare goblet
#

try logging bot.commands and bot.commands.get('math') i guess

vale garden
#
let operation = args[1];

    if (!args[1])
    return message.channel.send("Enter the operation to be performed")

    if (args[1] === "add") {

    let a = args[2];
    let b = args[3];

    if (!args[2])
      return message.channel.send("Enter the 2 values.");
    if (!args[3])
      return message.channel.send(
        "Enter the 2 values like this: `t!math add 10 3`"
      );

    if (args[2] && args[3]) {
      var valueOne = parseInt(args[2]);
      var valueTwo = parseInt(args[3]);
      var valueAnswer = Math.floor(valueOne % valueTwo);

      message.channel.send(
        `The sum of ${valueOne} + ${valueTwo} is equal to ${valueAnswer}`
      );
    }

    }```
#

is this correct

#

for v12

spare goblet
#

The command itself is tnot the issue

vale garden
#

i just remembered that i got it from my v11 bot

#

thats why

spare goblet
#

What you're having isn't the function itself

vale garden
#

what function

spare goblet
#

its that it cant even find the command file / cached command object properly in the first place

#

the execute function you created

vale garden
#

what

#

oh

#

no i have that

#

i just didnt paste it in

#

its above

spare goblet
vale garden
#
module.exports = {
  name: 'math',
  description: "used to perform mathematical operations",
  cooldown: 0.01,
  execute: (message, args) => {
pure lion
#

suuuuuuuuuuuuuup

spare goblet
vale garden
#

this is where the code begins

#

it does

#

i just didnt paste it here

spare goblet
#

AAAAA

#

no

vale garden
#
module.exports = {
  name: 'math',
  description: "used to perform mathematical operations",
  cooldown: 0.01,
  execute: (message, args) => {

    let operation = args[1];

    if (!args[1])
    return message.channel.send("Enter the operation to be performed")

    if (args[1] === "add") {

    let a = args[2];
    let b = args[3];

    if (!args[2])
      return message.channel.send("Enter the 2 values.");
    if (!args[3])
      return message.channel.send(
        "Enter the 2 values like this: `t!math add 10 3`"
      );

    if (args[2] && args[3]) {
      var valueOne = parseInt(args[2]);
      var valueTwo = parseInt(args[3]);
      var valueAnswer = Math.floor(valueOne % valueTwo);

      message.channel.send(
        `The sum of ${valueOne} + ${valueTwo} is equal to ${valueAnswer}`
      );
    }

    }
spare goblet
vale garden
#

this is how it looks

#

hat

#

what

spare goblet
#

Not the OBJECT'S execute FUNCTION

pure lion
#

so i wanna change the size of an image from a url, any ideas?

      .setThumbnail(song.url({dynamic: true, size: 1012}))
vale garden
#

wdym wdym

pure lion
#

its saying url isnt a function

spare goblet
#

I'm not saying that <command>.execute() isn't defined

sudden geyser
#

What is song

spare goblet
#

I'm saying <commandFile> isn't defined

vale garden
#

bruh it is

spare goblet
#

Your console

#

is saying

#

it's not defined

vale garden
#

all the other commands are working

earnest phoenix
#

how i can copy file from master brach to anothers brachs

#

?

vale garden
#

but

spare goblet
#

aka its not cached properly

vale garden
#

all

#

the

earnest phoenix
#

🤔

vale garden
#

other commands are working

spare goblet
#

It doesn't matter whether all the other ones are working.

vale garden
#

wat

spare goblet
#

'math' is obviously not fetching from your cache properly

pure lion
#

What is song
its the youtube video audio it downloaded to play, it can send the image but its too high res for some reason

spare goblet
#

That's why I told you to try console logging bot.commands.get('math')

#

and bot.commands

vale garden
#

ok

spare goblet
#

and making sure the response has one key: value where the key is exactly "math"

vale garden
#
case 'math':
    bot.commands.get('math').execute(message, args);
    break;

    console.log(bot.commands.get('math').execute(message, args))

#

this is what i did

earnest phoenix
#

you're still helping him or her?

vale garden
#

and nothing is logging

pure lion
#

:0

spare goblet
#

thats because you already ended the switch case

long yew
#

how do i make it so when i write .start sobble it also adds sobble to my mons.json file?

spare goblet
#

:')

long yew
vale garden
#

oh

pure lion
spare goblet
sudden geyser
#

Why are you adding a switch case for each command when you could just save the .get to a variable and see if it exists

#

What type of food do you want in your mouth

earnest phoenix
#

lmao

long yew
#

how do i make it so when i write .start sobble it also adds sobble to my mons.json file?

#

help

#

xD

spare goblet
#

@long yew slice up the message response using args to figure out what they typed, make sure they chose one of the three valid responses, then if they did, add it to your db
if you dont understand what i said google "js string methods" <- this will help you be able to learn how to figure out what they typed by slicing

#

and stop spammin gthe channelw ith your question

restive furnace
#

@long yew but why 2 message listeners??

pure lion
#

how do i make it so when i write .start sobble it also adds sobble to my mons.json file?
@long yew dude im right here-

vale garden
#

ok i messed something up somehow

pure lion
#

@long yew but why 2 message listeners??
I was trying to explain this in dm um

spare goblet
#

and stop putting multiple message listeners for one purpose, you're upping your CPU n other resources for no reason

vale garden
#

nothing is logging

earnest phoenix
#

no way you use message listeners for every command

long yew
#

@restive furnace idk

vale garden
#

and im getting the error again

long yew
#

@pure lion dm

pure lion
#

kk

restive furnace
#

its annoying to dm ppl with help but ok

spare goblet
#

@vale garden literally copy and paste
console.log(bot.commands)

and search through the log for a key that says math

solemn latch
#

Put it after(programatically) where you require all your commands, but above the erroring line

vale garden
#
'math' => {
    name: 'math',
    description: 'used to perform mathematical operations',
    cooldown: 0.01,
    execute: [Function: execute]
#

im getting this

solemn latch
#

And that's your only command?

vale garden
#

ok gtg ill see it tomorrow

#

no

solemn latch
#

Then there's a problem

vale garden
#

its not

solemn latch
vale garden
#

its not my only one

solemn latch
#

It should log all your commands

vale garden
#

it did

#

bruh

#

ok anyways gtg

#

ill see it tmrw

earnest phoenix
#

k

#

x to doubt

restive furnace
spare goblet
#

@vale garden oh not sure why its not working then tnc_d_well try console.log(bot.commands.get('math')) and see if execute is also defined in that case

sudden geyser
#

What does the command handler look like.

earnest phoenix
#

his status is a downer

#

i dont know how to use the dbl api thing to get server cout

#

count

restive furnace
spare goblet
#

you mean post server count?

earnest phoenix
#

ill help there

#

ok

#

ok, hi so i have a little problem on the heroku thing, i hosted my bot, but is this problem, i think you all know it the problem when heroku cant "write" json files, i saw some sites where it says __ dirname casue on heroku the path is dif that the one on the laptop,

#

my question, after i do the __ dirname thing, will be anything else to do?

spare goblet
#
  1. I do not use heroku so my answer can be wrong
  2. No, I did not know the problem about heroku because I do not use heroku
  3. __dirname only returns the directory path iirc, could be wrong
earnest phoenix
#

rephrasing your question would help

#

also Heroku can't update json files in realtime

spare goblet
#
  1. if you're using json for a database, it's a terrible idea
earnest phoenix
#

@spare goblet what do you use?

solemn latch
#

any real database

spare goblet
#

um i use mysql
but you can use any "real" db ig

earnest phoenix
#

for database and host

#

mysql, mongodb, sqlite etc.

slender thistle
#

that isn't hosted on the same machine*

spare goblet
#

just anything thats not a local file

earnest phoenix
#

yh so mongodb is the option

spare goblet
#

I use DO, but any host usually works lol kek

earnest phoenix
#

ikik i tried mongodb

#

you didn't try hard enough

spare goblet
#

sqlite is also hosted on the same machine, very terrible for anything larger than like 1k servers lol

earnest phoenix
#

ok

#

u dont understand my problem here

spare goblet
#

um well if they dont wanna use mongo there are also other options

earnest phoenix
#

1 i understand the database thing

#

i can swich is not a problem

#

but for me to be more easier i got json files

#

what was my problem

restive furnace
#

whats DO GWbruhGalaxyThink

earnest phoenix
#

was how to make heroku

spare goblet
#

well if Auric is correct, even if your bot is in 1 server and you really want to use file database, it will notwork because of heroku's nature

#

digitalocean

earnest phoenix
#

paid?

spare goblet
#

no decent vps is free lol

earnest phoenix
#

;-;

#

yeah

#

ok

digital ibex
#

if ur a student, u can get dg for free

earnest phoenix
#

so no one knows the answer cool

spare goblet
#

my bot's scale is way too large for a free host :')

earnest phoenix
#

nice help

digital ibex
#

via github tho

spare goblet
#

they literally

#

gave you

#

answer

earnest phoenix
#

imagine free hosts

#

oh yeah?

spare goblet
#

you CAN'T use heroku to edit files real time

earnest phoenix
#

oof

#

okk

#

thanks

spare goblet
earnest phoenix
#

i did say that

#

¯_(ツ)_/¯

#

so i have to move all on mangodb

#

ok

#

thanks

spare goblet
#

mangodb

earnest phoenix
#

yes mangodb

spare goblet
#

we all love mangoes kek

earnest phoenix
#

mongodb*

#

yep

#

no mangodb

#

stop getting it wrong

#

smh

#

me getting bullied cool

#

ok

#

thanks

#

cya

#

not really bullying

#

but ok

spare goblet
#

take a joke kekw

earnest phoenix
#

^

restive furnace
#

^^

pure lion
#

^^^

digital ibex
#

O_O

pure lion
#

supcanihavesomehelpuwu

digital ibex
#

what do u need

pure lion
#

me want to resize image so its lower resolution (from a url) but it no work (for context, song.url returns a url string for a youtube thumbnail)

#
.setThumbnail(song.url({dynamic: true, size: 1012}))
earnest phoenix
#

grr you didn't space it out <--- ignore that

digital ibex
#

it doesn't always work when resizing, its kinda weird, you're gonn have to get the right number, and use png if you're not already

restive furnace
#

1024

#

is real rezozulizotion

spare goblet
#

btw discord automatically lowers the resolution 👀

#

so it really doesnt matter

earnest phoenix
#

use 1024

pure lion
#

1024
oh oops

#

when i write the format do i do png or .png?

earnest phoenix
#

eh?

digital ibex
#

u can change it in ur clients options, but if u dont wanna do that u can just use replace

pure lion
#

ookay

feral aspen
#

Hello

#

so in this server.. it has 110k.

#

and my bot says that it moderates only 19k from here.

pale vessel
#

caching

feral aspen
#

does anyone know the reason for this?

#

hm..

#

this is my code..
```bot.user.setActivity(`${bot.users.cache.size} members! || a!help````

#

how should it be?

pale vessel
#

you should use the .reduce and guild.memberCount

#

memberCount is the real member count

#

though they won't be unique

feral aspen
#

hm.. can you tell me the code that would be inside ${}

pale vessel
#

if you really want a precise user count, you would need to fetch all users

#

that option should be in the client options

#

refer docs

#

personally, i would say it's not worth it because of memory and stuff but if you still insist

feral aspen
#

hm.

#

sorry to ask.. as Im beginner

#

what would cache effect.. what would cache do if you include it?

pale vessel
#

your bot already caches members, just not all of them, only the ones that are online etc.

client.users.cache.size is the amount of users the bot cached, which is not an exact amount since not all users are cached

#

if you don't cache anything, you would need to fetch the member every time you need to see their info, which is a pain. this is where caching comes to action

#

if you decide to cache all users, it would take quite a bit of your memory to store all users

feral aspen
#

Hm.. okay!

pale vessel
#

if you still want to cache all users (to get the exact amount of users the bot serves), enable the "cache all users" in the client options

#

it could be called members instead of users

solemn latch
#

in the future, i belive that will be considered a privlaged intent

pale vessel
#

it's not even worth doing it just for the user count

#

but oh well

feral aspen
#

if its not worth it.. then dont do it as said.

#

But thanks for explaining

#

😄 👍

still merlin
solemn latch
#

break doesnt make any sense right there

pale vessel
#

yeah just remove it

#

you probably had a switch statement and forgot to remove it

feral aspen
#

Remove the break at there.

still merlin
#

but wont that make the rest of my code apart of my eval command? (below it)

solemn latch
#

return is how to stop a function, but you dont even need that there

pale vessel
#

the first if statement already handles that

still merlin
#

ok

solemn latch
#

https://discord.js.org/#/docs/main/stable/class/Guild?scrollTo=memberCount
@feral aspen
you can go through each guild, get the member count property and add them all together.
this will duplicate users(if your bot is in 2 guilds, and the same member is in both guilds, he gets counted twice)

feral aspen
#

ohhh..

#

but that would take more space.

#

hm..

solemn latch
#

more "space"?

feral aspen
#

woops

pale vessel
#

that's what i was referring, but yeah, duplicates

feral aspen
#

I meant memory

pale vessel
#

you can use the reduce function for that and no, it doesn't take memory

solemn latch
#

well, no. only caching every user does that

#

you can reduce member count?

#

oh duh

#

nvm

#

ignore that, i was thinking something else

feral aspen
#

😐

solemn latch
#

reduce is the right way

pale vessel
#

guilds.reduce((prev, next) => prev.memberCount + next.memberCount)

#

LMAO

#

no

solemn latch
feral aspen
#

hm..

#

so what do i replace in here?

#

bot.user.setActivity(`${???????????????} members! || a!help

#

it was like that from before

#

```bot.user.setActivity(`${bot.users.cache.size} members! || a!help````

pale vessel
#

replace guilds with your client's guilds

#

it would be client.guilds

#

i think that's all

feral aspen
#

```bot.user.setActivity(`${bot.guilds.reduce((prev, next) => prev.memberCount + next.memberCount)} members! || a!help````

#

like that??????

#

🤦‍♂️

pale vessel
#

only one way to find out

feral aspen
#

bot.guilds.reduce is not a function.

#

...

#

am I missing something? 😐

solemn latch
#

ooop

#

discordjs 12?

pale vessel
#

probably

feral aspen
#

yes.

#

Yeah

#

Forgot to tell.

pale vessel
#

guulds.cache would be the cached guilds

#

my bad

solemn latch
#

guilds.cache*

pale vessel
#

yep

solemn latch
#

guilds are already all cached

feral aspen
#

Ill try out now.

pale vessel
#

kind feel sluggish since it's 2am

solemn latch
#

oo

#

12 hours apart

#

2pm for me

pure lion
#

:0

feral aspen
#

for me its 10PM

pale vessel
#

crazy

solemn latch
#

hello other side of the world

pure lion
#

BST gang anyone????????

#

:<

feral aspen
#

uhm

#

error

pure lion
feral aspen
#

its saying Watching NON members..! 🤯

pure lion
#

s a n d e r r

pale vessel
#

NaN

solemn latch
#

nan?

feral aspen
#

Yes./

pale vessel
#

could it be because some guilds don't have memberCount?

feral aspen
#

See the bot.. here. It's Attitude.

#

😐

#

hm.

#

should I keep it as it is better?