#development

1 messages ยท Page 1186 of 1

golden condor
#

That's why

faint prism
#

Hey guys I write my file like 10 times an hour and now all the data is messed up please help?
@golden condor I wrote to my jsondb 50+ times a min

opal plank
#

this is 5h of uptime in the host

faint prism
#

Before it broke

golden condor
#

PFFFT

thin tapir
#

@faint prism sent the class to ur dm

opal plank
#

175 Billion tuples

faint prism
#

I saw. Give me a bit

opal plank
#

in 5 h

earnest phoenix
#

I'll just press Alt + F4

thin tapir
#

k

earnest phoenix
#

Y'all should too

#

imagine using threading to extract data from a db

#

!Discord is meh

#

.-.

#

true

#

the opposite

golden condor
#

Guys pls help why it no work? Json be not respond? Pls I write it every time someone do send message and I do not know the cache?

earnest phoenix
#

discord ain't meh

opal plank
#

175 Billion tuples did the trick

#

25% total cpu usage

earnest phoenix
#

dent

#

???????

dull badger
#

Hi guys let me ask a question

opal plank
#

you missed my flex earlier didnt u code?

earnest phoenix
#

how do you remotely dent hardware

dull badger
earnest phoenix
#

Hi guys let me ask a question
@dull badger just ask it no need to tell us you wanna ask

opal plank
#

11k messages per minute

golden condor
opal plank
#

this is what was causing that server to use 25%

earnest phoenix
#

Is it looks like good?
@dull badger you've been told earlier by a mod not to ask for idea here

#

discord.js server is cool with that tho

opal plank
#

197 database calls per second

#

just let that sink

#

per SECOND

#

25% cpu usage

#

its quite the task to bring 2 Xeons to use that

earnest phoenix
#

my bot is always above 60% cpu usage even tho it is offline (yeah)

opal plank
#

those are the specs btw

#

if u missed it

earnest phoenix
#

the expressjs server alone eats half the cpu

opal plank
#

shit host

earnest phoenix
#

yeah

#

what do yoi expect

finite bough
#

i am getting a 401 discord api error while changing the channel of a webhook

#

anyone knows why

opal plank
#

401 (UNAUTHORIZED) The Authorization header was missing or invalid.

earnest phoenix
#

show code

#

not qt me i meant your code

finite bough
opal plank
#

i dont think u can do that

finite bough
#

in the docs

#

it said u can

opal plank
#

im 50% sure you cant edit webhooks once they are sent

earnest phoenix
#

you can't edit webhooks

#

she wanna edit the channel name

finite bough
earnest phoenix
#

bruuuuuuhhhh

finite bough
#

wait

#

wha

#

#bids edit webhooks like every second

#

LOL

opal plank
#

no, it sends new ones

spice cradle
#

hi i nedd bot for my yotube channel ?

finite bough
#

nope

opal plank
#

once its sent you cant edit it

slender thistle
#

It's the same webhook with changed name and avatar

opal plank
#

you can edit the webhook contents

finite bough
#

^

opal plank
#

thats when you send in the payload

#

you cannot edit a sent webhook

#

this is just the payload for the new one you'll send

finite bough
#

yea

opal plank
#

which technically is kinda wasteful

finite bough
#

thats exactly what i am doing

opal plank
#

im assuming you getting a bad webhook

finite bough
#

if i dont edit the channel

#

it works fine

opal plank
#

say that webhook is on #general then you try access channel #development

#

with the webhook that is tied to #general

#

thats my only assumption

earnest phoenix
#

#general notlikenoot

#

it's off topic man (pun intended)

finite bough
dense vessel
#

does heroku support discordjs databases?

finite bough
#

this is 1 webhook getting edited

#

@dense vessel discord.js lib yes

opal plank
#

thats not a webhook getting edited

#

thats the same webhook with different payloads sent

finite bough
#

like

#

u are saying the same thing but twisted

#

i dont mean like editing a webhook msg

opal plank
#

there is a difference

earnest phoenix
#

it's not our job to help man/woman

opal plank
#

even the name and avatar is part of the payload

slender thistle
#

On each request to a webhook, a different avatar and name are provided to Discord API

opal plank
#

to change the actual webhook channel i dont think you can use the payload

#

you need to create a webhook to that channel i assume

#

i dont recall seeing a channel in the webhook payload

finite bough
#

@slender thistle yea then it can also provide a different channel to the discord api no?

slender thistle
#

Mhm, webhooks are attached to channels

opal plank
#

so thats the issue

#

channel: ''

slender thistle
#

No, it can't, Shiemi

#

You can't edit a webhook's channel

opal plank
#

say that webhook is on #general then you try access channel #development
this

slender thistle
#

You need to create a separate one in another channel and send requests to it

finite bough
#

oh alr

#

ty

dense vessel
#

what are some good discordjs databases?

finite bough
#

gonna be a pain sad

opal plank
#

wot

finite bough
#

mongodb

opal plank
#

you mean js databases?

finite bough
#

better-sqlite3

opal plank
#

well not even

#

postgres?

#

sql?

#

mongo?

#

cassandra?

#

maria?

#

there are plenty

dense vessel
#

alr ill check them out

#

thanks

opal plank
#

usually boils down to preferenec

#

keyword usually

finite bough
#

use anything except 2 things, quick db and json db

opal plank
#

some are good in specific tasks

restive furnace
#

quick.db if u real lazy ๐Ÿคท

dense vessel
#

use anything except 2 things, quick db and json db
alr bet

finite bough
#

lmao

dense vessel
#

some are good in specific tasks
i just need a database for server specific settings

restive furnace
#

sqlite will do

finite bough
#

^

dense vessel
#

alr thanks guys

opal plank
finite bough
#

that requires a good knowledge of sql tho

#

if u dont have that

#

my choice would be mongodb

opal plank
#

likely not

#

postgres

finite bough
#

is mongo faster than postgres?

opal plank
#

PgAdmin is one hell of a saving grace

#

just look up pgadmin

#

not even kidding

slender thistle
#

I heard PostgreSQL is more performant compared to mongo

opal plank
#

you'll switch right away

finite bough
#

yea

opal plank
#

lemme initiate a session rq

raw canopy
#

i need help

finite bough
opal plank
#

dontasktoask

raw canopy
#

I can't access the Zira bot website

opal plank
#

is that your bot?

finite bough
#

@slender thistle do ur thing

slender thistle
#

-wrongserver @raw canopy

gilded plankBOT
#

@raw canopy

Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Support Server" button on the bot's page, not the "Join Discord" button at the top of our website. If there isn't a button that says Join Support Server, then we can't help you. Sorry :(

finite bough
#

good shiv

hazy sparrow
#

lol

opal plank
#

@finite bough

#

watch this

#

UI control over database

earnest phoenix
finite bough
#

i mean mongodb compass can provide something similar

#

wont say that well tho

opal plank
#

ive heard robomongo was a thing

#

but that was long ago

neon pelican
#

Hi....

opal plank
#

pgadmin is just...... perfect

digital ibex
#

compass does the exact same thing, but in its own way.. if that makes sense, theres no difference in the things u can do in the ui

neon pelican
#

How to invite a bot to my server?

hazy sparrow
#

which database is easy to comprehend? for d.js btw

opal plank
#

why people ask for d.js?

#

theres no db for d.js

digital ibex
#

i think mongodb is easy, never used any other databases so idk

sudden geyser
#

well there was that guy who made a database out of discord text channels

opal plank
#

highly against tos i assume

hazy sparrow
#

well there was that guy who made a database out of discord text channels
@sudden geyser did WHAT?

sudden geyser
#

but if you want sql I'd recommend sqlite

opal plank
#

using cdn as database

earnest phoenix
#

https://discord.com/oauth2/authorize?client_id=<That bot's id>&scope=bot&permissions=0 @neon pelican

digital ibex
#

lmao

sudden geyser
#

@opal plank I don't think it is

#

it's just not a good idea lol

earnest phoenix
#

Jesus where the world has come, teaching people how to invite bots

digital ibex
#

you wont be able to have more than 100 channels (users) if ur storing them

opal plank
#

im pretty sure it is

digital ibex
#

lmfao im dead

opal plank
#

using their cdn as storage

sudden geyser
#

if you want something plain and simple + the oop way I see people using quick.db

opal plank
#

i recall one guy that got bent over on DAPI cuz he had a server using 4TB of storage

sudden geyser
#

I've never used it myself

opal plank
#

he was sending images converted in b64

#

4TB of data in images

digital ibex
#

quick.db isnt easy, its a pain

#

to setup anyways

earnest phoenix
#

lies

opal plank
#

ive personally seen it

earnest phoenix
#

big

#

lies

digital ibex
#

ok

earnest phoenix
#

not talking about windows

neon pelican
#

Bye guys Sorry to interrupt

earnest phoenix
#

thw windows setup is impossible

neon pelican
#

I like this server bye

earnest phoenix
#

Bye guys Sorry to interrupt
@neon pelican don't tell us if you're apologizing to interrupt

digital ibex
#

most people, people i know, use windows

opal plank
#

ah yes, its not a public chat anymore

#

we are monopolizing it

#

its ours now

earnest phoenix
#

Yeah

#

wait

#

by that i meant what's the point of saying "Sorry to interrupt" if you are being sorry to interrupt just don't tell us you're disappearing into the darkness

digital ibex
#

ur just overcomplicating things man

opal plank
#

you described my code

earnest phoenix
#

???

opal plank
#

its overcomplicated

slender thistle
#

Channel limit is 500

#

so you can have plenty of "categories"

opal plank
#

100 Guilds per user account
1000 Relationships (Pending friend requests, friend suggestions, blocked users and total friends)
50 Pins per channel
250 Roles per guild
500 Channels per guild
1000 Invites per guild
50 Channels per category
20 Reactions per message

#

to be precise

earnest phoenix
#

categories are channels wyf

opal plank
#

actually

#

i dont see category limits

slender thistle
#

Categories are channels

digital ibex
#

oh, i thought it was 100

opal plank
#

oh

#

right

#

500 categories huh

#

499

slender thistle
#

and not a single text channel ๐Ÿ˜‚

opal plank
#

i assume you need 1 channel

finite bough
#

category.send("200 IQ")

#

yes

hazy sparrow
#

guys is there like a quick.db tutorial kinda thing

digital ibex
#

idk

hazy sparrow
#

im bad at understanding written words

#

:/

sudden geyser
#

The example should reasonably be good enough, even if it's harder than watching a video or something.

hazy sparrow
#

i'll look into it, thanks!

restive furnace
#

install windows build tools

#

npm i -g windows-build-tools

finite plover
#

In Discord.js, can I add the client (which is a Discord.Client) into module exports without issue?

hazy sparrow
#

ty

sudden geyser
#

yes

golden condor
#

Yes

sudden geyser
#

You can export anything

restive furnace
#

In Discord.js, can I add the client (which is a Discord.Client) into module exports without issue?
@finite plover yes, but you can just access it by message.client, if you pass the message into module exports.

finite plover
#

Oh OK.

earnest phoenix
#

@hazy sparrow : guys is there like a quick.db tutorial kinda thing
also @hazy sparrow : i am bad at understanding written words
pogey KEKW KEKW pogey

sudden geyser
#

what

quartz kindle
#

people these days only want video tutorials lul

earnest phoenix
#

me: i hate quick.db
also me: made an announcement two weeks ago i am changing the bot database from quick.db to mongoose and then never interacted with the code again cuz im lazy

finite plover
#

New dumb question, how do you create a text channel (in a specific category)?

sudden geyser
#

What library are you using

finite plover
#

Discord.js

#

Should have made that clear, my bad.

sudden geyser
fickle dune
#

make a ping command in d .js

#

how to do the

#

"latency"

earnest phoenix
#

That awesome explanation Lite

sudden geyser
#

Get the current time (variable 1), send an API request, get the time after the API request (after it's been resolved) and save that to variable 2. Minus the time it took in milliseconds

dense vessel
#

u get the client's websocket ping

sudden geyser
#

ws ping is not the same to my knowledge

dense vessel
#

Get the current time (variable 1), send an API request, get the time after the API request (after it's been resolved) and save that to variable 2. Minus the time it took in milliseconds
whenever i tried this it sent back 19214ms or negative ping

earnest phoenix
#

You're explanations are killing me Lite THEY'RE TOO AWESONE

dense vessel
#

thats why i rely on websocket ping

earnest phoenix
#

whenever i tried this it sent back 19214ms or negative ping
@dense vessel f

quartz kindle
#

websocket ping is the latency of the websocket connection, which is where discord sends events to you

#

rest ping is the latency of the rest api which is where you send requests to discord, ie send messages

earnest phoenix
#

what's a websocket? An electric socket for the internet?

dense vessel
#

ill try out rest ping 1sec

#

thanks for explaining tim

sudden geyser
#

Nistooks calculating rest ping can be as simple as this: ```js
// JavaScript
let start = Date.now()

sendMessage(...).then(() => {
let time = Date.now() - start // in ms
})```

hazy sparrow
#

npm i -g windows-build-tools
@restive furnace is that for quick.db?

finite plover
#

When creating a channel (Discord.js) can I specify which category I want it in?

hazy sparrow
#

ayy @quartz kindle long time no see lol

earnest phoenix
#

@hazy sparrow do you even know coding

quartz kindle
#

a websocket is a special type of connection that is kept always open, as opposed to regular http/https connections that are always closed once they are finished

sudden geyser
earnest phoenix
#

Does mongoose have a way to encrypt databases with my specificied key?

quartz kindle
#

hi bow lul

finite plover
#

Oh oops.

wheat jolt
#

how the heck do I "break" the inline for d.js MessageEmbed

#

I'm trying to have an embed like this:
Field1 Field2
Field3 Field4

earnest phoenix
#

the first two have to be inline

wheat jolt
#

then?

#

what do I do with the next ones

sudden geyser
#

You can't really have it in that 2x2 pattern as it's a limitation on how Discord renders it to the user, but you could do:
a b
c
d

if you're fine with that

wheat jolt
#

ah ok

sudden geyser
#

The last argument when you use .addField (or an object key for .addFields) is inline which is if the field will be inlined. So you can set that to false if you want the field to be on its own line but you can't do the 2x2 pattern like I said (from what I tested in the past).

quartz kindle
#

the closest thing you can do is this

#

a b
blank field
d e
blank field
g h

fervent goblet
#

anyone know C#?
if so can you answer this question:
How many times must a variable be declared?

drifting wedge
#

TypeError: on_guild_channel_update() takes 1 positional argument but 2 were given

#

anyone know this error?

quartz kindle
#

i dont know C# but there is no such thing as a number of times it must be declared in any programming language

#

all variables only need to be declared once, then you just need to make sure the variable is defined in the correct scope

fervent goblet
#

idk its on my C# quiz and its puzzling to me

quartz kindle
#

then the answer should be 1 lol

fervent goblet
#

ok

#

thanks Tim

slender thistle
#

Can't a variable only be declared once

#

with X type

knotty steeple
#

if its a constant yes

fervent goblet
#

typing Starman is typing...

slender thistle
#

And as for a dynamic variable, that's not declaring it, is it?

#

That'd be changing a variable's value or re-assigning

restive furnace
#

ghosting or whatever it was called exists btw

quartz kindle
#

idk the details of how c# implements those things

slender thistle
#

First time hearing about that term

knotty steeple
#

its more shadowing

#

that is how rust uses it anyway

faint prism
#

anyone know C#?
if so can you answer this question:
How many times must a variable be declared?
@fervent goblet I know C#

#

But idk what you mean by that question

#

You can declare a variable once within a scope.
You can set it's value as many times as you want.
Outside the scope, it no longer exists.

#
{ // Start scope
    var myVariable; // Declared
    myVariable = aThing;  // Setting the value for variable
    myVariable = anotherThing;  // Overwriting the value for variable
} // End sope
// myVariable no longer exists
fervent goblet
#

the correct answer was once

cinder patio
#

well yeah of course

#

declaring something twice makes no sense

fervent goblet
#

they said must

sinful belfry
#

is there a way to cache messages sent to a new channel that was created after the bot started up with discord.js-light 3.2.2? i've tried caching the channel, but that doesn't seem to cache any messages

restive furnace
#

starman, probably better to ask in tim's server

sinful belfry
#

๐Ÿ‘€ ill ask there then if the question gets lost in this channel without an answer

stable nimbus
#

Okay, so I apparently don't remember how to do this, but how do I set a user display name in an embed?

drifting wedge
#
async def on_guild_channel_update(member):
    channel = discord.utils.get(member.guild.text_channels, name='arch-logs')

    embed = discord.Embed(
            colour = discord.Colour.blue()
        )
    embed.set_author(name=f"Channel Edited", icon_url=f"{client.user.avatar_url}")
    embed.add_field(name=f":archedit: Channel '{after}' has been edited", value=f"โ€Žโ€Ž", inline=False)
    embed.set_footer(text=f"ID: {channel.id}")
    embed.timestamp = datetime.datetime.utcnow()

    await channel.send(embed=embed)```
#

should i not pass member?

sinful belfry
#

@stable nimbus what lib?

stable nimbus
#

Discord.js 12.2. Its on an added field.

slender thistle
#

still no before, after in the function parameters

sinful belfry
#

ah so with the user object, you can just do user.username

stable nimbus
#

Okay thanks.

slender thistle
#

still I don't know why you thought on_guild_channel_update accepted a Member object

sinful belfry
#

oh wait

stable nimbus
#

I don't know how I forgot it.

sinful belfry
#

r u talking about their nick?

drifting wedge
#

still I don't know why you thought on_guild_channel_update accepted a Member object
@slender thistle lol

sinful belfry
#

or just their username?

stable nimbus
#

Just their displayname.

drifting wedge
#

so dont pass anything?

slender thistle
#

still no before, after in the function parameters

sinful belfry
#

does that mean the nickname too?

slender thistle
#

on_guild_channel_update(before, after)

#

function parameters

stable nimbus
#

Display name:
If no nickname is set it defaults to username

drifting wedge
#

thanks

sinful belfry
#

because then you'll need the member object of that user

stable nimbus
#

So since I don't have a nickname here if I ran a command it would pass as fuzzyfurry069, but if I had a nickname that would pass.

sinful belfry
#

yeah i see

#

you need the member object of that user

#

then just do .displayName on that

stable nimbus
#

I know that.

#

I've used it many a time.

#

But I have an addFiled() function where I need the display name.

sinful belfry
#

yeah, you can just do: .addField(member.displayName, "some value here")

drifting wedge
#

member.guild.text_channels

#

im not passing member

#

how can i make it work?

stable nimbus
#

Yeah but of a mentioned user.\

slender thistle
#

after.guild

sinful belfry
#

@stable nimbus you need to look at the mentions in the message

drifting wedge
#

thanks so much lol

stable nimbus
#

Which I have the user function set up.

drifting wedge
#

also, how can i detect when a category is made?

forest drift
#
message.channel.send(message.author.String());

why doesnt this work to ping someone?

drifting wedge
#

or is it same as channe;

#
message.channel.send(message.author.String());

why doesnt this work to ping someone?
@forest drift mention

#

you need to mention

sinful belfry
#

can you send ur code, i don't really understand what u mean @stable nimbus

stable nimbus
#

I'm trying to change that undefined to a display name.

forest drift
#

so
message.channel.send(mention.author.String());

slender thistle
#

also, how can i detect when a category is made?
@drifting wedge a category is a channel, use on_guild_channel_create

sinful belfry
#

@stable nimbus can u show ur code tho

drifting wedge
#

yep

#

i have that

#

so its the same?

#

in the eyes of the code

stable nimbus
#
const embed = new MessageEmbed()
                  .setAuthor(message.member.displayName, message.author.displayAvatarURL())
                  .setTitle(`${emoji.a} The Breathalyzer! ${emoji.a}`)
                  .setColor(0xA1EE3)
                  .setDescription(`<@${message.author.id}> is checking <@${user.id}>'s BAC level!`)
                  .addField(`${user.displayName}'s BAC level: `, `${percent}%!`)
                  .setFooter(copyright.copyright);
                  message.delete();
                  message.channel.send(`Hey <@${message.author.id}>, <@${user.id}>!`, embed);```
slender thistle
#

Essentially, yes. A category is a channel that contains text/voice channels

sinful belfry
#

@stable nimbus .displayName can only be done on a member

#

not on a user

#

so you need to fetch the member, and then you can do .displayName on them

stable nimbus
#

When I do it on a member it breaks, I need to get the display name of somebody I mentioned.

slender thistle
#

Use isinstance(channel, discord.CategoryChannel) to check if created channel is a category

sinful belfry
#

you can fetch the member with the user pretty easily

stable nimbus
#

Thats not what I need ffs

misty sigil
#

what do you need then

stable nimbus
#

Nevermind.

sinful belfry
#

(you can't get people's nicknames from the user)

#

they are guild specific, which is why it is only obtainable from the member

#

perhaps i have misunderstood tho

blazing portal
#

Anyone else here having a sharded bot(discord.js) and uses pm2 and/or pm2 plus?

Because I just started sharding my bot, all good so far, however pm2 reports to me that the process only takes 42mb ram...
And it's only showing one process too... I am clueless at this point what's the issue

misty sigil
#

@blazing portal I have a sharded bot and use pm2

#

So is it nodejs?

blazing portal
#

Yeah

misty sigil
#

You can use client.shard.broadcastEval("process.memoryUsage().rss") to get all the usage

#

that's all i can think of

forest drift
#
message.channel.send(message.author.mention);

why when i use this does it could as "undefined"?

misty sigil
#

because message.author is a mention

#

you dont need message.author.mention

blazing portal
#

Ah no that's not the issue. My stats command works fine. It's just that pm2 says it's 42mb which is just wrong. And i use the pm2 web dashboard (pm2 plus) to monitor the server. So this being wrong is... bad for me xD

forest drift
#

oh thanks

misty sigil
#

@blazing portal Ah I see

drifting wedge
#
async def on_guild_role_update(before, after):
    channel = discord.utils.get(after.guild.text_channels, name='arch-logs')

    embed = discord.Embed(
            colour = discord.Colour.blue()
        )
    embed.set_author(name=f"Role Updated", icon_url=f"{client.user.avatar_url}")
    embed.add_field(name=f":archedit: Role '{after}' has been edited", value=f"{before} ยป {after}", inline=False)
    embed.set_footer(text=f"ID: {channel.id}")
    embed.timestamp = datetime.datetime.utcnow()

    await channel.send(embed=embed)```
#

this is my role update logs thing

#

it sends like all roles update

#

its a bit wierd

#

no errors

#

using discord py

pale vessel
#

because message.author is a mention
@misty sigil that is if it's inside a template literal (it turns it into a string) or using message.author.toString()

misty sigil
#

oh yes

#

@forest drift ^

pale vessel
#

otherwise it's an object

misty sigil
#

i mean iirc correctly it'll just send a .toString() of an object

#

yes if i recall correctly correctly

#

no, it doesnt

pale vessel
forest drift
#
if (message.guild.channels.exists('id', 'channelid')) {
}

I'm sure this is wrong but wouldnt this detect a channel?

quartz kindle
#

message.guild.channels.cache.has(channelid)

forest drift
#

thanks

#

then last question, how do i detect if a role exists if i have its id already?

restive furnace
#

same but replace channels with roles

blazing portal
#

@misty sigil Just out of curiosity, pm2 is showing the correct ram and cpu usage for your bot right? and does it show each shard independently?

misty sigil
#

No

forest drift
#

ah ok... trying to fool proof my bot so trolls dont break it

misty sigil
#

I just don't bother and use a netdata panel

blazing portal
#

I see... cheers

quartz kindle
#

pm2 cant see child processes

#

unless you run all processes in cluster mode

#

but discord bots are not really compatible with cluster mode because they are not stateless (you can make it work but it takes some effort)

drifting wedge
#
async def on_guild_role_update(before, after):
    channel = discord.utils.get(after.guild.text_channels, name='arch-logs')

    embed = discord.Embed(
            colour = discord.Colour.blue()
        )
    embed.set_author(name=f"Role Updated", icon_url=f"{client.user.avatar_url}")
    embed.add_field(name=f":archedit: Role '{after}' has been edited", value=f"{before} ยป {after}", inline=False)
    embed.set_footer(text=f"ID: {channel.id}")
    embed.timestamp = datetime.datetime.utcnow()

    await channel.send(embed=embed)``` this sends all roles
#

not just updated roles

#

any idea why?

forest drift
#

The console just keeps saying "client.channels.get" is not a function

misty sigil
#

client.channels.cache.get() for discord.js

drifting wedge
#

im using python

#

discord py

forest drift
#

ohhhhh so thats why u dont follow other guides...

misty sigil
#

no

#

im saying for ^

sand condor
forest drift
#

yeah... a lot of StackOverflow have a comment with the v12, but some are still on v11

#

other guides are outdated, your code is in v12
here is the official guide which isnt outdated: https://discordjs.guide/
@sand condor i used that when starting

blazing portal
#

but discord bots are not really compatible with cluster mode because they are not stateless (you can make it work but it takes some effort)
@quartz kindle I guess before i dive deep into making it possible with pm2 then i will just take another way to monitor my bot. Thanks ๐Ÿ™‚

fierce arch
#

How does one update nodejs via the command line? Linux

quartz kindle
#

@blazing portal or just use internal sharding

#

ยฏ_(ใƒ„)_/ยฏ

blazing portal
#

I do, I am using the ShardingManager provided by Discord.js. But pm2 shows me the wrong ram and cpu usage

quartz kindle
#

thats not internal sharding

misty sigil
#

what is then

blazing portal
#

oh right, i confused them. Is internal sharding better than traditional though?

quartz kindle
#

depends on the situation

#

the only reason to use the sharding manager is if you have multiple cpu cores and your bot uses a lot of cpu

#

otherwise internal sharding is better in almost every way

misty sigil
#

so how do you do said internal sharding

quartz kindle
#
const client = new Discord.Client({
  shards:"auto"
})
misty sigil
#

is it that fucking simple

quartz kindle
#

yup

misty sigil
#

well fuck me

blazing portal
#

same haha

zenith terrace
#

Is internal sharding easy, is it just that ๐Ÿคจ

cobalt spruce
#

i forgot how to see how many servers bot is in

#

is it

#

message.guilds.cache.size?

misty sigil
#

client.guilds.cache.size

quartz kindle
#

with internal sharding there is only 1 bot process, the same way as not sharding at all. all shards use the same cache, there is no broadcastEval, no fetchClientValues, etc...

cobalt spruce
#

@misty sigil thanks

zenith terrace
#

client.guilds.cache.size
@misty sigil or bot

cobalt spruce
#

ik$

#

ik

#

am not that dum

misty sigil
#

with internal sharding there is only 1 bot process, the same way as not sharding at all. all shards use the same cache, there is no broadcastEval, no fetchClientValues, etc...
@quartz kindle cooL lol

quartz kindle
#

it uses less ram because you dont need a full process for each shard

#

the only downside is that it cannot use multiple cpus

blazing portal
#

can't use multiple cpus or cpu threads?

quartz kindle
#

threads

#

aka virtual cpus

blazing portal
#

wait maybe it's because i had my head in the sharding stuff the past hours, but isn't discord.js using all available cpu threads by default? or am i confusing something here

misty sigil
#

cpu but virtual

quartz kindle
#

it has nothing to do with discord.js

#

javascript is single threaded, each javascript process can only use 1 thread, which in turn means that each node.js process only uses 1 thread as well

#

in order to multi-thread javascript and node.js, you need to either spawn multiple node.js processes, or use node.js's worker threads

#

discord.js's sharding manager does that, it uses node.js's child_process.fork() by default, and you can also set it to use worker_threads instead

#

internal sharding doesnt use the sharding manager, there is only 1 single process, and all shards are connected and managed inside the same process

thick gull
#

shard internal sharding

#

what happens

#

find out today on the random thoughts show

finite plover
#

In Discord.js, how do I get a channel's parent? Would have thought it's a parameter of the Channel class but apparently not.

blazing portal
#

welp. thanks for the info tim

drifting wedge
#

how do i get who caused a channel update

#

or role

quartz kindle
#

@blazing portal im not sure but you can try setting the sharding manager in worker mode, maybe it will show correct ram usage that way

#

new Discord.ShardingManager({mode:"worker"});

#

since workers share memory with the parent

misty sigil
#

what are the pros and cons of worker mode

quartz kindle
#

in worker mode, each shard is a worker process instead of a child process

#

worker processes share memory with the parent process and fully depend on it to run

#

child processes on the other hand are independent, each has their own memory and engine

#

if the parent fails, all workers fail, but child processes dont necessarily fail

misty sigil
#

so if i have pm2 on it it's fine

quartz kindle
#

so basically workers are more efficient but more dependent

#

child processes are designed to be independent

#

the operating system can see child processes independently, but it cant see worker processes afaik

blazing portal
#

Thanks very much ๐Ÿ™‚ Indeed when using worker mode it shows the correct ram and cpu usage.

quartz kindle
#

cool

modest smelt
#

how do i set the status of a bot in my code

#

like you know how Luca's status say Watching Discord Bots

#

I want to set my bot's status to: Playing in 'x' number of server

#

servers*

finite plover
#

Which framework?

pale vessel
#

framework already?

modest smelt
#

wdym @finite plover

#

how do i set the status of a bot in my code
like you know how Luca's status say Watching Discord Bots
I want to set my bot's status to: Playing in 'x' number of servers

solemn leaf
#
    let prefix = await db.get(`prefix_${message.guild.id}`)
    if (!prefix === null) prefix = "ch-"

    //let prefixes = JSON.parse(fs.readFileSync("./prefixes.json", "utf-8"))
    //if (!prefixes[message.guild.id]) {
        //prefixes[message.guild.id] = {
            //prefixes: config.prefix
        //};
    //}

    //let prefix = prefixes[message.guild.id].prefixes;
    //let prefix = message.content.substring(0, config.prefix.length);
    //if (prefix != 'ch-') return;
    let messageArray = message.content.split(" ")
    let cmd = messageArray[0]
    let args = messageArray.slice(1);

    let commandfile = bot.commands.get(cmd.slice(prefix.length));
    if (commandfile) commandfile.run(bot, message, args);

Im trying out ways to make a custom prefix but prefix.length is nil

modest smelt
#

@solemn leaf wut language r u using?

solemn leaf
#

i dont know

quartz kindle
#

dont use prefix === null

solemn leaf
#

lets see here

#

what lang has ifs like if(args) {

#

hmmm

#

js

quartz kindle
#

also, you're using !prefix === null which is even worse

#

it will always fail

solemn leaf
#

oh

quartz kindle
#

just do if(!prefix)

#

get rid of the null

modest smelt
#

how do i set the status of a bot in my code
like you know how Luca's status say Watching Discord Bots
I want to set my bot's status to: Playing in 'x' number of servers

#

@quartz kindle ?

quartz kindle
#

setActivity

solemn leaf
#

thanks

#

@modest smelt just run a loop for all the guilds your bot is in

#

and + membercount

grand finch
#

turns out making a poll bot is a lot harder than initially thought haha

#

well probably because I have timers, queues, poll types, and quoted string parsing in it also

modest smelt
#

how do i set it to that

#

i know how to get the number of servers there are

#

but how do i put it as the status?

grand finch
#

status of what

solemn leaf
#

@modest smelt

    let info = 0
    let servercount = 0
    bot.guilds.cache.forEach((guild) => {
        info = info + guild.memberCount
        servercount = servercount + 1
    })
modest smelt
#

@solemn leaf first of all i code in py

grand finch
#

the bots status is it's presence

modest smelt
#

how to put it as the status of the bot?

grand finch
#

Use client.user.setPresence({ activity: { name: ${someVar} } });

#

in node.js that is

#

it will say playing your message

modest smelt
#

how to do that in python?

#

i don't do node.js

grand finch
#

bad luck ๐Ÿ™‚

#

someone else who knows that archaic stuff might be able to help

#

you can also set the activity to a verb you prefer

#
await change_presence(*, activity=None, status=None, afk=False)```
finite plover
#

It's better than Discord.js IMO, I'll help.

solemn leaf
#

is it possible with js to deafen the bot?

finite plover
#

Use py await client.change_presence(activity=discord.Game(name='Hello World'))

misty sigil
#

yea

solemn leaf
#

if so how

restive furnace
obtuse jolt
#

where are discords api server located?

solemn leaf
#

@obtuse jolt if you mean voice
us-central: Chicago, Illinois

us-south: Dallas, Texas

us-east: New York City, New York

eu-central: Frankfurt, Germany
restive furnace
#

russia: russia

#

honk kong: hong kong

slender thistle
#

Russia is probably Moscow if not around random cities

earnest phoenix
#

mongoose is making me go nuts

#

this smol brain can't wrap his head around it

pale vessel
#

use a wrapper

#

funni

obtuse jolt
cinder patio
#

mongoose is already a wrapper tho

pale vessel
#

this smol brain can't wrap his head around it
@earnest phoenix

#

oh yeah

#

it is

earnest phoenix
#

lol

pale vessel
#

well

#

use a wrapper wrapper

cinder patio
#

so if your wrapping your head around a wrapper, I dunno what you can do

earnest phoenix
#

so umm

#

what should i do

pale vessel
#

idk, you never told the problem

earnest phoenix
#

read a biggo tutorial for ten hours

pale vessel
#

yes

earnest phoenix
#

suggest

pale vessel
#

if that makes you understand then so be it

earnest phoenix
#

me always reads adware blogs

#

k

#

they're not npm so they're actually useful

#

npm docs are trash

restive furnace
#

no

obtuse jolt
#

how can i remove ssh keys from ubuntu so it asks for a password and not keys

finite plover
#

You really shouldn't; keys are much more secure.

obtuse jolt
#

i know but they are annoying

finite plover
#

You need to update /etc/sshd_config

earnest phoenix
#

no
@restive furnace they don't have a search button how can it get worse

restive furnace
#

ctrl + f

finite plover
#

Change the variable PasswordAuthentication from no to yes

obtuse jolt
#

anddd my internet crashed when i saw about to save it

#

this is fucking annoying

earnest phoenix
#

So I just started using mongoose and this is my current code:

var mongoose = require("mongoose");
mongoose.connect('mongodb://localhost/test', {useNewUrlParser: true});
 
var db = mongoose.connection;
 
db.on('error', console.error.bind(console, 'connection error:'));
 
db.once('open', function() {
  console.log("Connection Successful!");
});

But when I run it in the repl.it shell it throws this error:
not gonna spend another ten hours trying to find the correct key combination to copy text from the shell so i'll take a screenshot

thick gull
#

Can you even run a local dB on repl.it?

pale vessel
#

yes

#

it's like glitch

earnest phoenix
#

Can you even run a local dB on repl.it?
@thick gull that json.sqlite file i've got is quick.db so

quartz kindle
#

you can use mongodb atlas

#

but im pretty sure you cant run a self hosted mongodb

earnest phoenix
#

wuts atlas

#

googles

quartz kindle
#

mongodb's online service

thick gull
#

iirc

earnest phoenix
#

what the fu

thick gull
#

itโ€™s like 500mb free

#

which is enough for a small discord bot storing strings

earnest phoenix
#

:yay:

thick gull
#

But it Varys

#

youโ€™ll have to see based on how much data you store

earnest phoenix
#

which is enough for a small discord bot storing strings
@thick gull what about a small discord bot storing a lot of objects under a kb in size each

#

my database is 60 kb in size

#

A

thick gull
#

SQLite โ‰  mongo

earnest phoenix
#

that's including all the weird question marks sqlite puts

digital ibex
#

i just use localhost so i dont have to worry about paying anything :p

thick gull
#

I mean I canโ€™t be bothered right now atleast because I donโ€™t have a VPS

digital ibex
#

cant be bothered to do what lol

thick gull
#

setup a proper db on my pc

golden condor
#

someone complaining that mongoose is hard

#

me

#

boi i have a package for that

thick gull
#

callum

#

no

golden condor
#

borboss

thick gull
#

:(

golden condor
#

i am not going to say the name of the package

#

but

#

it exists

#

and if i do say it timo will spank the hell out of me

thick gull
#

wrong link and haha joke

golden condor
#

i think i can say the name

thick gull
#

I tried to type from memory

golden condor
#

because the name does not contain ads

#

abc.db

worthy glacier
#

where can i find docs for the mongodb node js driver I want to figure out how to add,delete and edit individual items in a collection

restive furnace
#

"mongoose docs"

digital ibex
#

ahhhhh

tight plinth
#

so im trying to do a move command for a music bot, basically what i want to do is get the array with the songs and move the song at position args[0] to position args[1] in the array. what is the best method to do that? I tried js const o = serverQueue.songs[msg.args[0]] delete serverQueue.songs[msg.args[0]] serverQueue.songs.splice(msg.args[1], 0, o)but it doesnt work bc o seems to not exist

dull badger
sudden geyser
#

Go to the file you created and check the export

tight plinth
sudden geyser
#

See if you're exporting an object with a help key & value

#

That's just the look for inspecting variables

dull badger
#

@sudden geyser bro. im creating file without any code and BOOM error!

sudden geyser
#

I don't think that would actually mess with it. I see the issue now

tight plinth
#

btw the "move song" thing works

#

just gotta find a way to remove that empty element

sudden geyser
#

@dull badger it's probably just an error you were just not expecting. Show the file you created

thick gull
#

thereโ€™s nothing in the file?

#

then thereโ€™s nothing for it to read???

dull badger
#

fixed duh

digital ibex
#

ur rude

knotty steeple
tight plinth
#

ah

#

k

fringe axle
#

How can I get a file like my index with a discord.js v12 eval?

quartz kindle
#

wat?

fringe axle
#

Like w!eval index.js

#

That I get the file.

quartz kindle
#

you want the contents of the file as text?

fringe axle
#

Yes

quartz kindle
#

use fs.readFileSync

fringe axle
#

I want my whole index as text with an eval command.

#

But how?

quartz kindle
#

w!eval require("fs").readFileSync("./index.js")

fringe axle
#

Thanks

opal plank
#

just be ware of tokens

fringe axle
opal plank
#

if you going to output those files somewhere

fringe axle
#

Thatโ€˜s normal?

quartz kindle
#

readFileSync("./index.js","utf8")

fringe axle
#

Okay

#

Got it, thanks. But my token is always as โ€žSikeโ€œ :^)

earnest phoenix
#

does mongodb store collections as an array of objects

#

how do yoi fetch a collection from a db

#

im not dumb im just new

misty sigil
#

MongoDB or mongoose?

drifting wedge
#

how do i install ffmpeg?

earnest phoenix
#

mongodb

misty sigil
#

And why fetch an entire collection?

earnest phoenix
#

lol

midnight blaze
#

wow mongodb you must be smart then

#

would be too complicated for me...mongoose is so much simpler

misty sigil
#

mongodb isnt hard

thick gull
earnest phoenix
#

wow mongodb you must be smart then
@midnight blaze no it's that mongodb has better docs than mongoose

#

And why fetch an entire collection?
@misty sigil idk why

#

db.db("X").collection("Y");

#

does this return collection Y from database X

misty sigil
#

no

earnest phoenix
#

saw it on an online tutorial

#

the tutorial sux then

misty sigil
#

db.db("X").collection("Y").find({}).toArray() would iirc

earnest phoenix
#

k

fringe axle
#

readFileSync("./index.js","utf8")
@quartz kindle but I get \n and all the + in the file too...

quartz kindle
#

is your eval command using util.inspect?

fringe axle
#

No

#

But itโ€˜s okay

#

I can change all occurrences

earnest phoenix
#

what does a string constant mean

opal plank
#

probably a string that doesnt change

midnight blaze
#

can we read captchas with a Web Scraper ?

cinder patio
#

It's not an easy task

#

if it was, captchas would be meaningless. Why are you asking?

midnight blaze
#

They are? Nowadays serious pages do not use captchas

valid frigate
#

google uses captcha

midnight blaze
#

they use pictures which you have to click

#

they do not use simple captchas with text

earnest phoenix
#

Hi

cinder patio
#

that's still a captcha

valid frigate
#

ok so basically the primary objective of captchas is to keep bots out and they do a pretty good job at it

midnight blaze
#

I am more talking about this, I know, not many webpages use this method anymore

cinder patio
knotty steeple
#

readFileSync("./index.js","utf8")
@quartz kindle or just .toString()

#

๐Ÿง 

quartz kindle
#

yeah but if it has a built-in way why not use it lul

digital ibex
#

thats really smart

#

wow

#

i wonder how they do that, anyone have any idea lul

#

the image text thingy

cinder patio
#

machine learning

digital ibex
#

oh

earnest phoenix
#

How do I show the amount of servers my bot is in as the status?

misty sigil
#

what lib

still merlin
misty sigil
#

<code>

still merlin
#

epic thankyou!

earnest phoenix
#

what lib
Were you talking to me?

shy turret
#
userid = 276497792526974996;
console.log(await client.users.fetch(userid));

returns

{id: '276497792526974996', bot: false, username: 'Two', discriminator: '4828', avatar: '579773f553694a3fa57bb79c66474084'}

but

userid = 276497792526974996;
console.log(await client.users.fetch(userid).username);

is not working..

misty sigil
#

you cant await a part of a promise iirc

cinder patio
#

^ yeah that

#

and also IDs are strings in javascript because they are too big to be a number. I am not sure how you get that result in the first example

misty sigil
#

i'd think (await client.users.fetch(${userid})).username would work

#

idk

shy turret
#

undefined

misty sigil
#

ok so just do

#

const user = await client.users.fetch

#

user.username will work

shy turret
#

i think i found a solution but it's kinda dumb lmao

#

hm let me try that

#

yep it works, thanks

#

i figured i can also put () around the await client.users.fetch()

#

nope nvm

#

oh wait i forgot await lmao

#

how do you async eval()

earnest phoenix
#

`>invite to add me to your server`
^

TypeError: client.guilds.cache.size is not a function

misty sigil
#

try client.guilds.cache.size

#

and not client.guilds.cache.size()

earnest phoenix
#

That's what I have

#

online on ${client.guilds.cache.size} servers!

sudden geyser
#

Can you show us your source code and where the error is originating

earnest phoenix
#

I sent the source bin

sudden geyser
#

ah

#

Are you forgetting your commas to separate each element in the array?

#

Also you don't need to require Client at the top of your file since you aren't making a new instance of it.

misty sigil
#

also

sudden geyser
#

And you should set the time you change the status to something longer.

misty sigil
#

5000 is very close to the ratelimit

sudden geyser
#

Like a minute or two

misty sigil
#

if not at/below the ratelimit

earnest phoenix
#

You're right

misty sigil
#

make it longer

earnest phoenix
#

And what's wrong with 5000?

misty sigil
#

the ratelimits

slender thistle
#

It's only a second over the ratelimit for status changes

misty sigil
#

close

sudden geyser
#

It's very low for what you should reasonably set it to. Although Discord does not have its rate limits clearly defined rate limits are not something you should try to get close to, so I recommend a minute or two.

earnest phoenix
#

Okay I didn't think of that, thanks

#

There are now discord bots in PHP, backend server sided developement turned into discord bot making

faint prism
#

neat

golden condor
#

Discord bots were possible on PHP for a while lol

quartz kindle
#

why do discord libs insist on caching everything

#

damn ram eaters

cobalt spruce
#

does anyone here can help

sudden geyser
#

ask your question pls

quartz kindle
#

yes i can haz help

cobalt spruce
#

``` if (message.content.startsWith(${prefix}lock)){
let args = message.content.substring(prefix.length).split(" ");

  const channels = message.guild.channels.cache.filter(ch => ch.type !== 'category');
  if (args[0] === 'lock') {
      channels.forEach(channel => {
          channel.updateOverwrite(message.guild.roles.everyone, {
              SEND_MESSAGES: false
          }).then(() => {
              channel.setName(channel.name += `๐Ÿ”’`)
          })
      })
      return message.channel.send('locked all channels');
  } else if (args[0] === 'lockoff') {
      channels.forEach(channel => {
          channel.updateOverwrite(message.guild.roles.everyone, {
              SEND_MESSAGES: true
          }).then(() => {
                  channel.setName(channel.name.replace(':lock:', ''))
              }
          )
      })
      return message.channel.send('unlocked all channels')
  }

}```

i have this script works 100% but i dont want it to lock all channels i want it to lock specific channel
Ex: lock #development

quartz kindle
#

instead of channels = ....filter
use channel = .....find

#

and remove the forEach

cobalt spruce
#

what i replace forEach with?

quartz kindle
#

nothing

#

forEach is for looping over many channels

#

if you want just one channel there is no need for looping

#

just updateOverwrite on the channel directly

cobalt spruce
#
     if (message.content.startsWith(`${prefix}lock`)){
      let args = message.content.substring(prefix.length).split(" ");

      const filter = message.guild.channels.cache.find(ch => ch.type !== 'category');
      if (args[0] === 'lock') {
        filter(channel => {
              channel.updateOverwrite(message.guild.roles.everyone, {
                  SEND_MESSAGES: false
              }).then(() => {
                  channel.setName(channel.name += `๐Ÿ”’`)
              })
          })
          return message.channel.send('locked all channels');
      } else if (args[0] === 'lockoff') {
          channels.forEach(channel => {
              channel.updateOverwrite(message.guild.roles.everyone, {
                  SEND_MESSAGES: true
              }).then(() => {
                      channel.setName(channel.name.replace('๐Ÿ”’', ''))
                  }
              )
          })
          return message.channel.send('unlocked all channels')
      }
}```
#

now?

#

am dum

quartz kindle
#

google how .find works

#

also, you need to use args to know which channel you want

#

or even easier, use channel mentions

#

channel = message.mentions.channels.first()
channel.updateOverwrite(...)

cobalt spruce
#

that is the probelm

#

YES

#

am dum

#

i dont understand

copper cradle
#

then probably sit back and read your code, figure out what everything does, learn a bit more about the language and the library you're using and then finish your project

cobalt spruce
#
    if (message.content.startsWith(`${prefix}lock`)){
      let args = message.content.substring(prefix.length).split(" ");
      channel = message.mentions.channels.first()
      if(!channel[1]) return message.channel.send('Please include a name for the channel after the command')
    
      const filter = message.guild.channels.cache.find(ch => ch.type !== 'category');
      if (args[0] === 'lock') {
        filter(channel => {
              channel.updateOverwrite(message.guild.roles.everyone, {
                  SEND_MESSAGES: false
              }).then(() => {
                  channel.setName(channel.name += `๐Ÿ”’`)
              })
          })
          return message.channel.send('locked all channels');
      } else if (args[0] === 'lockoff') {
        filter(channel => {
              channel.updateOverwrite(message.guild.roles.everyone, {
                  SEND_MESSAGES: true
              }).then(() => {
                      channel.setName(channel.name.replace('๐Ÿ”’', ''))
                  }
              )
          })
          return message.channel.send('unlocked all channels')
      }
}```

@quartz kindle some progress?
quartz kindle
#

dont forget the let

misty sigil
#

no need for channel[1]

#

just channel

quartz kindle
#

^

#

no need for filter either

#

and filter is not a standalone function

cobalt spruce
#

what i should replace with?

quartz kindle
#

remove it

cobalt spruce
#

like anything

#

just remove it

#

?

quartz kindle
#

yes

cobalt spruce
#

``` if (message.content.startsWith(${prefix}lock)){
let args = message.content.substring(prefix.length).split(" ");
channel = message.mentions.channels.first()
if(!channel) return message.channel.send('Please include a name for the channel after the command')

  const filter = message.guild.channels.cache.find(ch => ch.type !== 'category');
  if (args[0] === 'lock') {
    filter(channel => {
          channel.updateOverwrite(message.guild.roles.everyone, {
              SEND_MESSAGES: false
          }).then(() => {
              channel.setName(channel.name += `๐Ÿ”’`)
          })
      })
      return message.channel.send('locked all channels');
  } else if (args[0] === 'lockoff') {
    filter(channel => {
          channel.updateOverwrite(message.guild.roles.everyone, {
              SEND_MESSAGES: true
          }).then(() => {
                  channel.setName(channel.name.replace('๐Ÿ”’', ''))
              }
          )
      })
      return message.channel.send('unlocked all channels')
  }

}

#

hmm

quartz kindle
#

i said to remove filter lol

cobalt spruce
#

const filter

#

?

#

or

#

the other one?

earnest phoenix
#

OOF

cobalt spruce
#

filter(channel => {
const filter

#

?

quartz kindle
misty sigil
#

lmoa

cobalt spruce
#

@quartz kindle am dumb

#

it worked

#

but it dont add the name

#

๐Ÿ”’

#

idk why

quartz kindle
#

when was the last time you changed the name?

#

channel names can only be changed 2 times every 10 minutes

cobalt spruce
#

ok

#

so

#

idc

#

about the name

#

Tim thank you very much i dont know i was going to do without u

#

my brother know about this things but he is watching ANIME

#

so i cant

#

lol

drifting wedge
#

for a message delete event

#

what should i pass?

#

i want to get the person who deleted the message, the message, and who wrote it

small ivy
#

umm need help with smthing if anyone could help it would be awsome

#

so I am trying to ad a background to my bot page

#
 
  
  <body style="background-image:url('https://imgur.com/XI6CMFz');">

   </body>```
#

but it not work

sudden geyser
#

@drifting wedge you're looking for the on_message_delete event (discord.py you're using I think). You already have the message as the first parameter is the message that was deleted if it's in the cache. If you need every deleted message, use the on_raw_message_delete event instead.

If you want who deleted the message, you'll probably need to look in the audit logs. You can get the author of the message message.author I think.

drifting wedge
#

whats this error "raise HTTPException(r, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embed.fields.0.name: Must be 256 or fewer in length."

earnest phoenix
#

how can i distinguish between a member and a bot.
example this bot: ${message.guild.members.cache.filter(m => m.user.bot).size}

#

what should i do for just the member

misty sigil
#

message.guild.members.cache.filter(m => !m.user.bot).size possibly

sudden geyser
#

@drifting wedge the embed name field must be 256 or fewer in length

earnest phoenix
#

thx

#

its working.

quartz kindle
#

daily reminder the above method only counts online members/bots

#

just in case you wonder why you get inaccurate numbers

misty sigil
#

^ unless you fetched them all

digital ibex
#

wouldnโ€™t it return an array lol

#

not object

quartz kindle
#

collection.filter returns a collection

digital ibex
#

so, wouldnโ€™t it be .length ?

quartz kindle
#

collection extends Map

#

Map uses size

dreamy thistle
#

can i use 1 single webhook to multiple things?

misty sigil
#

yes

dreamy thistle
#

okay thats quite ussefull

#

ty

misty sigil
#

depends what webhook you mean actually

digital ibex
#

oh

drifting wedge
#

something really f'ed up my atom

#

its like check marks

#

i really have no idea wtf is going on

unreal tapir
#

Code where I put in 'ping' and message.channel.send('Pong!')
with the prefix ?
Anyone know how to fix this?

#

the client login is blurred out by the way

torn ravine
#

Explain it better?

drifting wedge
#

Explain it better?
@torn ravine me:

#

its like instead of running the code

#

it shows like a green check mark

#

and the code doesnt run

unreal tapir
#

if(command === 'ping'){
message.channel.send('Pong!');
} else if (command == 'youtube'){
message.channel.send(command with a link)
}
});

quartz kindle
#

we still down understand what you want

#

your code is already using the prefix

unreal tapir
#

it to work

quartz kindle
#

it should work?

unreal tapir
torn ravine
#

did you run your program?

unreal tapir
#

says its online

torn ravine
#

try changing command to message.content

quartz kindle
#

the code looks correct tho

torn ravine
#

so js const command = message.content

#

you really think so tim?

#

also you should use a switch before you add more commands

quartz kindle
#

add console.log(command) before the if(command)

#

then show what your console says

opal plank
#

Finally managed to create my own cache with refresh

#

now to add getters

marsh glen
#
if (message.content == `${prefix}youtube `) { 
return message.channel.send("your_txt") 
} 
``` @unreal tapir
unreal tapir
#

oh

#

thanks

torn ravine
#

or you can change what you defined command as to message.content

sudden chasm
#

    fs.writeFile('file.txt', variable.1, (err) => {
        if (err) throw err;
        console.log('Sub count saved.');
    });```
I used this, but somehow it doesnt work, any help?
unreal tapir
#

wtaf what am i doing wrong

misty sigil
#

what do you wanna do with the text file

sudden chasm
#

everything else works, variable.1 is fine

#

just save a number to it

misty sigil
#

why not store it as variable.1 then

sudden chasm
#

lol- wait oh hi matthew

#

just recognized ur pfp LOL

#

and yeah

#

ur right

unreal tapir
wooden ember
#

Help :KEKW:
same lol

torn ravine
#

@unreal tapir change what you defined command as to message.content

unreal tapir
#

confused

torn ravine
#

const command = message.content

unreal tapir
#

o

#

ok

earnest phoenix
#

Wait what

#

Yo wtf

torn ravine
#

what?

unreal tapir
#

ok so im new to this and all but how do i push an update

#

just node . right

torn ravine
#

by restarting the bot

misty sigil
#

by putting the files on the hosting

#

then you restart the bot

#

then the bot comes online

unreal tapir
#

explain

misty sigil
#

do you not have hosting?

unreal tapir
#

no

torn ravine
#

I highly suggest it

unreal tapir
#

ill go to botghost

misty sigil
torn ravine
#

oh

#

no

#

what did we do?

unreal tapir
#

ok on botghost and now what

#

i put in the info

torn ravine
#

botghost isn't hosting

unreal tapir
#

oh

#

what is then

misty sigil
#

botghost is just a great way to leak your token imo

torn ravine
#

where do they even store your token

unreal tapir
#

idk

misty sigil
#

where do they even store your token
@torn ravine in a sql injectable database

still merlin
#

probably in a json database mmulu

torn ravine
#

HAHAHHHHAhAHHAhaHahAHHA

opal plank
#

how do you not know where u store ur token

torn ravine
#

if you think I'm trusting them with one of my important tokens

#

you're wrong

opal plank
#

also im feeling so left out, everyone nitro boosting

misty sigil
#

bcuz theres no time for security when you've gotta run wix for bots

torn ravine
#

my nitro expires today Crying

unreal tapir
#

oof

misty sigil
#

cry goodbye nerd

unreal tapir
#

it just expired