#development
1 messages · Page 903 of 1
Yes
@surreal notch https://discord.js.org/#/docs/main/master/class/CategoryChannel?scrollTo=permissionOverwrites
@earnest phoenixbut where to paste it
https://discordjs.guide/popular-topics/permissions.html#adding-overwrites here's some useful documentation
}else if(message.author.id !=460690666964385803){
on permission overwrites
Ok
oh great, hope it works
thanks
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
if (guild.channels.cache.find(c => c.name == yourChannelName)) {
// channel exists
}```
but without an ID
Ow
just any channel named something like #memes-and-media
find
Okay let me change it
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
Just add an
else {
// do something
}``` underneath
if (guild.channels.cache.find(c => c.name == yourChannelName)) {
message.channel.send("exists")
}
else {
message.channel.send("doesn't exist")
}
}
Yes. But now it sends both in the channel you executed a certain command
= message.channel
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")
}
}
});
Yes that will work. But it won't send the "exists" in the channel you found. And make sure to define yourChannelName, of course
but wont it send 'exists' in the channel because the person said the cmd?
No because you send the "exists" message in the message.channel. That is the channel where the command message was sent
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
Yes
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")
}
}
});
Yes
👍
Now you have a command "test" that will say if the general channel exists
Do you want it to be case insensitive?
I mean the "general" thing
I guess precreated channels are called "General"
so only lower case
Yes
I guess precreated channels are called "General"
@nocturne grove nvm this is not true
Yes now it does that
Oh no I mean you should check if the channel name toLowerCase() is "general"
ah
Because "general" == "General" returns false
args shift toLowerCase() ?
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
I have it set so it works with uppercase and lowercase
so its fine if they send like that
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?
oh now I understand
yes like that
but lowercase
so "General" wont work but "general" will
yes
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")
}
}
});
yes right 👌
alr
is guild defined btw?
yes that's better
Works 👍 thank you
no problem
show code yea
@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
@royal portal show it please
ok
me?
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
} else {
lol
One clear }
works now epic
Have you formatted your code? (It'll be easier to find syntax issues if it's formatted)
works now epic
@royal portal 👍
also how do you make it so
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
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

not uppercase like tWo
@royal portal then compare it with the args set to lower case
if(args[0].toLowerCase() === 'two') {
yes
well I'm trying to make it so you can say it with upper case or without
yes that will solve it ^
👍
an arg is normally just one word
but then if I do 'help ' it will say cannot read property 'toLowerCase' of undefined
ohh yes the command name is help
then check if(args[0] && args[0].toLowerCase() == 'two)
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"))
};
@nocturne grove works thank you
whats problem
???
np
@rotund lantern catch error and log it to console
read the error
ı 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.
my goal was to convert the ping command into an embed message
make the embed a seperate variable
how?? can you help me @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
guys anyone can tell me the command to know my bot position in queue?
Jimp.read(user.avatarURL(), (err, avatar) => { avatar.resize(179, 135)
you must Resize
?
-faq 2
(=
@earnest phoenix
can you help it has a problem
it doesn't work when I write the code
in discord
you gotta actually send the embed too
what's the error when you try to run it?
oh yeah, message.channel.send is it
yeah its message.channel.send
whats the error there?
https://stackoverflow.com/questions/52232802/unhandledpromiserejectionwarning-typeerror-cannot-create-property-reply-on-n read this, i gotta do something important right now
Is there a fast way to make every text in css white?
I don't want to manually set all the text to whitr
can you write a code for me @earnest phoenix plzzz

it dosnt run
nope, no spoonfeeding
plus, i dont know shit about javascript, i just like to read up the docs and kinda understand it
We aren't developers at your disposal
read the error
read the error
@summer torrent
read the error
what the fuck of this code
"already been declared"
what is this mean
Anyone can answer my question? :<
I'm currently using css too
🤦♂️
I mean its another self explanatory error
why you need "coins.json" on ping command
if you don't understand the code, you shouldn't code these stuff. learn from the beginning and start from there.
Youtube
do not
There's a site called google
stop giving them bad sources
hm
this one is a great one though https://discordjs.guide/
thats where i get my informations
An idiots guide is also a good one
he needs to learn js
yeah
15.1.1 ?
and then d.js
Djs v15, this person is in the future
I'd recommend codecadamy (i believe the javascript course is free)
avatar is undefined
but it isnt free
@rotund lantern it is a great way to learn it though
uh thx
isn't it format?
ah yes
well we'll see if they come back
Anyone can help me with CSS?
what do you need?
<p>
Is there a property in Djs that tells you whether the bot can DM a certain user?
user.dmable
jk
just use catch after .send()
.send().catch(err => { cannot send });
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
np
user.dmable would be quite useful tho ngl
Yeah tru
If I did .createDM().then(), if the then bit was fired does that mean they're dmable or not?
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
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?
on top.gg*
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
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
@split hazel but how
can we talk in dm
nd i m using discord.js v12 not cmd handler
You figure that out, we can give you general advice, but can't spoonfeed you. You need a database to hold that information
Ah
D.js has a wonderful example of this https://discordjs.guide/sequelize/currency.html
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
Could you show some code?
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
Print verified
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
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
well now convert what you said to some JS code
if(!logchannel) then create dthe channel
=js if (!logChannel) { guild.channels.create(channelName); }
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)
Don't really have an easy way to, hence asking lul
okay I will do it for you 😅
Cheers
we ain't spoonfeeding here 
@true ravine js const arr = []; console.log(arr.filter(element => element.startsWith('idk'))); // => []
@surreal notch read the topic from discordjs i sent
Tyvm @nocturne grove
Ok
Why are so many people alergic to reading lul
haha
More people are infected with that than covid 19
we had someone back then who didn't even bother reading what we said
Oof

I read the docs for my bedtime story ngl
like you could spare asking if you would just do one single google search

thats why it is always useful to have docs open in the background
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
Interesting
whenever I edit my codes my cooldown reseted why?
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?
are the cooldowns stored in a Discord collection?
i have used quick.db
oh okay so the cooldowns are stored somewhere when your bot is turned off?
well that's the problem
then what i have to do
your bot can't remember all its data when it goes offline
using a database for that
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
@nocturne grove so now
if(!logchannel) {
guild.channels.create('bot-logs')
}
.then(console.log)
.catch(console.error);
Why i got an erorr ( unexpected token ) at .then and .catch ?
@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
I try to post it every 30 minutes
@earnest phoenix you should use the .catch and .then after .create(), but inside the if-statement
@nocturne grove How to use data base
How to define guild? =))
frm where
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
user command
then it's message.guild
what should i google
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?
yes, something like that. Maybe add js or node.js
ok
-faq 2
well you can't know if you just submitted it. But you can in theory see when your bot joins the verification server
Also wrong channel
what is wrong with my warn command?
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
@earnest phoenix it's avatarURL() or displayAvatarURL()
And are you using D.js v12?
hmm
it doesnt work on a ready event tho
but what id are you using in the ready event?
same id the user has
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).
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
okay
oh oof
Does anyone know where to put a css file when I'm editing my bot's page on top.gg?
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
In the description
the long description
Just directly insert the css there, EDIT: add <style> and </style> before and after the css
style tag
like .nav {display: none}
wait... is that automatically linked to the html? I'm used to have seperate files and linking them, fyi
Yes, its directly linked
oh awesome, thanks
@slender thistle Do I need to report to Discord that I'm getting Error 520, or should I just let it be?
hi
You're getting that from Discord?
My bot can't connect, Error 520
Maybe just let it be for an hour 
(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
that's really strange tho
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;
});
520 is cloudflare
It's 5xx as stated by Discord
522 Connection Timed Out
Cloudflare could not negotiate a TCP handshake with the origin server.
Hmm... I don't know anyway, never got this error
ive never seen it either
My CPU's acting up trying to reconnect every 5 secs or smlt
@heavy marsh about your "what to add here smsh", according to the docs an invite object
hmm
weird, it's not in the docs => nvm
@neat harness which library are you using?
@quartz kindle Discord.js v12.12.0
nvm
try logging the debug event
I don't know what's going on, but I'm getting this in my console
client.on("debug", console.log)```
are you doing an http request yourself before starting the discord client?
I think so
show your index.js
//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();
That URL
👀
A sec, Imma check mongodb
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?
<!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
it doesn't matter, adding your own html block will separate your css
Prob
yes
then remove html head and body
body too? okay
your description gets injected into the existing top.gg website, its not an independent page
Also, @quartz kindle My MongoDB is properly connected it says
Though it's odd that it's at 6 connections 🤔
or only <style> and no <head> anymore?
@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
okay thanks. Will google that
@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
yes div works. Thanks!
I could use some help with https://discordapp.com/channels/264445053596991498/272764566411149314/706124878990016562 😅 thanks
@neat harness i mean in places such as mongo.connect().catch()
or anything else that returns a promise
Hmmm, lemme try
No error logged, it still shows error 520/522
You don't need to use png, just use the original format
yeah
can anybody help me making a simple button with html/css?
even w3schools is not helping me
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>
o wow thank you
oh but the thing I want is a link in it. And that didn't work
<button class="button"><a href="" style="text-decoration:none">Click Me</a></button>
@nocturne grove A better way'd be to decorate the link to the point that it looks like a button
why is that better?
Because it lets you have more control over the link, without limiting it to a button
more control like markdown?
<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
why does this happen? (when i use !play dance monkey, the search result is completely different from what is supposed to be)
Designing a button is pretty useless
why does this happen?
@cinder dove Because it probably has a different search system
okay thanks @neat harness
But I use same youtube Api 🤔
maybe it's in the yt description
it should be first result in search.
MEE6 doesn't use YouTube I think
Oh
Try searching it in youtube
oh and btw, we're not the Mee6 support server in case you thought that
I searched it, Dance Monkey is pretty popular
I can't find anywhere BEST DANCES 2018
Then it's probably because of a different API or you misconfigured the bot
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.
Probably API issues or idk
copyrighted content
Agggh RIP my bot ||damn|| it
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
Prob
oh so how do I avoid that?
you dont
Well I do.
so if ur avoiding it whats the problem
I don't think mee6 bought licenses from every album ^^
I'm not, but I want to, and I'm not sure how.
Good luck with that
ty
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? 
I really can't read this...
Apparently the issue is with simple-youtube-api module.
ytdl-core doesn't block copyrighted videos ^^
Thought so, API error
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:’)
what is await
copied it wrong, fixed
What's message
ah, i’ve just realised that’s the wrong one to copy- one sec
hmm i think the problem is slightly different- nvm
Hold on why are you specifying message kwarg
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
Maybe try :thumbsup:? 
it’s not the emoji that’s the problem, it’s which message it’s reacting to :(
Sounds like you might wanna print(message) 👀
what exactly do you mean by that? :0
What does your code look like fully?
How to set user limit on vc with discord.js library?
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
.send returns the sent message soooo
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 ????
msg = blah.blah.blah.send(embed=eg)
await msg.reactetc(my_emoji='hehehaha')```
@wise quartz That's how mentions work
Huh?
It's your client that can't render users from the mentions
ty shivaco, ill try that
Your client be like that 
Huh.......
oh my bot's been fixed
How do i fix it then?....
But i want it to mention them like that (@wise quartz)
Do i just wait and it'll be fixed or?
It will randomly fix itself
Hello
Nothing you can do to change it on your end 
?help
-botcommands @earnest phoenix
@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.
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?
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') {}
}
})
what port speeds would a bot at, idk, 2k guilds need?
or does it depend
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
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
lmao
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
)
also @hollow prawn when you give reply
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
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
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
Guild owners should kinda know how to set mute perms imo
the proper way to do loop like that is to use a for loop with async await syntax
@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 }
the problem is that the random timeout wont do much
@quartz kindle wym I didn't return correctly
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
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?
@quartz kindle yeah down/up speeds
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
tim what am I doing wrong with my return?
@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
huh
well muy bot sucks at keeping connections lol
lol
just wondering if it's because of discord js 11 or internet
@earnest phoenix review this part
bot.user.setStatus('available')
bot.user.setPresence({
game: {
name: 'with depression',
type: "STREAMING",
url: "https://www.twitch.tv/monstercat"
}
});
});```
you get the guild's prefix, but you dont check if the message starts with it
error
you check only for the global prefix
if i put guild presences in the intents array, will i have access to guild members as normal?
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?
man i suck at topping with one hand
@quartz kindle how would I check for my second prefix, (which happens to a keyv)
@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
ah, alright
how do have syntax highlighing for code blocks without knowing the language of the code snippet?
(this is for a webapp)
@ me when responding
@grizzled raven if you want guild members, you need guild memebrs intent
presence intent is just for status and activity
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 ?
@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?
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'
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 ?
@hasty lotus I just copied the cooldowns from https://www.discordjs.guide, works perfectly
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
} else { ?
yep
yes sure
dont teach people to fucking spoonfeed
so like
@nocturne grove rule 7
xDD
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 ?
Where i get the answer 
I just recommend a website, lol
if (!message.member.roles.cache.some(role => role.name === 'VIP') {
message.channel.send('hello vip')
} else {
message.channel.send(not a vip')
}
}
so what exactly are you saying is u have a command that sends messages to server member(s)
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)
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'
@nocturne grove i don't see any cooldown on discordjs.guide 🤷♂️
@royal portal I don't know about the role checking part, but you can try it of course
just remember this for later
okay I'll see if that works what I wrote
dont tell people to go to a site and directly copy code
okay lol I love it how you just come here to nag about me instead of helping all those people
thats what i do
okay I'll see if that works what I wrote
It should work fine
this part doesnt
if (!message.member.roles.cache.some(role => role.name === 'VIP') {
I have something wrong with bracket
so what exactly are you saying is u have a command that sends messages to server member(s)
at the end of it
@knotty steeple and maybe you should read the role underneath 7
@broken ruin are u going to answer or not
Yes @knotty steeple
@royal portal oh yes you didn't close your if statement with a )
oh i see ur trying to be a smartass
I tried that
this is friendly compared to shit i usually say
oh i see ur trying to be a smartass
@knotty steeple you started
@quartz kindle does it have to be both [id, guild] and [id, channel]? or could I use only one ?
"you started" bro this aint a school fight
I'm not a keen user of for nor have I used it that much
also sarhan i dont think its a problem if u say the message was sent by a user
no ofc not
but generally i wouldnt make a command that allows users to send messages to others directly in dms and such
.......} else {
message.channel.send(**'**not a vip')
}
@royal portal
You just missed '
@hollow prawn collections are iterated over entries
like if you were use Object.entries(obj)
it gives you an array of [key,value]
oh, ic, so it has to be the way you suggested it
@broken ruin tried that too didnt work
you can also do for(bla of client.guilds)
no errors
and then use bla[0] for id or bla[1] for the data
if (!message.member.roles.cache.some(role => role.name === 'VIP')) {
message.channel.send('hello vip')
} else {
message.channel.send('not a vip')
}
}
and this way I wouldn't use bla[0] and bla[1]?
what's that last } for? @royal portal
extra }
yes because you use a destructuring assignment
alright
so I need another } or no
no you should remove the last one
u dont if thats all
The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, into distinct variables.
before I carry on, is the channel overwrite permissions correct? that I use
Why you are adding } at final
for args[0]
<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')
}
})
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 }
please indent
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
for gods sake
and }); is the closing of the event? @royal portal
yes
and it gives an error?
no error

ur missing a } it seems
is there a role that's exactly called VIP?
yep
oh yes what sammy says
is it the bottom line im missing }
no the one before });, you're missing the closing of the if (command == ...) statement
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?
yes
it's sending 'not a vip'? Or nothing?
it working the opposite way
@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 aahh that's because of the ! in your second if statement
and if i do have role, it does nothing
I just saw that
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
oh so four }
ur code is kinda weird
but i get error
also i said indent dammit
missing ) after argument list
If you missed } or ) you will see error
Which line
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
managed to fixed it
everything works now
3 brackets at end not 4
thanks for help guys
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

@hollow prawn ah i forgot that permissions are a modified collection, they do have that admin thing indeed
hi
@royal portal do you know what is indentation?
no worries, altho a bit weird, is it normal that it shows my code with this colour
the === should be blue not purple/pink
no
think i gotta find where its messed up and fix it lol
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 }
thats just your code editor i guess
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
@royal portal indentation is adding space on the left side of the code, to identify what is inside what
for example
nah its an issue somewhere, i use atom, checked different part of code it is indeed blue
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
@quartz kindle How to set user limit on vc with discord.js library?
indenting too much can also make the code hard to read 
if you use proper indentation, it becomes much easier to read your code, and you will not have problems like missing brackets
bruh i still
some guide said i need presence intents for guild member stuff too like
@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
would the member cache slowly fill up with every message sent or how
yes
and will guild member add and remove still fire?
wait so if my custom prefixes are in my mongodb, how would I make my bot not ignore em
yes if you have guild members intent
- get prefix from db
- check if message starts with the prefix you got
- if not, return
oh and can you still fetch members with guild.members.fetch(id)?
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
how would I take my prefixes from mongodb
idk how did you save them there in the first place? check the mongo docs and guides for how to use it
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 .clearReactions() you'd also wanna do .catch() as its a promise i think
oh
ill use await then
@grizzled raven they will be fetched without presences as well
you can check in the docs after u fetch a message it'll be message.clearReactions
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
@quartz kindle might be onto something
you might be on to having no idea what you're doing lol
(node:22293) UnhandledPromiseRejectionWarning: TypeError: msg.clearReactions is not a function
why is clearReactions an error
i don't think clearReactions is a thing
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
we can add apdate to a bot ?
i'm not sure
okay
what
https://discord.js.org/#/docs/main/stable/class/ReactionManager
@earnest phoenix
its weird bcs i use in my code clear reactions
this is for my version, top one is for stable
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
4968659306
are you use msg is a message object?
msg is the message you delete the reactions from
am i supposed to do message.reactions.removeAll(msg)?
no, i mean
the msg you're using
are you sure its an actual message?
show the rest of your code
yes
its an id
its an id?
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
fetchMessage returns a promise
yes
How do i change ['text'] to text ?
first one is array which should be a string (the 2nd one), unless you want to use the mark down of ` quotes automatically
i have made a command (*ping) but the bot respond 5 msg, why ?
5 instances ig lol
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
would low port speeds be one cause of your bot constantly reconnecting?
what ?
@shell raptor show your message event