#development
1 messages Β· Page 866 of 1
Me too... Idk how it works actually...
guild.fetchBans()
but where would I add it
could do that after your permission checks, since there's no point in going on about creating embeds if the user isn't banned anway
huh? in the code you sent, there is no check whether someone is banned?
or am i getting old
@blazing portal but how can we check if the mentioned user id as it's the user we want to unban is not in the banned list?
well, fetch bans returns a collection(after awaiting it) with all bans mapped by their id. So you just check if the provided id is in that collection. if it isn't, return
if (client.guild.member(USER_ID).exists){
and then send embed
}
but then
that only checks for that user id
not the id mentioned
which d.js version are you using?
v12
I'm not exactly sure what you mean. Let me post what i think could work
Ok so I've made it to here now in my code:
collector.on('collect', message => {
let checkFailEmbed = new discord.MessageEmbed()
.setDescription("**Error**")
.setColor("#FF0000")
.addField("Stuff", "Stuff")
.addField("Examples", "stuff goes here");
const zone = message.content
if (zone === "cancel") return user.send("Operation cancelled.")
const check = got("http://api.timezonedb.com/v2.1/get-time-zone?key=keyhere&format=json&by=zone&zone=" + zone + "time=1586725120")
let checkData = JSON.parse(check.body)
if (checkData.status === "FAILED") return user.send(checkFailEmbed);
console.log("Check 4");
})```
But now I'm having the same issue.
i do close this btw
client.on("message", async message => {
if (message.author.bot) return;
if(message.channel.type === "dm") return;
let prefix = "-";
if (message.content.indexOf(prefix) !== 0) return;
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
if (command === "unban") {
if (!message.guild.me.hasPermission('BAN_MEMBERS')) return message.channel.send('Error: I don\'t have the permission to unban members.');
if (!message.member.roles.cache.some(role => role.name === 'Server Administrator')) return;
let guildBans = await message.guild.fetchBans();
let bannedMember = await client.users.fetch(args[0]).then().catch(console.error);
if(!bannedMember) return message.channel.send("Please provide a userID to unban someone.")
//Check if bannedUser is actually banned
if(!guildBans.has(bannedMember.id)) return message.channel.send("User is not banned in this guild");
let reason = args.slice(1).join(" ")
if(!reason) reason = "No reason given."
let logsChannel = message.guild.channels.cache.find(ch => ch.name === "mod-log");
let embed = new Discord.MessageEmbed()
.setTitle('Unban')
.addField('User', `${bannedMember.tag} (<@${bannedMember.id}>)`, true)
.addField('Moderator', message.author.tag, true)
.addField('Reason', reason)
.setColor("#00ff00")
.setTimestamp();
if(!message.guild.me.hasPermission(["BAN_MEMBERS", "ADMINISTRATOR"])) return message.channel.send("Error: I don't have permission to perform this command.")|
message.delete()
try {
message.guild.members.unban(bannedMember).then().catch(console.error);
logsChannel.send(embed).then().catch(console.error);
} catch(e) {
console.log(e.message)
}
}
});
Yes
Yeah, or whatever else you want it to say, this is just what floated around in my head. Haven't tested that one though
Just return it
if(!guildBans.has(bannedMember.id)) return;
Yes
ok
yh
also i had a mistake in my code
if(!message.guild.me.hasPermission(["BAN_MEMBERS", "ADMINISTRATOR"])) return message.channel.send("Error: I don't have permission to perform this command.")|
you see
the end
bit
again π
You put a | lol
Ok so I've made it to here now in my code:
collector.on('collect', message => { let checkFailEmbed = new discord.MessageEmbed() .setDescription("**Error**") .setColor("#FF0000") .addField("Stuff", "Stuff") .addField("Examples", "stuff goes here"); const zone = message.content if (zone === "cancel") return user.send("Operation cancelled.") const check = got("http://api.timezonedb.com/v2.1/get-time-zone?key=keyhere&format=json&by=zone&zone=" + zone + "time=1586725120") let checkData = JSON.parse(check.body) if (checkData.status === "FAILED") return user.send(checkFailEmbed); console.log("Check 4"); })``` But now I'm having the same issue.
@gritty bolt can someone please help with this
what are you doing with those |
idk
wtf is wrong with me
i just ctrl + c on my pc
then ctrl + v on my rpi
thinking it would work
π
i was trying to install node-opus
i have build tools
but why it dont install π€
uhm
@blazing portal it deletes the message where i say -unban when i unban the user
did you add that
you put that in your code yourself π right above the trycatch
nope
wait
yes
is it supposed to say
logged in as bot
like 6 times
and it works normally
is anyone gonna like help me lol
in pm2
sorry @gritty bolt i had no idea what causes your problem
How was the Command for updating discord.js in cmd?
typically not @royal portal
npm i discord.js
npm i discord.js
that was for @regal saddle
its fixed
but if it shows
logged in bot
like 6 times
do i ignore it
because if i say a command, it doesnt reply to it 6 times

general advice, never just ignore a problem, it can cause more problems later on and then you're f*cked π
anyone dealing with .net? and is there a way to prevent this exception randomly appearing? https://img.thaun.dev/hpp1d.png
quite possibly Bloxys, pm2 does not flush the logs when you restart your bot. only when you manually flush them π
also
another problem
i can still mention users that are banned in discord
and when i do -unban user then
invalid form body
value <userid> is not snowflake
@blazing portal possible to fix?
Depends on how you coded it
because I can still mention banned users
And just cuz it's in your clients cachebdoesnt mean it's cached in your bot
Mentions are resolved as @ usernamehere thru ur cache
If it's not cached it won't show
also
I know that .id is the id of the user
what would it be to see the user's tag
user.tag?
I'd have to check the docs. Before I do that, I'll let you do that
yes
user.tag returns username#discrim if you only want the discriminator its user.discriminator
I couldn't use the user.tag way
Nvm my brain is fried lmaoo
What are you trying to do with the user.tag?
does anyone here know how to fix this? https://pastebin.com/9QSxXSfA
im not getting any errors
tried asking earlier but nobody knew
@blazing portal im trying to make it so if you mention a person in unban then it says please provide a user id
because right now it says that but gives me errors
like <userid> is not a snowflake
and then when that happens
i cant unban the person through userid
because it thinks the user is already unbanned
idk
does anyone know how messagecollecters work?
here's my code
client.on("message", async message => {
if (message.author.bot) return;
if(message.channel.type === "dm") return;
let prefix = "-";
if (message.content.indexOf(prefix) !== 0) return;
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
if (command === "unban") {
if (!message.guild.me.hasPermission('BAN_MEMBERS')) return message.channel.send('Error: I don\'t have the permission to unban members.');
if (!message.member.roles.cache.some(role => role.name === 'Server Administrator')) return;
let guildBans = await message.guild.fetchBans();
let bannedMember = await client.users.fetch(args[0]).then().catch(console.error);
if(!bannedMember) return message.channel.send("Please provide a userID to unban someone.")
//Check if bannedUser is actually banned
if(!guildBans.has(bannedMember.id)) return message.channel.send("User is not banned in this guild");
let reason = args.slice(1).join(" ")
if(!reason) reason = "No reason given."
let logsChannel = message.guild.channels.cache.find(ch => ch.name === "mod-log");
let embed = new Discord.MessageEmbed()
.setTitle('Unban')
.addField('User', `${bannedMember.tag} (<@${bannedMember.id}>)`, true)
.addField('Moderator', message.author.tag, true)
.addField('Reason', reason)
.setColor("#00ff00")
.setTimestamp();
if(!message.guild.me.hasPermission(["BAN_MEMBERS", "ADMINISTRATOR"])) return message.channel.send("Error: I don't have permission to perform this command.")|
message.delete()
try {
message.guild.members.unban(bannedMember).then().catch(console.error);
logsChannel.send(embed).then().catch(console.error);
} catch(e) {
console.log(e.message)
}
}
});
@gritty bolt what is there to fix ?
What are you trying to do?
collect a response to a dm
when user is banned and you mention them then it says please provide userid and gives me error
You want to attach a listener to a DM?
yes
and then you cant unban the user through id or anything
Can you upload your code on hastebin or something? It's hard to read through discord
mine?
Who else?
On a sidenote, I'm trying to store a guild in a variable to try things out:
var g = client.guilds.cache.get('actualidhere');
if (g.member(userID)) {```
> Fixed my issue by not forgetting I'm creating a new Client instead of using my original one
You could simply do
<user>.dmChannel.createMessageCollector()
@gritty bolt
Rather than attaching a listener to every single message then filtering it out yourself
Also in your first function you passed a user
Not a channel
user is equal to message.author
but then how do I use it in my collector.on?
@spice pier small error in it, here's the new one: https://hatebin.com/npjgercbvu
Literally everything is the same except
and how do I do the time?
whats up with this thing here?
and is there anything else that could make it not work>
const collector = await <user>.dmChannel.createMessageCollector(filter, options )
collector.on('collect', m => {
})
yeah i just send the new one @spice pier
Sorry I'm on mobile so it's taking a whiole to type
Thats from the new one
so if I don't need a filter what do I put first im kinda having a dumb moment here
its fine
nope
If you don't need a filter you could just put a dummy filter function ig
the new one works
Do you know at what point it returns?
yes
when the user is unbanned
its just that if you try to unban someone by mentioning them, i get an error
ok final thing here, could I just use null, and why is it m => instead of message =>?
you can do message
It doesn't matter what you name the parameter
For me it's just easier to type m than message :,)
No.
Thats because mentions aren't IDs
It's the same as declaring a variable lmaoo
and finally can i have a null filter?
Uh
once i mention the user in the -unban, im not able to unban them using the id
what, so if you do -unban mention you can't unban them with -unban id afterwards?
sometimes
@gritty bolt you should probably make the filter (m => <user>.id === m.author.id )
in case your bot decides to send a message to the channel
you don't want it to trigger the listener
@hybrid ruin bad practice to use var btw 
@spice pier i just need it to ignore mentions when you unban
and to ignore "@everyone" for ban and unban
if arg[0] startwith <@ return
On dbl vote, get a certain guild, check if member is in guild, if so, send message in specific channel
var is old, don't use it, it's genuinely bad practice
Ah okay
so i would add that
well, @everyone isnt a valid id, so it shouldnt trigger anything
It's the only var in my code so far, no worries
ah
everyone is not snowflake
i've got a new issue
what tis your issue
Cannot read property 'createMessageCollector' of null
dmChannel isn't defined
const collector = await user.dmChannel.createMessageCollector(m => user.id === m.author,{time: 60000})```
is user defined
@ everyone is server ID yeah
let user = message.author```
are you creating a ticket system
Lowkey don't know why you're putting a listener in a listener if you're not doing a ticket systemβ’οΈ
its like a setup for a feature
unexpected thing
thats because its english, not js
The XY problem is asking about your attempted solution rather than your actual problem. This leads to enormous amounts of wasted time and energy, both on the part of people asking for help, and on the part of those providing help.
User wants to do X.
User doesn't know how to do X, but thinks they can fumble their way to a solution if they can just manage to do Y.
User doesn't know how to do Y either.
User asks for help with Y.
Others try to help user with Y, but are confused because Y seems like a strange problem to want to solve.
After much interaction and wasted time, it finally becomes clear that the user really wants help with X, and that Y wasn't even a suitable solution for X.
buT
try making sure dmChannel is valid
(by either console logging it or otherwise)
@everyone doesnt have any id, the raw content of it is @everyone so it doesnt have any id
you just pinged everyone
He doesn't have perms
oh
soooo it doesn't matter
for some reason if args[0] startwith <@ return doesnt work
is there like a tutorial for messageCollecters out there
I think I need to watch one before I do this
cause my dummy self cant find the dmChannel
I literally said what I told you isn't js I was just explaining the logic
Fixed my issue by not forgetting I'm creating a new Client instead of using my original one
good work
this is too confusing with these errors
What errors are you getting
userid not a snowflake
Can you just show your code
I did
which line is your error
how many embeds can a webhook send?
I-
bro
first of all it's client.users.cache unless you're using v11 or older
secondly, it's client.users.cache.fetch(snowflake)
args[0] is a string
let user = bot.channels.find(message.author.id)```
a snowflake refers to a user ID; you can find it on a user by doing this
this won't find the channel but I don't get why
uh
So i have a mute command Everything works on it except the channel permission overwrites are incorrect...
Is there something wrong here?
(discord.js 12.1.1)
http://hatebin.com please
isn't doing that with find deprecated since like v10
are u on v12
@gritty bolt which version are you using?
client.channels.cache.get(id)
latest
client.channels.cache.get(id)
Hmm if @spare goblet's method doesn't work then it's:
<client>.channels.fetch();
... I guess...
could I do if message starts with <@ then return;
iara's method worked
?
i forgot the cache
Hmm nice
i've been trying to figure this out for 5 hours
@earnest phoenix the way you're doing it is most likely going to hit a ratelimit
so if you say -unban (mention) then just ignore it
@royal portal so it just work if it's a user id?
would suggest delaying it so you don't get ratelimited
secondly if they have @ everyone to be able to send messages in the channel, then that happens ig
yup dank
the code: https://hatebin.com/hlqiuztbdr
so it ignores <@!> and mentions
just make your own regex to find the id from a mention, smh . . .
@royal portal hmm like... I did this:
if (!args[0]) return; and it worked...
but this isnt working lol
does that ignore mentions
Mentions simply get mapped, they're still arguments
It doesn't ignore mentions but i made mine in a way that only works for user id... Wanna see it? @royal portal
@royal portal just do
let user;
try {
user = await client.users.cache.fetch(args[0])
}catch (err) {
return message.reply(sorry please send a valid ID)
}
if(user){
// do something
}
@royal portal this is how i made it... That it only works for user ids
@spare goblet why doesn't doing let user = bot.channels.cache.get(message.author.id) define user right in user.dmChannel.createMessageCollector(m => user.id === m.author,{time: 60000});
Try mine i guess @royal portal
smh
@royal portal wait a second... Isn't user ids only numbers right?
Do:
if (isNaN(args[0])) return;

does not mean its valid
SECONDLY
isNaN(string) would never be true
isNaN(parseInt(string)) is what you're looking for but is not applicable in this situation
I mean like... He is just saying it would ignore mentions... So that would work
What?
wait wait isNaN(string) would never be true?
Are you reading anything that's being said
you mean always be true?
yes
isNaN(string) is always true
sry my brain is friedβ’οΈ
other way around
the point is, it won't workβ’οΈ
user.createMessageCollector ```Cannot read property 'createMessageCollector' of undefined
user is nothing then
i feel like an idiot but i really cant figure out whats wrong
Wait... Brb in a sec
let user = bot.channels.cache.get(message.author.id)
if (args[0] === "setup") {
console.log(user)
const collector = await user.createMessageCollector(m => user.id === m.author,{time: 60000});```
Don't ask to ask, just ask
It's possible the DM channel does not exist yet, you have to create it then
yikes that tabbing is not good
const user = await message.author.createDM()
const collector = await user.createMessageCollector(m=> message.author.id === m.author.id, { time: 60000 })
@spare goblet as i see... The thing i said didn't work... Lol
I'm aware
@spare goblet so as i were talking about my mute command... What was wrong lol?
I already mentioned it before, I'm not going to repeat my answer
and stop pinging me
ty
Kk... Hmm
hello, I would like to make an unban all on my discord how can I do?
message.guild.fetchBans(true).then(bans => {
message.guild.unban(bans....)
})```
use the docs
figure out what you need to call on what object
@earnest phoenix it's literally extremely hard to find how to do that by just reading the docs...
what do you mean?????????
discord.js docs are literally clicking until you get what you need
Does it show how to unban everyone that's been banned and put which code to where...?
(If it even does... It's hard to figure it out)
no, because discord api doesn't allow that
@earnest phoenix cuz he might be a new dev so it would be hard for him...
And a new dev needs to learn how to read docs
as people wont always be able to help
it's not a magic ball, you still need to use your fucking brain to figure out "hey fetch all bans and then unban members one by one", which may i say they already figured out, they're struggling with what they need to call, so for the sake of keeping everyone sane, shut it
Uh... Anyway...
I was just saying at least tell them if it's possible at the first before telling them to read the docs lol @earnest phoenix
I approach what I want to do 
var a = 0
message.guild.fetchBans(true).then(bans => {
setInterval(async () => {
if (a === 0) {
message.guild.unban(bans.first().user.id)
message.channel.send(bans.first().user.tag + " membre unban")
a = 1
} else if (a === 1) {
message.guild.unban(bans.first().user.id)
message.channel.send(bans.first().user.tag + " membre unban")
a = 0
}
}, 1000)
})```
I'm very bad at English, excuse me
Lis la doc qu'y dit
it's something that I want to do only once so it doesn't matter if it's not "well done"
use a for loop with which you will be able to go through bans one by one
@spice pier english only in here xx
where does it say that? I'm also helping this person in a language they understand
@spice pier la quel ? (wich one ?)
d.js doc smh
I know it is against rules but why does it matter the language if you are having a helpful conversation?
because the conversation is restricted to people who speak that language
as long as it isnt spam or clogging up the channel, I dont see the problem
the speaker may misinform the listener, in which case there's a very slim chance that anyone will be able to correct them
and people won't be able to utilize the search feature to see if someone else had the same problem because the conversation is in another language
it is the rules must respect them :/
I understand that
and I will still follow them
and I see your point with people being unable to help
I found nothing on the docs on this
not okay 
closer
not there yet
abandon .first()
the reason you're for looping is so you can index the bans array with i
array[i] would return the object from the array at the index i
message.guild.fetchBans(true).then(bans =>
bans.forEach(
ban => {
message.guild.unban(ban.user)
message.channel.send("Le membre : " + ban.user.tag + "Γ Γ©tΓ© unban, nombre de membres encore ban : " + bans.size)
})
)```I found another much simpler way thanks, just that the "bans.size" does not change
it's something i'll do once it's not that bad
Hi, there!
So, I'm using discord.js, and recently, I've noticed a huge RAM usage that only goes up over time - it's up to a point I have to restart my bot every few hours to clear the memory. I've been trying to fix it for a few days, but to no avail.
Apparently, discord.js cashes a lot of data about users, if I understand correctly. Is there a way I could disable the cashing I don't need, or otherwise lower the memory usage?
Tim's lib is pretty good
it disables caching
and gives some more control over the lib
Oh, cool! I'll try it out and see if it fixes the problem. Thank you!
So I have a bot that takes the arguements in a users command and searches it in an API. However user have to use dashes instead of spaces, how would I be able to set it to turn the spaces into dashes so people don't have to do this annoying step
This is js btw
If the arguments is an array, use .join(delim) with delim being your delimiter.
If the arguments is a string, replace every case of a space with a dash using a regex.
The comand is ?spell acid splash
The user has to format it acid-splash
Because what it does is paste the args into the end of the API url
Yeah, so you could do either of the options I listed.
It's not about it being easier or not. It's about what case you need it for.
Ok, would that work with any command
Like if the arg is scorching ray
Because doesn't it sort arguements alphabetically
If you make it sort arguments alphabetically, it will. I don't know what your code is, so however you want to have your arguments work is up to you.
Ok, thanks!
will a for loop always finish before executing the code after it?
yes, it's synchronous, however if there are async functions in it, it may appear out of order (for example, I ran this for loop 50000 times then a console.log("done")) https://oliy.is-just-a.dev/dzkrq7_3539.png
I think anyways
it's rather the context that matters
if you're in a synchronous context doing async methods, it won't block
if you're in an asynchronous context doing awaited async methods, it will block and wait for it to finish one by one
ok well say if i do ```js
(async function() {
await onePromiseHere() //notify that its gonna do stuff
let data = {}
for (const yes of no) {
// lol nothing here just collecting data
data[yes] = 42
}
saveDataToDatabase(data)
await lastPromiseHere() // notify im done
})
thats basically what im dojng
for will exit once it's done doing whatever it needs to do in each iteration
so then would there be a possibility that it saves data when its not finished in the for loop?
yeah for is going to block regardless
ok
i keep forgetting that node is singlethreaded so true concurrency doesn't exist 
I tried .join and i got a .join is not a function
const args = msg.content.slice(prefix.length).join(delim);
is the line of code
and i have const delim = ("-")
further up
slice on a string doesn't return an array
No, you split it after.
so .join then .split
join() is creating string using arrays
wait nani
but wouldnt .join attach the command to the args
where would i put .join then, im super cofused now
like this?
const command = args.shift().toLowerCase();```
cause that spits a args.shift is not a function error
@grizzled raven
For discord.js ( v11.6.1 ) ; is there a way to get my bot to react with :Regional_indicator_f:???
^ because you cannot really paste that in to Atom code editor
or is it not possible
try \xd8\x3c\xdd\xeb
uh ok
"Unknown Emoji"
hmmm
I thought you just quoted π« (the name of the emoji) in quotes
then try :regional_indicator_f: directly i guess
yeah he says he can't paste the emoji in atom
I donβt mean the emoji, I mean the name like you just said
@grizzled raven that succeded at putting dashes between things, but it put it between everything, not just the 2 words
its still unknown emoji for all of my types
wait
Last time I tried that it worked except I was using β on discord.js version 12
@valid gyro what u tryin to do
Yes
My bot searches an api for info, currently users have to use - instead of spaces for url formatting, im trying to make the bot turn spaces into -
That should work I think Discord converts the Unicode characters to emojis by default
@valid gyro wdym put it between everything
also that's super ew
message.slice(prefix.length).replace(/ +/g, delim)
that would be why lmao
i didnt call the delim
whats that command for anyway
to split the args from my command so it doesnt search the command too
Why am I listening to nightcore music while I am in bed at 5:30 AM in the morning
Lol
Yea
what did
(/ +/g, delim)
so msg.content.slice(prefix.length).replace(/^\s+[^\s]+\s+/, '').replace(/ +/g, delim)
something like this maybe
ill try that
~~has anyone gotten
ECONNREFUSED
before?~~
Case solved, ignore.
ugh back to args.shift is not a function
you don't need args.shift
o right
idk lets try it
o ya i do
command would be undefined
i could send my whole code if that helps?
const [_, command, args] = msg.content.match(/\s*(\S+)\s+(.+)/)
const dashedArgs = args.replace(/\s+/g, delim)
something like this maybe idk
kk
*fixed
TypeError: msg.match is not a function or its return value is not iterable
missed the .content. oops
now it doesnt even respond to commands lmao
I think ill try getting it to outpt the args as an array, and then joining that
Is there a way I can import the WoW Classic Emjois from the Raid Helper so people can use them as server default reactions?
Which permission do you think would best match the ability to force skip a song? I was thinking MANAGE_CHANNELS or MANAGE_SERVER. Obviously there is going to be a normal vote skip command
MANAGE_MESSAGES.
Allows the option of letting moderators on most servers skip songs that may be inappropriate. @main ridge
Thanks @drowsy sentinel
Hey guys how do I make a bot send dm when muted on server?
Or upon mute role given
which lib
^
Java
javacord?
Open for dm? Lol I dont wanna hype channel
bruh this channel dead

you ain't hyping up anything
this channel gets 2 messages a day
@winter thistle I am asking which library do you use
too much clout for the dev channel 
is it me or is this channel being hyped up

still waiting for which library that person is using
might be in html, but i dunno
member.send("lol get muted") will DM someone
java β JavaScript
i mean you can technically write javascript in html via the <script> tag
Awesome that's a lead forsure guys thank u
But how about
Like the main things
Which is when muted
With !mute command
Or do I just write my whole new mod commands with it
u mean like add a muted role?
member.addRole(mutedrole).then(() => {
member.send('You have been muted`)
})
Woot wwooot
it's been 10 minutes and we're still not sure if they're using d.js, eris, or some other lib lol
d.js, he said
make sure to define both member and mutedrole
they said node.js
javascript and nodejs?
its definitely d.js
Javascript node.js
lmao
Lol
dis.html

what
Durp
discord.css
discord.bat
discord.png
discord.ogg
It definitely stinks of 12 year old in here.
discord.ico
discord.txt
discord.bin

discord.ignore
._discord
Cold
wtf is a .ignore file
discord.dll
discord.sqlite 
shit, we do be
@indigo folio never heard of .gitignore?
.discignore
nice
seizure emotes
underage person stop your illegal activities 
can you delete that
ban 
i mean you havent even tried
also why did you give up? its quite easy
there's a reason discord is 13+
you havent even said what library you use yet
Who am I even talking to here
Is this help
Or troll
And yet I'm breaking rules
what rules
Exactly
What is going on here
no you said it, not me
it's been 18 minutes and we still don't know what library you're using
LMFAO
Another one
the word "library" is a troll
you expect us to help you... without being able to help you
Yall had ur first days too
What did you download

@winter thistle what's your first language in terms of speaking
What is the name of the program
can we just ping a mod now
ghost when you started coding your bot did you run npm i discord.js?
what youtube tutorial did you watch?
get them to confess they're underage and boom ban hammer
ok
Did you watch a tutorial
jesus christ
Follow a guide
Um
check his YouTube channel
is there a javascript library that isn't d.js?
see if hes a minor
Ghost why are you making this hard. What library are you using for the bot?
eris @indigo folio
there is nothing to see there
ah ok
dead end
he is a nitro and a server booster, how does that work
mommy's credit card
What is going on
Mate, what library do you use to code and is it JavaScript?
we helped him

there's a reason discord is 13+ please for the sake of your innocence get off the platform until you're old enough to use it
I appreciate the ones actually trying to help
it was discord.js
we helped him
@turbid bough did you??
i tried
Appears Ghost is trolling, I have muted them.
the example I gave was discord.js
like i said in #memes-and-media idk if he was even intentionally trolling
Them ???
there's a reason discord is 13+ please for the sake of your innocence get off the platform until you're old enough to use it
@earnest phoenix true dat, I heard a 10 year old almost got kidnapped because their last name was gave out
my full name is on github 
oh no
i uh
my twitter?
(don't think anything bad can happen from people knowing your full name)
I mean the main reason discord is 13+ is likely because of COPPA but
What if it's a pen name 
How those discord got to know if he/she is 18+
And someone knowing your full name is not likely to result in being kidnapped
chances are it's premeditated
well there are websites used to find people
like whitepages? lol
Lol
A 10 year old isn't gonna be on the phonebook
Tracking ppl with names
oh
You seriously still talking bout this?
idk
sure
Ofcourse
we should move this to #memes-and-media
wrong channel ye
whats a good way to make a website that is connected to the database someway?
i mean you cant just have the ports open to the database right??
if im going to have to make it work with my bot
wouldnt i have to create some kind of api to my database, or just host the website with the database?
is the database hosted on the same machine as the website is
well, i am asking if it should be on the same machine as the database or not
ok, so what if it isnt going to be on the same network
do i need to create a something like rest api with oauth or something
or is it fine to open the database ports?
I'm trying to do the exact same thing and I've got nowhere so far
At the moment I'm trying to connect my website to a nodejs server where my database is via socket.io and shift the data that way
Although so far no luck
I've tried websockets and xhr as well
client.on("message", message => {
let args = message.content.substring(PREFIX.length).split(" ");
switch (args[0]) {
case "purge":
if(args[1] > 100){
message.channel.send("Please say a number equal to or less then 100")
}
if(args[1] === null){
message.channel.send("Please specifiy a number")
}
message.channel
.bulkDelete(args[1])
.then(messages =>
message.channel.send(
`**Succesfully deleted ` + `${args[1]} ` + `messages**`
)
);
break;
}
});```
it does work but if i get rid of the null statement it does
doesnt
well if they enter the command correclty it should send the message that works it should send a message if the number is under 100 and it should send a message if they forgot a number but it doesnt do that
over*
imo, i would check for the arg.s length, and not the args value
That is because if args[1] doesn't exist it will be undefined not null
and you are strictly comparing them
why don't people just use if (!args[1])?
i forgot about that
@pale vessel why doesnt people use why instead of what
what
lol
autocorrect
good save
lost half my commands but don't remember which ones i lost this is fun
i typed "wh" and clicked the first suggestion
i wonder if you could use tryparse an arg[1] for a number, for true or false, or if you can actually tryparse an undefined, that would kinda also filter out using words instead of numbers
i dont know if js has it or not so
and why does the code have missing semicolons?
where
oh i ususally put them when im done
//request
const fetch = require("node-fetch");
const querystring = require('querystring');
//post
var form = {
serverCount: "4"
};
var formData = querystring.stringify(form);
var contentLength = formData.length;
fetch('https://glennbotlist.xyz/api/v2/bot/698741208427528203/stats', {
method: 'post',
body: formData,
headers: { 'Content-Type': 'application/json', 'Authorization': 'NONONONO },
})
.then((res) => {
status = res.status;
return res.json()
})
.then((jsonData) => {
console.log(jsonData);
console.log(status);
})
.catch((err) => {
console.error(err);
});
How do i Authorization?
It not work :/
no he's not missing a '
how
Where ?
I am not sure about post thing
yeah
can you check whether you closed the quote or not after the authorization header?
and saying "it no work :(" won't help
tell us the error
FetchError: invalid json response body at https://glennbotlist.xyz/api/v2/bot/698741208427528203/stats reason: Unexpected token < in JSON at position 0
at C:\Users\ou714\node_modules\node-fetch\lib\index.js:272:32
at processTicksAndRejections (internal/process/task_queues.js:89:5) {
message: 'invalid json response body at ' +
'https://glennbotlist.xyz/api/v2/bot/698741208427528203/stats reason: ' +
'Unexpected token < in JSON at position 0',
type: 'invalid-json'
}
um, im not sure if querystring.stringify is the way you want to use as json
show us your json file
what is your output on querystring.stringify?
cause you dont want to use querystring, cause thats i think is doing like
'foo:bar;baz:qux'
not json at all
yeah
foo=bar*
foo=bar&baz=qux
try using JSON.stringify(obj);
i havent even heard of querystring
ah, right querystring, to parse data over do when you want to do php._GET[] stuff
yo that's php
your php
and it's $_GET[]
I KNow but i wanted to show that im talking about php smh
ok
smh=slam my head
make sure you know what you're talking about
ok php. π΅ get["no?"]
[discord.js] How can I create an invitation for a specific channel?
create invite ik
for specific channel...
maybe try to read the docs?
@balmy knoll https://lumap.is-inside.me/DmIVIQme.png
@tight plinth 
π₯:feed:
So, what the F did I miss?
I already have the `` around the description and the footer, don't worry about that.
well u dont
I didn't edit dat part
Oh, damn right, thanks @tight plinth
lol
no
i think this isn't the right place to ask this
it's for discord bots
how can i quote this way?
- ...
2)...
3)...
let Users = invites.filter(UserGet => UserGet.inviter.id === member.user.id).map(g => "1) " + g.code + " " + g.uses).join("\n\n")```
ok
wdym @wicked pivot
http://alex.is-bad.com/2tvZLHM.png
http://alex.is-bad.com/AdMaCm9.png
http://alex.is-bad.com/3V7tHzw.png
http://alex.is-bad.com/8XejkK4.png
why does chunks array gets modified after buildFile function?
I would like to list what my "map" will say this way
1)..
2)..
is invites an array or a collection?
message.guild.fetchInvites(true).then(invites => {
let Users = invites.filter(UserGet => UserGet.inviter.id === member.user.id).map(g => "" + g.code + " " + g.uses).join("\n\n")
})```sorry i didn't show all the code
that was a question towards Tony
collection"
You could do:
invites.array().filter(UserGet => UserGet.inviter.id === member.user.id).map((g, index) => `${(index + 1)})` + g.code + " " + g.uses).join("\n\n") but I am not sure if the most efficient way of doing it
http://alex.is-bad.com/2tvZLHM.png
http://alex.is-bad.com/AdMaCm9.png
http://alex.is-bad.com/3V7tHzw.png
http://alex.is-bad.com/8XejkK4.png
why doeschunksarray gets modified after buildFile function?
someone?
I'm trying to figure it out since yesterday
it works thank you very much @cinder patio
hi, what do you do if you have a project in mind but you know its just too big for a side project?
does anybody know a mongodb lib for node.js that supports promises
mongoose
that isn't mongoose
if(userTickets.has(user.id)) {
if(reaction.message.channel.id === userTickets.get(user.id)) {
let embed = new discord.MessageEmbed();
embed.setDescription("Ticket will be closed in 5 seconds.")
reaction.message.channel.send(embed);
setTimeout(() => {
reaction.message.channel.delete('closing ticket')
.then(channel => {
console.log("Deleted " + channel.name);
})
.catch(err => console.log(err));
}, 5000);
}
}
else if(reaction.message.guild.channels.cache.some(channel => channel.name.toLowerCase() === user.username + 's-ticket')) {
let embed = new discord.MessageEmbed();
embed.setDescription("Ticket will be closed in 5 seconds.");
reaction.message.channel.send(embed);
setTimeout(() => {
reaction.message.guild.channels.forEach(channel => {
if(channel.name.toLowerCase() === user.username + 's-ticket') {
channel.delete().then(ch => console.log('Deleted Channel ' + ch.id))
}
});
}, 5000);
}
}
});
please someone help me
idk what is wrong
i use discord v12
dbl.getBot("691936549243191346").then(bot => {
const count = axios.get(`https://top.gg/api/bots/691936549243191346/stats`)
const botinfo = new MessageEmbed()
.setAuthor(bot.username, "https://images-ext-2.discordapp.net/external/3mbasJg2QkXgD_RRuDPijvTJ5-RnJOwgwLqMwSktTH0/%3Fv%3D1/https/cdn.discordapp.com/emojis/698612397933592658.png")
.setColor("#000000")
.setDescription("Shows some infos about the Bot")
.addField("Bot ID", bot.id, true)
.addField("Username", bot.username, true)
.addField("Discriminator", bot.discriminator, true)
.addField("Short Description", bot.shortdesc, true)
.addField("Bot Library", bot.lib, true)
.addField("Bot Prefix", bot.prefix, true)
.addField("Tags", bot.tags, true)
.addField("Server Count", count.server_count, true)
.setThumbnail("https://images-ext-2.discordapp.net/external/3mbasJg2QkXgD_RRuDPijvTJ5-RnJOwgwLqMwSktTH0/%3Fv%3D1/https/cdn.discordapp.com/emojis/698612397933592658.png")
message.channel.send(botinfo)
});```
it says undefined in the value of server count
[discord.js] How can I check if the everyone role already has CONNECT permission on a voice channel?
I can't find the reason for this error
someone can help me up?
ur code is not the error
@balmy knoll what version of node.js are you using?
it says: cannot read property send of undefined bot.channels.cache.get(`694189734146211901`).send(embed) Someone Can Help?
the channel doesn't exist.
Ok
but i copy the id
it exist
bot.channels.cache.get("694189734146211901").sens()
ok
use " instead of `
is send or sens
send
ok
no
we won't do the work for you
ok
it says the same
but why?
show code
of course bot is the name of ur dbl code.
Its not ur discord.js bot name
show ur const discord = require ....
ect
const Discord = require('discord.js');
const bot = new Discord.Client();
Post it on gist
are you using the same name for discordjs bot and DBL code ?



