#development

1 messages Β· Page 866 of 1

earnest phoenix
#

You first need to fetch the guild bans and if the user's id that you want to unban is in the banned list it would unban it but if it's not there... It would say this user not is not banned

royal portal
#

I'm not sure how

#

I tried it before

earnest phoenix
#

Me too... Idk how it works actually...

blazing portal
#

guild.fetchBans()

royal portal
#

but where would I add it

blazing portal
#

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

royal portal
#

yeah

#

it still sends embed when user isnt banned

blazing portal
#

huh? in the code you sent, there is no check whether someone is banned?

#

or am i getting old

earnest phoenix
#

@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?

royal portal
#

no

#

there isnt

#

i cant find a way how

blazing portal
#

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

royal portal
#

if (client.guild.member(USER_ID).exists){

#

and then send embed

#

}

#

but then

#

that only checks for that user id

#

not the id mentioned

blazing portal
#

which d.js version are you using?

royal portal
#

v12

blazing portal
#

I'm not exactly sure what you mean. Let me post what i think could work

gritty bolt
#

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

royal portal
#

V12 version @blazing portal

#

node.js

blazing portal
#
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)
    }
  }
});
royal portal
#

ye

#

and also

#

if user isnt banned then

#

it says user isnt banned in this guild?

earnest phoenix
#

Yes

blazing portal
#

Yeah, or whatever else you want it to say, this is just what floated around in my head. Haven't tested that one though

royal portal
#

wait

#

what about

#

if I didnt want it to say

earnest phoenix
#

Just return it

royal portal
earnest phoenix
#

Yes

royal portal
#

ok

blazing portal
#

yh

royal portal
#

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

blazing portal
#

again πŸ˜„

earnest phoenix
#

You put a | lol

gritty bolt
#

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

blazing portal
#

what are you doing with those |

royal portal
#

idk

#

wtf is wrong with me

#

i just ctrl + c on my pc

#

then ctrl + v on my rpi

#

thinking it would work

#

πŸ˜‚

clever arch
#

i was trying to install node-opus

#

i have build tools

#

but why it dont install πŸ€”

royal portal
#

uhm

#

@blazing portal it deletes the message where i say -unban when i unban the user

#

did you add that

blazing portal
#

nah i just added the 2 lines

#

when exactly does it delete them?

royal portal
#

so when i unban a user

#

and its successful

#

then it deletes the message i sent

blazing portal
#

you put that in your code yourself πŸ˜„ right above the trycatch

royal portal
#

how would I remove that

#

I can't just remove it

blazing portal
#

why not?

#

just remove the line and youre fine

royal portal
#

nope

#

wait

#

yes

#

is it supposed to say

#

logged in as bot

#

like 6 times

#

and it works normally

gritty bolt
#

is anyone gonna like help me lol

royal portal
#

in pm2

blazing portal
#

sorry @gritty bolt i had no idea what causes your problem

regal saddle
#

How was the Command for updating discord.js in cmd?

blazing portal
#

typically not @royal portal

royal portal
#

idk

#

but the bot works normally..

blazing portal
#

npm i discord.js

royal portal
#

why

#

already have

#

oh wait

blazing portal
#

npm i discord.js
that was for @regal saddle

royal portal
#

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

regal saddle
royal portal
#

but now i restarted it and it works

#

maybe cuz log file

blazing portal
#

general advice, never just ignore a problem, it can cause more problems later on and then you're f*cked πŸ˜„

royal portal
#

lol

#

i think it was just the logs

#

from pm2

turbid bough
blazing portal
#

quite possibly Bloxys, pm2 does not flush the logs when you restart your bot. only when you manually flush them πŸ˜‰

royal portal
#

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?

spare goblet
#

Depends on how you coded it

royal portal
#

because I can still mention banned users

spare goblet
#

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

royal portal
#

also

#

I know that .id is the id of the user

#

what would it be to see the user's tag

#

user.tag?

spice pier
#

tag?

#

What do you mean by tag?

blazing portal
#

I'd have to check the docs. Before I do that, I'll let you do that

spare goblet
#

yes

spice pier
#

user.tag returns username#discrim if you only want the discriminator its user.discriminator

spare goblet
#

That is not true

#

user.tag returns username#discrim

#

Oh

#

Ngm

spice pier
royal portal
#

I couldn't use the user.tag way

spare goblet
#

Nvm my brain is fried lmaoo

royal portal
#

so if user banned then return

#

but that didnt work

blazing portal
#

What are you trying to do with the user.tag?

royal portal
#

wait

#

so

#

if user mentioned is unbanned then return

gritty bolt
#

im not getting any errors

#

tried asking earlier but nobody knew

royal portal
#

@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

queen needle
#

who uses uptimerobor

#

uptimerobot

royal portal
#

idk

gritty bolt
#

does anyone know how messagecollecters work?

royal portal
#

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)
    }
  }
});
spare goblet
#

@gritty bolt what is there to fix ?

gritty bolt
#

the code isn't returning anything

#

no errors

spare goblet
#

What are you trying to do?

gritty bolt
#

collect a response to a dm

royal portal
#

when user is banned and you mention them then it says please provide userid and gives me error

spare goblet
#

You want to attach a listener to a DM?

gritty bolt
#

yes

royal portal
#

and then you cant unban the user through id or anything

spice pier
#

Can you upload your code on hastebin or something? It's hard to read through discord

royal portal
#

mine?

spice pier
#

Who else?

royal portal
#

okay

#

hastebin is down

hybrid ruin
#

Hatebin isn't

royal portal
#

@spice pier

spice pier
#

ty

hybrid ruin
#

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
spare goblet
#

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

gritty bolt
#

user is equal to message.author

spare goblet
#

sorry I mean, in your first parameter

#

Yes

gritty bolt
#

but then how do I use it in my collector.on?

royal portal
spare goblet
#

Literally everything is the same except

gritty bolt
#

and how do I do the time?

spice pier
gritty bolt
#

and is there anything else that could make it not work>

spare goblet
#

const collector = await <user>.dmChannel.createMessageCollector(filter, options )

#

collector.on('collect', m => {

})

royal portal
#

yeah i just send the new one @spice pier

spare goblet
#

Sorry I'm on mobile so it's taking a whiole to type

spice pier
#

Thats from the new one

gritty bolt
#

so if I don't need a filter what do I put first im kinda having a dumb moment here

#

its fine

spice pier
#

nvm

#

And theres no error when you run the command?

royal portal
#

nope

spare goblet
#

If you don't need a filter you could just put a dummy filter function ig

royal portal
#

the new one works

spice pier
#

Do you know at what point it returns?

royal portal
#

yes

#

when the user is unbanned

#

its just that if you try to unban someone by mentioning them, i get an error

gritty bolt
#

ok final thing here, could I just use null, and why is it m => instead of message =>?

spare goblet
#

you can do message

#

It doesn't matter what you name the parameter

#

For me it's just easier to type m than message :,)

gritty bolt
#

but if i'm already talking about a message

#

wouldn't i need to use message?

spare goblet
#

No.

gritty bolt
#

oh this is seperate

#

oh

#

oh

#

oh

spice pier
#

Thats because mentions aren't IDs

spare goblet
#

It's the same as declaring a variable lmaoo

gritty bolt
#

and finally can i have a null filter?

spare goblet
#

Uh

royal portal
#

well yeah

#

but then

spare goblet
#

You can do something like

#

true === true

royal portal
#

once i mention the user in the -unban, im not able to unban them using the id

spice pier
#

what, so if you do -unban mention you can't unban them with -unban id afterwards?

royal portal
#

sometimes

gritty bolt
#

ok thanks so much

#

i will return if i have more issues

spare goblet
#

@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 ZumEyes

royal portal
#

@spice pier i just need it to ignore mentions when you unban

hybrid ruin
#

I tried using const

#

Then I tried using var

#

Both made me cry

spare goblet
#

why use var?

#

what are you trying to do tho

royal portal
#

and to ignore "@everyone" for ban and unban

hybrid ruin
#

Cause a guide showed me var

#

I'm trying to uh

spice pier
#

if arg[0] startwith <@ return

hybrid ruin
#

On dbl vote, get a certain guild, check if member is in guild, if so, send message in specific channel

spare goblet
#

var is old, don't use it, it's genuinely bad practice

hybrid ruin
#

Ah okay

royal portal
#

so i would add that

spice pier
#

well, @everyone isnt a valid id, so it shouldnt trigger anything

hybrid ruin
#

It's the only var in my code so far, no worries

royal portal
#

near the banned member

#

well it did

spare goblet
#

ah

royal portal
#

everyone is not snowflake

spare goblet
#

im pretty sure @ everyone is @ server id

#

or something

gritty bolt
#

i've got a new issue

spare goblet
#

what tis your issue

gritty bolt
#

Cannot read property 'createMessageCollector' of null

spare goblet
#

dmChannel isn't defined

gritty bolt
#
const collector = await user.dmChannel.createMessageCollector(m => user.id === m.author,{time: 60000})```
spare goblet
#

is user defined

hybrid ruin
#

@ everyone is server ID yeah

gritty bolt
#
let user = message.author```
spare goblet
#

are you creating a ticket system

gritty bolt
#

no

#

its similar though i guess

spare goblet
#

Lowkey don't know why you're putting a listener in a listener if you're not doing a ticket systemℒ️

gritty bolt
#

its easking questions

#

asking*

#

then storing them

#

for a system

royal portal
#

if arg[0] startwith <@ return

#

its not correct

gritty bolt
#

its like a setup for a feature

royal portal
#

unexpected thing

spice pier
#

thats because its english, not js

spare goblet
#

feel like what we're having rn is this

#

-xyproblem

gilded plankBOT
#

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.

spare goblet
#

buT

#

try making sure dmChannel is valid

#

(by either console logging it or otherwise)

spice pier
#

@everyone doesnt have any id, the raw content of it is @everyone so it doesnt have any id

royal portal
#

you just pinged everyone

spare goblet
#

He doesn't have perms

royal portal
#

oh

spare goblet
#

soooo it doesn't matter

royal portal
#

for some reason if args[0] startwith <@ return doesnt work

spare goblet
#

that's such gross code

#

why are you doing that uwot_confused

spice pier
#

Show me your line

#

with the if statement

gritty bolt
#

is there like a tutorial for messageCollecters out there

royal portal
gritty bolt
#

I think I need to watch one before I do this

royal portal
#

the part where it checks

#

if user is banned

#

it says it in //

spare goblet
#

There are discord js docs on it

#

:^)

gritty bolt
#

cause my dummy self cant find the dmChannel

spice pier
#

I literally said what I told you isn't js I was just explaining the logic

spare goblet
hybrid ruin
#

Fixed my issue by not forgetting I'm creating a new Client instead of using my original one

spare goblet
#

good work

hybrid ruin
#

Might want to put that in my original message actually

royal portal
#

this is too confusing with these errors

hybrid ruin
#

What errors are you getting

royal portal
#

userid not a snowflake

spare goblet
#

Can you just show your code

royal portal
#

I did

hybrid ruin
royal portal
spare goblet
#

which line is your error

hybrid ruin
#

What am I reading

#

Is 22 throwing errors?

peak quail
#

how many embeds can a webhook send?

spare goblet
#

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

gritty bolt
#
let user = bot.channels.find(message.author.id)```
spare goblet
gritty bolt
#

this won't find the channel but I don't get why

spare goblet
#

uh

earnest phoenix
hybrid ruin
spare goblet
#

isn't doing that with find deprecated since like v10

gritty bolt
#

it didnt work with get either

#

i tried both

spare goblet
#

are u on v12

earnest phoenix
#

@gritty bolt which version are you using?

spare goblet
#

client.channels.cache.get(id)

gritty bolt
#

latest

spare goblet
#

client.channels.cache.get(id)

earnest phoenix
#

Hmm if @spare goblet's method doesn't work then it's:
<client>.channels.fetch();
... I guess...

royal portal
#

could I do if message starts with <@ then return;

gritty bolt
#

iara's method worked

royal portal
#

?

gritty bolt
#

i forgot the cache

earnest phoenix
#

Hmm nice

royal portal
#

i've been trying to figure this out for 5 hours

spare goblet
#

@earnest phoenix the way you're doing it is most likely going to hit a ratelimit

earnest phoenix
#

@royal portal like a mention?

#

@spare goblet lol...

royal portal
#

so if you say -unban (mention) then just ignore it

earnest phoenix
#

@royal portal so it just work if it's a user id?

spare goblet
#

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

royal portal
#

yup dank

#

so it ignores <@!> and mentions

spare goblet
#

just make your own regex to find the id from a mention, smh . . .

gritty bolt
#

still getting the same error

#

maybe im just really stupid

earnest phoenix
#

@royal portal hmm like... I did this:
if (!args[0]) return; and it worked...

gritty bolt
#

but this isnt working lol

royal portal
#

does that ignore mentions

spare goblet
#

No

#

It doesn't

#

:^)

hybrid ruin
#

Mentions simply get mapped, they're still arguments

earnest phoenix
#

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
#

sure

#

its 02:08 rn for me

#

a.m

spare goblet
#

@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
}

earnest phoenix
gritty bolt
#

@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});

royal portal
#

@spare goblet i did that

#

it doesnt work

earnest phoenix
#

Try mine i guess @royal portal

spare goblet
#

You're fetching a channel.

royal portal
#

im just gonna give up

#

its 02:12

spare goblet
#

pinkpepe smh

earnest phoenix
#

@royal portal wait a second... Isn't user ids only numbers right?
Do:
if (isNaN(args[0])) return;

spare goblet
#

Bro

#

Just cuz it's a number

hybrid ruin
spare goblet
#

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

earnest phoenix
#

I mean like... He is just saying it would ignore mentions... So that would work

hybrid ruin
#

What?

amber fractal
#

wait wait isNaN(string) would never be true?

hybrid ruin
#

Are you reading anything that's being said

amber fractal
#

you mean always be true?

hybrid ruin
#

Never be true

#

You're asking if a string, text, would be true to a number

amber fractal
#

is not a number

#

ex

spare goblet
#

yes

hybrid ruin
#

I mean

#

not a number

amber fractal
#

isNaN(string) is always true

spare goblet
#

sry my brain is friedℒ️

hybrid ruin
#

other way around

spare goblet
#

the point is, it won't workℒ️

gritty bolt
#

user.createMessageCollector ```Cannot read property 'createMessageCollector' of undefined

amber fractal
#

well

#

unless it's numbers in a string]

hybrid ruin
#

user is nothing then

amber fractal
gritty bolt
#

i feel like an idiot but i really cant figure out whats wrong

earnest phoenix
#

Wait... Brb in a sec

spare goblet
#

@gritty bolt show the line of code before

gritty bolt
#
      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});```
hybrid ruin
#

Don't ask to ask, just ask

spare goblet
#

It's possible the DM channel does not exist yet, you have to create it then

gritty bolt
#

yikes that tabbing is not good

spare goblet
#

const user = await message.author.createDM()
const collector = await user.createMessageCollector(m=> message.author.id === m.author.id, { time: 60000 })

earnest phoenix
#

@spare goblet as i see... The thing i said didn't work... Lol

spare goblet
#

I'm aware

earnest phoenix
#

@spare goblet so as i were talking about my mute command... What was wrong lol?

spare goblet
#

I already mentioned it before, I'm not going to repeat my answer

#

and stop pinging me

#

ty

earnest phoenix
#

Kk... Hmm

wicked pivot
#

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....)
})```
earnest phoenix
#

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)

amber fractal
#

no, because discord api doesn't allow that

earnest phoenix
#

@earnest phoenix cuz he might be a new dev so it would be hard for him...

amber fractal
#

And a new dev needs to learn how to read docs

#

as people wont always be able to help

earnest phoenix
#

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

wicked pivot
#

I approach what I want to do Detente_ref

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)
})```
earnest phoenix
#

loop through the bans

#

with a for loop

#

what you're doing is half correct

wicked pivot
#

I'm very bad at English, excuse me

spice pier
#

Lis la doc qu'y dit

wicked pivot
#

it's something that I want to do only once so it doesn't matter if it's not "well done"

earnest phoenix
#

use a for loop with which you will be able to go through bans one by one

#

@spice pier english only in here xx

spice pier
#

where does it say that? I'm also helping this person in a language they understand

earnest phoenix
wicked pivot
#

@spice pier la quel ? (wich one ?)

spice pier
#

d.js doc smh

crimson vapor
#

I know it is against rules but why does it matter the language if you are having a helpful conversation?

earnest phoenix
#

because the conversation is restricted to people who speak that language

crimson vapor
#

as long as it isnt spam or clogging up the channel, I dont see the problem

earnest phoenix
#

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

wicked pivot
#

it is the rules must respect them :/

crimson vapor
#

I understand that

#

and I will still follow them

#

and I see your point with people being unable to help

wicked pivot
#

I found nothing on the docs on this

earnest phoenix
#

a for loop isn't a part of d.js lol

#

it's javascript fundamentals

wicked pivot
#

yes yes i know it's js

#

but I looked if I could find my happiness like this x)

earnest phoenix
wicked pivot
earnest phoenix
#

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

wicked pivot
#
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
earnest phoenix
#

forEach is slow

#

that's why i was telling you to for loop instead

wicked pivot
#

it's something i'll do once it's not that bad

wild cloud
#

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?

amber fractal
#

Tim's lib is pretty good

#

it disables caching

#

and gives some more control over the lib

wild cloud
#

Oh, cool! I'll try it out and see if it fixes the problem. Thank you!

valid gyro
#

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

sudden geyser
#

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.

valid gyro
#

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

sudden geyser
#

Yeah, so you could do either of the options I listed.

valid gyro
#

The second seems easier

#

So I'll try that

sudden geyser
#

It's not about it being easier or not. It's about what case you need it for.

valid gyro
#

Ok, would that work with any command

#

Like if the arg is scorching ray

#

Because doesn't it sort arguements alphabetically

sudden geyser
#

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.

valid gyro
#

Ok, thanks!

grizzled raven
#

will a for loop always finish before executing the code after it?

amber fractal
#

I think anyways

earnest phoenix
#

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

grizzled raven
#

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

earnest phoenix
#

for will exit once it's done doing whatever it needs to do in each iteration

grizzled raven
#

so then would there be a possibility that it saves data when its not finished in the for loop?

earnest phoenix
#

no

#

that's the opposite of what i said

#

for is blocking

grizzled raven
#

oh ok

#

theres no async methods in the loop btw

earnest phoenix
#

yeah for is going to block regardless

grizzled raven
#

ok

earnest phoenix
#

i keep forgetting that node is singlethreaded so true concurrency doesn't exist lul

valid gyro
#

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

earnest phoenix
#

slice on a string doesn't return an array

valid gyro
#

o, so i need to do a regex then?

#

oof

sudden geyser
#

No, you split it after.

valid gyro
#

so .join then .split

summer torrent
#

join() is creating string using arrays

valid gyro
#

wait nani

#

but wouldnt .join attach the command to the args

#

where would i put .join then, im super cofused now

grizzled raven
#

you dont

#

add .split(/ +/g) between join and slice

valid gyro
#

like this?

#
  const command = args.shift().toLowerCase();```
#

cause that spits a args.shift is not a function error

#

@grizzled raven

grizzled raven
#

wait why are you joining them back?

#

removed the join

obtuse wind
#

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

earnest phoenix
#

uhh

#

πŸ‡«

#

hang on

obtuse wind
#

or is it not possible

earnest phoenix
#

try \xd8\x3c\xdd\xeb

obtuse wind
#

uh ok

earnest phoenix
#

in a string

#

ofc

#

it's f except escaped

obtuse wind
#

"Unknown Emoji"

earnest phoenix
#

hmmm

obtuse wind
#

or can I not put it in ``

#

I'll try it in quotes

earnest phoenix
#

o

#

try quotes

main ridge
#

I thought you just quoted πŸ‡« (the name of the emoji) in quotes

earnest phoenix
#

then try :regional_indicator_f: directly i guess

#

yeah he says he can't paste the emoji in atom

main ridge
#

I don’t mean the emoji, I mean the name like you just said

valid gyro
#

@grizzled raven that succeded at putting dashes between things, but it put it between everything, not just the 2 words

obtuse wind
#

its still unknown emoji for all of my types

earnest phoenix
#

o

#

hmm

#

bruh

obtuse wind
#

wait

main ridge
#

Last time I tried that it worked except I was using βœ… on discord.js version 12

earnest phoenix
#

@valid gyro what u tryin to do

obtuse wind
#

^^ I'm on v11

#

Let me try the unicode for F

main ridge
#

Yes

valid gyro
#

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 -

main ridge
#

That should work I think Discord converts the Unicode characters to emojis by default

earnest phoenix
#

@valid gyro wdym put it between everything

#

also that's super ew

#

message.slice(prefix.length).replace(/ +/g, delim)

valid gyro
#

that would be why lmao

earnest phoenix
#

hmm

#

wait

valid gyro
#

i didnt call the delim

earnest phoenix
#

whats that command for anyway

valid gyro
#

to split the args from my command so it doesnt search the command too

main ridge
#

Why am I listening to nightcore music while I am in bed at 5:30 AM in the morning

#

Lol

earnest phoenix
#

nightcore

#

wow that brings back memories

#

@valid gyro args?

main ridge
#

Yea

earnest phoenix
#

example of command pls?

#

o

#

oh

#

right

#

personally i like replace

valid gyro
#

that made my args undefined lol

#

idk how

earnest phoenix
#

what did

valid gyro
#

(/ +/g, delim)

earnest phoenix
#

so msg.content.slice(prefix.length).replace(/^\s+[^\s]+\s+/, '').replace(/ +/g, delim)

#

something like this maybe

valid gyro
#

ill try that

earnest phoenix
#

first one is <space(s)><not space(s)><space(s)>

#

to remove the command

obtuse wind
#

~~has anyone gotten

ECONNREFUSED

before?~~

Case solved, ignore.

valid gyro
#

ugh back to args.shift is not a function

earnest phoenix
#

you don't need args.shift

valid gyro
#

o right

earnest phoenix
#

well i mean

#

i guess you need the command right?

valid gyro
#

idk lets try it

#

o ya i do

#

command would be undefined

#

i could send my whole code if that helps?

earnest phoenix
#
const [_, command, args] = msg.content.match(/\s*(\S+)\s+(.+)/)
const dashedArgs = args.replace(/\s+/g, delim)
#

something like this maybe idk

valid gyro
#

kk

earnest phoenix
#

*fixed

valid gyro
#

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

minor bluff
#

Is there a way I can import the WoW Classic Emjois from the Raid Helper so people can use them as server default reactions?

earnest phoenix
#

what

#

what

main ridge
#

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

drowsy sentinel
#

MANAGE_MESSAGES.

#

Allows the option of letting moderators on most servers skip songs that may be inappropriate. @main ridge

main ridge
#

Thanks @drowsy sentinel

winter thistle
#

Hey guys how do I make a bot send dm when muted on server?

#

Or upon mute role given

summer torrent
#

which lib

unreal cliff
#

^

winter thistle
#

Java

summer torrent
#

javacord?

winter thistle
#

Open for dm? Lol I dont wanna hype channel

unreal cliff
#

bruh this channel dead

summer torrent
unreal cliff
#

you ain't hyping up anything

indigo folio
#

this channel gets 2 messages a day

summer torrent
#

@winter thistle I am asking which library do you use

earnest phoenix
#

too much clout for the dev channel awauEyesRolling

indigo folio
#

is it me or is this channel being hyped up

turbid bough
#

still waiting for which library that person is using

#

might be in html, but i dunno

winter thistle
#

Javascript bro

#

Node.js

indigo folio
#

member.send("lol get muted") will DM someone

unreal cliff
#

java β‰  JavaScript

turbid bough
#

i mean you can technically write javascript in html via the <script> tag

summer torrent
winter thistle
#

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

main ridge
#

u mean like add a muted role?

winter thistle
#

That too

#

Cuz muted are gunna have role

unreal cliff
#
member.addRole(mutedrole).then(() => {
    member.send('You have been muted`)
})
winter thistle
#

Woot wwooot

earnest phoenix
#

it's been 10 minutes and we're still not sure if they're using d.js, eris, or some other lib lol

indigo folio
#

d.js, he said

unreal cliff
#

make sure to define both member and mutedrole

earnest phoenix
#

they said node.js

turbid bough
#

javascript and nodejs?

indigo folio
#

its definitely d.js

winter thistle
#

Javascript node.js

indigo folio
#

lmao

winter thistle
#

Lol

earnest phoenix
#

the former is a language the latter is a runtime

#

neither are a lib

#

πŸ’€

turbid bough
#

dis.html

main ridge
winter thistle
#

Hive me a nickname noob newbie begginger

#

My bad guys

indigo folio
#

what

winter thistle
#

Durp

unreal cliff
#

discord.css

indigo folio
#

discord.bat

earnest phoenix
#

what's this smelly smell that im smelling

#

it smells like an underage user

unreal cliff
#

discord.png

indigo folio
#

discord.ogg

turbid bough
#

discord.exe

#

wait

dusky marsh
#

It definitely stinks of 12 year old in here.

unreal cliff
#

discord.ico

indigo folio
#

discord.txt

main ridge
#

discord.bin

winter thistle
indigo folio
turbid bough
#

discord.ignore

unreal cliff
#

._discord

winter thistle
#

Cold

indigo folio
#

wtf is a .ignore file

unreal cliff
#

discord.dll

main ridge
#

discord.sqlite JOYE

winter thistle
#

Now yall spamming

#

All hyped

unreal cliff
#

shit, we do be

turbid bough
#

@indigo folio never heard of .gitignore?

indigo folio
#

discord.swf

#

i know gitignore

#

but its not git.ignore

unreal cliff
#

.discignore

indigo folio
#

nice

winter thistle
#

I give up

#

Ty

unreal cliff
#

seizure emotes

earnest phoenix
#

underage person stop your illegal activities discordPolice

summer torrent
#

can you delete that

unreal cliff
#

ban ban

turbid bough
#

i mean you havent even tried

indigo folio
#

also why did you give up? its quite easy

earnest phoenix
#

there's a reason discord is 13+

winter thistle
#

Yall cold

#

Threw me off

turbid bough
#

you havent even said what library you use yet

winter thistle
#

Who am I even talking to here

#

Is this help

#

Or troll

#

And yet I'm breaking rules

turbid bough
#

what rules

winter thistle
#

Exactly

golden condor
#

What is going on here

turbid bough
#

no you said it, not me

sudden geyser
#

it's been 18 minutes and we still don't know what library you're using

golden condor
#

LMFAO

winter thistle
#

Another one

turbid bough
#

the word "library" is a troll

golden condor
#

What is the name of it

#

The one you downloaded

earnest phoenix
#

you expect us to help you... without being able to help you

winter thistle
#

Yall had ur first days too

golden condor
#

What did you download

winter thistle
indigo folio
#

@winter thistle what's your first language in terms of speaking

golden condor
#

What is the name of the program

sudden geyser
#

can we just ping a mod now

indigo folio
#

ghost when you started coding your bot did you run npm i discord.js?

turbid bough
#

what youtube tutorial did you watch?

earnest phoenix
#

get them to confess they're underage and boom ban hammer

winter thistle
#

πŸ˜‚

turbid bough
#

ok

golden condor
#

Did you watch a tutorial

earnest phoenix
#

jesus christ

golden condor
#

Follow a guide

main ridge
#

Um

unreal cliff
#

check his YouTube channel

indigo folio
#

is there a javascript library that isn't d.js?

unreal cliff
#

see if hes a minor

glad charm
#

Ghost why are you making this hard. What library are you using for the bot?

scenic kelp
#

eris @indigo folio

turbid bough
#

there is nothing to see there

indigo folio
#

ah ok

unreal cliff
#

dead end

turbid bough
#

he is a nitro and a server booster, how does that work

earnest phoenix
#

mommy's credit card

golden condor
#

What is going on

indigo folio
#

mom's card

#

lol

winter thistle
#

Lol

#

Yeah

golden condor
#

Mate, what library do you use to code and is it JavaScript?

winter thistle
#

I'm good man

#

I dont need help here

#

Thank u

turbid bough
#

we helped him

pallid zinc
earnest phoenix
#

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

winter thistle
#

I appreciate the ones actually trying to help

unreal cliff
#

it was discord.js

golden condor
#

we helped him
@turbid bough did you??

turbid bough
#

i tried

drowsy sentinel
#

Appears Ghost is trolling, I have muted them.

unreal cliff
#

the example I gave was discord.js

indigo folio
pallid zinc
#

Them ???

ripe lantern
#

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

turbid bough
#

my full name is on github sweat

ripe lantern
#

oop

#

well uh

glad charm
#

Homie it's also on your Twitter

#

What you thinkin

ripe lantern
#

oh no

indigo folio
#

i uh

ripe lantern
#

my twitter?

indigo folio
#

(don't think anything bad can happen from people knowing your full name)

scenic kelp
#

I mean the main reason discord is 13+ is likely because of COPPA but

sudden geyser
#

What if it's a pen name horithinkingsmirk

ripe lantern
#

yea

#

I use my pen name

#

which is blaine

pallid zinc
#

How those discord got to know if he/she is 18+

ripe lantern
#

hey uh

#

maybe rephrase that

scenic kelp
#

And someone knowing your full name is not likely to result in being kidnapped

#

chances are it's premeditated

ripe lantern
#

well there are websites used to find people

indigo folio
#

like whitepages? lol

pallid zinc
#

Lol

indigo folio
#

you kinda need to be an adult to even be listed on the site

#

Β―_(ツ)_/Β―

scenic kelp
#

A 10 year old isn't gonna be on the phonebook

pallid zinc
#

Tracking ppl with names

ripe lantern
#

oh

golden condor
#

You seriously still talking bout this?

ripe lantern
#

idk

scenic kelp
#

sure

pallid zinc
#

Ofcourse

ripe lantern
scenic kelp
#

wrong channel ye

turbid bough
#

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?

earnest phoenix
#

is the database hosted on the same machine as the website is

turbid bough
#

well, i am asking if it should be on the same machine as the database or not

earnest phoenix
#

ideally, no

#

if you're on a budget, it's fine

turbid bough
#

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?

true ravine
#

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

queen needle
#
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

turbid bough
#

isnt that what its supposed to do?

#

atm i dont see anything wrong

queen needle
#

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*

turbid bough
#

imo, i would check for the arg.s length, and not the args value

cinder patio
#

That is because if args[1] doesn't exist it will be undefined not null

#

and you are strictly comparing them

pale vessel
#

why don't people just use if (!args[1])?

queen needle
#

i forgot about that

finite bough
#

@pale vessel why doesnt people use why instead of what

turbid bough
#

what

queen needle
#

lol

pale vessel
#

autocorrect

finite bough
#

good save

queen needle
#

lost half my commands but don't remember which ones i lost this is fun

pale vessel
#

i typed "wh" and clicked the first suggestion

turbid bough
#

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?

queen needle
#

where

turbid bough
#

where you have message.channel.send

#

on the two if statements

queen needle
#

oh i ususally put them when im done

lean swan
#
//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?

turbid bough
#

you are missing a quote

#

'

#

after nononono

pale vessel
#

add "Authorization" to header

#

he did oh

lean swan
#

It not work :/

pale vessel
#

no he's not missing a '

turbid bough
#

how

lean swan
#

Where ?

pale vessel
#

probably deleted it to hide the token

#

actually

lean swan
#

I am not sure about post thing

queen needle
#

yeah

pale vessel
#

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

lean swan
queen needle
#

thats in your json file i believe

#

{ }

lean swan
turbid bough
#

um, im not sure if querystring.stringify is the way you want to use as json

queen needle
#

show us your json file

turbid bough
#

its in the code

#
var form = {
  serverCount: "4"
};```
lean swan
turbid bough
#

what is your output on querystring.stringify?

pale vessel
#

the content type is wrong

#

it's not json

#

that's a form

turbid bough
#

cause you dont want to use querystring, cause thats i think is doing like

#

'foo:bar;baz:qux'

#

not json at all

queen needle
#

yeah

pale vessel
#

foo=bar*

lean swan
#

Hmmmm

#

@@

pale vessel
#

foo=bar&baz=qux

turbid bough
#

try using JSON.stringify(obj);

queen needle
#

i havent even heard of querystring

lean swan
#

Output 200

#

try using JSON.stringify(obj);
@turbid bough Thank you!

turbid bough
#

ah, right querystring, to parse data over do when you want to do php._GET[] stuff

pale vessel
#

yo that's php

queen needle
#

your php

pale vessel
#

and it's $_GET[]

queen needle
#

*you

#

*you're

turbid bough
#

I KNow but i wanted to show that im talking about php smh

pale vessel
#

ok

queen needle
#

smh=slam my head

pale vessel
#

make sure you know what you're talking about

turbid bough
#

ok php. πŸ’΅ get["no?"]

balmy knoll
#

[discord.js] How can I create an invitation for a specific channel?

tight plinth
#

create invite ik
for specific channel...
maybe try to read the docs?

summer torrent
pale vessel
#

@tight plinth spoonfeed

tight plinth
#

πŸ₯„:feed:

high bough
#

I already have the `` around the description and the footer, don't worry about that.

tight plinth
#

well u dont

high bough
#

-_-

#

It dissapeared cuz i had the light mode on

tight plinth
high bough
#

I didn't edit dat part

tight plinth
#

ikkkk

high bough
#

Oh, damn right, thanks @tight plinth

tight plinth
#

lol

high bough
#

LOL XD

#

I feel horrible as a coder now

tight plinth
#

no

scenic nest
#

i need help with lua

#

on roblox

wheat jolt
#

i think this isn't the right place to ask this

pale vessel
#

it's for discord bots

wicked pivot
#

how can i quote this way?

  1. ...
    2)...
    3)...
let Users = invites.filter(UserGet => UserGet.inviter.id === member.user.id).map(g => "1) " + g.code + " " + g.uses).join("\n\n")```
scenic nest
#

ok

summer torrent
#

wdym @wicked pivot

wheat jolt
wicked pivot
#

I would like to list what my "map" will say this way

1)..
2)..

cinder patio
#

is invites an array or a collection?

pale vessel
#

console.log

#

or docs

wicked pivot
#
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
cinder patio
#

that was a question towards Tony

wicked pivot
#

collection"

cinder patio
#

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

wheat jolt
#

I'm trying to figure it out since yesterday

wicked pivot
#

it works thank you very much @cinder patio

vagrant tree
#

hi, what do you do if you have a project in mind but you know its just too big for a side project?

sick cloud
#

does anybody know a mongodb lib for node.js that supports promises

summer torrent
#

mongoose

sick cloud
#

that isn't mongoose

edgy heron
#

how to get total upvotes from dblAPI

#

please ping me if someone replies..'

earnest phoenix
#
        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

edgy heron
#
  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

balmy knoll
#

[discord.js] How can I check if the everyone role already has CONNECT permission on a voice channel?

earnest phoenix
#

I can't find the reason for this error

#

someone can help me up?

#

ur code is not the error

warm delta
#

@balmy knoll what version of node.js are you using?

summer torrent
earnest phoenix
#

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?

dire abyss
#

show code

earnest phoenix
#

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();

turbid bough
#

Post it on gist

earnest phoenix
#

are you using the same name for discordjs bot and DBL code ?