#development

1 messages Β· Page 706 of 1

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

cache cleaning?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

quartz kindle
#

wut

#

lmao

warm marsh
#

I reckon it means Discord.Client not the actual client.

quartz kindle
#

^

sage bobcat
#

One message removed from a suspended account.

lunar crystal
warm marsh
#

"turn off"?

unique nimbus
#

I don't know JS but don't you ; the last bit

#

with the prefix

quartz kindle
#

semicolons are not strictly required in js

#

the engine basically attempts to autocomplete them where needed

mossy vine
#

@Eliacin / Resistensia#1575 it means that it is unused

quartz kindle
#

@lunar crystal if you mean the color that your editor is showing, that doesnt have any significance

lunar crystal
#

Ouh... Ok thanks u

quartz kindle
#

code editors try to guess what your code does and give you relevant colors for it, but it doesnt have any actual meaning

#

its just the program trying to guess what your code is doing

mossy vine
#

its darker than the rest, thats how vscode is telling you that the variable is unused

lunar crystal
#

Ok

quartz kindle
#

because bot doesnt exist

mossy vine
#

lmao

quartz kindle
#

you really should look into learning basic javascript

lunar crystal
#

What do you mean by this slonk

mossy vine
#

you define your client as client then refer to it as bot

lunar crystal
#

'k thanks u

quartz kindle
#

client.on
client.user
client.user

inland bear
#

what is a DBL Token?

quartz kindle
#

a token for connecting with the discordbots API

lunar crystal
#

thanks u πŸ˜„

inland bear
#

how can i find my bot's token

quartz kindle
#

in your bot's edit page, in the website

#

after your bot is approved

inland bear
#

ah okay πŸ‘

lunar crystal
unique nimbus
#

bruh

grizzled jackal
#

oh boi

elfin vale
#

u have to change bot.user to client.user

mossy vine
#

please learn javascript

lunar crystal
#

Oh yes I forgot lol

elfin vale
#

making a bot is a good way to learn JS :) its how i learned at least

lunar crystal
#

Yes I think so

quartz kindle
#

yes, but please try to understand why, what, how, etc

#

not just blindly copy paste code without understanding

lunar crystal
#

Oki

grizzled jackal
#

I can't stress this enough but experimenting is very important so you can see how it reacts if you change something to get a better understanding of it

quartz kindle
#

^

lunar crystal
#

I think that I'm going to take classes for learn js

unique nimbus
#

yes

lunar crystal
#

Because on internet it's very hard to find some good free classes

quartz kindle
#

its not hard, but most lessons on youtube and websites require you to already know something about coding in general

unique nimbus
#

yes

quartz kindle
#

there is not a lot of content for absolute beginners that knows how to explain things in a way they understand

earnest phoenix
#

!leaderboard

unique nimbus
earnest phoenix
#

.

#

I-

unique nimbus
#

no

#

@quartz kindle isn't discord.js in nodejs

quartz kindle
#

yes

unique nimbus
#

yes

loud salmon
#

dbl nicetry @earnest phoenix

covert turtleBOT
#

Hey, any bots that have common prefixes are now blocked from reading any channel. Nice try spamming your dms though.

unique nimbus
#

It took a google search

lunar crystal
#

Thank you @unique nimbus

quartz kindle
#

the problem is, most node.js tutorials assume the person already knows some basic js

unique nimbus
#

I don't know shit for js

#

However due to my experiences of python I got a tad understanding

#

Eventhough its different

quartz kindle
#

yeah

#

basic understanding of coding in general

unique nimbus
#

ye

#

Before I say I am "okay" I need to make something like a calculator or some shit

#

without tutorials

quartz kindle
#

im gonna start giving paid private lessons some day

#

i hope

unique nimbus
#

Give me free lessons

#

jk

quartz kindle
#

lmao

unique nimbus
#

I mean it is a good way to get paid

quartz kindle
#

its something im slowly finding out i really like to do, hence why i spend absurd amounts of time here

unique nimbus
#

ye

quartz kindle
#

i need a life

unique nimbus
#

same

#

I need to learn js but I don't have the effort to do it atm

quartz kindle
#

rip

earnest phoenix
#

We-

lunar crystal
#

How do we do to make a text like that when you're coding in vsc ?

unique nimbus
#

what

elfin vale
#

you mean bold text?

dusky marsh
#

@quartz kindle I think I feel you, I really like helping people with their problems when they can't figure stuff out, and I do tutor people on the side for Math things. It's satisfying helping people gain some more knowledge

grizzled jackal
#

I enjoy helping people out as well but I don't have too much patience myself so I try to not get too involved

willow magnet
sudden geyser
#

Have you posted your stats to dbl? wdym by missed up the old request?

pine jacinth
#

What are the requirements to become verified again?

golden herald
#

Does anyone how to find out how many users your bot is listening to on .py

pine jacinth
#
len(client.users)
#

@golden herald

snow urchin
slim heart
#

believe it or not, fetch usually means its over the internet

#

@snow urchin

snow urchin
slim heart
#

again

#

believe it or not, fetching usually means its over the internal

#

Promise.entries is not a property mmLol

sudden geyser
#

Promise.entries = undefined mmulu

blissful wind
#

So I know you can use member.roles.add() in discord.js Master branch, how would I do it for a user though? user.add.roles() returns cannot read property roles of undefined

eternal mesa
#

Iirc a user has no context of a guild

#

So that wouldn't work on just the base user object

#

Also look at what you posted for member vs user

#

@blissful wind

blissful wind
#

Yeah, it's weird as fuck lol, but I think I get what you're getting at there

eternal mesa
#

You need to get a GuildMember object in order to modify roles

#

What is the context of you adding a role

slender thistle
#

A user can't be in a guild, a member can

eternal mesa
#

^

blissful wind
#

Just a verification command p much. Instead of having to assign the roles manually

#

gotchu

#

Makes more sense, I'm just overthinking now

#

Thanks you two

eternal mesa
#

I mean if you are getting the user from a message, just use the member prop

slender thistle
#

πŸ‘

eternal mesa
#

And np

blissful wind
#

member prop? So like user = message.member

#

or

eternal mesa
#

yes

blissful wind
#

I was gonna do that but stopped myself because I thought it wouldn't work, I guess I shoulda just tried LOL

eternal mesa
#

always try πŸ™‚

blissful wind
#

I'll give it a shot!

#

Dope, that did the trick, just didn't assign the role for some reason

eternal mesa
blissful wind
#

wtf that's so different from my autorole

#

so it'd have to be user.guildMemberRoleStore.add()?

eternal mesa
#

no

#

user.roles

blissful wind
#

yeah

#

user.roles.add

eternal mesa
#

is a guildMemberRoleStore

#

yes

#

show me your code

blissful wind
#
var user = message.member;
            user.roles.add(test);
            message.channel.send(`${user.displayName} now has New Member role.`)
eternal mesa
#

what is test

blissful wind
#

It displays the text that I set the role, but doesn't actually set the role

#
        var test = '611249207764058113'
eternal mesa
#

and that is a role id?

blissful wind
#

Yes

eternal mesa
#

first of all those functions are both promises

blissful wind
#

So I'd have to async await it

eternal mesa
#

yes

#

do you have an eval command?

blissful wind
#

Yeah

eternal mesa
#

i would eval something along the lines of message.guild.roles.has('611249207764058113')

#

to verify you actually have the role id

blissful wind
#

Came back true

#

ignore NewMember

eternal mesa
#

im a little confused why you are overwriting user

blissful wind
#

cause it didn't work if I didn't, like we were discussing a moment ago

#

I want to be able to mention the user I want to give the role to

eternal mesa
#

@blissful wind member is an argument type

blissful wind
#

thonk_happy oboi, I'm doing the whole thing wrong aren't I

sudden geyser
#

psst, guild id is a string, not integer πŸ‘€

eternal mesa
#

that too

blissful wind
#

woops, fixed that haha

blissful wind
#

Still can't seem to find the right way to change user into a member object

amber fractal
#

Get user, get guild, get/fetch member from user

eternal mesa
#

@blissful wind you can do that^

#

but using djs commando, arguments have a type member

warm marsh
#

how to install discord.js 12.0.0?

#

I've tried npm i discordjs/discord.js --save

#

like it says on their website.

slim heart
#

Make sure you have git installed

warm marsh
#

It was installed on windows still got the same error

slim heart
#

If you do git it works?

warm marsh
#

Yeah I get loads of shit about how to use it.

slim heart
#

What do you get when you do git --version?

warm marsh
#

I'll restart maybe something is mad.

slim heart
#

Hm

warm marsh
#

I think my VPS install of Ubuntu might be the reason.

#

Nothing seems to be installed.

slim heart
#

Just reinstall git

#

To update and make sure your git path is properly set

warm marsh
#

Alright will do.

#

I will do that when I wake up, Thanks!

sterile grove
#

Is listing servers in the console/terminal allowed?

sudden geyser
#

no

#

unless you make it opt-in servers or something

sick cloud
#

ok how do you properly get cpu usage

warm marsh
#

Lang?

earnest phoenix
#

@warm marsh npm i --save discordjs/discord.js

#

:)

#

If you want discordjs v12

#

Or

#

In you package.json:
"discord.js": "github:discordjs/discord.js#405bdb5b558eff478d0bde739cee1ee8e40c330b",

and type: npm i --save discord.js

slim heart
#

If you read the issue this is not a solution nor even considering of the original issue

sick cloud
#

awkward math question but if i have a length in ms and another length in ms for my song, like 1000 and it's 740 in, how do i turn that into a percentage (ie. 74% done)

slim heart
#

You want to divide down to a 1% value and multiply back up to a 100%

#

So 740/1000 = .74 * 100 = 74

sick cloud
#

okay and how would i turn that into a dynamic script more, like songLength and songPlayed (being 1000 and 740 in the demo obv)

slim heart
#

((songPlayed / songLength) * 100).toFixed()

sick cloud
#

and that'll get the % played

#

okay

#

thanks berry

slim heart
#

Should ye

#

πŸ‘

sick cloud
#

then i got timo's great code to make a progress bar out of that

slim heart
sick cloud
#

ah ok ran into a great issue on my side

#

so soundcloud are sick and give you the song duration, ty, but youtube won't

slim heart
#

They give you no info?

#

Because iirc the get song info stuff should give some sort of length indication

sick cloud
#

well at least my current method doesn't

#

time to get crafty

#

soundcloud gives so much information

amber fractal
#

What do you use?

sick cloud
#

download links, full streams, even the wavelength png lol

#

a custom wrapper

amber fractal
#

I meant like module for yt mmulu

#

Oohh

#

I read that wrong

sick cloud
#

yeah i use a custom one

#

it powers @dusty bronze actually so i should be able to modify it and pull the duration

slim heart
#

Yez

amber fractal
#

Ik that ytdl returns a contentLength

sick cloud
#

my wrapper has durationSeconds

#

okay

slim heart
#

GoogleVideo.contentDetails.duration mmLol

sick cloud
#

getting ms from seconds is just sec*1000 right

amber fractal
#

Yes, seconds to ms is sec*1000

slim heart
#

Or GoogleVideo.fileDetails.durationMs

sick cloud
#

okay

narrow kettle
#

so i made those cons... is it possible to import them to another file or i will just need to copy them

#

(when i say other file i just mean another file in visual studio code

earnest phoenix
#

Yes

#

You can

#

@narrow kettle create a config.json and put:

{
"token": "TOKEN BOT",
"PREFIX": "k!",
}```
#

And in your index file

narrow kettle
#

those are in the index file btw

earnest phoenix
#
const config = require("./config.json");```
narrow kettle
#

oh ok

earnest phoenix
#

And js bot.login(config.token)

#

Example :)

narrow kettle
#

tnx

earnest phoenix
#

Np

narrow kettle
#

do glitch run only one file? (only the main bot file seems to run)

lavish shuttle
#

checking if message author is bot outside message event

#

Using sendMessage

late hill
#

also

#

You don't have to create a new client

#

For each command

narrow kettle
#

so should i use just send?

#

and its still not working from some reason

sick cloud
#

i can see so many issues with that

narrow kettle
#

can you tell me what are they?

sick cloud
#

making a client for every new command file
mixing const and var, use let instead of var
not exporting things correctly, you don't put a whole new message event and bot in a file, you load commands and all in dynamically
using depreciated methods
using multiple events

#

and a couple small ones

narrow kettle
#

i fixed the making a new client for every file(on my current code)
should i leave const as const but switch all of my var to let?
can you give me an example on how to export correctly?
not sure what you mean?(commands and all in dynamically, using depreciated methods,using multiple events)

gentle oxide
#

!invite

sick cloud
narrow kettle
#

tnx

earnest phoenix
#

!invite

earnest phoenix
#

And comon prefix are muted

narrow kettle
#

it tells me client is not defined but on visual studio code there is no problem... can anyone tell me how to define it then?

earnest phoenix
#

.......................

#

Replace client by bot..............................

grim aspen
#

you never defined client

earnest phoenix
#

@narrow kettle

grim aspen
narrow kettle
#

oh right, yep im retarted pay no attention to me

slim heart
#

All you should be declaring an instance of client, by doing new Discord.Client() instead

narrow kettle
#

yeah i fixed it

copper cradle
#

@narrow kettle don't use sendMessage as it's deprecated, and why tf arw you checking if the message.author is a bot... outside of the message event

narrow kettle
#

its literlly the same in Discord.js guild...

earnest phoenix
#

Uhm

amber fractal
#

message.author.bot is in the message event MegaThonk

earnest phoenix
#

why OUTSIDE of the handler

#

oh sait

#

wait*

#

im retarded

slender thistle
#

Will the amount of MESSAGE_DELETE event emits per one bulk message delete be the same?

copper cradle
narrow kettle
#

did a mistake, then fixed it

copper cradle
#

I mean

#

that was the first thing I saw when I opened this channel

earnest phoenix
#

Bruh wΓ–t

#

You

#

@narrow kettle

narrow kettle
#

ye?

earnest phoenix
#

What did you thought back then

#

When you made this

narrow kettle
#

i mean... i just came back from 3 hours of math(school)... brain.exe stopped working at this point

earnest phoenix
#

I can releate

narrow kettle
#

whats better to use, if or switch?

earnest phoenix
#

if

#

for commands

narrow kettle
#

cuz its not realy working for me, i defentaly did a big mistake

earnest phoenix
#

Bruh no if you use it in a command then fo switch

#

so like

narrow kettle
#

definitely*

earnest phoenix
#

wait lemme recode

#

brb

copper cradle
#

b r u h

#

how did u define command

#

wtf

#

why are you doing that

#

"info version"

#

"info developers"

narrow kettle
copper cradle
#

"info"

narrow kettle
#

just checking stuff, those are not realy going to be commands

earnest phoenix
#

Omg...

fluid basin
#

@slender thistle I believe they are 2 separate events so doing a bulk delete will only create a bulk delete event and no message delete events afaik

slender thistle
#

That's somewhat weird

#

I'll need to confirm that later

fluid basin
#

since even according to the official discord api its a different endpoint for message bulk delete

#

and only bots can use that endpoint + less than 2 weeks

slender thistle
#

Understandable

grim aspen
#

hold up

#

importing discord

#

via js

fluid basin
#

yeah that shouldn't work

grim aspen
fluid basin
#

should be directly importing client from d.js

#

idk

mossy vine
#

or import * as Discord from 'discord.js'

fluid basin
#

yeah this should be the correct import ^

#

idk if it will work for the one in that img

#

yup errors

earnest phoenix
#

es6

stray garnet
#

@grim aspen that works ?

grim aspen
#

i'm just used to seeing import in python

#

didn't feel right

fluid basin
#

welp

#

apparently imports don't work in vanilla nodejs

#

for es6 import I think they have some requirements like needing to define the module as es6

#

and as well as adding the experimental modules switch when running

#

maybe I did too much typescript lol

mossy vine
#

es6 imports are supported in node v12 arent they?

fluid basin
#

experimental?

#

and the switch must be passed to node

#

and the whole module must be in es6 (which clearly d.js isnt)

sudden geyser
#

and the whole module must be in es6 (which clearly d.js isnt)
Not sure about that one.

lunar crystal
#

Can I change the name of my bot ( I put vitas instead of Vitas ) ??

#

And second question it is possible to make some bold text with ** on vsc ?

mossy vine
#

yes and yes

valid frigate
#

lmao yes

warm marsh
#

Does anyone know why my version of Ubuntu has nothing installed?

valid frigate
#

go to your discord developer console

coarse patrol
#

How do I make it show a picture in an embedded message? I'm trying to make an avatar command, but it only shows the URL.

#

let avatarEmbed = new Discord.RichEmbed()
.setDescription(message.author.username)
.addField("Avatar", message.author.avatarURL)
return message.reply(avatarEmbed)

amber fractal
#

Read docs some more.

warm marsh
#

Does anyone have a guide on how Structure.extend works in djs?

grim aspen
amber fractal
#

Never heard of that @warm marsh is it on master or stable?

#

@grim aspen he has the url

#

He just wanted it to not be a link

grim aspen
#

oh

#

display avatar url

amber fractal
#

He wanted setImage...

warm marsh
#

Master

quartz kindle
#

@warm marsh what are you trying to do?

grim aspen
#

are you not listening?

quartz kindle
#

i use it in my lib

amber fractal
#

I thought so Ill have to look at it

warm marsh
#

I'm trying to add some properties in the TextChannel and stuff.

#

I remember using it ages ago for doing that but I've kinda forgot.

amber fractal
#

@grim aspen he asked why it's showing as a link and not a picture

warm marsh
#

Methods*

grim aspen
#

show code @warm marsh

warm marsh
#

Of?

quartz kindle
#

@warm marsh js Structures.extend("Message", Message => { return class extends Message { // add/modify Message methods } });

warm marsh
#

Then I just require the file inside my main file?

quartz kindle
#

you have to call Structures from Discord, and do your modifications before you call Client

warm marsh
#

Alright, Thanks.

#

I don't have to export this? If I do it in an external file.

quartz kindle
#

you can, as long as you apply it to the same Discord instance as you're creating a client from

#

you can for example, require Discord in an external file, do the modifications, then export Discord to your main file, then call new Discord.client() from your exported Discord

#

so instead of const Discord = require("discord.js") you would do const Discord = require("./yourmodifieddiscord.js")

grim aspen
#

oh ffs, i didn't see the second question

quartz kindle
#

actually i think you dont even need to do that because of require cache

#

im not sure here, but once Discord is required from any file, subsequent requires should take it from the require cache, and if you modify its structures it should also reflect in the cache

#

i guess you need to experiment with it

stray garnet
#

How can i search for an ID? Like in my Avatar Command that i can do n.avatar 180112943612952577

warm marsh
#

Language?

#

So it works but it's probably very badly done.

stray garnet
#

Discord.js

warm marsh
#

Em, Using the Client but then that's for cached users. Idk if the DBL API can help you.

grim aspen
wheat jolt
#
async function fetchGet(url) {
    fetch(url)
        .then(async res => {
            return res
        }
}

console.log(await fetchGet('someurl')) // -> undefined
#

why it's undefined?

#

or how I can return the function in a .then()

warm marsh
#

Because of the Promise.

#

I'm pretty sure.

#

You could do js async function fetchGet(url) { return new Promise(function(resolve, reject) { fetch(url) .then(function(resp) { resolve(resp); }); }); }

#

Or shorten it to

async function fetchGet(url) {
    return await fetch(url);
}```
#

I think that would work.

west spoke
warm marsh
#

Not wrong.

west spoke
#

never said it was wrong

warm marsh
#

"Not wrong" means you're not wrong therefore I was agreeing with you.

west spoke
warm marsh
#

I know.

west spoke
warm marsh
#

I have no idea how to explain why it's not working without googling how to explain it.

west spoke
#

you arent supposed to just give them it. You need to teach them in a way.

#

copying things from stack wont help you learn

warm marsh
#

Depends, If you just copy it then sure you're not learning but if you learn why it works then you will.

west spoke
#

not my point

earnest phoenix
#

simply telling them to await would've been sufficient

west spoke
#

^

warm marsh
#

Await what though?

earnest phoenix
#

the only thing that does something in the entire method

#

"await it"
"await your fetch"
etc

warm marsh
#

Saying that no doubt would've ended up with them leaving the .then so there would be another question to why it's still not working.

earnest phoenix
#

as to why is because when they get their solution explained//in words they're encouraged to do their own research - which is more likely to stick with them, but when you just give them baked code it ruins the point of learning

lunar crystal
#

How do we do bold text on Vsc ?

warm marsh
#

What do you mean?

west spoke
#

**text**

warm marsh
#

Oh for sending messages.

mossy vine
#

you cant make it bold in the editor itself

west spoke
#

You could have said "promise the fetch" or "await the fetch"

mossy vine
#

but when sending message, regular discord markup applies

west spoke
#

and had them learn how to do it themselves

#

Instead of just copying code

stray garnet
#

does that mean

loud salmon
#

obviously it means Max Listeners Exdeeded

slender thistle
#

You are listening to the same event many times

loud salmon
#

and it tells you how to solve it

#

please tell me you arent creating a new message listener for each command

stray garnet
#

I'm overwhelmed lol

#

@loud salmon wym

loud salmon
stray garnet
#

i see

#

but what can i do against it

#

well ik .setMaxListeners()

but where?

#

in index? in commandfile

loud salmon
#

@stray garnet you shouldnt be using 11 ready listeners unless you have a very good reason to

stray garnet
#

Huh wait what im not using 11 ready listeners at all

loud salmon
stray garnet
#

Im retarteded rn

loud salmon
#

idk is this node?

#

wait

stray garnet
#

Yes it is

loud salmon
#

have you tried googling what it means by that

stray garnet
#

nah

loud salmon
#

its a valid way of troubleshooting

grim aspen
ebon crypt
#

Hello.

#

Anybody can help me?

mossy vine
#

just post your question

ebon crypt
#

i dont invite my bot to my friend's server.

#

And anyone don't look the bot's website.

#

And the website write this: Bot awaiting approval - Please be patient, us humans take time to verify bots!

mossy vine
#

first of all, did you actually make the bot

ebon crypt
#

yes, i do.

#

the bot is on my server.

mossy vine
#

well, it takes time for bots to get approved

#

so be patient

ebon crypt
#

But i can't invite my friend's server

#

Okay.

#

Thanks

quartz kindle
#

you can use your bot's invite link, you dont need to wait for approval

west spoke
#
if (receivedMessage.text.startsWith("neko")){
	                        ^

TypeError: Cannot read property 'startsWith' of undefined
#
    // Prevent bot from responding to its own messages
    if (receivedMessage.author == client.user) {
        return
    }

const nekoEmbed = new Discord.RichEmbed()
	.setTitle('Nekos!')
	.setImage("http://neko-bot.net/nekos/neko30.png")//nbapi.random.neko())
	.setFooter('Made by LazyNeko', 'http://neko-bot.net/images/ownerimg.round.png');
	if (receivedMessage.text.startsWith("neko")){
    receivedMessage.channel.send(nekoEmbed)
}})```
#

Idk what's happening I'm new to js

#

Is startswith not a function or am I doing things wrong

#

Oh

#

content

#

I'm dumb

#

Nevermind I found my problem

#

By scrolling through docs for like 5 seconds

#

It's hard to see what it is on phone /shrug

amber fractal
#

Lol

#

When you see that it means the thing before it is undefined

west spoke
#

I said I'm new to js

#

it's so different ffs

amber fractal
#

I didn't mean anything bad with it MegaThonk

#

I just meant in future cases, that's what it means

west spoke
#

ok

#

I'm not messing with js tho

#

only to make my bot in it

slender thistle
#

informed > uninformed

west spoke
#

yay

#

I love this

sudden geyser
#

lazy you still need help?

#

@west spoke

west spoke
#

No

sudden geyser
#

alright

copper cradle
#

@west spoke use === not ==

#

just google why

west spoke
#

@copper cradle its working

#

Its fine

copper cradle
#

I mean

amber fractal
#

it

#

doesnt

#

matter

#

dont make a big deal of strict typing

#

In most use cases it won't matter

slender thistle
#

iirc === has proven itself to be slower

amber fractal
#

the difference

#

but most times, it wont matter

slender thistle
#

I mean if you're sure you'll be working with the same data type Shrug

sudden geyser
#

doesn't really matter, just recommended.

amber fractal
#

it wont make a difference here

cold harness
#

In discord.py is it possible to send 2 embeds in one message

grim aspen
#

what do you mean

heavy marsh
#
const Discord = require("discord.js");

        module.exports = async (client, message)  => {
        
const ban = await client.guild.fetchBans();
        
var voice1 = client.channels.get("629821895386071060")
var voice2 = client.channels.get("629821926516195350")
var voice3 = client.channels.get("629822000008921099")
var voice4 = client.channels.get("629822053230444544")

voice1.setName(`Members: ${client.guild.memberCount}`) 
voice2.setName(`Humans: ${client.guild.members.filter(member => !member.user.bot).size}`)
voice3.setName(`Bots: ${client.guild.members.filter(member => member.user.bot).size}`)
voice4.setName(`Ban Count: ${ban.size}`)
        ```
**ERROR:** TypeError: Cannot read property 'get' of undefined
sudden geyser
#

Are you sure client is an instance of the Client class

hollow saddle
#

And client.guild isn't a thing

grim aspen
#

i would think client would be defined also

sudden geyser
#

Anyone know if there's a way to paste a discord.gg link without the invite embed appearing?

#

Wrapping it in <> doesn't seem to work

hushed berry
#

maybe surrounding with <>

#

oh

#

nevermind then

sudden geyser
#

<> only works sometimes if it has the default discordapp embed page. But doesn't actually hide the invite sad

valid frigate
#

this happens when i'm spawning clusters

#

the shards on one cluster just randomly disconnect and don't reconnect after about say 10 or 20 minutes

#

this is in eris

#

this problem is seriously annoying since idk where it's coming from mm

cold harness
#

I mean in msg.send(embed=embed) can I send more than one embed in that one msg.send?

west spoke
#

No

#

one embed/message

peak bloom
#

i have a rapidly growing bot which needs to hit a postgres database with every single message it receives, this is causing quite a lot of cpu usage

#

i'm planning on having a website dashboard and it should be able to horizontally scale so i'm wondering what i can do to reduce the cpu usage that will work with those requirements

#

anyone have any ideas?

west spoke
#

@peak bloom have a cache

#

store in db, and every minute update the dashboard

peak bloom
#

if i have a cache, how can i ensure it's always updated with changes from other sources (another server/the dashboard)

west spoke
#

some sort of wack json

#

idk

#

That's what I would do, or make it check only for specific messagss

peak bloom
#

i would love to do that but the whole point of the bot is that it checks for every message

#

which is making this quite a difficulty

slender thistle
#

Possibly store in cache and db but not sure if that's better

west spoke
#

^

#

Instead of sending a post request to some server per message, sending it in a set interval would be best

#

Imo

peak bloom
#

so, a solution that results in, say, changes to the db via one bot instance/the dashboard taking up to a minute (or whatever the set interval is) to be reflected in another bot instance?

west spoke
#

I guess

peak bloom
#

that could definitely work

hushed berry
#

@peak bloom whats the bot do?

peak bloom
#

@signal shuttle allows users to emulate having multiple 'pseudo-accounts' by detecting user-specified markers surrounding a message

#

restricting the format of the markers in any way at this stage with over 800k such accounts in the database isn't an option

hushed berry
#

I'd probably just dual write into redis+postgres

#

pull from redis, if not exists, grab from postgres and put into redis

#

and then setup some key removal technique like LFU and you're all set

#

You could even add a super shortlived cache on top of that locally on each instance if redis cant handle the load

peak bloom
#

my issue with that is if another instance of the bot, or the dashboard i'll be creating, makes changes to the postgres database those changes need to be reflected in a timely manner in the bot

#

so how do i handle that using redis?

hushed berry
#

I know, thats why I said dual write into redis and postgres

peak bloom
#

okay will admit right now i've never touched redis and don't know its capabilities lol

hushed berry
#

It's basically a super fast in memory db

#

its awful for persistent data but great for things like caches

#

A read from redis is insanely cheap

peak bloom
#

if it's in memory how will a website/other bot instance write into it?

hushed berry
#

a write as well

#

Wdym

#

It's just like a normal db

#

You could even make the write just invalidate the key in the cache

#

so that the next read populates it instead

peak bloom
#

that sounds ideal

#

i'll look into redis, thanks

hushed berry
#

this is pretty standard architecture for highly trafficced applications btw ^^

peak bloom
#

i'm sure, it's just that i'm a single developer with no experience with such things and i haven't the slightest idea where to start with many of these issues heh

hushed berry
#

Yeah, I mean

#

thats where i was a couple years ago

#

it just kinda gets forced on you

#

you either figure it out or stuff falls apart 🀷

#

if you want, you could always slide in my DMs if you've got a coherent question

#

pls no "how do make bot good"

peak bloom
#

i appreciate that, and no worries i'm at least past that point lol

hushed berry
#

πŸ˜‚

earnest phoenix
#

yarn fixed it

#

yarn op

#

Is there a property that returns reactions on a message and how many times the reaction has been used?

#

I want to implement a type of voting system

mossy vine
#

lib?

earnest phoenix
#

D.js

mossy vine
#

message.reactions

valid frigate
#

iirc npm hangs whenever installing large packages

#

updating the terminal sometimes helps

mossy vine
#

d.js aint that large

earnest phoenix
#

Idunno, couldn't find it when I searched "reaction"

#

Ok, so msg.reactions is a map of the type of reactions on a msg

mossy vine
#

yes, read the documentation

earnest phoenix
#

But it doesn't say anything about how many have used the reaction?

#

Or will there just be duplicates in the map if the more than 1 person use the same reaction?

mossy vine
#

it does, MessageReaction#count

real helm
#

Hello

#

I'm programming in py

#

And i have a question

earnest phoenix
#

Oh, right

#

Ty

real helm
#

For do a import

#

I need install something, like npm in js?

mossy vine
#

you want to import libraries/packages?

real helm
#

Yes

mossy vine
real helm
#

requests?

#

and for install a new library, pip install ?

mossy vine
#

yes

#

if you want to install requests for example, pip install requests

real helm
#

Where i install

#

In cmd?

mossy vine
#

yes

real helm
#

okay, thanks

lunar crystal
real helm
#

lol

#

it don't work

#

omfg

mossy vine
#

oh god everything about that is so wrong

#

please learn javascript properly

real helm
#

yes

#

@mossy vine bro

#

I need help lol

mossy vine
#

error?

real helm
#

idk how install a pip in windows

mossy vine
#

it should come with your python installation. if it didnt, run the installer again and make sure you select to install pip

real helm
#

okay

coarse patrol
#

I'm trying to make my bot do "Watching over x servers, .help" but it's in 2 servers and it shows "Watching over 0 servers, .help"

#

client.on("guildCreate", guild => {
console.log(New guild joined: ${guild.name} (id: ${guild.id}). This guild has ${guild.memberCount} members!);
client.user.setActivity(over ${client.users.size} servers, .help, { type: 'WATCHING'});

#

How do I fix this?

late hill
#

You used client.users

#

And don't do that

#

You'll get ratelimitted if your bot joins a bunch of servers in a small period of time

#

Your bot might not be growing that fast

#

But all it takes is 1 asshole to realise this and he can get you ratelimitted

earnest phoenix
#

anyone down for looking at code and telling me how i could do it better?

coarse patrol
#

What should I do then?

late hill
#

language sip

#

You can put an interval with a set time to update it

#

Or save when you've last updated it

#

And don't do an update if it hasn't been long enough

coarse patrol
#

How though? I don't really know how to do that.

late hill
#
setInterval(functionToExecute, delay)```
#

You'd pass your client to it

#

So you can use client.guilds.size

#

Make sure you don't start the interval in some event

#

So it won't be there multiple times

frank wyvern
#

hey does anyone know why im getting discord.errors.ConnectionClosed: WebSocket connection is closed: code = 1000 (OK), no reason on all shards after running my bot for a while?

#

alternatively, it could be concurrent.futures._base.TimeoutError

slender thistle
#

Something blocking or your bot is disconnecting by itself 02think

#

But tbh sounds like blocking

frank wyvern
#

@slender thistle any idea how I would go about fixing that?

slender thistle
#

Anything you think that could take a long while to process?

frank wyvern
#

@slender thistle I havent changed anything?

#

it was working fine and then suddenly stopped

slender thistle
#

So that's 2 people randomly getting that error

frank wyvern
#

@slender thistle 1.2.3

#

@slender thistle so any idea on how I can fix it, a lot of people are waiting?

slender thistle
#

Not really sure how you can fix that apart from trying to see if anything non-async is left hanging in your code for too long

frank wyvern
#

@slender thistle i'll have a look. Is there anyway to tell specifically where?

slender thistle
#

Nah chief

#

you'll have to apply logic and thinking and probably more testing

#

But then again, that's just my pure guess astolfoShrug

frank wyvern
#

@slender thistle the only thing I can think of that would be processor heavy is doing the guild count because its on a lot of server, do you think that could be it?

#

because I haven't changed the code but obviously the servers have changed

slender thistle
#

Doesn't have to be heavy on memory usage

#

But that could be the reason

frank wyvern
#

@slender thistle ok, if you think af anything else, please let me know

slender thistle
real helm
#

Hello

#

Who help me?

#

I'm doing a email sender in py

#

And i need help :v

earnest phoenix
#

does anyone know how to get the message logs to show a deleted message in a embed without the bot crashing as the message is no longer there but im trying to find a way of getting the content that was deleted without it crashing

#

in which library

#

i will show the code i have

#
bot.on("messageDelete", function(message){// message logs
    const logchannel = message.guild.channels.find(channel => channel.name === "message-logs");
    var user = message.author;
    if(!logchannel) return
    let deleteEmbed = new Discord.RichEmbed()
    .setTitle("⚠️ A message was deleted!")
    .addField("Sent by User", `${message.author.tag} (ID: ${message.author.id})`)
    .addField("Deleted Message", ${message})
    .addField("Deleted In", message.guild.channels.get(message.channel.id).toString() + ` (${message.channel.id})`)
    .setFooter(`Author ID: ${user.id}| Message ID: ${message.id}`, bot.user.avatarURL)
    .setColor("#FF0000")
    logchannel.send(deleteEmbed)
});
#

but it crashes saying the embed is empty

#

on this line

    .addField("Deleted Message", ${message})
#

but this is because the message is no longer there as it was deleted so this is causing the bot to crash

#

but this is discord.js

#

and people have said it only works in discord.py and thats not correct surely

#

what's the error

sudden geyser
#

Well, fix the template literal

ocean atlas
#

ooh @earnest phoenix

earnest phoenix
#

ey

#

i think the "smoothness" of how blocks fit together without gaps depends on font type ?

ocean atlas
#

what about

Β«β•£β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ• Β»
earnest phoenix
#

that's pretty smooth

#

@earnest phoenix just trying to find the pic i took when i do can i dm you

#

but i like [β– β– β– β– β– ] too

#

you don't have to dm me

#

what would those look like at 50%Β¨

#

β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘

ocean atlas
#

that looks good

earnest phoenix
#

woah, are those gradients colored for you too ?

ocean atlas
#

using the minecraft brick wall banner ASCII

#

and yes wtf

#

β–“β–“β–“β–“β–“β–“

#

why is there a rainbow in it

earnest phoenix
#

bruh

ocean atlas
#

does it happen with this one too?

#

β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’

#

yep

earnest phoenix
#

AAAAAAAAAAA

#

wtf

ocean atlas
#

thats the most obvious one

#

lolΒ imΒ usingΒ NBSPΒ spaces

#

gtg i got a drivers ed class to get to

earnest phoenix
#

aight

quartz kindle
#

@earnest phoenix the messageDelete event only has content if the deleted message was cached

#

so you have to check if the message content exists

#

it might also be a message without content, such as embeds from other bots

#

you can do something like ${message.content || "no content"}

sudden geyser
#

dang it tim you edited what I was gonna say

quartz kindle
#

hue

earnest phoenix
#

ahhh okay

#

so i just replace line 25 with

    .addField("Deleted Message", ${message.content || "no content"})
quartz kindle
#

yes

earnest phoenix
#

it then throws that error

#

lol

#

hey guys

quartz kindle
#

ah sorry, i sent that assuming you would use `

#

since you actually dont need backticks anymore

earnest phoenix
#

ohhh yeah i forgot to add it 1 min

quartz kindle
#

you can just do it without them

earnest phoenix
#

can you guys help me with something?

quartz kindle
#

message.content || "no message"

#

what is it?

earnest phoenix
#

usually i add the ` lol

quartz kindle
#

well you can, but you dont need it if you're not mixing text with variables

earnest phoenix
#

Tim thank you very much for that i will let you know if this fixes my issue i have been trying to fix it for 3 weeks now and after a length time it crashes with the same error and was getting frustrating.. i have now added it so i will let you know in 10 hours if i get a crash as i have to go out now thank again

quartz kindle
#

πŸ‘

earnest phoenix
#

how can i revive a bot offline?

#

;-;

#

oh mai gash now im ded

grizzled jackal
#

Give it cpr

earnest phoenix
#

.-.

#

no u

#

i rlly need halp qwp

grizzled jackal
#

Um, how old are you?

earnest phoenix
#

why?

quartz kindle
#

what do you mean "revive a bot offline"?

#

explain what happened

earnest phoenix
#

eh

golden herald
#

I asked a few days ago how to show how many users your bot is listening to, but bot.users doesn't work, how do you fix this

#

.python btw

earnest phoenix
#

i could tell u in js but idk if its the same for py

#

in js its

#

<client>.users.size

#

@golden herald

golden herald
#

ok, do you have to use client or is bot?

#

because my whole bot is bot and not client

earnest phoenix
#

<client> is ur client definition

#

so

#

i think in ur case bot

golden herald
#

ok

#

thanks

earnest phoenix
#

tell me if it worked

golden herald
#

it didn't sadly thanks for helping anyway πŸ˜„

earnest phoenix
#

you can't give instructions which work on an entirely different language ΒΏΒΏ?? lol

stray garnet
#

(node:13339) UnhandledPromiseRejectionWarning: RangeError: Color must be within the range 0 - 16777215 (0xFFFFFF).

#

wtf does that mean?

#

.setColor(0xfff007f)

#

where is the error

earnest phoenix
#

that's not a valid 24* bit color

quartz kindle
#

count the number of chars you have there

earnest phoenix
#

Hi

#

How do I send a bot message to all the channel that has the channel name info?

#

I tried client.guilds.channels.get().send

stray garnet
#

@earnest phoenix

earnest phoenix
#

refrain from spoonfeeding

stray garnet
#

Ahw Shit

earnest phoenix
#

That doesn’t post to all the servers

#

I got it anyways

#

I mapped all the channels

#

Thanks anyways

#

and it's api abuse//mass messaging to message to all servers - against the tos

stray garnet
#

for what is it? @earnest phoenix

earnest phoenix
#

not really against ToS cause it’s private bot?

#

For 2 servers

stray garnet
#

well than ut would be ok i think

earnest phoenix
#

When I execute Β₯push , sends info I pushed to the 2 servers

#

And plus , not spoonfeeding if I provided code btw .

quartz kindle
#

Client.guilds.channels doesnt exist

#

Because guilds is a collection

earnest phoenix
#

Tim it’s fine I got it πŸ™‚

#

Thanks anyways

quartz kindle
#

πŸ‘

frank wyvern
#

How do we get a message by ID from a specific channel using rewrite?

tender kraken
#

where i found dasha present bot for world of warships ?

earnest phoenix
#

is that even a question

astral meteor
#

How do I add the discord.js and node.js version to my bot's stats command?

slim heart
#

require("discord.js").version

astral meteor
#

okay thanks

#

same for node.js?

slim heart
#

And process.version

astral meteor
#

Okay thanks berry :)

late hill
#

What meta tag does Discord use for the color when it embeds links?
I did some research and found something that told me to use this.
It's not working and I wonder if it's because it's actually wrong or if it's just because it shows like a cached version or something.

earnest phoenix
#

someone know how to sort a map by a property value ? like if i want to sort a map of guilds by memberCount instead of id

#

It's not working and I wonder if it's because it's actually wrong or if it's just because it shows like a cached version or something.
add a cache breaker to your url

late hill
#

Thank you

#

It does work

quartz kindle
#

@earnest phoenix you need to create another map/array

#

you can simply use .map()

#

or use one of d.js's collection functions

earnest phoenix
#

ah okay, so no built in function

covert tartan
#

+ev this.client.guilds.sort((a,b) => b.memberCount - a.memberCount).first(10).map((g, index) => `${index + 1}. ${g.name}: ${g.memberCount}`).join('\n')
#

is this what you want?

earnest phoenix
#

i guess, i thought there was a no spoon feeding rule though pepowot

covert tartan
#

i suppose if you understand what each part does then its ok, its pinned in my server because i check it every once in a while so i just copied it here

earnest phoenix
#

u have one of those bots that runs code directly from chat ?

covert tartan
#

yea, an +eval command

hot portal
#

pref.: rmario

earnest phoenix
#

What

#

That's a bot

#

serverlist command is forbidden

#

No?

hot portal
#

Can I post my bot's link?

earnest phoenix
#

Its forbidden yes, if you want to use it, make it owner only

#

In my case I input a command and it outputs to the console

#

Nobody else sees the console

hot portal
#

Can I post my bot's link? (Again asking.)

earnest phoenix
#

Okay

hot portal
#

Yes or no?

earnest phoenix
#

NO

hot portal
#

If you said okay, then no, then what is it?!

earnest phoenix
#

No

#

You have to wait for your bot approval like everyone else, anyway no one can see your bot page except you during the approval time

#

He okayed to me

hot portal
#

I'm gonna check

earnest phoenix
#

I said okay for Ricochet quel_con

hot portal
#

I said I'm gonna check the approval.

earnest phoenix
#

What does that even mean

hot portal
#

No.

#

It's not visible.

earnest phoenix
#

there's no timer or ETA for it lol

#

Basically wait a week

#

And pray

#

I have wait 2 weeks πŸ˜„

#

I had to wait a bit under a week luckily

hot portal
#

Why this server is so active?

earnest phoenix
#

But yeah some of us are less fortunate

indigo geyser
#

Cause it's good

earnest phoenix
#

It has 70k members lol

earnest phoenix
#

How do I add a picture to a long description?

quartz kindle
#

with html

#

the image needs to be hosted somewhere, so you can link it

#

if you dont want to host it anywhere, you can use base64

earnest phoenix
#

With what code can I do this?

faint bridge
#

html

quartz kindle
#

google html images

earnest phoenix
#

Okay thanks πŸ˜„

spark kelp
#

my bot have 200 servers rn and it makes average 300mb memory usage how can i reduce memory usage and what is sharding is that helpfull ?

west spoke
#

Sharing separates the servers onto different areas, I guess. Though using it is a bit more difficult.

earnest phoenix
#

sharding is irrelevant until you get to 2k

#

enforced at 2.5k

amber fractal
#

if you use 300mb at 200 servers something is wrong

#

unless you do music

#

or something really intensive

#

My bot was in 1000 guilds and used 300mb

quartz kindle
#

Thats djs caching for you

#

Assuming hes using djs

#

Also, this server has 70k members. This server alone is worth hundreds of normal servers in terms of memory usage

#

This server alone is literally one third of my bot's 1600 servers

shy thistle
#

hi

#

how do i make it in html

#

that the image is clickable

#

and it gives you a link

#

wait no

#

this is wrong channel

#

ok bye

west spoke
#

actually

#

@shy thistleright channel

#

<a href="link"><img src="image url"></a>

quartz kindle
#

Or onclick, or img.addEventListener

topaz fjord
#

I don't see a reason to use jQuery/js for something simple

quartz kindle
#

Its Not jquery

#

But yes,theres no need for js

#

Just laying down the options lul

topaz fjord
#

I'm proud of myself

#

I used gh actions to auto deploy whenever website updates

shy thistle
#

@west spoke ty

west spoke
#

Yw

#

I do that for some things on my bot page

stray garnet
#

How can i track how much an Server got Boosted?

earnest phoenix
#

@stray garnet What lang? kermitworried

stray garnet
#

Js

#

@earnest phoenix

earnest phoenix
#

Oh jeez, i'm using only py but I use server_boosts = message.guild.premium_subscription_count for py so js should be likewise

stray garnet
#

hm well i try edit it

hollow saddle
#

@stray garnet

earnest phoenix
#

Yea looked into a bit, @hollow saddle is more accurate.

stray garnet
#

Fuck im 11.5.1 @hollow saddle

#

It won't work i guess

hollow saddle
#

No it won’t, but you could upgrade to master if you really want it

stray garnet
#

Rewriting the whole bot :(

hollow saddle
#

Not the entirety of it but yeah, it’s a pain since it’s such a big jump from v11

stray garnet
#

Yeah

#

also uh .setColor() is not working for me @hollow saddle

#

can you help me

hollow saddle
#

Are you using it on an embed

stray garnet
#

Yes

#

Well it keeps at every Hex Color i Put in its Grey

#

@hollow saddle

mossy vine
#

code?

hollow saddle
#

^

stray garnet
#

@mossy vine @hollow saddle

mossy vine
#

thats not how setColor works iirc

#

try without the #

stray garnet
#

oof ty

coarse patrol
#

bot.on("guildCreate", guild => {
console.log(New guild joined: ${guild.name} (id: ${guild.id}). This guild has ${guild.memberCount} members!);
bot.user.setActivity(over ${bot.guilds.size} servers, .help, { type: 'WATCHING'});
This takes a while for it to register when it joins a new server.
How do I decrease the time for it to register?

tired mulch
#

Anyone know what to do about the high lighted part of my code? When I say Hello(in all caps) to my bot it does not respond

mossy vine
#
  1. reset your token, you just leaked it
#
  1. try console.logging msg.content
tired mulch
#

oh

#

Yeah I reset it now

#

And thank you.

quartz kindle
#

@coarse patrol a bot can only change its presence 5 times per minute

#

so its not a good idea to do that in the first place

coarse patrol
#

It got kicked from a server 10 minutes ago yet it doesn't change.

quartz kindle
#

well, you need to do the same on the guildDelete event

#

but its much better to do it on an interval

west spoke
#

^

earnest phoenix
west spoke
faint bridge
#

noice

west spoke
#

that's on server side

#

Nothing you can do about it

earnest phoenix
#

So it’s broken?

#

I’m guessing discord sever share is broken now

west spoke
#

no

#

that's our website, not discord.

earnest phoenix
#

Oh well I used a different sever share and it worked perfectly fine goodbye

late hill
#

Are we allowed to use the discord logo

#

Like on a website for the bot πŸ‘€

earnest phoenix
#

yes

late hill
#

oh

#

we're keen on keeping things quality so if you're gonna use our art for something please keep it tasteful and send it our way for approval.

#

Should I do that then

earnest phoenix
#

Why?

mossy vine
#

awaiting the promise might tell you more

earnest phoenix
#

Okay

knotty steeple
#

what is that unicode name

earnest phoenix
#

1

#

message.guild.createChannel("1")

knotty steeple
#

not what i was asking but ok

earnest phoenix
#

Oh

mossy vine
#

what is the response if you await the promsie

earnest phoenix
#
{ DiscordAPIError: Invalid Form Body
type: Value "text" is not int.
    at item.request.gen.end (/media/root2/ER/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15)
    at then (/media/root2/ER/node_modules/discord.js/node_modules/snekfetch/src/index.js:215:21)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  name: 'DiscordAPIError',
  message: 'Invalid Form Body\ntype: Value "text" is not int.',
  path: '/api/v7/guilds/599617087165563015/channels',
  code: 50035,
  method: 'POST' }
#

I have this

#

πŸ€”

quartz kindle
#

read the docs lol

mossy vine
#

yeah you cant use numbers in channel names

earnest phoenix
#

But before that it worked.....

mossy vine
#

wait nvm you can

earnest phoenix
#

Oh

#

Even with letters only, it doesn't work.

#

It's good

#

message.guild.createChannel(arg)
=>
message.guild.createChannel(arg, { type: 'text' })
My forget

quartz kindle
#

it actually seems to be a bug lol

#

yup, its a bug in d.js stable

#
type: type ? Constants.ChannelTypes[type.toUpperCase()] : 'text',```