#development

1 messages Β· Page 870 of 1

earnest phoenix
#

ill try

#

i used parseInt(bet) and it didnt work

#

will it work on args[1]

#

?

#

they are the same thing

quartz kindle
#

parseInt means parse integer

#

it converts whatever you give it to an integer

earnest phoenix
#

so why didnt bet work and args[1] will ?

quartz kindle
#

it wont work if you give it NaN

#

if parseInt gives you NaN, whatever you gave it is not a valid number

earnest phoenix
#

i mistyped it
its args[0]
but it wouldnt work

quartz kindle
#

but if you use parseInt, it defeats the pupose of using isInteger, as any valid number will be converted to an integer, therefore it will always say that it is an integer, even if its not

earnest phoenix
#

oh

quartz kindle
#

the proper way to convert a string into a number is Number(string)

earnest phoenix
#

isNumber(args[0])?

quartz kindle
#

no

earnest phoenix
#

oh

#

Number(args[0])

quartz kindle
#

yes

#

that will give you either a number, or NaN

earnest phoenix
#

can i use Number(bet) then ?

quartz kindle
#

what is bet?

earnest phoenix
#

args[1]

#

so it will work

quartz kindle
#

is it a number?

earnest phoenix
#

oh wait

#

lmao

#

its args[0]
and it is

quartz kindle
#

then yes

earnest phoenix
#

i used 100

#

but it would still return t

#
if(Number.isInteger(Number(bet))) return message.channel.send("T")```
#

am i doing it wrong?

quartz kindle
#

100 is an integer

#

if its an integer, return T

earnest phoenix
#

oh
i wanted it if its NOT an integer

#

i translated it

quartz kindle
#

then add !

earnest phoenix
#

alright

#

Thanks Tim!
Again lmao

#

i feel like if it takes more then 2 weeks its easy accept

#

wrong chat

golden condor
#
exports.run = async(client, guild) => {
    console.log(
        `New guild joined: ${guild.name} (id: ${guild.id}). This guild has ${guild.memberCount} members!`
      );
      let value = 0;
      await client.guilds.cache.forEach(g => value += g.memberCount)
      client.user.setPresence({ activity: { name: `c!help | ${client.guilds.cache.size} servers | ${value.toLocaleString()} users` }, status: 'dnd' })
      const cnl = client.channels.cache.get("672484520175599636");
      const embed = new Discord.MessageEmbed()
        .setAuthor(`New Server Joined!`)
        .addField("Server name ", `${guild.name}`)
        .addField(`Member Count`, `${guild.memberCount}`)
        .addField(`Server ID`, `${guild.id}`)
        .setThumbnail(guild.iconURL())
        .setColor("#00aaff");
    
      cnl.send({ embed });
}``` Why won't this code work when a server joins, it shows no errors
quartz kindle
#

does the console.log not show either?

golden condor
#

It console.logs

#

But doesn't send the message

#

and it changes the status

quartz kindle
#

you dont need to await forEach, its not a promise
console.log(cnl) to see if the channel exists
cnl.send().catch(console.log) to see if there is any error when sending the message

warm marsh
#

You could always use fetch in the case that it's not cached

quartz kindle
#

guilds and channels should always be cached by default

warm marsh
#

All channels?

quartz kindle
#

yes

#

except DM channels

warm marsh
#

Guess that's one reason for high ram usage? Constantly cached channels.

quartz kindle
#

yup

warm marsh
#

djs is such a joke tbf

quartz kindle
#

well, its a general purpose library

#

it needs the caching for all its features to work

#

but its not suitable for very large bots

#

large bots should either create their own custom library for their specific needs, or modify discord.js for their specific needs

warm marsh
#

Yeah or just don't use js.

mossy vine
#

my bot is barely in 700 servers and im leaning very close to writing my own library

quartz kindle
#

i went with the second option

#

i didnt wanna deal with websockets myself lul

dusky marsh
#

Ive been in the process of migrating my bot to rust and its way more performant memory wise

quartz kindle
#

i heard good things about rust

#

but icba learning it at this point

#

especially because i dont wanna have to learn a whole other graphics engine, too used to canvas

warm marsh
#

Just setup some sort of API and use Canvas like that?

lyric mountain
#

java has something akin to canvas

quartz kindle
#

and waste network requests

lyric mountain
#

which is graphics2d

quartz kindle
#

every time i looked into java it just seemed so weird lmao

dusky marsh
#

rust can probably interface with canvas through wasm stuff

lyric mountain
#

it's not, it's actually a cute little puppy who wants to play

warm marsh
#

What's your thoughts on Dart? I'm still trying to pick a language.

lyric mountain
#

depending on how you develop it'll either become a savage bloodthirsty hellhound or a cute chubby doggo

dusky marsh
#

dart is okay afaik, ive used it a tad with the flutter library

warm marsh
#

I used it a small amount, It compiles to JS iirc

lyric mountain
#

also, tim, you can use js in java too

dusky marsh
#

practically everything compiles to js nowadays

warm marsh
#

Most languages can be used in Java due to embedding.

lyric mountain
#

yep

quartz kindle
#

yeah i looked into stuff like vert.x and es4x

warm marsh
#

I might give JDA a try.

lyric mountain
#

jda is almost perfect, just lacks proper wiki

#

but the javadocs are pretty well explained

surreal notch
#

How to solve this error

warm marsh
#

description takes a string

hollow saddle
#

.setDescription doesn't have an options object

warm marsh
#

Also that's not how objects are defined.

#

{ key: value }

surreal notch
#

var embed = new discord.MessageEmbed().setColor("BLUE").setTitle("Your Random Number Is...").setDescription({"answer"})

#

Please correct it and send

dusky marsh
#

They told you whats wrong, fix it yourself

#
surreal notch
#

i am not a that much big coder

earnest phoenix
#

I can't find the oauth2 discord api invite link

warm marsh
#

Then learn to code.

earnest phoenix
#

I tried

#

but don't work

finite bough
#

@surreal notch what are u trying to do

surreal notch
#

i am trying to learn

finite bough
#

no like

#

is answer defined?

surreal notch
#

Can't understand

warm marsh
#

It'll never work like that.

#

setDescription("messagecontenthere")

surreal notch
#

ohk sorry

warm marsh
#

without the braces

surreal notch
#

But then these 2 errors came out

warm marsh
#

Read the red dot and fix it.

#

Probably missing a )

surreal notch
#

ok lemme try

earnest phoenix
#

we need a bill wurtz version of have you tried reading your error

surreal notch
warm marsh
#

Then learn to code first.

finite bough
#

can u copy paste ur code

surreal notch
#

here?

warm marsh
#

He'll not learn from copy and paste.

finite bough
#

yes

#

here

earnest phoenix
#

no

surreal notch
#

ohk wait

earnest phoenix
#

you're cluttering the chat when you paste blocks of code here

finite bough
surreal notch
finite bough
#

i am lazy πŸ‘€

earnest phoenix
finite bough
#

ok so you dont know what defining a value means right?

surreal notch
#

yup

earnest phoenix
#

try this

finite bough
#

defining means when a word(string) is given a value

#

like
let date = 14-april-2020

green kestrel
#

We aren’t spoon feeding are we?

finite bough
#

here date is defined

surreal notch
#

ohkk

restive furnace
#

no no and no.

finite bough
#

here you have defined embed

summer torrent
restive furnace
#

it can be integer, and all strings require " before and after, it can be object and anything else too.

#

(what you have been made, example a class, like Discord.Client on discord.js, or embed for example)

finite bough
#

and?

surreal notch
#

but even now i couldn't find my errorGWbruhSquidWoke

restive furnace
#

whats the error?

surreal notch
#

coz i am a nub in coding

finite bough
#

you havent defined message

#

like

#

i defined date

restive furnace
#

@surreal notch ctrl + c and ctrl + v?

surreal notch
#

if (message.content.startsWith(`${prefix}randomnumber`)) { var numbers = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]; var answer = numbers[Math.floor(Math.random()*numbers.length)]; var embed = new discord.MessageEmbed().setColor("BLUE").setTitle("Your Random Number Is...").setDescription("messagecontenthere") message.channel.send({embed: embed}) })

finite bough
#

yea here

restive furnace
#

you havent defined message, so i think this is ctrl + v

finite bough
#

u see message.content?

surreal notch
#

yes

#

.setDescription("messagecontenthere")

#

this one?

finite bough
#

no

#

after if

#

in the 1st line

surreal notch
#

ohh yes

restive furnace
finite bough
#

that means it checks if a message's text has the stuff you asked for

restive furnace
#

i dont recommend using startsWith, use messageContent is "somestring", instesd of messageContent#startsWith.

finite bough
#

and why dont you?

restive furnace
#

well...

#

theres many reasons

finite bough
#

if i am helping someone to use dyno bot

#

and i said to ban someone use !ban @finite bough

#

according to you

#

it will trigger it

restive furnace
#

dyno prefix is ? by the way :)

finite bough
#

customizable :)

surreal notch
#

So what should exactly i have to do now

#

@finite bough

finite bough
#

1st lets start off with the basics

surreal notch
#

dm?

finite bough
#

hmm sure

valid holly
#

I think no but thought of asking, can slowmode be relative to a member's role ?

lyric mountain
#

no

#

the only difference is that roles with MANAGE_CHANNEL or MESSAGE_MANAGE can bypass it completely

finite bough
#

^

valid holly
#

I wouldn't entrust a normal member with that much power tbh.

lyric mountain
#

what you can do is have a different channel for certain roles

valid holly
#

Thanks o/

earnest phoenix
#

how to move a client from his id ?

lyric mountain
#

you what?

valid holly
#

move ?

earnest phoenix
#

yeah

#

change his voicechannel

lyric mountain
#

you can change the bot's connected channel

valid holly
#

Well check for bool if voice connection then move ?

lyric mountain
#

not an user's

earnest phoenix
#

u can move a user.

#

bot can do almost everything users can

valid holly
#

Not anymore ?

lyric mountain
#

ah, yeah, forgot users can be moved too

earnest phoenix
#

anyway couldnt finde a great way

#

to move a user from the user id in a channel id

#

in which lib

#

discordjs v12

#

it took me less than 20 seconds to find this

#

couldnt fine it

#

"edit"

#

was cherching move or channel move

#

so like

gray pagoda
#

What if I want to have a value for use.api and another for use.api.github?

earnest phoenix
#

guild.members.get(ID).edit(channel , channelid)

#

gotta try

#

yaxeldragon, what

gray pagoda
#

What if I want to have a value for use.api and another for use.api.github?

My Code

const use = {
  api: function(req){ ... }
}
earnest phoenix
#

that's not how declarations work

#

you can't

gray pagoda
#

ok

earnest phoenix
#

you already defined api as a function

gray pagoda
#

what if I want to have an api and then an api.github

#

can't?

earnest phoenix
#

make api an object

#

and contain your functions inside of that object

gray pagoda
#

ok

#

thx

quartz kindle
#

you can make a getter

#

but getters in objects have bad performance last time i checked

earnest phoenix
#

If i shard my existing bot, can I distribute servers already allocated to my bot or can I only distribute future servers?

#

you don't control which servers are distributed to what shard

#

oh wait

#

servers as in machines?

#

or discord guilds

#

As guilds

#

yeah you don't control that

#

(node:5260) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
DICT_TYPE_CONVERT: Only dictionaries may be used in a DictType

#

why are you passing in a string

#

what

#

did you even take a look at the docs

#

I did lol

topaz fjord
#

holy shit that code

earnest phoenix
#

Else i won't be able to get the edit("channel"

#

i tried without and got an error

quartz kindle
#

is it that hard to read this?

earnest phoenix
#

i used that

#

thx and what ?

quartz kindle
#

GuildMemberEditData is an object

#

do you know what is an object?

earnest phoenix
#

it require proprieties

topaz fjord
#

Tim is an object

quartz kindle
#

no i am a class

#

lmao

topaz fjord
#

no

#

const tim = new Tim()

#

you're now an object

earnest phoenix
#

But will sharding only affect future guild or does it shard current guilds too? If i have a bot with 100 guilds and shard it into 100 bots will each bot serve 1 guild or will I have 99 bots without a guild??

topaz fjord
#

you won't

quartz kindle
#

@earnest phoenix this is a string js "channel" and this is an object: js {"a":"something"}

earnest phoenix
#

oh ok i just understnad

#

{"channel" "id"}

topaz fjord
#

@earnest phoenix what?

quartz kindle
#

@earnest phoenix sharding splits all your servers into shards

#

if you have 1 shard with 100 servers, when you change to 2 shards, your bot will restart and get approx 50 servers on each shard, according to the formula posted by cry

topaz fjord
#

the formulas on the discord docs

earnest phoenix
#

And each shard means I would host an instance of the bot on separate servers right?

#

you don't have to

quartz kindle
#

yes, each instance of the bot will handle an X number of servers

earnest phoenix
#

only huge bots like mee6, rythm and dyno do that

topaz fjord
#

you don't need a separate server for each shard

#

the big boys do

earnest phoenix
#

Oh that was just an example

#

That's normal

topaz fjord
#

what

earnest phoenix
#

cuz my code is

#
if (oldState.channelID !== newState.channelID) {

client.guilds.cache.get("688151170971336735").members.cache.get(newState.id).edit({"channel" : oldState.channelID})
}    
}
#

So its always moving me

#

πŸ˜‚

quartz kindle
#

you're always moving it to the old state

#

whenever it moves

earnest phoenix
#

I know

#

and old state is the channel i just got moved

topaz fjord
#

so you're just going back and forth

earnest phoenix
#

huh how can i fix that πŸ€”

#

Yes

#

In loop πŸ˜‚

topaz fjord
#

you don't do it in the event?

earnest phoenix
#

i do

#

 client.on('voiceStateUpdate', (oldState, newState) =>  {
if (newState.id == "425328259056664596" ) {
if (newState.serverMute == true) {newState.setMute(false) } 
if (newState.serverDeaf == true) {newState.setDeaf(false) } 
if (antimove == true) {
if (oldState.channelID !== newState.channelID) {

client.guilds.cache.get("688151170971336735").members.cache.get(newState.id).edit({"channel" : oldState.channelID})
}    
}
}})
quartz kindle
#

if you want make it always move back to the same channel, instead of comparing oldState and newState, compare if newState !== channelID you want

topaz fjord
#

or just check if they're in the right channel and if they are don't do it

earnest phoenix
#

you should also ensure that the change that happened is actually a switch between voice channels

#

@quartz kindle i don't understant

quartz kindle
#

do you want it to always be moved back to the same channel?

earnest phoenix
#

yeah

#

i don't want to be moved

#

and if im moved from my channel i just get moved back

quartz kindle
#

then if newState.channel exists, and newState.channel NOT EQUAL TO channelID you want

#

move to channelID you want

#

do you understand?

earnest phoenix
#

lmao im kinda lost hold on haha

#

No i don't really xD

quartz kindle
#

you are comparing oldState.channel to newState.channel

topaz fjord
#

petition to make tim write all comparisons in words

quartz kindle
#

instead of that

topaz fjord
#

in all caps

quartz kindle
#

compare newState.channel to a fixed channel ID

earnest phoenix
#

The fixed channel ID is the one im in

quartz kindle
#

is the one where you want your bot to stay

earnest phoenix
#

No

#

My bot is not involved

#

Like i join

#

i just type "!"

#

And then if im moved

#

just get moved back

quartz kindle
#

what

earnest phoenix
#

i join a channel

quartz kindle
#

oh you want to move people to where your bot is

#

not move the bot

earnest phoenix
#

No πŸ˜‚

#

type "!" will enable anti move for me

#

If then i gve moved anywhere

#

the bot will move me back to the voicechannel where i tiped the "!"

quartz kindle
#

then thats a whole different story lol

#

for starters you need to track states

#

save the state for each user, if they are fixed or not

#

and if you want to keep the setting saved between bot restarts, you need a database

earnest phoenix
#

Nt between bots

#

Its just for me

#

as im the bot owner

quartz kindle
#

yes but

#

if you do ! and save it in a variable

#

when your bot restarts, that information will be lost

#

and the bot will forget you ever used !

earnest phoenix
#

That's not a problem

#

cuz the bot won't restart

#

and i wil change frequently channels

#

how are you so sure

quartz kindle
#

lol ok

#

then you need to save that status in a variable

earnest phoenix
#

Cuz its just a protection to avoid toxicity

#

Its like when we are in conflicts

#

idiots move other people

#

so i want to lock myself

#

to not get moved by other idiots

quartz kindle
#

lmao

#

anyway

earnest phoenix
#

yeah this is stupid

#

πŸ˜‚

quartz kindle
#

you need to save that you used !

#

in a variable

earnest phoenix
#

alright so i need to get my client actual channel it

quartz kindle
#

when you type !

earnest phoenix
#

when he type "!"

#

Yes

#

exactly

quartz kindle
#

you need to get that information in your message event

#

and save it somewhere

earnest phoenix
#

Yeah can just create a string

#

0 = no channel id

#

else channel id

#

ez

quartz kindle
#

yes

#

but you need to save it somewhere that will be accessible

#

for example, a global variable

#

or attached to client

earnest phoenix
#

yeah a global var

#

Literaly doing that

#

works πŸ˜‚

#

don't ask

#

what it that

#

lol

quartz kindle
#

then once you set the that, in your voiceState event you can check for that

earnest phoenix
#

yeah

#

alright brb checking discordjs doc to get user voicechannel

quartz kindle
#

if(globalvariablechannelid && newState.channelID !== globalvariablechannelid) {
move channel
}

earnest phoenix
#

yeah

#

Bruh im trying to find the actual user channel id

#

Am i suposed to use that ? πŸ€”

quartz kindle
#

no

#

what do you want to do?

#

get the voice channel id that you are in?

earnest phoenix
#

yes

quartz kindle
earnest phoenix
#

alright

quartz kindle
#

or member.voice.channelID

#

author is not a member

#

author is a user

#

user and member are different things

earnest phoenix
#

message.member

quartz kindle
#

yes

reef summit
#

Payment = discord nitro

nocturne dagger
#

I dont think thats the place for this.

reef summit
#

Where then

lyric mountain
#

nowhere

earnest phoenix
#

how can i make a number integer

#

1

lyric mountain
#

remove decimals

reef summit
#

Wtf

earnest phoenix
#

?

reef summit
#

Where can i ask for development

earnest phoenix
#

here?

finite bough
#

here

earnest phoenix
#

with discord bots

#

im confused

lyric mountain
#

but ask specifically for bot development

reef summit
#

Wtf

lyric mountain
#

instead of "Payment = discord nitro"

nocturne dagger
earnest phoenix
#

umm can we get back to my problem/

#

it's a help channel not a hiring channel lol

lyric mountain
#

umm can we get back to my problem/
@earnest phoenix remove decimals

earnest phoenix
#

itay, string manipulation

slender thistle
earnest phoenix
#

how @earnest phoenix

#

search it up

reef summit
#

I’m looking for someone that could make a bot for me

#

Thats it

lyric mountain
#

Math.round(somenumber)

earnest phoenix
#

it isnt one thing lol

reef summit
#

Where do i sent my messages

earnest phoenix
#

then it isnt here

nocturne dagger
#

not this server

reef summit
#

Wtf

nocturne dagger
#

please stop asking I already answered that

earnest phoenix
#

stop saying that when we try to tell you what goes on here

reef summit
#

Sorry my english is not soo good

finite bough
#

@reef summit no one will make a bot for u for free atleast but if u want there are many people willing to make a bot for u for a decent money

slender thistle
#

-needdev @reef summit

gilded plankBOT
#

@reef summit

DBL is not a place to find developers for jobs. You can try and put a request on Fiverr or Freelancer. Please do not post the request again. Doing so may result in punishment.

reef summit
#

Tf

#

Like a month ago, someone helped me here

nocturne dagger
#

Helped not did

earnest phoenix
#

helped or got hired?

finite bough
#

those kind of people are rare to find

slender thistle
#

This channel is for help, not freelance requests.

turbid bough
#

id help, but i wouldnt make a bot for you

reef summit
#

No he was making a bot for me

earnest phoenix
#

lmao?

reef summit
#

I’m paying discord nitro

turbid bough
#

im also paying discord nitro

#

so what

reef summit
#

I’m not talking to u

#

Lmfao

earnest phoenix
#

.=.

slender thistle
earnest phoenix
#

^

#

Alright umm
Thanks it worked

#

Math.round btw

earnest phoenix
#

I have a coin system and I want to make a command to reset the economy
I tried using coins.delete(message.guild.id) and some other stuff but it doesn't seem to be working

gritty bolt
#

I keep getting the error TypeError: this.remit is not a function and Its coming from my message collector. Has anyone seen this before/knows how to fix it?

earnest phoenix
#

can you send your collector and filter?

#

or what u got there

plucky heart
#
        .addField("**SUGGESTION**", `${suggestmessage}`)
        .setFooter(`Suggestion By ${message.author.tag}`)
        .setTimestamp()
    suggestchannel.send({
        embed
    }).then(msg => {
        msg.react('βœ…').then(r => msg.react('❎'))
    });

Why not working?

earnest phoenix
#

what error are you getting ?

plucky heart
#

(node:5419) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Emoji

earnest phoenix
#

unknown emoji?
this seems correct

#

what is the r => for ?

#

just use msg.react

plucky heart
#

No, it's still the same

earnest phoenix
#

well this is weird

quartz kindle
#

that means the emoji is wrong

earnest phoenix
#

yeah but these seem part of discord emojis?

plucky heart
#

βœ… and ❎

earnest phoenix
#

yeah

plucky heart
#

i used unicode emoji

quartz kindle
#

make sure you're using the right version of it, there might be multiple versions

plucky heart
#

'\βœ… '

earnest phoenix
#

\βœ…

plucky heart
#

i used this

quartz kindle
#

try this one 'βœ“'

earnest phoenix
#

but this is the mini version of the emoji he is looking for
\βœ…

#

he used it correctly

#

i dont see whats the problem

quartz kindle
#

i dont see whats the problem either, but errors dont lie so...

#

Β―_(ツ)_/Β―

plucky heart
#

it's still the same

earnest phoenix
#

well
christmasthink

quartz kindle
#

try only one emoji at a time, to see if one of them works

earnest phoenix
#

^ was going to suggest

plucky heart
#

it's still the same

#

so..

earnest phoenix
#

what are you hosting your bot on?

plucky heart
#

Google Cloud

quartz kindle
#

none of them work?

#

you tried them both separately?

earnest phoenix
#

@gritty bolt ?

gritty bolt
#

you asked me to send the code

#

a few mins ago

earnest phoenix
#

oh alright

gritty bolt
#

I keep getting the error TypeError: this.remit is not a function and Its coming from my message collector. Has anyone seen this before/knows how to fix it?
@gritty bolt

earnest phoenix
#

what line is it coming from?

plucky heart
#

Yes, I tried both separately

gritty bolt
#

it doesnt say

#

MessageCollector.handleCollect (C:\Users\myname\Desktop\PlutoBot\node_modules\discord.js\src\structures\interfaces\Collector.js:100:12)

earnest phoenix
#

ive never seen this error before

gritty bolt
#

me neither so i really dont know

quartz kindle
#

that makes no sense

summer torrent
#

what is your node.js and discord.js version

quartz kindle
#

there is no this.remit in the whole discord.js library

#

not even in past versions

earnest phoenix
#

lmao
unknown error

quartz kindle
#

its supposed to be this.emit

#

not this.remit

gritty bolt
#

why in the world then is it this.remit

#

im using the latest stable on everything

earnest phoenix
#

again, confused

quartz kindle
#

do you have .handleCollect anywhere in your code?

gritty bolt
#

no

quartz kindle
#

can you open the file C:\Users\myname\Desktop\PlutoBot\node_modules\discord.js\src\structures\interfaces\Collector.js

gritty bolt
#

i've opened it

quartz kindle
#

show line 100

plucky heart
#

emoji doesn't work in my code :v

gritty bolt
#

this.remit('collect', ...args);

#

im assuming this should be emit?

quartz kindle
#

yes

gritty bolt
#

how did that happen

quartz kindle
#

no idea

gritty bolt
#

i havent touched that file

quartz kindle
#

reinstall discord.js

earnest phoenix
#

So i have my bot that's called @royal knoll and i would like to ask why it isn't responding anymore...
It was responding yesterday and today it isn't responding at all...

finite bough
#

is everything ok?

#

like console loggings

earnest phoenix
#

Yea...

finite bough
#

bot status

earnest phoenix
#

It's online

#

But not responding

finite bough
#

is it this server only or all the servers

earnest phoenix
#

All servers

finite bough
#

did u update ur discord.js version?

earnest phoenix
#

Yup

finite bough
#

like yesterday

earnest phoenix
#

No

#

But it's discord.js 12.1.1

finite bough
#

doesnt rlly matter

quartz kindle
#

do you have an eval command?

earnest phoenix
#

Yes

quartz kindle
#

do you have sharding?

earnest phoenix
#

No

quartz kindle
#

try evaling client.ws.shards.first()

earnest phoenix
#

Hmm lemme see if even the bot responds

quartz kindle
#

oh yeah nvm lol

#

if it doesnt respond to that, there is nothing you can do besides restarting it

earnest phoenix
#

Oh lol

quartz kindle
#

it might be on a dead connection

grizzled raven
#

do the djs peer dependencies have an effect in performance

earnest phoenix
#

I restarted it 2 times... It didn't work

grizzled raven
#

say in keeping websocket connections

quartz kindle
#

yes

#

idk about keeping them

#

but they help with cpu usage when processing packets

earnest phoenix
#

And if you're wondering if my bot is ratelimited... It's not ratelimited

quartz kindle
#

if you already restarted and it still doesnt work, then its not a dead connection

#

does the ready event work?

earnest phoenix
#

Yup

#

My bot is running slowly and its in 85 servers but when i use a new bot token and run the same code using a different bot is runs faster. Any reason why this happens?

quartz kindle
#

do ```js
client.on("raw", r => {
if(r.t === "MESSAGE_CREATE") { console.log(r.d) }
})

earnest phoenix
#

Hmm lemme try that

quartz kindle
#

@earnest phoenix which language and library?

earnest phoenix
#

discord.js

#

javascript

quartz kindle
#

node.js version and discord.js version?

finite bough
#

dank

#

are u using glitch

earnest phoenix
#
"discord.js": "^12.1.1",
quartz kindle
#

ping 18k lmfao

earnest phoenix
#

Lol

quartz kindle
#

your connection is dying

finite bough
#

ok it's not glitch then

#

glitch's ping is awesome

earnest phoenix
#

@quartz kindle i think it's 100% because of my internet connection being SUCCY

#
Welcome to Node.js v12.13.0.
finite bough
#

wait

#

it's a self host?

earnest phoenix
#

@finite bough you talking to me lol?

finite bough
#

@earnest phoenix wdym different bot

#

@earnest phoenixyes

earnest phoenix
#

@finite bough yea it's self-hosting

quartz kindle
#

and discord.js version?

earnest phoenix
#

ok so i have 1 bot thats in 85 servers and then i made another bot thats in 1 server i took the code from the one in the 85 servers and put it in the bot in 1 server and ran it

#

WHEN INTERNET CONNECTION BECOMES SUCCY...

#
"discord.js": "^12.1.1",

@quartz kindle

quartz kindle
#

when you say slow, its at responding to commands?

earnest phoenix
#

yea

#

and logging in to the bot

#

but its fast with my other bots

quartz kindle
#

logging in is much slower with more guilds and more users

#

but responding to messages shouldnt be

#

where do you host it?

earnest phoenix
#

its local hosted right now but im using ethernet on 500 MB down and 500 MB up

quartz kindle
#

show your code

earnest phoenix
#

oh god theres so much code

quartz kindle
#

do you have any code that gets information from many members/users?

#

such as members.fetch()

#

do you have a database with prefixes and stuff?

#

is it slow on all commands or only a few?

#

do you have any command that sends many messages at once?

earnest phoenix
#

im getting members

#

like how many members the bot is connected to

#

and how many guilds its in

quartz kindle
#

using .cache or .fetch?

earnest phoenix
#

im using guilds.foreach

quartz kindle
#

put your code in pastebin or something

earnest phoenix
#
client.users.cache.size.toString()
quartz kindle
#

dont setPresence every 5 seconds

earnest phoenix
#

alright ill do it every 30

#

oh dang that actually fixed it

#

i think since its in so many guilds thats what was messing it up

quartz kindle
#

i dont think that alone was the cause, as it doesnt depend on guild size

#

but presence does have higher rate limits than messages

#

so it might have been rate limiting you

earnest phoenix
#

yeah most likely

#

it works fine now

grizzled raven
#

if you install discord's peer dependencies, will discord automatically use them or do you have to use them

quartz kindle
#

it will automatically use them

grizzled raven
#

is it best to go crazy and install them all (except voice stuff lol) or just 1 or two that are necessary

#

xd

quartz kindle
#

you wont go wrong with installing those 4

earnest phoenix
quartz kindle
#

zlib-sync, bufferutil, erlpack, utf-8-validate

#

you need to add a cache breaker to the widget url

earnest phoenix
#

Hmm how's that tho?

quartz kindle
#

for example url + "?v=" + Date.now()

#

this will append a changing number to the end of the url, making it invalid for caching

earnest phoenix
#

Hmm

#

That discord widget url + "?v=" + Date.now()?

quartz kindle
#

i dont see ?v=number

#

also, why do you have url=

earnest phoenix
#

Idk... Is it necessary?

quartz kindle
#

no lol

earnest phoenix
#

Lmao

quartz kindle
#

its like doing 0+10 when you can literally do 10

#

way worse than that actually

#

because its defining a global variable

earnest phoenix
#

Ah yes...
But like this?:
https://top.gg/api/widget/id.png + "?v=" + Date.now()
?

quartz kindle
#

yes

#

but since you already have a string

#

you can just do "https://top.gg/api/widget/id.png?v=" + Date.now()

earnest phoenix
#

K lemme see...

quartz kindle
#

lol apparently it only works if the number is smaller

#

what kind of bullshit is this lmao

earnest phoenix
quartz kindle
#

do this then

#
  • (Date.now() >> 0).toString(36)
#

lmao

earnest phoenix
#

can someone help me with threading?

quartz kindle
#

you can also do + Math.random().toFixed(5)

#

as long as the value is not bigger than 6 or 7 characters

earnest phoenix
#

Thx for the help

#

can anyone help with threading?

modest maple
#

why do u need it?

earnest phoenix
#

to do multiple things

modest maple
#

oh god nononononoooooooooooooooooooooooooooooo

#

no

#

dont do that

#

no

#

why do you think you're using async def

earnest phoenix
#

but

#

they don't do stuff simultaneously

#

if yes, pls tell me how

modest maple
#

do you know what asynchronous means?

earnest phoenix
#

i do

#

but is async def all?

#

that's all i need?

modest maple
#

so think about it, why do you think with python we use async def and asyncio rather than just def

heavy anchor
#

Which is better MongoDB or SQLight?

amber fractal
#

"better"

#

they have their uses

frigid sierra
#

follow up question: what are your thoughts on SQL

copper cradle
#

SQLight?

#

never heard of that

frigid sierra
#

probably referring to sqlite

copper cradle
#

unless you meant sqlite

#

yeah

heavy anchor
#

*sqlite

frigid sierra
#

what are your thoughts on SQL?

ember atlas
#

I personally think MongoDB, as it has mongoose which makes it easy to use

#

It's used by a lot of the big bots and has a neat web dash built it (compass)

heavy anchor
#

I know very little of it,

amber fractal
#

the npm mongo driver is quite easy to use too

frigid sierra
#

they both have their use cases so you can't reasonably say one is better than the other

#

though my settling point was that i personally don't like SQL

grizzled raven
#

i honestly am uncool and i am probably gonna use rethinkdb lmao

modest maple
#

SQL is better and quicker for large datasets

earnest phoenix
#

sql databases also have ORM wrappers so that isn't a valid argument but both nosql and sql databases excel in specific fields the best type of database for you depends on what you want to use it for

modest maple
#

^^

quartz kindle
#

nosql is better for storing objects that may have variable fields

modest maple
#

yes and no

quartz kindle
#

sql is better for tighly coupled data with fixed fields

#

other than that, its mostly user preference

modest maple
#

something like postgreSQL with the ability to store datetime fields and json objects quickly and efficiently can put it easily up there with nosql databases

#

ontop of the speed with large datasets and reliability

heavy anchor
#

Which is easier to learn lol

#

?

modest maple
#

mongo

wanton nova
#

hey guys
so i am feeling very stupid and stumped...

    console.log(res.needs.happiness)
      if (14000 <=res.needs.happiness < 15000) {
    a(0)
  console.log("a")
} else if (10000 <= res.needs.happiness < 14000) {
a(25)
  console.log("b")
} else if (5000 <= res.needs.happiness < 10000) {
a(50)
  console.log("c")
} else if (1 <= res.needs.happiness < 5000) {
a(75)
  console.log('d')
}

and when i log res.needs.happiness, it goes out with 10... but for some reason, after that, it logs A, showing that the number is somehow between 15000 and and 14000... Any help? Sorry if this is very stupid...

amber fractal
#

mongo is way easier to learn

modest maple
#

if you're not using an orm mongo is easier

earnest phoenix
#

postgres is one of the if not the most performant sql databases out there often used in the gaming industry

modest maple
#

but SQL is generally faster

wanton nova
#

and imo mongo is hard to get into, but its worth the trouble

quartz kindle
#

yes, but json functions in sql databases are an addon, not part of the original SQL design, so their performance might not be as good

modest maple
#

i still find Postgres outpacing mongo ever time ive used it

lyric mountain
#

Better to store json as varchar and parse it in the code itself

#

Works wonders

earnest phoenix
#

Postgres is a very strong choice

modest maple
#

tho personal opinion i would go with postgres

quartz kindle
#

postgre is possibly the best database out there, no denying that

#

but depending on your data, mongo will be much easier to use

#

and sqlite much easier to setup

trim nexus
#

do you guys use orm

lyric mountain
#

The only thing I miss about postgres is easy-to-install clients

quartz kindle
#

i dont

modest maple
#

the only thing postgres hasnt got going for it, is ease of use when hand writing querys, and setup

#

setting up a postgres server and managing it all can be a right pain

#

saying that the inbuilt docker image makes like 1000000000000000% easier

#

life*

lyric mountain
#

Pgadmin4 in beautiful but BOI.....does it give a headache to make work

earnest phoenix
#

if i don't seek maximum performance i use orms

modest maple
#

yh

grizzled raven
#

huh

quartz kindle
#

i dont use orms because i like being in control of what exactly the database is storing and how it is structured

lyric mountain
#

Omnidb is great, but doesn't work at all with nginx

earnest phoenix
#

there are still some performant orms which can compete against some hand written queries but more often than not hand written will be faster than what ORMs generate

lyric mountain
#

So I'm stuck with either phppgadmin or intellij database manager

modest maple
#

rip

lyric mountain
#

My Pgadmin4 started to throw weird CSRF errors

turbid bough
#

there isnt just those two

lyric mountain
#

Not even stackoverflow could help me

modest maple
#

in general my goto dbs:

sqlite3 -> if its a simple program and only testing

postgres -> the production database getting used with heavy workflow

lyric mountain
#

there isnt just those two
@turbid bough I'll not use windows 2000-like interface clients

turbid bough
#

yee

earnest phoenix
#

one thing i love about pgsql is the fact that it's open source

quartz kindle
#

atm im just using sqlite for everything lul

modest maple
#

yeah

#

the community supporting pg is nice

trim nexus
#

I run a few queries on every message, although there is not any noticable performance issues, performance.time ranges from 40-50ms... mysql

earnest phoenix
#

ew

trim nexus
#

which is not acceptable

turbid bough
#

@lyric mountain tried heidisql?

quartz kindle
#

look into caching those queries

#

for example, getting guild prefix can and should be cached

lyric mountain
#

Nope, does it have a decent interface?

modest maple
#

for me: (i run on every message that the bot responds, sometimes upto 45 times a sec) it takes 5ms to send a request to the webserver, get the data and return it

earnest phoenix
#

it's smart to cache and update the data in the cache alongside the database

turbid bough
#

well, i cant say much, but its ok

trim nexus
#

Can't cache these queries

lyric mountain
#

for example, getting guild prefix can and should be cached
@quartz kindle I use sqlite for caching, it's very lightweight and doesn't seem to impact performance at all

turbid bough
#

basically

modest maple
#

@trim nexus just dont use MySQL lol

#

if you gonna go through the effort of MySQL you could of just setup postgres

lyric mountain
#

well, i cant say much, but its ok
@turbid bough it gives me IBExpert PTSD

trim nexus
#

I mean I already have so it would be an effort changing everything

#

to pg

modest maple
#

ig ya gotta deal with ur 40ms then

turbid bough
#

it also supports ssh tunnels too

modest maple
#

i would advise setting up a system which you can load and unload data to transfer databases easily

turbid bough
#

like what pgadmin also does

lyric mountain
#

That's on intellij database manager's level

#

A bit less

modest maple
#

e.g i can dump my entire database into a json -> change database backend -> load json -> data fully setup and ready to go

digital ibex
#

hi

turbid bough
#

a database

digital ibex
#

well

#

ik what it means but

#

how can i fix it?

turbid bough
#

i dont know what mongoose is

lyric mountain
turbid bough
#

looks fancy, but has too many jpg artifacts

lyric mountain
#

Lol couldn't find a png

#

Not on the pc atm

trim nexus
#

ew heidi does the job 4 me

heavy anchor
#

it also supports ssh tunnels too
@turbid bough
what does postgres?

turbid bough
#

what

#

is that question

lyric mountain
#

Guess I'll stick with IJDM until I find a better manager or pgadmin devs fix that issue

ember atlas
#

@digital ibex Is that your IP in the screenshot, if so delete it.

digital ibex
#

its not my ip

#

its some random one

turbid bough
#

postgres is a database.

ember atlas
#

Ok good proceed

earnest phoenix
#

lmao

turbid bough
#

lol when i post my screenshot with an url its fine

earnest phoenix
#

theyre trial mods let them be

heavy anchor
#

is that question
@turbid bough Which one supports SSH?

lyric mountain
#

Heidisql

#

which is not a database

turbid bough
#

both pgadmin and heidisql

lyric mountain
#

And IJDM

modest maple
#

I thinks they have miss understood what you ment by ssh

turbid bough
#

i said ssh tunnels, so yeah, they probably did not read the tunnel part

heavy anchor
#

ooh i see

royal portal
#

so I have a cat thing

#

a cat command

#

how do I make it so

#

when you say -cat

#

it says finding a cat

#

then edits message

#

to 'found one'

#

and then sends cat

#

nvm i found it

#

lol

turbid bough
wide ridge
#

does anyone else randomly have their shards go down without any errors?

#

I have this code in my shardingManager to check if one of my shards disconnected
shard.on("disconnect", console.log);
One of my shards just disconnected (I think it was the main shard), and it did not log anything to the console. The shard stayed disconnected for about 3 or 4 mins and I just manually restarted my bot

modest maple
#

That sounds more like blocking rather than fully disconnecting

#

Nd also probably you lib hasn't adapted to the sharding changes discord has made

wide ridge
#

sharding changes? o.o

#

I implemented sharding about a week ago

#

so i'm not sure if it has to do with being outdated?

#

O.O

#

and in terms of blocking, the bot's status showed up as "offline" for the shard that was acting strange

quartz kindle
#

it happened to me too, a shard randomly fails to reconnect

slow cape
#

hey

#

so

#

im making a triggered command

#

and it just sends the file itself

#

if(message.content.startsWith(`${p}triggered`)) { //message.channel.send(`We're currently making this command!`) let target = message.mentions.users.first() || message.author; let profilepic = target.avatarURL; let url = `https://eclyssia-api.tk/api/v1/triggered?url=${profilepic}`; await message.channel.send({ files: [{ attachment: url, name: `triggered.gif` }] })

#

i want the image to be seeable

earnest phoenix
#

@slow cape why not send it in an embed?

slow cape
#

@earnest phoenix would that fix the problem?

earnest phoenix
#

you cant just do that lmao

#

@slow cape i mean... It would look way better in an embed and yea...

#

you need go GET the file returned, download it into memory or to your local storage and upload it from therw

#

there*

#

d.js doesnt automatically download the file for you

#

putting the image url in an embed or just sending it eliminates having to download it since you're telling discord "get the image from this link directly instead of my bot"

amber fractal
quartz kindle
#

actually it should work both ways

amber fractal
#

weird so the docs are incorrect? (wouldn't doubt it lol)

quartz kindle
#

i guess because most times when fetching a remote file, the user would want to keep the original name

#

while when sending a local file, the user would probably want to specify its own name

slow cape
#

@earnest phoenix how woulld code be in an embed

earnest phoenix
#

Hmm you don't know how to do an embed? @slow cape

#

I can show you if you don't know how to do it...

slow cape
#

@earnest phoenix ik but how do i put the file inside it

earnest phoenix
#

Hmm @slow cape is it a url?

quartz kindle
#

@slow cape what is your discord.js version?

slow cape
#

v12

#

ye

#

@earnest phoenix is it a url

#

*it is

earnest phoenix
#

You can do .setImage(`${url}`)
@slow cape

#

(in embed)

slow cape
#

ok

quartz kindle
#

if you're using v12, the problem is not even that

#

author.avatarURL is a function in v12

#

not a property

#

so your entire url is wrong and you get an invalid file

earnest phoenix
#

@slow cape @quartz kindle is right...
It's:
author.displayAvatarURL()

quartz kindle
#

with the code you showed, the url will actually be like this lmao https://eclyssia-api.tk/api/v1/triggered?url=avatarURL(%7B format, size, dynamic } = {}) {undefined if (!this.avatar) return null;undefined return this.client.rest.cdn.Avatar(this.id, this.avatar, format, size, dynamic);undefined }

slow cape
#

now i have an error TypeError: (intermediate value).addTitle is not a function

#
if(message.content.startsWith(`${p}triggered`)) {
    //message.channel.send(`We're currently making this command!`)
    let target = message.mentions.users.first() || message.author;
    let profilepic = target.displayAvatarURL()
    let url = `https://eclyssia-api.tk/api/v1/triggered?url=${profilepic}`;
    let embed = new Discord.MessageEmbed()
    .addTitle(`${target.displayName} is Triggered!`)
    .setImage(`${url}`);
    message.channel.send(embed);
  }```
#

@quartz kindle

#

@earnest phoenix

earnest phoenix
#

@slow cape it's
.setTitle()

slow cape
#

OH SHOOT

#

I CANT BELIEVE I DID THAT

#

IVE NEVER MADE THAT MISTAKE B4

earnest phoenix
#

Lol chill... We all make mistakes lmao...

#

@slow cape also you can do
target.user.username

slow cape
#

its just sending nothing

earnest phoenix
#

Hmm lemme check your code real quick

slow cape
#

k

#
if(message.content.startsWith(`${p}triggered`)) {
    //message.channel.send(`We're currently making this command!`)
    let target = message.mentions.users.first() || message.author;
    let profilepic = target.displayAvatarURL()
    let url = `https://eclyssia-api.tk/api/v1/triggered?url=${profilepic}`;
    let embed = new Discord.MessageEmbed()
    .addTitle(`${target.displayName} is Triggered!`)
    .setImage(`${url}`);
    message.channel.send(embed);
  }```

@slow cape

#

@earnest phoenix

earnest phoenix
#

Also
Do target.user.username
Instead of that and also try changing the `${url}` to just url

slow cape
#

TypeError: Cannot read property 'username' of undefined

#

@earnest phoenix

digital ibex
#

hi

slow cape
#

hmm

digital ibex
#

does anyone know how to fix this error with mongoose?

#

when i try to connect, i get that

slow cape
#

@earnest phoenix can ya help pl0x

earnest phoenix
#

@slow cape oh ok... Change that to target.username i guess

slow cape
#

@earnest phoenix

#

oof

earnest phoenix
#

Hmm...

#

@slow cape can ya show me your code?

#

(edited new one)

digital ibex
#

probably because uh

earnest phoenix
#

Also i can help ya in dms to make the command work flawlessly... Tho

digital ibex
#

u r looking for users and not members?

#

idk

slow cape
#

if(message.content.startsWith(`${p}triggered`)) { //message.channel.send(`We're currently making this command!`) let target = message.mentions.users.first() || message.author; let profilepic = target.username; let url = `https://eclyssia-api.tk/api/v1/triggered?url=${profilepic}`; let embed = new Discord.MessageEmbed() .setTitle(`${target.displayName} is Triggered!`) .setImage(url); message.channel.send(embed); }

#

@earnest phoenix

earnest phoenix
#

Hmm i think ik why...

slow cape
#

y

earnest phoenix
#

Because you need to separate the user mention logic and message.author to different embeds

digital ibex
#

try changing target to message.mentions.members.first() || message.member;

earnest phoenix
#

@digital ibex that won't work lol

slow cape
#

ye

digital ibex
#

i don't see anything wrong with it

slow cape
#

should i do an if else statement

earnest phoenix
#

@slow cape so come to DMs and i'll show you something...

visual sandal
#

I have the widget set as an image on one of my commands but it gets outdated after a few hours and it doesn't automatically update unless I modify the link.. how could I keep it updated?

earnest phoenix
#

idk much about rdps

#

this is for Vultr

#

which is the best for 5k guild bots etc

#

Does a bot goes offline if it got rate limited?

icy crane
#

No

earnest phoenix
#

@visual sandal
Url + "?v=" + (Date.now() >> 0).toString(36)

high bough
#

which is the best for 5k guild bots etc
@earnest phoenix Probably Cloud Computer

earnest phoenix
#

@high bough GG

high bough
#

^^

icy crane
#

aHhHh lItE mOdE

#

lmao

#

jkjk

#

gg

high bough
earnest phoenix
#

@icy crane light mode is brighter than the sun itself lmao

#

What do I do if my bot gets too big and is getting rate limited a lot because of commands ran?

#

Make an interval for all your commands so it can be used every 10 to 15 minutes lmao @earnest phoenix

calm shore
#
if(message.embeds.length === 1 && message.embeds[0].description ("🎟️"))
``` how do i make this so if description startsWith \🎟️
earnest phoenix
#

@calm shore what are you trying to do?

calm shore
#

make this so if description startsWith

#

bruh

icy crane
#

if you have a command handler

earnest phoenix
#

Hmm [Visible CONFUSION] but anyways

icy crane
#

guess i should have asked about that first

calm shore
#

like

#

for example

#

message.content.startsWith This grabs the first thing and it can be added on to it, but if you get rid of startsWith then its the whole thing in quotes

#

i want that for the embed

#

but i get an error when i do description.startsWith

earnest phoenix
#

Hmm wait... Like are you trying to put anything in the message.content that starts with that emoji in an embed's description? @calm shore

calm shore
#

Yes exactly

#

so if the embed description startsWIth that emoji then...

#

it will react to it

earnest phoenix
#

Hmm... Imma have to test that tho

#

I literally don't know if something like that is even possible or not

calm shore
#
if(message.embeds.length === 1 && message.embeds[0].description.startsWith("🎟️"))
#

it will work

#

but if you run another command

#

it will error it out

earnest phoenix
#

Like is it that necessary to check for that?

calm shore
#

Yes

#

very necessary

#
if(message.embeds.length === 1 && message.embeds[0].description.startsWith("🎟️"))
earnest phoenix
#

Does anyone know the CSS selector for the Long Description?

#

I have tried .longdescription and .content

#

longdescription only changes the outside bar

calm shore
#

.longdescription .content { }

#

u gotta put it on the top

#

very top

earnest phoenix
#

I'll try it again, maybe I made a typo Β―_(ツ)_/Β―

#

Ah, that'll be it.

calm shore
#

just below script

#

but on top

earnest phoenix
#

ty

calm shore
#

Np

earnest phoenix
#

Another quick question.

#

How do I change the triangle on the tags.

#

The atag selector only does the center

calm shore
#

Oh here

#

thats easy

#

.atag {

#

did u try that

earnest phoenix
#

Yessir.

#

I'll try it again since things are working.

#

And they weren't earlier.

calm shore
#

Very top[

#

again