#development

1 messages · Page 903 of 1

green vale
#

But otherwise that should work

surreal notch
#

Yes

earnest phoenix
surreal notch
#

@earnest phoenixbut where to paste it

earnest phoenix
surreal notch
earnest phoenix
#

on permission overwrites

surreal notch
#

Ok

earnest phoenix
#

now on edit events

#

A good way to check is to have it logged

green vale
#

Hm

#

Actually, I just thought of a simpler solution

earnest phoenix
#

oh great, hope it works

green vale
#

thanks

earnest phoenix
royal portal
#

How do I check if a channel exists

#

and if it does, send a message

#

and if it doesnt, send another message saying it doesnt

#

Because I get 'undefined' when a channel exists

nocturne grove
#
if (guild.channels.cache.find(c => c.name == yourChannelName)) {
// channel exists
}```
royal portal
#

but without an ID

nocturne grove
#

Ow

royal portal
earnest phoenix
#

find

nocturne grove
#

Okay let me change it

royal portal
#

if (guild.channels.cache.find("general")) {
// channel exists
}

#

I think

nocturne grove
#

No that does not work

#

Find needs a structure like in my edit

royal portal
#

how about elseif

#

so else if channel doesn't exist, send a message

#

example: if channel doesnt exist, say it doesnt exist and if it does, say it does

nocturne grove
#

Just add an

else {
// do something
}``` underneath
royal portal
#
if (guild.channels.cache.find(c => c.name == yourChannelName)) {
message.channel.send("exists")
}

else {
message.channel.send("doesn't exist")
}
}
nocturne grove
#

Yes. But now it sends both in the channel you executed a certain command

#

= message.channel

royal portal
#

so like

#
if (command === "test") {
if (guild.channels.cache.find(c => c.name == general)) {
message.channel.send("exists")

else {
message.channel.send("doesn't exist")
}
}
});
nocturne grove
#

Yes that will work. But it won't send the "exists" in the channel you found. And make sure to define yourChannelName, of course

royal portal
#

but wont it send 'exists' in the channel because the person said the cmd?

nocturne grove
#

No because you send the "exists" message in the message.channel. That is the channel where the command message was sent

royal portal
#

so if user says test in the channel they are in, it will say 'exists' if it exists

#

and 'doesn't exist' if it doesnt

nocturne grove
#

Yes

royal portal
#

alright

#

thx

nocturne grove
#

No not now

#

It depends on what the yourChannelName is

royal portal
#

i've set it as general

#

do I need to put it in ""

nocturne grove
#

Yes, but that's a string

#

Yup ^

royal portal
#

alright

#

so it would end like this

#
if (command === "test") {
if (guild.channels.cache.find(c => c.name == "general")) {
message.channel.send("exists")

else {
message.channel.send("doesn't exist")
}
}
});
nocturne grove
#

Yes

royal portal
#

👍

nocturne grove
#

Now you have a command "test" that will say if the general channel exists

#

Do you want it to be case insensitive?

royal portal
#

I already got that set

#

its above all my commands

nocturne grove
#

I mean the "general" thing

royal portal
#

oh

#

yes

nocturne grove
#

I guess precreated channels are called "General"

royal portal
#

so only lower case

nocturne grove
#

Yes

royal portal
#

would it be "general"

#

so if its upper case then it will say doesnt exist

nocturne grove
#

I guess precreated channels are called "General"
@nocturne grove nvm this is not true

#

Yes now it does that

royal portal
#

alright

#

testing it

nocturne grove
#

Oh no I mean you should check if the channel name toLowerCase() is "general"

royal portal
#

ah

nocturne grove
#

Because "general" == "General" returns false

royal portal
#

args shift toLowerCase() ?

nocturne grove
#

We aren't using an arg for a channel name, or do we?

#

And that is the command name. So it will also execute the command if you send it like "TeST"

#
if (command === "test") {
if (guild.channels.cache.find(c => **c.name** == "general")) {
message.channel.send("exists")

else {
message.channel.send("doesn't exist")
}
}
});

This

#

See the bold part

royal portal
#

I have it set so it works with uppercase and lowercase

#

so its fine if they send like that

nocturne grove
#

Yes nice. But that's not what I mean

#

If "general" doesnt exist but "General" does, it will say it doesn't exist now. Do you want it like that?

royal portal
#

oh now I understand

#

yes like that

#

but lowercase

#

so "General" wont work but "general" will

nocturne grove
#

yes

royal portal
#

so would it be

#
if (command === "test") {
if (message.guild.channels.cache.find(c => c.name.toLowerCase() == "general")) {
message.channel.send("exists")

else {
message.channel.send("doesn't exist")
}
}
});
nocturne grove
#

yes right 👌

royal portal
#

alr

nocturne grove
#

is guild defined btw?

royal portal
#

like that?

#

i edited it

nocturne grove
#

yes that's better

royal portal
#

Works 👍 thank you

nocturne grove
#

no problem

earnest phoenix
#

v

#

my bot works

#

but commands

#

wont register

nocturne grove
#

show code

#

btw, you mean the commands cannot be used?

tight plinth
#

show code yea

earnest phoenix
#

yes

#

i do +help

#

nothing happens

royal portal
#

@nocturne grove how would I make an embed in } else

#

because I've made one where the channel exists

#

and it sends an embed

#

but if channel doesnt exist, the embed which says it doesnt won't work

nocturne grove
#

@royal portal show it please

royal portal
#

ok

nocturne grove
#

nothing happens
@earnest phoenix 🤷

#

and ping me again pls then

royal portal
#

me?

nocturne grove
#

yes otherwise I'll forget probably

#

euhh me, I mean

royal portal
#
if (command === "test") {
if (message.guild.channels.cache.find(c => c.name.toLowerCase() == "general")) {
const embed = new Discord.MessageEmbed()
.setTitle("Exists")
.setDescription("exists")
message.channel.send(embed).catch(console.error);

} else
const embed = new Discord.MessageEmbed()
.setTitle("Error")
.setDescription("doesnt exist")
message.channel.send(embed).catch(console.error);
}
}
});
#

@nocturne grove

#

the error is the const part

#

near } else

nocturne grove
#

hmm

#

you're missing { after else

cloud storm
#

} else {

royal portal
#

that gives me tons of errors

#

unexpected token ')'

#

oh I forgot }

#

two of them

vivid crescent
#

lol

cloud storm
#

One clear }

royal portal
#

works now epic

vivid crescent
#

Have you formatted your code? (It'll be easier to find syntax issues if it's formatted)

nocturne grove
#

works now epic
@royal portal 👍

royal portal
#

but i fixed it now

#

lol

nocturne grove
#

or install eslint

#

pretty handy

royal portal
#

also how do you make it so

cloud storm
#
if (command === "test") {
if (message.guild.channels.cache.find(c => c.name.toLowerCase() == "general")) {
const embed = new Discord.MessageEmbed()
.setTitle("Exists")
.setDescription("exists")
message.channel.send(embed).catch(console.error);

} else{
const embed = new Discord.MessageEmbed()
.setTitle("Error")
.setDescription("doesnt exist")
message.channel.send(embed).catch(console.error);
}
 }
#

@royal portal

royal portal
#

yeah i did that

#

it works

#

now im trying to do args[0]

#

so if(args[0] === 'two') {

#

but that only works on lowercase

#

not uppercase like tWo

summer torrent
nocturne grove
#

not uppercase like tWo
@royal portal then compare it with the args set to lower case

royal portal
#

if(args[0].toLowerCase() === 'two') {

nocturne grove
#

yes

royal portal
#

well I'm trying to make it so you can say it with upper case or without

nocturne grove
#

yes that will solve it ^

royal portal
#

alr

#

testing

nocturne grove
#

👍

royal portal
#

@nocturne grove so in my args I have 'two'

#

so I can do 'help two'

nocturne grove
#

an arg is normally just one word

royal portal
#

but then if I do 'help ' it will say cannot read property 'toLowerCase' of undefined

nocturne grove
#

ohh yes the command name is help

royal portal
#

but if I add a space after it

#

it gives error

nocturne grove
#

then check if(args[0] && args[0].toLowerCase() == 'two)

rotund lantern
#

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

module.exports = {
komut: "ping",
açıklama: "Botun pingini ölçer.",
kategori: "genel",
alternatifler: ['ping','p','gecikmesüresi'],
kullanım: "!ping",
yetki: '',
};

module.exports.baslat = (client, message) => {
//mesaj gönderme
message.channel.send(new Discord.RichEmbed()
.setDescription("Botun ping değeri aşağı satırlarda gösterilmektedir.")
.setColor("RANDOM")
.setTitle("Ping Ölçüm tablosu")
.addField("Botun gecikme süresi:", Math.round(client.ping) + " MS", true)
.addField("Botun gecikme süresi tanımı",'Bu ayar sizin değil sunucunun pingidir',true)
.setFooter("Bu bir bitiş açıklaması")
.setTimestamp()
.setAuthor(message.author.username,message.author.avatarURL)
.setThumbnail("https://images-ext-2.discordapp.net/external/DRZcof68F0ishEiw6EkiEouhDj3b74rxucmfEMSch6c/http/wttr.in/kayseri_0tqp_lang%3Dtr.png?width=177&height=114")
.setImage("https://images-ext-2.discordapp.net/external/DRZcof68F0ishEiw6EkiEouhDj3b74rxucmfEMSch6c/http/wttr.in/kayseri_0tqp_lang%3Dtr.png?width=177&height=114"))
};

royal portal
#

@nocturne grove works thank you

rotund lantern
#

whats problem

summer torrent
#

???

nocturne grove
#

np

summer torrent
#

@rotund lantern catch error and log it to console

rotund lantern
#

oky

summer torrent
#

read the error

rotund lantern
#

ı read it but ı dont understand

#

(node:13296) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message
at C:\Users\bedia\OneDrive\Masaüstü\MaTeMaTiK\MaTeMa\bot\node_modules\discordjs-advanced\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:85:15
at C:\Users\bedia\OneDrive\Masaüstü\MaTeMaTiK\MaTeMa\bot\node_modules\snekfetch\src\index.js:215:21
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:13296) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:13296) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

earnest phoenix
#

it says what it says

#

you're trying to send an empty message

rotund lantern
#

no

#

can you see my code

earnest phoenix
#

🌈 reading comprehension 🌈

#

sure

rotund lantern
#

my goal was to convert the ping command into an embed message

earnest phoenix
#

make the embed a seperate variable

rotund lantern
#

how?? can you help me @earnest phoenix

earnest phoenix
#

like just do

const embed = new Discord.RichEmbed()
.setDescription("Your Stuff")
// etc

and in the end, just use that embed const in your message.channel.send

frozen valve
#

guys anyone can tell me the command to know my bot position in queue?

royal portal
#

nope

#

i dont think it is a command here

earnest phoenix
#

your queue placement is confidential

#

nobody except the mods know it

stuck scaffold
rotund lantern
#

you must Resize

stuck scaffold
#

?

stuck hatch
#

my botdeloper rol pls

#

my creat bot

slender thistle
#

-faq 2

gilded plankBOT
earnest phoenix
#

oop luca died

#

nvm

rotund lantern
#

(=

#

can you help it has a problem

#

it doesn't work when I write the code

#

in discord

earnest phoenix
#

you gotta actually send the embed too

rotund lantern
#

what

#

ı dont understand

#

can you help me

#

@earnest phoenix

earnest phoenix
#

what's the error when you try to run it?

rotund lantern
#

dont give error

#

but dont run it

#

oh wait

#

an eeror

#

wait

earnest phoenix
#

oh yeah, message.channel.send is it

rotund lantern
earnest phoenix
#

yeah its message.channel.send

rotund lantern
#

but ı can message.channel.send and it dosnt run

#

see wait

#

no

#

dont run

earnest phoenix
#

whats the error there?

rotund lantern
#

error

earnest phoenix
rotund lantern
#

oh

#

it dosnt run

copper fog
#

Is there a fast way to make every text in css white?

#

I don't want to manually set all the text to whitr

rotund lantern
#

can you write a code for me @earnest phoenix plzzz

summer torrent
rotund lantern
#

it dosnt run

earnest phoenix
#

nope, no spoonfeeding

#

plus, i dont know shit about javascript, i just like to read up the docs and kinda understand it

rotund lantern
split hazel
#

We aren't developers at your disposal

summer torrent
#

read the error

rotund lantern
#

hm ok

#

can you help me @summer torrent

summer torrent
#

read the error
@summer torrent

earnest phoenix
#

read the error

rotund lantern
#

what the fuck of this code

summer torrent
#

"already been declared"

rotund lantern
#

what is this mean

earnest phoenix
#

read the error

#

means the const already exists

copper fog
#

Anyone can answer my question? :<

earnest phoenix
#

sec

#

are you talking about your bot page?

copper fog
#

No

#

My website

earnest phoenix
#

actual website, alright

#

using css would be useful

copper fog
#

I'm currently using css too

rotund lantern
#

hm oky ı corretc

#

but now

#

@earnest phoenix

summer torrent
#

🤦‍♂️

split hazel
#

I mean its another self explanatory error

rotund lantern
#

)=

#

ı dont understand code

#

can you help

summer torrent
#

why you need "coins.json" on ping command

rotund lantern
#

why?

#

ı dont know

pale vessel
#

if you don't understand the code, you shouldn't code these stuff. learn from the beginning and start from there.

rotund lantern
#

how can I learn

#

can you help

honest perch
#

Youtube

pale vessel
#

do not

honest perch
#

There's a site called google

pale vessel
#

stop giving them bad sources

rotund lantern
#

hm

earnest phoenix
#

thats where i get my informations

honest perch
#

An idiots guide is also a good one

earnest phoenix
#

outdated tho

#

the discordjs is up to date

rotund lantern
#

hm

#

but my version is 15.1.1

#

on the code

pale vessel
#

he needs to learn js

rotund lantern
#

yeah

summer torrent
#

15.1.1 ?

pale vessel
#

and then d.js

honest perch
#

Djs v15, this person is in the future

earnest phoenix
#

this stuff is also useful

rotund lantern
#

I do not know English much

#

beacuse ı am türkish

split hazel
#

I'd recommend codecadamy (i believe the javascript course is free)

rotund lantern
#

@split hazel thank you

pale vessel
#

avatar is undefined

rotund lantern
#

but it isnt free

summer torrent
#

try avatarURL({type:"png"})

#

because avatarURL() is webp

earnest phoenix
#

@rotund lantern it is a great way to learn it though

stuck scaffold
#

uh thx

pale vessel
#

isn't it format?

summer torrent
#

ah yes

earnest phoenix
#

well we'll see if they come back

copper fog
#

Anyone can help me with CSS?

earnest phoenix
#

what do you need?

earnest phoenix
#

are you using <p> in your html?

#

or something elseß

copper fog
#

<p>

earnest phoenix
copper fog
#

Hm

#

Alright

#

I'll try checking it

true ravine
#

Is there a property in Djs that tells you whether the bot can DM a certain user?

pale vessel
#

user.dmable

#

jk

#

just use catch after .send()

#

.send().catch(err => { cannot send });

true ravine
#

Oh right okay thank you, that's what I'm doing at the moment I just wondered if there was a more efficient way

#

Yeah thank you

pale vessel
#

np

earnest phoenix
#

user.dmable would be quite useful tho ngl

true ravine
#

Yeah tru

#

If I did .createDM().then(), if the then bit was fired does that mean they're dmable or not?

pale vessel
#

yes

#

but you need .catch also

#

i think

#

you can test it out for yourself

true ravine
#

Yeah I'm trying to upgrade my function that finds a channel where a user can be contacted, so I already have some of the stuff in place

copper fog
#

I want to trigger a style tag in css in button onclick

#

When the button is clicked all the text on the page will be red

#

How can I do this?

earnest phoenix
robust moth
pale vessel
#

well yeah

#

you don't own a bot yet

earnest phoenix
#

anyone used postgresql on heroku? or use pgAdmin
and know where i can view my perms?

#

How do I get the server count across all shards? I am using Eris, eris-sharder and eris-additions.

#

can anyone give me some feedback on my bot?

#

Nope, unfortunately not

surreal notch
#

What i have to do if i want to donate my bot coins to another person

#

or give him

split hazel
#

Not sure what you're using, but general idea is subtract the amount of coins you want to give from yourself, and add that amount onto the other user

surreal notch
#

@split hazel but how

#

can we talk in dm

#

nd i m using discord.js v12 not cmd handler

split hazel
#

You figure that out, we can give you general advice, but can't spoonfeed you. You need a database to hold that information

surreal notch
#

Ah

split hazel
lyric hawk
#

Hi, I have a problem with discord.py. When a member joins, I autorole them, but sometimes I get discord.errors.NotFound: 404 Not Found (error code: 10007): Unknown Member

#

Though the member variable is in the event itself

#

So I don't get it

split hazel
#

Could you show some code?

lyric hawk
#

Sure

#
@client.event
async def on_member_join(member):
    joined_guild = member.guild
    verified = joined_guild.get_role(get_ver_role(joined_guild.id))
    await member.add_roles(verified)
    await member.send("**:white_check_mark: Added autorole!**")
#

Is it related to cache or something?

#

I mean how can the member be unknown if they just joined

slender thistle
#

Print verified

lyric hawk
#

It's a role object that is valid

#

Not None

#

And as I said it works like 19 times in 20

#

It just happens for some members

#

Super weird

earnest phoenix
#

how to make a boat create a channel if there is no one with this name

#

well, how about more informations?

#

what library are you using, what language?

#

better yet, more context would be useful.

#

@earnest phoenix node.js

#

and what library?

#

discord.js v 11.5.1

#

i want to make something like this

#

if(!logchannel) then create dthe channel

nocturne grove
#

well now convert what you said to some JS code

#

if(!logchannel) then create dthe channel
= js if (!logChannel) { guild.channels.create(channelName); }

true ravine
#

If I try to filter an array of objects but that array is empty, will it throw an error or will it just return the same empty array?

#

(js)

nocturne grove
#

I guess the second, but just try it and see 😉

#

don't believe my guess

true ravine
#

Don't really have an easy way to, hence asking lul

nocturne grove
#

okay I will do it for you 😅

true ravine
#

Cheers

surreal notch
#

message.channel.send(`You have ${cdata} coins`)

#

How to embed this statement

earnest phoenix
#

we ain't spoonfeeding here GWossuKannaSip

surreal notch
#

message.channel.send(embed) = text

#

Like this?

nocturne grove
#

@true ravine js const arr = []; console.log(arr.filter(element => element.startsWith('idk'))); // => []

earnest phoenix
#

@surreal notch read the topic from discordjs i sent

true ravine
#

Tyvm @nocturne grove

nocturne grove
#

no, read the link Hope sent

#

np

surreal notch
#

Ok

true ravine
#

Why are so many people alergic to reading lul

nocturne grove
#

haha

true ravine
#

More people are infected with that than covid 19

earnest phoenix
#

we had someone back then who didn't even bother reading what we said

true ravine
#

Oof

surreal notch
nocturne grove
#

lol

#

but reading docs is so informative

true ravine
#

I read the docs for my bedtime story ngl

nocturne grove
#

you will see things like "ow I could've used that too, is much easier"

#

🤣

earnest phoenix
#

like you could spare asking if you would just do one single google search

surreal notch
earnest phoenix
#

thats why it is always useful to have docs open in the background

nocturne grove
#

yeah

#

or just logging an object. You'll see new properties and understand the whole thing of objects. At least for me

#

but sometimes that makes me confused, for example:
logging a user won't log a property tag, but it does exist

true ravine
#

Interesting

surreal notch
#

whenever I edit my codes my cooldown reseted why?

nocturne grove
#
User {
  id: '481031493490049044',
  bot: false,
  username: 'Menno',
  discriminator: '0985',
  avatar: '2f74ed1ca3a11879b6058fba918c5f1e',
  lastMessageID: null,
  lastMessageChannelID: null
}``` this is my user object
#

whenever I edit my codes my cooldown reseted why?
@surreal notch do you have very long cooldowns? Or just a couple of seconds?

surreal notch
#

6 hrs

#

just

nocturne grove
#

are the cooldowns stored in a Discord collection?

surreal notch
#

i have used quick.db

nocturne grove
#

oh okay so the cooldowns are stored somewhere when your bot is turned off?

surreal notch
#

no

#

in main file only

nocturne grove
#

well that's the problem

surreal notch
#

then what i have to do

nocturne grove
#

your bot can't remember all its data when it goes offline

#

using a database for that

untold dome
#

so I'm trying to post guild count to top.gg using a task with:
await self.dblpy.post_guild_count(shard_count=len(self.bot.total_shards), shard_no=shard_number
I get no error messages, but the guild count doesn't change on the website

#

tried to manually do that as well, same thing

surreal notch
#

@nocturne grove so now

earnest phoenix
#
  if(!logchannel) {
    guild.channels.create('bot-logs')
  }
  .then(console.log)
  .catch(console.error);
                       

Why i got an erorr ( unexpected token ) at .then and .catch ?

nocturne grove
#

@untold dome you can only post it every 15 minutes, maybe that's the problem. But I don't know discord.py well. Btw, you should use #topgg-api

#

@surreal notch you should use a database or delete the cooldowns

untold dome
#

I try to post it every 30 minutes

nocturne grove
#

@earnest phoenix you should use the .catch and .then after .create(), but inside the if-statement

earnest phoenix
#

oh

#

ok

surreal notch
#

@nocturne grove How to use data base

nocturne grove
#

hm okay

#

I'd suggest you first find out what kind of database you'd like

earnest phoenix
#

How to define guild? =))

surreal notch
#

frm where

nocturne grove
#

How to define guild? =))
@earnest phoenix when does your code get executed? By a user command, when a member joins etc.?

#

frm where
@surreal notch internet

earnest phoenix
#

user command

nocturne grove
#

then it's message.guild

surreal notch
#

what should i google

nocturne grove
#

many things have a guild property: message.guild, role.guild, member.guild, channel.guild

#

Do I really have to explain you how to use Google?

surreal notch
#

no

#

what should i write in google

#

best database ?

nocturne grove
#

yes, something like that. Maybe add js or node.js

surreal notch
#

ok

modest maple
#

That's very subjective

#

There is no single best databade

#

Base*

idle schooner
#

omg wtf

#

how do i know when they are gonna review my bot

#

lol

slender thistle
#

-faq 2

gilded plankBOT
nocturne grove
#

well you can't know if you just submitted it. But you can in theory see when your bot joins the verification server

slender thistle
#

Also wrong channel

idle schooner
#

i don't have my bot hosted

#

oof im not applying again lol

earnest phoenix
#

let image = client.users.get("id").avatarURL

(node:9098) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'avatarURL' of undefined

#

i made a new bot and i put this on the ready event

nocturne grove
#

@earnest phoenix it's avatarURL() or displayAvatarURL()

#

And are you using D.js v12?

earnest phoenix
#

it worked on a command

#

v11

nocturne grove
#

hmm

earnest phoenix
#

it doesnt work on a ready event tho

nocturne grove
#

but what id are you using in the ready event?

earnest phoenix
#

same id the user has

neat harness
#

Guys, I'm getting Error 5xx, help?

Quoting Discord Dev Documentation:

5xx (SERVER ERROR) | The server had an error processing your request (these are rare).

nocturne grove
#

same id the user has
@earnest phoenix which user? Client user?

#

@neat harness I'm sorry idk so I can't help you

#

try googling it

earnest phoenix
#

its ok i got it

#

the user left the server
f

nocturne grove
#

okay

#

oh oof

#

Does anyone know where to put a css file when I'm editing my bot's page on top.gg?

neat harness
#

Damn, my CPU usage jumped to 40% trying to connect

#

Does anyone know where to put a css file when I'm editing my bot's page on top.gg?
@nocturne grove Yeah

nocturne grove
#

wow

#

oh nice

neat harness
#

In the description

#

the long description

#

Just directly insert the css there, EDIT: add <style> and </style> before and after the css

slender thistle
#

style tag

neat harness
#

like .nav {display: none}

nocturne grove
#

wait... is that automatically linked to the html? I'm used to have seperate files and linking them, fyi

neat harness
#

Yes, its directly linked

nocturne grove
#

oh awesome, thanks

neat harness
#

@slender thistle Do I need to report to Discord that I'm getting Error 520, or should I just let it be?

unreal pike
#

hi

slender thistle
#

You're getting that from Discord?

neat harness
#

My bot can't connect, Error 520

slender thistle
#

Maybe just let it be for an hour catshrug

neat harness
#
(node:17923) UnhandledPromiseRejectionWarning: Request failed. Status code: 522
(node:17923) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:17923) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
#

It's error 5xx

#

5xx (SERVER ERROR) | The server had an error processing your request (these are rare).

#

So says discord

nocturne grove
#

that's really strange tho

heavy marsh
#

How can I fetch an invite or invites from a paragraph using v 11.4.8

if(new RegExp("(https?:\/\/)?(www\.)?(discord\.(gg|io|me|li)|discordapp\.com\/invite)\/.+[a-zA-Z0-9]").test(message.content)) {

client.fetchInvite(<What To Add Here Smsh>).then(invite => console.log(`Obtained invite with code: ${invite.code}`)

return;

});
quartz kindle
#

520 is cloudflare

neat harness
#

It's 5xx as stated by Discord

quartz kindle
#

522 Connection Timed Out
Cloudflare could not negotiate a TCP handshake with the origin server.

neat harness
#

Hmm... I don't know anyway, never got this error

quartz kindle
#

ive never seen it either

neat harness
#

My CPU's acting up trying to reconnect every 5 secs or smlt

nocturne grove
#

@heavy marsh about your "what to add here smsh", according to the docs an invite object

heavy marsh
#

Yep but how to get it using reg

#

Ok nvm found it

nocturne grove
#

hmm

quartz kindle
#

@neat harness which library are you using?

nocturne grove
#

weird, it's not in the docs => nvm

neat harness
#

@neat harness which library are you using?
@quartz kindle Discord.js v12.12.0

nocturne grove
#

nvm

quartz kindle
#

try logging the debug event

neat harness
#

I don't know what's going on, but I'm getting this in my console

quartz kindle
#
client.on("debug", console.log)```
neat harness
#

k lemme try

#

Nope, didn't even reach as far as to turn on

quartz kindle
#

are you doing an http request yourself before starting the discord client?

neat harness
#

I think so

quartz kindle
#

show your index.js

neat harness
#
//Locator and Link + Configuration
const fs = require("fs");
const Discord = require("discord.js");
const client = new Discord.Client({fetchAllMembers: true});
const config = require("./config.json");
const fetch = require('node-fetch');
const DBL = require('dblapi.js');
const mongoose = require("mongoose");
mongoose.connect('mongodb+srv://<account>:<password>@arc-neko-gl57b.gcp.mongodb.net/test?retryWrites=true&w=majority', { useUnifiedTopology: true, useNewUrlParser: true });
const Profile = require("./models/profile.js")
const Guild = require("./models/guild.js")
const Channel = require("./models/channel.js")
const neko = require("./models/neko.json")
const clientneko = require('nekos.life');
const sfw = new clientneko();
slender thistle
#

That URL

split hazel
#

👀

neat harness
#

A sec, Imma check mongodb

quasi forge
#

So, I was trying use lavalink and was using this library called erela.js but in my lavalink side, I see the error: Exception in websocket connection, closing. Channel state is Websocket Channel is null java.lang.IllegalStateException: Failed to connect to wss://us-central11.discord.media/?v=4. Any suggestions where might I be messing up?

nocturne grove
#
<!DOCTYPE html>
<html>
<head>
  <style>
    .right {
        text-align: right;
    }
  </style>
</head>
<body>
some things
<a class = "right" href = "https://www.discord.gg/noAds">Join my support server!</button>
</body>
</html>

Why is this not working?

#

sorry I'm noob at this 😂

#

the link it not aligning right

neat harness
#

no need to add your html

#

just the <style>

nocturne grove
#

oh wait I've still </button> there

#

oh okay thanks. Will try

neat harness
#

it doesn't matter, adding your own html block will separate your css

quartz kindle
#

is that for your bot description in top.gg?

neat harness
#

Prob

nocturne grove
#

yes

quartz kindle
#

then remove html head and body

nocturne grove
#

body too? okay

quartz kindle
#

your description gets injected into the existing top.gg website, its not an independent page

neat harness
#

Also, @quartz kindle My MongoDB is properly connected it says

nocturne grove
#

hmm sounds obvious

#

but what's the place for my style sheet?

neat harness
#

Though it's odd that it's at 6 connections 🤔

nocturne grove
#

or only <style> and no <head> anymore?

neat harness
#

yes @nocturne grove

#

If you want, you can use <div>s

quartz kindle
#

@neat harness you will need to catch errors to see where the error comes from, look into adding .catch(console.log) to any connection or promise you may have. otherwise remove all those lines and re-add them one by one until you find which one is causing the error

nocturne grove
#

okay thanks. Will google that

neat harness
#

@neat harness you will need to catch errors to see where the error comes from, look into adding .catch(console.log) to any connection or promise you may have. otherwise remove all those lines and re-add them one by one until you find which one is causing the error
@quartz kindle Like I said, it didn't even turn on, it won't call client.on

nocturne grove
#

yes div works. Thanks!

quasi forge
quartz kindle
#

@neat harness i mean in places such as mongo.connect().catch()

#

or anything else that returns a promise

neat harness
#

Hmmm, lemme try

quartz kindle
#

because the error is coming from a promise

#

as its an unhandled promise rejection

neat harness
#

No error logged, it still shows error 520/522

#

You don't need to use png, just use the original format

#

yeah

nocturne grove
#

can anybody help me making a simple button with html/css?

#

even w3schools is not helping me

neat harness
#

this gives the same error @neat harness
@stuck scaffold Are you sure the issue's there?

#

can anybody help me making a simple button with html/css?
@nocturne grove ```html
<style>
.button {
position: relative;
background-color: #4CAF50;
border: none;
font-size: 28px;
color: #FFFFFF;
padding: 20px;
width: 200px;
text-align: center;
transition-duration: 0.4s;
text-decoration: none;
overflow: hidden;
cursor: pointer;
}

.button:after {
content: "";
background: #f1f1f1;
display: block;
position: absolute;
padding-top: 300%;
padding-left: 350%;
margin-left: -20px !important;
margin-top: -120%;
opacity: 0;
transition: all 0.8s
}

.button:active:after {
padding: 0;
margin: 0;
opacity: 1;
transition: 0s
}
</style>
<button class="button">Click Me</button>

nocturne grove
#

o wow thank you

neat harness
nocturne grove
#

oh but the thing I want is a link in it. And that didn't work

neat harness
#
<button class="button"><a href="" style="text-decoration:none">Click Me</a></button>
nocturne grove
#

owww a button is something around the link itself 🤦

#

thanks!

neat harness
#

@nocturne grove A better way'd be to decorate the link to the point that it looks like a button

nocturne grove
#

why is that better?

neat harness
#

Because it lets you have more control over the link, without limiting it to a button

nocturne grove
#

more control like markdown?

neat harness
#
<head>
<style>
menu li{list-style: none}
menu li a {text-decoration: none; color:#ffffff; padding: 0 36.7px; float:left; line-height: 50px }
menu li a:hover {background-color:#ffd700}
menu ul.2 li {list-style:none;}
</style>
<menu>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="index.html#About">About Us</a></li>
<li><a href="events.html">Events</a></li>
<li><a href="contact.html">Contact Us</a></li>
<li><a href="gallery.html">Gallery</a></li>
<li><a href="">AEC Courses</a></li>
</ul>
</menu>
</head>
#

I mean, more like designing it

cinder dove
#

why does this happen? (when i use !play dance monkey, the search result is completely different from what is supposed to be)

neat harness
#

Designing a button is pretty useless

#

why does this happen?
@cinder dove Because it probably has a different search system

nocturne grove
#

okay thanks @neat harness

cinder dove
#

But I use same youtube Api 🤔

nocturne grove
#

maybe it's in the yt description

cinder dove
#

it should be first result in search.

neat harness
#

MEE6 doesn't use YouTube I think

cinder dove
#

Oh

neat harness
#

Try searching it in youtube

nocturne grove
#

oh and btw, we're not the Mee6 support server in case you thought that

cinder dove
#

I searched it, Dance Monkey is pretty popular

#

I can't find anywhere BEST DANCES 2018

neat harness
#

Then it's probably because of a different API or you misconfigured the bot

cinder dove
#

The bot shouldn't have any problems.

#

Coded it pretty well. It should get the first result - and even if it doesn't get the first there are other 10000 results on dance monkey.

#

I get everything EXCEPT dance monkey which is weird.

neat harness
#

Probably API issues or idk

cinder dove
#

Ill try creating another account and use a new api

#

So weird smh

mossy vine
#

copyrighted content

neat harness
#

Agggh RIP my bot ||damn|| it

mossy vine
#

i have no idea what you are using in the backend but since ytdl cant get a stream from the first result (as its copyrighted and therefore protected content) it likely jumps to next result

neat harness
#

Prob

cinder dove
#

oh so how do I avoid that?

mossy vine
#

you dont

cinder dove
#

Well I do.

mossy vine
#

so if ur avoiding it whats the problem

cinder dove
#

I don't think mee6 bought licenses from every album ^^

#

I'm not, but I want to, and I'm not sure how.

neat harness
#

Good luck with that

cinder dove
#

ty

slender thistle
#
    for ($i = 1; $i <= $_POST['years']; $i++) {
        if ($i == 1) {
            $s = 100;
            $g = $s * 20;
        }
        else {
            $s = round($s + (5 / $s) * 100, 2);
            $g = round($g + (20 / $g) * 100, 2);
        }

5% of 100.5 is 5.025, but when $i is 2, it outputs only 105. Is it really float precision that's at fault here? nekothinking

neat harness
#

I really can't read this...

cinder dove
#

Apparently the issue is with simple-youtube-api module.

#

ytdl-core doesn't block copyrighted videos ^^

neat harness
#

Thought so, API error

cinder dove
#

made new api so seems like they just avoid those vids

#

why though :/

dusty onyx
#

yo, i’m having issues getting my bot to react to its own message (which is an embed) - my current code is
await message.add_reaction(message=“embed”, emoji=‘:thumbsup:’)

slender thistle
#

what is await

dusty onyx
#

copied it wrong, fixed

slender thistle
#

What's message

dusty onyx
#

ah, i’ve just realised that’s the wrong one to copy- one sec

#

hmm i think the problem is slightly different- nvm

slender thistle
#

Hold on why are you specifying message kwarg

dusty onyx
#

i hadn’t realised that i was copying the one that returned the wrong error- my actual code was await message.add_reaction(emoji=‘\U0001F44D’)

#

i specified message bc i was trying to adapt some code that i had already done w adding reacts

slender thistle
#

Maybe try :thumbsup:? catshrug

dusty onyx
#

it’s not the emoji that’s the problem, it’s which message it’s reacting to :(

slender thistle
#

Sounds like you might wanna print(message) 👀

dusty onyx
#

what exactly do you mean by that? :0

slender thistle
#

What does your code look like fully?

charred jetty
#

How to set user limit on vc with discord.js library?

dusty onyx
#

no

#

sorry give me a s e c

#

if message.content.startswith('£test'): eg = discord.Embed( description='Press the react to start! ', colour=0x008000 ) eg.set_author(name='test test') await message.channel.send(embed=eg) await message.add_reaction(emoji = "\U0001F44D")

#

there we go

slender thistle
#

.send returns the sent message soooo

wise quartz
#

Why can't my bot mention members? I tried {ctx.author.mention} and <@{ctx.author.ir}> and none worked it just returns with @raven kite or @undone maple ????

slender thistle
#
msg = blah.blah.blah.send(embed=eg)
await msg.reactetc(my_emoji='hehehaha')```
#

@wise quartz That's how mentions work

wise quartz
#

Huh?

slender thistle
#

It's your client that can't render users from the mentions

dusty onyx
#

ty shivaco, ill try that

wise quartz
#

But how?

#

It used to mention ppl before

#

python btw

slender thistle
#

Your client be like that catshrug

wise quartz
#

Huh.......

earnest phoenix
#

oh my bot's been fixed

wise quartz
#

How do i fix it then?....

slender thistle
#

It's not exactly an "issue"

#

It's just how Discord client's caching works

wise quartz
#

But i want it to mention them like that (@wise quartz)

#

Do i just wait and it'll be fixed or?

slender thistle
#

It will randomly fix itself

wise quartz
#

Alr then

#

I hope

#

Thanks for the help

runic kestrel
#

Hello

slender thistle
#

Nothing you can do to change it on your end catshrug

grizzled raven
#

what port speeds would a bot at idk 2k guilds need

#

or does it depend

earnest phoenix
#

?help

runic kestrel
#

My shards are loading everytime

#

Auto restarts

slender thistle
#

-botcommands @earnest phoenix

gilded plankBOT
#

@earnest phoenix

Hey! Bots aren't given permissions to send responses in this channel. Please use #commands or #265156322012561408 to run commands. In addition, bots with commonly used prefixes cannot read or send messages in any channel. This is done to prevent spam and bot abuse.

cursive laurel
#

So I set my bot to respond to a certain 2 character prefix, yet it responds to any 2 character prefix, does anyone know why?

grizzled raven
#

no we dont know why

#

show code please™️

earnest phoenix
#

anyone know how I would ignore every message execept my custom prefix and my globalPrefix

#

code

#
const Keyv = require('keyv');
const prefixes = new Keyv('not a mongodb');
const config = require('../config');
const globalPrefix = config.globalPrefix;
module.exports = {
    name: 'prefix',
    description: 'changes server-wide prefix',
    execute: async (message, args) => {
        const member = message.member;
        if (!message.member.hasPermission('MANAGE_GUILD')) {

            return message.channel.send("You can't use this command, You don't have the permission :sc1:")
        }
        if (args.length) {
            await prefixes.set(message.guild.id, args[0]);
            return message.channel.send(`Prefix Is Now \`${args[0]}\` :sc3:`);
        }

        return message.channel.send(`Prefix is \`${await prefixes.get(message.guild.id) || globalPrefix}\``);
    }
}```
#

here's the main file code```
const bot = new Discord.Client();
bot.commands = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(./commands/${file});
bot.commands.set(command.name, command);
}
bot.on('debug', console.log);
bot.once('ready', () => {
console.log('Bot Started With No Errors');
bot.user.setPresence({
activity: {
name: 'Crying Without Knowing Why | $chelp to Start'
},
status: 'online'
})

})

bot.on('message', async message => {
    if (message.author.bot) return;
    
    const args = message.content.slice(globalPrefix.length).split(/\s+/);
    const commandName = args.shift().toLowerCase();

    const command = bot.commands.get(commandName) ||
        bot.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName));


    if (message.content.startsWith(globalPrefix)) {
        prefix = globalPrefix;
    } else {

        const guildPrefix = await prefixes.get(message.guild.id);
        if (message.content.startsWith(guildPrefix)) prefix = guildPrefix;
      
        if (!message.content.startsWith(globalPrefix, 0)) return;
    }
    try {
        command.execute(message, args);
    } catch (error) {
        console.error(error);
        message.channel.send('there was an error trying to execute that command!');
        if (typeof execute !== 'undefined') {}
    }
})
grizzled raven
#

what port speeds would a bot at, idk, 2k guilds need?
or does it depend

quartz kindle
#

port speeds?

#

you mean bandwidth / download / upload speed??

#

@earnest phoenix you need to return if the message doesnt start with one of the prefixes

#

you're not returning correctly

maiden mauve
#

sometimes js is confusing

#

I haven't touched this function in months

#

and there is a word just sitting in the middle of it

#

that the compiler ignores

quartz kindle
#

lmao

hollow prawn
#

ikr I probs shouldn't ask this, but I would like someone advanced/proficient to check this code before I run it to know if there will be an error or not
https://sourceb.in/e8a2646976
this is ran when the bot is ready and the goal is to get all guilds that have the muterole based on ID, then check each channel in those guilds and fix the permissions by nullifying perms like SEND_MESSAGES in a voice channel, while checking if it is disabled and disabling if it is not SPEAK in it, etc..
On top of that it should somewhat be limited by the setTimeout so it doesnt instantly spam-out the API with everything
for most things I'm fine with testing, but this one i'm a little bit scared as I had already started it once (much lesser code and I think I overspammed the API, so i'm a bit uneasy and BlobFearSweat )
also @hollow prawn when you give reply

quartz kindle
#

how many guilds?

#

@hollow prawn

#

if you have 100 guilds, with about 10 channels each

#

that code will run through all 1000 channels in the span of 10 seconds

vivid crescent
#

discord will yeet your account lol

#

Better a good idea to just tell the owner to set the permissions, or set the permissions of the channel category

quartz kindle
#

it wont necessarily send 1000 requests, as it will only make requests to channels whose permissions are wrong

#

but still, thats the wrong way to approach the problem

vivid crescent
#

Guild owners should kinda know how to set mute perms imo

quartz kindle
#

the proper way to do loop like that is to use a for loop with async await syntax

hollow prawn
#

@quartz kindle 5 guilds about 100 channels or so, I did it random set timeout between 1 and 10s so it doesn't do all, I just wanna know that the coding would do it as I'm not sure about the { prm: null } or { prm: false} or { prm: true }

quartz kindle
#

the problem is that the random timeout wont do much

earnest phoenix
#

@quartz kindle wym I didn't return correctly

quartz kindle
#

at that size its not gonna be a problem, but its not an ideal solution for scaling

#

the loops do not wait for each other to complete, the timeouts are all executed concurrently

hollow prawn
#

I could increase the timeout to 60k MS so then it'd be even more random, would await do it better? if yes where would I put await?

grizzled raven
#

@quartz kindle yeah down/up speeds

quartz kindle
#
for(let [id,guild] of client.guilds) {
  for(let [id,channel] of guild.channels) {
    if(permissions are wrong) {
      await channel.updateOverwrites
      // optional delay between each request
      // await new Promise(r => setTimeout(() => r(), 1000))
    }
  }
}
#

@hollow prawn this way every single request is done sequentially and the code will properly pause on each api request and prevent multiple requests from firing concurrently

#

for loops respect the await keyword, array loops like forEach do not

earnest phoenix
#

tim what am I doing wrong with my return?

quartz kindle
#

@grizzled raven well, at 3k guilds, without intents and without compression, my bot downloads at 5-10MB/s when connecting, and then maintains an average of 200KB/s download and 15KB/s upload on idle

#

with compression it uses about 80% less, and with intents it uses about 98% less

grizzled raven
#

huh

#

well muy bot sucks at keeping connections lol

#

lol

#

just wondering if it's because of discord js 11 or internet

quartz kindle
surreal notch
#
    bot.user.setStatus('available')
    bot.user.setPresence({
        game: {
            name: 'with depression',
            type: "STREAMING",
            url: "https://www.twitch.tv/monstercat"
        }
    });
});```
quartz kindle
#

you get the guild's prefix, but you dont check if the message starts with it

surreal notch
#

error

quartz kindle
#

you check only for the global prefix

grizzled raven
#

OH YEAH

#

tim

grizzled raven
#

if i put guild presences in the intents array, will i have access to guild members as normal?

hollow prawn
#

would adding a await while inside .forEach that is async not do it @quartz kindle or I'd have to change the code around like you have suggested?

grizzled raven
#

man i suck at topping with one hand

earnest phoenix
#

@quartz kindle how would I check for my second prefix, (which happens to a keyv)

quartz kindle
#

@hollow prawn no it will not work, because forEach executes the code as a callback function, its like doing for(bla) { async function() { await bla } }

#

an async forEach will just create N async functions concurrently

hollow prawn
#

ah, alright

next remnant
#

how do have syntax highlighing for code blocks without knowing the language of the code snippet?
(this is for a webapp)

#

@ me when responding

quartz kindle
#

@grizzled raven if you want guild members, you need guild memebrs intent

#

presence intent is just for status and activity

hasty lotus
#

hey, i'm making a cooldown on some commands, would you know if there is any way to show the remaning time ? for the moment i've got this :

const cooldown = new Set()

if(cooldown.has(msg.author.id)) return msg.reply("you can use this command only once every hour")

/*
command script*/

cooldown.add(msg.author.id)

setTimeout(function() {
  cooldown.delete(msg.author.id)
}, ms("1h")}```
And i would like tu return a message like "you have 20 minutes remaning before you can use this command again. Any idea ?
grizzled raven
#

@quartz kindle no i mean, if i put the presence intent in the intents, meaning that i dont recieve packets, will i still have normal guild member cache and will guild members still be present in message.member, guild roles etc?

#

or do i need the guild members presence to be able to have access to anything to do with guild members?

royal portal
#

How would I make it so if a user types the command 'help' then if they have no role, send hello. if they have an 'VIP' role, send 'you're a vip'

broken ruin
#

If i allow server owners to use command that make my bot send a message and the message content chosen from the author and the author add illegal content, is there any harm to my bot ?

nocturne grove
hasty lotus
#

hmm ok i didn't know they made a public cooldown

#

i'm gonna have a look at this ty

nocturne grove
#

How would I make it so if a user types the command 'help' then if they have no role, send hello. if they have an 'VIP' role, send 'you're a vip'
@royal portal well just do this
If (hasrole)
// do this
else
// do this

#

np

royal portal
#

} else { ?

hasty lotus
#

yep

nocturne grove
#

yes sure

knotty steeple
#

dont teach people to fucking spoonfeed

royal portal
#

so like

knotty steeple
#

@nocturne grove rule 7

hasty lotus
#

xDD

nocturne grove
#

If i allow server owners to use command that make my bot send a message and the message content chosen from the author and the author add illegal content, is there any harm to my bot ?
@broken ruin good question, but I don't have an answer

#

@knotty steeple ?

broken ruin
#

Where i get the answer 2018_BatThink

knotty steeple
#

dont tell people to go copy and paste shit

#

thats my point

nocturne grove
#

I just recommend a website, lol

royal portal
#

if (!message.member.roles.cache.some(role => role.name === 'VIP') {
message.channel.send('hello vip')
} else {
message.channel.send(not a vip')
}
}

knotty steeple
#

so what exactly are you saying is u have a command that sends messages to server member(s)

nocturne grove
#

do you think people who just start their bot project and want a cooldown, can just make it themselves? Definitely not (at least I could not)

knotty steeple
#

they can

#

and thats not the fucking point

royal portal
#

no so like if you have the 'VIP' role then send 'hello vip' and if they dont have that role then send 'not a vip'

hasty lotus
#

@nocturne grove i don't see any cooldown on discordjs.guide 🤷‍♂️

nocturne grove
#

@royal portal I don't know about the role checking part, but you can try it of course

knotty steeple
#

just remember this for later

royal portal
#

okay I'll see if that works what I wrote

knotty steeple
#

dont tell people to go to a site and directly copy code

nocturne grove
#

okay lol I love it how you just come here to nag about me instead of helping all those people

knotty steeple
#

thats what i do

broken ruin
#

okay I'll see if that works what I wrote
It should work fine

royal portal
#

this part doesnt

#

if (!message.member.roles.cache.some(role => role.name === 'VIP') {

#

I have something wrong with bracket

knotty steeple
#

so what exactly are you saying is u have a command that sends messages to server member(s)

royal portal
#

at the end of it

nocturne grove
#

@knotty steeple and maybe you should read the role underneath 7

knotty steeple
#

@broken ruin are u going to answer or not

broken ruin
#

Yes @knotty steeple

nocturne grove
#

@royal portal oh yes you didn't close your if statement with a )

knotty steeple
#

oh i see ur trying to be a smartass

broken ruin
#

if (!message.member.roles.cache.some(role => role.name === 'VIP')) {
@royal portal

royal portal
#

I tried that

knotty steeple
#

this is friendly compared to shit i usually say

nocturne grove
#

oh i see ur trying to be a smartass
@knotty steeple you started

hollow prawn
#

@quartz kindle does it have to be both [id, guild] and [id, channel]? or could I use only one ?

knotty steeple
#

"you started" bro this aint a school fight

hollow prawn
#

I'm not a keen user of for nor have I used it that much

knotty steeple
#

also sarhan i dont think its a problem if u say the message was sent by a user

nocturne grove
#

no ofc not

knotty steeple
#

but generally i wouldnt make a command that allows users to send messages to others directly in dms and such

broken ruin
#

.......} else {
message.channel.send(**'**not a vip')
}
@royal portal
You just missed '

quartz kindle
#

@hollow prawn collections are iterated over entries

#

like if you were use Object.entries(obj)

#

it gives you an array of [key,value]

hollow prawn
#

oh, ic, so it has to be the way you suggested it

royal portal
#

@broken ruin tried that too didnt work

quartz kindle
#

you can also do for(bla of client.guilds)

knotty steeple
#

whats ur code

#

and ur errors

royal portal
#

no errors

quartz kindle
#

and then use bla[0] for id or bla[1] for the data

royal portal
#
if (!message.member.roles.cache.some(role => role.name === 'VIP')) {
message.channel.send('hello vip')
} else {
message.channel.send('not a vip')
}
}
hollow prawn
#

and this way I wouldn't use bla[0] and bla[1]?

nocturne grove
#

what's that last } for? @royal portal

knotty steeple
#

extra }

quartz kindle
#

yes because you use a destructuring assignment

hollow prawn
#

alright

royal portal
#

so I need another } or no

nocturne grove
#

no you should remove the last one

knotty steeple
#

u dont if thats all

quartz kindle
#

The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, into distinct variables.

hollow prawn
#

before I carry on, is the channel overwrite permissions correct? that I use

broken ruin
#

Why you are adding } at final

royal portal
#

for args[0]

broken ruin
#
<CLIENT>.on('message', message =>{
if (!message.member.roles.cache.some(role => role.name === 'VIP')) {
message.channel.send('hello vip')
} else {
message.channel.send('not a vip')
}
})
royal portal
#
if (command === "help") {
if (!message.member.roles.cache.some(role => role.name === 'VIP')) {
if(args[0] && args[0].toLowerCase() === "two") {
message.channel.send('hello vip')
} else {
message.channel.send('not a vip')
}
}
});
#

I have to add an extra }

knotty steeple
#

please indent

hollow prawn
#

as I'm really not sure if defining permissions in array above and then using the definion such as

prm = <permission>
channel.overwritePermissions(mtr, **{ prm: false }**, `Updating perms for ${channel.type} named ${channel.name}`).catch(console.error);```
not really sure if that would work inside the multipliers
knotty steeple
#

for gods sake

nocturne grove
#

and }); is the closing of the event? @royal portal

royal portal
#

yes

nocturne grove
#

and it gives an error?

royal portal
#

no error

broken ruin
knotty steeple
#

ur missing a } it seems

nocturne grove
#

is there a role that's exactly called VIP?

royal portal
#

yep

nocturne grove
#

oh yes what sammy says

royal portal
#

is it the bottom line im missing }

nocturne grove
#

no the one before });, you're missing the closing of the if (command == ...) statement

royal portal
#
if (command === "help") {
if (!message.member.roles.cache.some(role => role.name === 'VIP')) {
if(args[0] && args[0].toLowerCase() === "two") {
message.channel.send('hello vip')
} else {
message.channel.send('not a vip')
}
}
}
});
#

like that?

nocturne grove
#

yes

royal portal
#

tried that

#

didnt wor

#

no errors

nocturne grove
#

it's sending 'not a vip'? Or nothing?

royal portal
#

it working the opposite way

quartz kindle
#

@hollow prawn .has() doesnt need two parameters, only one, not sure why you have those false in there
to have dynamic keys in objects you need to wrap them in brackets, like this

royal portal
#

kinda

#

so if i dont have role, it will do hello vip

nocturne grove
#

@royal portal aahh that's because of the ! in your second if statement

royal portal
#

and if i do have role, it does nothing

nocturne grove
#

I just saw that

royal portal
#

oh

#

but now the command doesnt work if you have no role

#

it doesnt say 'not a vip'

knotty steeple
#

how are u running it

#

just help alone or

broken ruin
#
if (command === "help") {
if(args[0] && args[0].toLowerCase() === "two") {
if (!message.member.roles.cache.some(role => role.name === 'VIP')) {
message.channel.send('hello vip')
} else {
message.channel.send('not a vip')
} // else
} // vip
} // args
} // for command help
}); // event
royal portal
#

oh so four }

knotty steeple
#

ur code is kinda weird

royal portal
#

but i get error

knotty steeple
#

also i said indent dammit

royal portal
#

missing ) after argument list

broken ruin
#

If you missed } or ) you will see error

royal portal
#

I missed an )

#

somewhere

#

in just that piece of code

broken ruin
#

Which line

hollow prawn
#

the 2nd parameter is for the check for admin permission
so making the prm in [ ] does fix it, it changes the outlook which is good, thanks for that one @quartz kindle

grizzled raven
#

sigh

#

okay

royal portal
#

managed to fixed it

#

everything works now

#

3 brackets at end not 4

#

thanks for help guys

nocturne grove
#

just change this to a more common one I guess
message.member.roles.cache.some(role => role.name === 'VIP') => message.member.roles.cache.find(r => r.name == 'VIP')

#

oh nvm

#

np

royal portal
quartz kindle
#

@hollow prawn ah i forgot that permissions are a modified collection, they do have that admin thing indeed

digital ibex
#

hi

quartz kindle
#

@royal portal do you know what is indentation?

hollow prawn
#

no worries, altho a bit weird, is it normal that it shows my code with this colour

#

the === should be blue not purple/pink

royal portal
#

no

hollow prawn
#

think i gotta find where its messed up and fix it lol

digital ibex
#

i'm a little confused how i can create a warning system, i made my model
js modlogs: { warns: { reason: String, mod: String, type: String }

quartz kindle
#

thats just your code editor i guess

digital ibex
#

and what do i need to do to like do something to show in a modlogs command? it'll show the reason mod and stuffi'm a little confused how i can create a warning system, idk, if i'm making sense

quartz kindle
#

@royal portal indentation is adding space on the left side of the code, to identify what is inside what

#

for example

hollow prawn
#

nah its an issue somewhere, i use atom, checked different part of code it is indeed blue

quartz kindle
#

instead of js a() { b() } you do js a() { b() }

#

you put spaces or tabs on the left side, to help you see what is inside what, what starts and ends where

charred jetty
#

@quartz kindle How to set user limit on vc with discord.js library?

grizzled raven
#

indenting too much can also make the code hard to read lmao

quartz kindle
#

if you use proper indentation, it becomes much easier to read your code, and you will not have problems like missing brackets

grizzled raven
#

bruh i still

#

some guide said i need presence intents for guild member stuff too like

quartz kindle
#

@grizzled raven GUILD_CREATE: If you are using Gateway Intents, members and presences returned in this event will only contain your bot and users in voice channels unless you specify the GUILD_PRESENCES intent.

#

thats the only thing that isnt strictly presences

grizzled raven
#

would the member cache slowly fill up with every message sent or how

quartz kindle
#

yes

grizzled raven
#

and will guild member add and remove still fire?

earnest phoenix
#

wait so if my custom prefixes are in my mongodb, how would I make my bot not ignore em

quartz kindle
#

yes if you have guild members intent

#
  1. get prefix from db
  2. check if message starts with the prefix you got
  3. if not, return
grizzled raven
#

oh and can you still fetch members with guild.members.fetch(id)?

quartz kindle
#
If you are using Gateway Intents, there are some significant changes to this command to be mindful of:
GUILD_PRESENCES intent is required to set presences = true. Otherwise, it will always be false
GUILD_MEMBERS intent is required to request the entire member list—(query=‘’, limit=0<=n)
You will be limited to requesting 1 guild_id
Requesting a prefix will return a maximum of 100 members
Requesting user_ids will continue to be limited to returning 100 members
#

this is for fetching guild members

earnest phoenix
#

how would I take my prefixes from mongodb

quartz kindle
#

idk how did you save them there in the first place? check the mongo docs and guides for how to use it

earnest phoenix
grizzled raven
#

i mean since guild create only returns the bot and vc users, just wondered if fetching a member without presences would be affected

#

but whatever

earnest phoenix
#

how do i remove all reactions from a fetched message? v11

hollow prawn
#

@earnest phoenix .clearReactions() you'd also wanna do .catch() as its a promise i think

earnest phoenix
#

oh
ill use await then

quartz kindle
#

@grizzled raven they will be fetched without presences as well

hollow prawn
#

you can check in the docs after u fetch a message it'll be message.clearReactions

earnest phoenix
#

yeah i saw that somewhere but it didnt work for some reason

#

(node:22293) UnhandledPromiseRejectionWarning: TypeError: msg.clearReactions is not a function

#

msg is defined as args[0] where i put the id

grizzled raven
#

ok cook

#

cool

earnest phoenix
quartz kindle
#

you might be on to having no idea what you're doing lol

earnest phoenix
#

(node:22293) UnhandledPromiseRejectionWarning: TypeError: msg.clearReactions is not a function
why is clearReactions an error

digital ibex
#

i don't think clearReactions is a thing

earnest phoenix
#

you can check in the docs after u fetch a message it'll be message.clearReactions

#

idk

#

i think it is as i saw that in a few places

digital ibex
#

clearReactions isn't a thing

#

i just checked

earnest phoenix
#

um

#

so what is

shell raptor
#

we can add apdate to a bot ?

digital ibex
#

i'm not sure

shell raptor
#

okay

digital ibex
#

what

hollow prawn
#

its weird bcs i use in my code clear reactions

#

this is for my version, top one is for stable

earnest phoenix
#

i just found it myself

#

its removeAll

#

but it still wont work

#
await msg.reactions.removeAll()```
(node:23121) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'removeAll' of undefined
bold moon
#

4968659306

quartz kindle
#

are you use msg is a message object?

earnest phoenix
#

msg is the message you delete the reactions from

#

am i supposed to do message.reactions.removeAll(msg)?

quartz kindle
#

no, i mean

#

the msg you're using

#

are you sure its an actual message?

#

show the rest of your code

earnest phoenix
#

yes
its an id

quartz kindle
#

its an id?

earnest phoenix
#
  if(command === "removeallreactions") {
    let nopermissionembed = new Discord.RichEmbed()
    .setDescription("You don't have the permission.")
    .setColor(config.Red)
    if(!message.member.hasPermission("MANAGE_MESSAGES")) return message.channel.send(nopermissionembed)
    let specify = new Discord.RichEmbed()
    .setDescription("Please specify a message id.")
    .setColor(config.Red)
    if(!args[0]) return message.channel.send(specify)
    let msg = message.channel.fetchMessage(args[0])
    .catch(err => console.log(err))
     await msg.reactions.removeAll()
    .catch(err => console.log(err))
  }```
#

yes

#

wow it looks bad like that

quartz kindle
#

its neither an id, nor a message

#

its an unawaited promise lol

earnest phoenix
#

wdym

#

no await ?

quartz kindle
#

fetchMessage returns a promise

earnest phoenix
#

Oh

#

so i need to await

quartz kindle
#

yes

earnest phoenix
#

clearReactions() did work

#

lmao i forgot its a promise

#

f

#

thanks Tim

wise quartz
#

How do i change ['text'] to text ?

hollow prawn
#

first one is array which should be a string (the 2nd one), unless you want to use the mark down of ` quotes automatically

shell raptor
#

i have made a command (*ping) but the bot respond 5 msg, why ?

modest maple
#

5 instances ig lol

shell raptor
#

nope

#

wait

#

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

module.exports.run = async(client, message, args) => {

let début = Date.now();
await message.channel.send("Ping").then(async(m) => await m.edit(`Ping : ${Date.now () - début} ms`));

};

module.exports.help = {
name: "ping"
}

#

is the code

#

oh

grizzled raven
#

would low port speeds be one cause of your bot constantly reconnecting?

shell raptor
#

what ?

quartz kindle
#

@shell raptor show your message event