#development

1 messages ยท Page 1371 of 1

pale vessel
#

message.mentions.members is a collection of mentioned members in the message

#

you can get the first mentioned member (it's not in any particular order) by using message.mentions.members.first()

earnest phoenix
#
bot.on('message', msg => {
    if (msg.content.substring(1, 5) === "/kick") {
        msg.mentions.members[1].Kick()
    }
});```
#

?

#

oh

#

first

pale vessel
#

yeah

#

there is no method called Kick()

earnest phoenix
#
bot.on('message', msg => {
    if (msg.content.substring(1, 5) === "/kick") {
        msg.mentions.members[1].Kick()
    }
});``` if I had this, and i said "/kick @earnest phoenix @pale vessel" would it kick me and you or just me
pale vessel
#

since the mentions are not in any particular order, it's kind of random

#

but only one of them

earnest phoenix
#

but if I used .First it will just kick me right?

pale vessel
#

who knows, the api doesnt return it by order

#

make sure you only mention one member

earnest phoenix
#

wait so there isnt a .kick() method?

pale vessel
#

there is

#

you said Kick(), which is invalid

#

cases matter

earnest phoenix
#

How can you dm a user

#

so like

pale vessel
#

user.send(message)

earnest phoenix
#

got it

#

Thanks

#

wait

pale vessel
#

you have to check whether message.mentions.members.first() exists first before trying to kick them

earnest phoenix
#

user.send() or member.send()

pale vessel
#

both works

earnest phoenix
#

well

#

if i did member i would have to send before i do .kick() right?

pale vessel
#

yeah

#

since the bot might not be able to dm it anymore

earnest phoenix
#

how would i check if theres a ping in the message tho?

#

would i have to iterate thru all members

waxen tinsel
#

check length of message.mentions

earnest phoenix
#

eh?

pale vessel
#

thats literally the thing that you used

#

message.mentions.members

earnest phoenix
#

oh

pale vessel
#

i think you should learn js basics first to be honest

earnest phoenix
#

thats literally the thing that you used
@pale vessel yes but

pale vessel
#

otherwise it would hard to grasp these things

waxen tinsel
#

I would recommend checking the docs on lots of this too, then asking about anything you are confused about. Docs can honestly help more than us, and where it doesnt we can fill in the blanks

earnest phoenix
#

i would get an error if i did js bot.on('message', msg => { if (msg.content.substring(1, 5) === "/kick") { msg.mentions.members.First.Kick() } }); and i said /kick hi

#

so how would i check that that is a valid mention

blissful coral
#

msg.mentions.members.first().kick()

waxen tinsel
pale vessel
#

.First.Kick()

#

hmm

#

see what i mean

blissful coral
pale vessel
#

dont make up property names

#

read docs

earnest phoenix
#

@waxen tinsel wdym check length

#

only thing i can think of is iterate through all members

waxen tinsel
#

If there are no mentions, then its going to error when you try to get something that doesnt exist

earnest phoenix
#

and check if the iteration value = the string

#

Hello world! Xddd

#

If there are no mentions, then its going to error when you try to get something that doesnt exist
@waxen tinsel thats exactly my point

blissful coral
#
bot.on('message', msg => {
    if (msg.content.startsWith("/kick")) {
          const member = msg.mentions.members.first()
          member.kick()
    }
});```
#

Here

earnest phoenix
#

u dont understand

#

i get that

waxen tinsel
#

there has to be a way to check length of a list or whatever in js. Thats how I would do it in python, at least.

earnest phoenix
#

my point is

pale vessel
#

just going to leave this to you extreme

earnest phoenix
#

if i did /kick bob

#

it would error

#

because bob isnt a mention

waxen tinsel
#

am i wrong @pale vessel ?

crystal wigeon
#

btw does anyone know how a gaming "Attacks" should work? like the damage dealth etc

#

currently the damage is constant every round

earnest phoenix
#

from what ive heard Lua and js are pretty simular so i dont think i need to learn js basics

waxen tinsel
#

@earnest phoenix then check if there are any mentions first

pale vessel
#

you can use .length for arrays, but since mentions.members is a collection/map, you can use mentions.members.size

blissful coral
#

Then do it if(!member) return message.channel.send("Mention Someone!")

waxen tinsel
#

ez, check to make sure that mentions.members.size is not 0

#

if it isnt then proceed

blissful coral
#

@earnest phoenix call .find() not .get()

surreal sage
#

ID for .get

#

.find for any

earnest phoenix
#

is it nil or null in js

#

okay i try

blissful coral
#

?

surreal sage
#

null

pale vessel
#

null

blissful coral
#

null

sage bobcat
#

One message removed from a suspended account.

blissful coral
#

I think it connects before handshakre

sage bobcat
#

One message removed from a suspended account.

blissful coral
#

Pretty sure it does

earnest phoenix
#

do bot.on() methods run in a new thread or the same thread

#

@earnest phoenix call .find() not .get()
@blissful coral .find(c => c.name === 'the channel name') ?

sage bobcat
#

One message removed from a suspended account.

pale vessel
#

same iirc

#

ye

sage bobcat
#

One message removed from a suspended account.

pale vessel
#

so sad

earnest phoenix
#

does js have coroutines

pale vessel
#

kinda

#

async/await

blissful coral
#

@earnest phoenix yes

earnest phoenix
#

Okay

surreal sage
#

.get is id*

earnest phoenix
#

im going to run the kick thing in a new thread so if it errors it doesnt break the entire bot

waxen tinsel
earnest phoenix
#

Good evening I try to integrate this button in the description of my bot on top.gg but it does not display

<script type="text/javascript" src="https://cdnjs.buymeacoffee.com/1.0.0/button.prod.min.js" data-name="bmc-button" data-slug="sayrix" data-color="#FF5F5F" data-emoji=""  data-font="Poppins" data-text="Buy me a coffee" data-outline-color="#000000" data-font-color="#ffffff" data-coffee-color="#FFDD00"></script>```
pale vessel
#

you can't use javascript

earnest phoenix
#

@pale vessel i found out a way to do what i was saying

#

message.guild.member(user)

#

theres a function that does this

pale vessel
#

uh, no

earnest phoenix
#

it was on the api

#

I put the code on an html file and the button works but on top.gg it doesn't work

pale vessel
#

well, it only works for ids and user objects

#

I put the code on an html file and the button works but on top.gg it doesn't work
@earnest phoenix you can't use the script tag in the description

earnest phoenix
#

ah okay

pale vessel
#

no js code basically

earnest phoenix
#

is .catch() a way to stop an error from actually erroring

#

like pcall()

pale vessel
#

yes, only works for promises though

#

you need to use try {} catch(e) {} if it's not a promise

desert hazel
pale vessel
#

invite is undefined

#

make sure invite exists first before continuing

desert hazel
#

its not though ;-;

pale vessel
#

try debugging

#

add console.log(invite) after declaring it

desert hazel
#

undefined ;-;

#

whys it undefined 1105_prez_cry

pale vessel
#

is it defined now lol

desert hazel
#

no

earnest phoenix
#

ok I tried to convert the code to html but it's supposed to have a button with an orange background but there's only the text and the coffee icon

#

I think this is the code

.bmc-btn svg {
    height: 32px !important;
    margin-bottom: 0px !important;
    box-shadow: none !important;
    border: none !important;
    vertical-align: middle !important;
    transform: scale(0.9);
}

.bmc-btn {
    min-width: 210px;
    color: #ffffff;
    background-color: #FF5F5F !important;
    height: 60px;
    border-radius: 12px;
    font-size: 24px;
    font-weight: Bold;
    border: none;
    padding: 0px 24px;
    line-height: 27px;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center;
    font-family: 'Poppins', sans-serif !important;
    -webkit-box-sizing: border-box !important;
    box-sizing: border-box !important;
}

.bmc-btn:hover, .bmc-btn:active, .bmc-btn:focus {
    text-decoration: none !important;
    cursor: pointer;
}

.bmc-btn-text {
    margin-left: 8px;
    display: inline;
    line-height: 0;
}```
proper bolt
#

if the button does anything more than redirecting you to their site, it wont work.

earnest phoenix
#

Hi

#

I haven't used discord.js v12 since I am currently learning java, but ever since they've added .cache
I cant really do message.guild.members.cache.size as that returns the members that have been cached.

How do I truly fetch all members in the server?

proper bolt
#

(await msg.guild.members.fetch()).size

#

you need the server members intent

earnest phoenix
#

I got ```js

proccess.on('unhandeldRejection', (err, reason, promise) =>{

console.log(reason)
})

#

ah, let me enable that

proper bolt
#

i think you still might need to fetch once enabling it

earnest phoenix
proper bolt
#

is the bot in over 100 servers?

stable eagle
#

You need to get whitelisted

earnest phoenix
#

Mail discord

#

It is in 1000 servers.

#

and its verified

#

o nice

proper bolt
#

yeah you need to get it certified and then apply for the intents

earnest phoenix
#

So I gotta make a new ticket.

#

This system kinda weird.

proper bolt
#

ยฏ_(ใƒ„)_/ยฏ

earnest phoenix
#

I got ```js

proccess.on('unhandeldRejection', (err, reason, promise) =>{

console.log(reason)
})

#

process is spelt wrong ._.

#

ye i know

#

i typed it out here

#

like quick

#

how i got in my code

#

i mean you can try something like client.channels.cache.get("channelID").send(reason)

proper bolt
#

well its on the entire process

earnest phoenix
#

msg.delete()

#

what is a promise boolean?

proper bolt
#

so you cant really

earnest phoenix
#

msg.delete() for this method

#

It has to be in a client event

#

to get a channe

#

l

#

talking to me?

#

no

proper bolt
#

how would you know which channel it occured in

earnest phoenix
#

to apollo

#

Idk

#

thats the problem

#

was about to say you can use a webhook but uh

#

ooh yes

#

thats what i can do

proper bolt
#

best way would be to make a map of errors or whatever

#

and then dm the error maybe?

#

i dunno

earnest phoenix
#

theres no client

#

hm

#
const sendWebhook = (id, token, message) => {
    if (allowed) axios.default(`https://discord.com/api/webhooks/${id}/${token}`, {
            data: {
                content: message
            },
            method: 'POST'
        })
        .then(res => {})
        .catch(e => {
            console.log(e.response.data.retry_after)
        });
}```
#

the client.on('error') function suckz

#

I find it useless, so

proper bolt
#

why do you even want to send the unhandledpromiserejection to the channel

earnest phoenix
#

So the person who executed a command

proper bolt
#

seems like too much for the avg user to handle

earnest phoenix
#

knows that theres a problem

proper bolt
#

just handle the errors in the command

#

??

#

try catch block or just handle the promises

earnest phoenix
#

ye

#

maybe

#

console.log is always another thing

#

webhook is your best bet though if you think you're going to experience a fuck ton of errors you are lazy to receive in your terminal

proper bolt
#

why would you use a webhook if you are working on a discord bot

#

send a message using the bot

earnest phoenix
#

yay ratelimit

proper bolt
#

theres a ratelimit for webhooks too

earnest phoenix
#

ye

proper bolt
#

and its per channel

earnest phoenix
#

but that has to be in a client on

#

and webhooks dont have to

proper bolt
#

no it doesnt?

earnest phoenix
#

It does

proper bolt
#

just somewhere client is defined

earnest phoenix
#

otherwise it returns undefined

proper bolt
#

what

earnest phoenix
#

add this in ur main file

#

but not in a client on function

#

console.log(client.users.cache.size)

#

it will say undefined

proper bolt
#

yeah well the client isnt ready yet

earnest phoenix
#

ye but if it is?

proper bolt
#

what

#

no its not

earnest phoenix
#

if

proper bolt
#

console.log your on ready

earnest phoenix
#

that will work

proper bolt
#

if its ready its gonna return the amount of cached users

#

yes

earnest phoenix
proper bolt
#

yea lmao

solar helm
#

I need bot infrastructure for glitch can you help me

earnest phoenix
#

Do you mind sending us the whole code?

proper bolt
#

glitch deadaf

earnest phoenix
#

@solar helm You want a video?

solar helm
#

yes

earnest phoenix
#

Dont mind who made it

#

It helps.

proper bolt
#

lmao

earnest phoenix
#

Actually, this is version 11

#

i gotta make an updated one

solar helm
#

thx

earnest phoenix
#

Big Announcement,
Glitch no longer supports 24/7 Discord Bots as they have released a paid subscription to keep your project online 24/7.

This method does work however, but its lasting time will last for an indefinite time.
Sorry to break out the news..

#

weee wooo, thats why I bought a vps

#

yes

proper bolt
#

lmao glitch

#

havent heard that in a while

#

arent those things like way more expensive if you pay than a vps

earnest phoenix
#

honestly, I thought it died as a discord bot host, but surprisingly it still works lol

proper bolt
#

i know heroku is overpriced as hell

earnest phoenix
#

im pretty sure heroku just emails you 50 times per day saying it will expire

#

but really it doesnt

proper bolt
#

i mean like the paid plan

earnest phoenix
#

oh yeah

solar helm
#

@earnest phoenix Where can I find the link of the infrastructure in the video?

proper bolt
#

$50/mo for 1 gig of ram

#

lmao

earnest phoenix
#

@proper bolt pog

proper bolt
#

$500/mo for 14gb of ram

#

yikers

earnest phoenix
#

@solar helm its an 8 minute video, do me a favor and give me watch time scroll to the end of the video and copy it from there.

#

send me your provider ._.

proper bolt
#

i forget how much i pay for aws

#

aws pricing isnt bad iirc

#

holdup $1/mo for 7gb of ram is hella cheap

#

what the hell do you use

solar helm
#

I couldn't understand where is the link? @earnest phoenix

earnest phoenix
#

ight imma commit something brb

#

Why does my bot always turn off

#

@proper bolt galaxygate, which is overpriced af, but I plan to move to something cheaper.

#

I turn it on using node .

#

but it turns off random

#

@earnest phoenix are you using pm2?

#

what does that mean

#

where are you hosting it in the first place

#

on my computer

#

well, if you close the terminal or turn off your pc

#

the bot will go offline

#

so

#

how do i fix that

#

aslo

#

i never closed the terminal

#

do errors shut off the bot?

proper bolt
#

yes

earnest phoenix
#

ok so

#

that aside

proper bolt
#

dockerize it or use pm2

earnest phoenix
#

some errors do.

#

dockerize it

#

pm2 is easier

#

what does that mean

#

and whats pm2

#

pm2 is a package that keeps your bot running

proper bolt
#

docker is containers

#

pm2 is a process manager

earnest phoenix
#

that too

#

so do i download it

#

pm2

proper bolt
#

yes

#

npm i -g pm2

earnest phoenix
#

is it free

proper bolt
#

yes

earnest phoenix
#

pm2 start [main.js] --name=[name of the application]

proper bolt
#

and then

earnest phoenix
#

pm2 log [name of the application]

proper bolt
#

pm2 save

#

and pm2 startup

earnest phoenix
#

so i would do

solemn latch
#

you should really research pm2 on your own. theres a lot of little useful features you may want

earnest phoenix
#

C:/me/OneDrive/Documents/DoritoBot> pm2 log index.js?

#

after i downloaded pm2

#

read what I said above

#

pm2 start [main.js] --name=[name of the application]
pm2 log [name of the application]

#

wdym by name of application

#

name it whatever you want

#

i suggest a short abbrev.

#

by name of application do u mean this

#

no

#

your bots name

#

C:/me/OneDrive/Documents/DoritoBot>pm2 start index.js

solemn latch
#

or anything

earnest phoenix
#

can i just do this

#

pm2 start index.js --name=sparkus
pm2 log sparkus

#

something like that.

#

can you give me an example

#

that doesnt make sense

#

just did

#

C:/me/OneDrive/Documents/DoritoBot>

#

using my directory

#

okay

#

wait

#

cd to your bots folder

#

iti s

#

it is*

#

then run pm2 start index.js --name=DoritoBot
pm2 log DoritoBot

#

simple as that

#

all imma give you

#

ok got it

#

oh and pm2 save

#

uhh

#

C:/me/OneDrive/Documents/DoritoBot> pm2 start index.js --name=DoritoBot
C:/me/OneDrive/Documents/DoritoBot> pm2 save

#

so like that

#

?

proper bolt
#

yes

earnest phoenix
#

ok thx

#
bot.on('ready', () => {
    console.log("${bot.User.Tag} logged in successfully");
});```
#

also why does my bot literally say "${bot.User.Tag}"

solemn latch
#

``

#

not ""

earnest phoenix
#

what

#

also bot.user.tag

#

not User

#

oh

#

console.log(``${bot.User.Tag} logged in successfully``);

#

so like that

#

no

#

remove ` from each side

#

console.log(${bot.User.Tag} logged in successfully);

#

oops

#

mhm

#

thats right

proper bolt
#

also it should be bot.user.tag

earnest phoenix
#

console.log(`${bot.User.Tag} logged in successfully`);

proper bolt
#

non caps

earnest phoenix
#

wait

#

bot.user.tag like I said above

#

do u mean ` or '

#

@earnest phoenix thats correct.

proper bolt
#

`

#

make it non caps for the property names

earnest phoenix
#
 if (member) {
                member.kick();
                msg.channel.send(`> ${user.Tag} has been kicked.`);
                user.send(`You have been kicked from the server. `);
                msg.delete();```
#

why does it error saying

#

cannot send message to this user

#

do you know how code works

still merlin
#

You're kicking the user first

earnest phoenix
#

bruh

still merlin
#

DM the user first then kick

earnest phoenix
#

someone earlier told me

#

member, vs user

#

member is person in the server

#

user is anyone

still merlin
#

that isn't related

#

you're bot can't message you're user because they don't share any guilds

earnest phoenix
#

do you know how code works
@earnest phoenix yes ive been scripting lua for over 2 years

#
  1. you're kicking the member first
  2. if the member's dms are closed then it wont work and it throws errors
still merlin
#

You need to send the DM FIRST then kick

earnest phoenix
#

lua is completely unrelated to js

still merlin
#

^

earnest phoenix
#

that wasnt his question

#

he asked if i knew how code worked

#

were talking about js

#

because you're coding in it.

#

ok

#

when you say standalone "code" i assumed you meant coding logic

#

self explanatory if you put some logic into it.

#

If this passes the argument, then it executes this..
Else we run this

#

what

proper bolt
#

are you learning js right now @earnest phoenix ?

earnest phoenix
#

yes

#

@proper bolt yes but i know c# so i have some understanding of js

#

im not completely new to the concept

sudden geyser
#

when you say standalone "code" i assumed you meant coding logic
code that can stand alone

earnest phoenix
#

do u not know what standalone means

#

i dont literally mean stands with noone else

#

wait is js synchronous or asynchronous

#

i can look that up actually

solemn latch
#

both

#

honestly

earnest phoenix
#

how does that even work

#

can run multiple threads and cant

solemn latch
#

๐Ÿค”

earnest phoenix
#

same

#

doesnt make sense

solemn latch
#

js is a lot of both

#

is it a front end or backend language? both.
is it multi threaded or single threaded? both.
is it async or sync? both.

blissful coral
#

Anyone know css here?

#

Like actually know css

#

k

#

so

#
border-radius: 10%;
    float: left;
#

I am using float left

solemn latch
#

does anyone actually know css ;p

blissful coral
#

Because I am gonna put text to the right of it

solemn latch
#

css is so mishmashy

blissful coral
#

It puts it outside the box

solemn latch
#

ay, botreviewers got their roles pogey

blissful coral
#

Only when using float tho

#

First wave did

#

Yeah float right fuck's it up aswell

#

Damnit

earnest phoenix
#

I want to create a webhook url with heroku, but when I press the button test I receive this error..

I need to put this in a start files ? pls (my bot is host on heroku with discord.js)

const DBL = require('dblapi.js');
const dbl = new DBL(process.env.DBL, { webhookPort: process.env.PORT, webhookAuth: process.env.PASSWORD});
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});```
sudden geyser
#

Can you check your package.json

earnest phoenix
#
  "name": "bot",
  "version": "1.0.0",
  "description": "",
  "main": "bot.js",
  "dependencies": {
    "dblapi.js": "^2.4.1",
    "discord.js": "^11.6.4",
    "file-system": "^2.2.2",
    "ms": "^2.1.1"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}```
sudden geyser
#

You need a start field in the scripts field.

#

For example: json { "start": "node ." }

earnest phoenix
#

so that !?

{
  "start": "node bot.js"
}```
sudden geyser
#

Try it and see

earnest phoenix
#

okay thx

#

thx u very much Lite, all works fine happy

earnest phoenix
#

mb mb sorry

quartz kindle
#

@craggy pine if you're still looking into customizing the review stars, its possible without js, but its a bit complicated, you need about 5 lines of css, one for each rating

craggy pine
#

I figured it out โค๏ธ

#

Kinda seend ur message earlier in the other channel @quartz kindle

quartz kindle
#

๐Ÿ‘

earnest phoenix
#

how can i make it so

#

any string Uppercase or lowercase characters gets accepted

#

HellO will work

#

hello will work

#

hElLo will work

#

etc...

umbral zealot
#

how can i make it so
You ask Picard

earnest phoenix
#

what

#

i said what i was asking

#

read the whole thing

umbral zealot
#

C'mon take the joke

earnest phoenix
#

oh

umbral zealot
#

To accept any case, just put everything as lowercase.

earnest phoenix
#

ok

#

so like

#

if(string.lower(msg) == "hello") {

#

?

umbral zealot
#

what language?

earnest phoenix
#

js

#

well

umbral zealot
earnest phoenix
#

not sure if string.lower() exists in js

#

ok

#

@umbral zealot (figured it out, sorry for ping)

opal plank
#

cuz message is an object

earnest phoenix
#

oh

opal plank
#

message.content is the actual string with the contents of it

earnest phoenix
#

so msg.content.toLowerCase()

#

ok

opal plank
#

yup

earnest phoenix
#
bot.on('message', msg => {
    if (msg.content.startsWith("/kick")) {
        var SplitMessage = msg.content.split(" ");
        const user = SplitMessage[1];
        const reason = SplitMessage[2];
        if (user) {
            const member = msg.guild.member(user);
            if (member) {
                user.send(`You have been kicked from ${msg.guild.name}: ${reason}`);
                msg.channel.send(`> ${member.tag} has been kicked.`);
                member.kick();
                msg.delete();
            } else {
                msg.channel.send("> User is not a valid member of this channel!");
            }
        } else {
            msg.channel.send("> User must exist");
        }```
#

im doing something wrong here but i dont know what

#

it doesnt error

#

it just doesnt work right

#

like

#

am i using string.split right for one?

#

thats what it says

#

and i said the message once

#

why does it say undefined has been kicked

#

how should i be doing it

#

uhhh

#

what

#

but how will it know

#

what member im tryng to get

#

const member = msg.guild#Members.cache.get(user)

#

so like this

#

what does that mean

#

@earnest phoenix

#

@earnest phoenix ur script doesnt work

#

everything is green

#

wait

#

no i think ur misunderstanding

#

const member = msg.guild.member(user);

#

this is literally the example the api uses

#

im asking why it says Undefined

quartz kindle
#

because the member is not cached

earnest phoenix
#

it still kicks them

#

it just says Undefined

quartz kindle
#

it still kicks them?

earnest phoenix
#

yes

quartz kindle
#

where does it say undefined?

#

"undefined has been kicked"?

earnest phoenix
#

yes

clever dust
#

Only user have tag property, not member

quartz kindle
#

thats because members dont have tags

#

users do

#

so user.tag

#

or member.user.tag

earnest phoenix
#

also it doesnt send the reason

quartz kindle
#

it should

#

if you do /kick 563945937938759837 abc it should say abc in the reason

earnest phoenix
#
bot.on('message', msg => {
    if (msg.content.startsWith("/kick")) {
        var SplitMessage = msg.content.split(" ");
        const user = SplitMessage[1];
        const reason = SplitMessage[2];
        if (user) {
            const member = msg.guild.member(user);
            if (member) {
                user.send(`You have been kicked from ${msg.guild.name}: ${reason}`);
                msg.channel.send(`> ${user.tag} has been kicked.`);
                member.kick();
                msg.delete();
            } else {
                msg.channel.send("> User is not a valid member of this channel!");
            }
        } else {
            msg.channel.send("> User must exist");
        }```
#

still kicks them

#

still says > undefined has been kicked

#

still doesnt give them a kick message

#

not even the user.send() one

#

and no errors

signal vortex
#

console.log user, see what's being logged.

#

@earnest phoenix

opal plank
earnest phoenix
#

i use

#

the uh

#

command console

#

t odebug

strong tundra
#

is there compiler debugger

opal plank
#

then open and link and read whats in

earnest phoenix
#

it says nothing

opal plank
#

which compiler?

earnest phoenix
#

thats why im confused

strong tundra
#

rustc

opal plank
#

wdym theres nothing?

#

no clue bout rust, but i assume it would

earnest phoenix
#

bruh

#

it says that stuff

#

but no error

#

s

wise quartz
#

how can i have my cogs inside a folder instead of just being files inside my bot folder?

opal plank
#

huh?

#

you dont need an error to debug

#

what im doing is that old saying
give a man a fish and he'll eat for a day
teach the man how to fish and they'll never starve
or something along those lines
i'd much rather teach you how to debug code

earnest phoenix
#

i know how to debug jesus

#

its just that

#

making changes to a bot

#

then having to republish it

#

takes like 5 minutes

#

id rather just ask

opal plank
#

wdym republish the bot?

strong tundra
#

what do you want to do

earnest phoenix
#

i have to kick it from my server

strong tundra
#

waht

opal plank
#

why?

earnest phoenix
#

then i have to edit vs

#

then readd the bot

strong tundra
#

no you don;t?

earnest phoenix
#

with the changes

#

it doesnt do live editing

opal plank
#

then re-require the cache

earnest phoenix
#

i dont know what that means

opal plank
#

set the command in a different folder and then re-require

strong tundra
#

oh you want live editing

opal plank
#

delete the cache

earnest phoenix
#

what are u talking about

#

my point is

#

it takes too long

strong tundra
#

if you don't want to do this you can just restart the bot

earnest phoenix
#

thats what i have to do

#

but that takes like 5 minutes

strong tundra
#

you don't have to kick it

earnest phoenix
#

how do u restart the bot

strong tundra
#

what do you use?

earnest phoenix
#

vs

strong tundra
#

hmm

#

which language

earnest phoenix
#

js

strong tundra
#

do you know how to close a javascript command line program

earnest phoenix
#

no i keep every tab i have open from the day i made my pc

strong tundra
#

if you figure out how to, that's how you can turn off your bot

earnest phoenix
#

do you know how to close a javascript command line program
@strong tundra

#

vs doesnt work like that

#

its not a console

strong tundra
#

is this visual studio

earnest phoenix
#

its a compiler

#

2017

strong tundra
#

or visual studio code

earnest phoenix
#

vs 2017

strong tundra
#

you don't compile javascript???

earnest phoenix
#

js isn't compiled

#

why are you using vs for js

#

lol

#

Visual Studio 2017 is literally the name of the application

strong tundra
#

there's a stop button on the top

opal plank
strong tundra
#

wait lemme get vs pulled up

earnest phoenix
#

vs 2017 is old you shouldn't be using in the first place and visual studio was made for .net

#

i dont know how to use new visual studio

#

ok?

opal plank
#

learn?

earnest phoenix
#

so i dont use it

#

why

#

id rather use an old one which makes more sense

#

as long as it works

opal plank
#

....

strong tundra
earnest phoenix
#

why are you using vs for js

#

uh

#

because bots speak code

strong tundra
#

im using c++ but it should be same for whatever

earnest phoenix
#

???

#

i cant just tell it to do something

#

that was a dumb question

opal plank
#

you're not making any sense whatsoever

earnest phoenix
#

what in the literal fuck are you doing lol

#

i know

#

this dude is asking why i use an ide to script

opal plank
#

we're trying to help

earnest phoenix
#

visual studio isn't made for javascript and doesn't have proper javascript support

#

yes it does

opal plank
#

update your code, and delete and re-require the cache so you dont have to restart the bot

#

js is run on NODE

earnest phoenix
#

it has formatting support

strong tundra
#

it does

earnest phoenix
#

its supporting it for me

#

oh my fucking god

strong tundra
#

though i wouldn't use it for javascript

earnest phoenix
#

what else should i use

#

notepad

#

lol

opal plank
#

that code runs on NODE my dude

strong tundra
#

no yeah vs works fine for javascript, it's just that no one uses it

opal plank
#

VSC

earnest phoenix
#

visual studio code

#

i

strong tundra
#

webstorm

earnest phoenix
#

am

#

using vsc

#

what

opal plank
#

VS =/= VS

#

two different things

earnest phoenix
opal plank
#

visual studio is NOT the same as Visual Studio Code

strong tundra
#

ok lemme ask a question

earnest phoenix
#

oh

strong tundra
#

ah ok you're using vs

earnest phoenix
#

i use vs for every language

#

lua

#

c#

#

js

#

py

#

ive never had a problem with it

#

also you shouldn't be complaining that shit on older software doesn't work... it's older software

#

update to vs2019

strong tundra
#

you can click the stop button and it should stop

earnest phoenix
#

i have vs 2019

opal plank
#

or use VSC like everyone

earnest phoenix
#

it doesnt make sense

#

lua is compiled

#

yes

#

compiled languages are supported on vs

strong tundra
#

javascript is supported on vs as well,

viscid gale
#

no yeah vs works fine for javascript, it's just that no one uses it
i use javascript owo

earnest phoenix
#

interpreted languages have trash support in vs

#

ok there

#

can u help me with my problem now

strong tundra
#

can you take a screenshot of your whole screen

opal plank
#

click this button valurium

#

you'll see Create debug config in one of the options

strong tundra
#

oh wait this is vsc duh

opal plank
#

click that to generate a new profile

earnest phoenix
#

heres my screen

strong tundra
#

ah ok

earnest phoenix
#

lo l

opal plank
#

...

#

i give up

#

im out

#

peace

viscid gale
#

lol

earnest phoenix
#

genuinely can't tell if this is trolling or just being awfully dull

strong tundra
#

is your bot currently running

viscid gale
#

i see the error

earnest phoenix
#

How can i check if a member has a role with administrator permissions?

I tried

guild.members.cache.get(executor.id).roles.cache.filter(u => {
    u.permissions.has(['ADMINISTRATOR', 'BAN_MEMBERS', 'KICK_MEMBERS'])
})

But returning an empty collection

#

@opal plank that button doesnt even appear for me

opal plank
#

cuz its VSC

earnest phoenix
#

thtas

opal plank
#

which was the screenshot you psoted

earnest phoenix
#

what im using

#

yes

opal plank
earnest phoenix
#

because u said to use vsc

opal plank
#

no, THATS VS

earnest phoenix
#

no it isnt

opal plank
#

the one i linked is VSC

viscid gale
#

look... the part where u said that user=splitMessage[1]

#

if someone pings..

earnest phoenix
#

clearly says

#

visual studio code

#

v
s
c

opal plank
strong tundra
#

oh they have both open

#

nvm

earnest phoenix
#

oh

#

i sent old image

#

@opal plank

#

lol mb

viscid gale
#

hold upp..... what is the error

opal plank
#

then thats why

#

post a new one

earnest phoenix
#

i have both open

#

clicked vs by accident

opal plank
#

use VSC

#

unless you want VS support, which i dont provide since i dont know it

earnest phoenix
#

there

viscid gale
#

:l tbh i edit my stuff in microsotf wordpad like a bep

strong tundra
#

ok yeah hit this button

earnest phoenix
#

YO

opal plank
earnest phoenix
#

VSC SUPPORTS THE THING

opal plank
#

click that

earnest phoenix
#

if i in a discord.js specific thing

#

i actually get autofill results

#

cool

opal plank
#

welcome to 2020

strong tundra
opal plank
#

anyhow, clieck that button

earnest phoenix
#

i figured it out

#

thanks

#

also uh

#

i think its broken

viscid gale
#

hmm turn const user=splitMessage[1] into const user=splitMessage[1].split('').filter(a=>{!isNaN(parseInt(a))})

opal plank
#

i see you clearly figured it out

earnest phoenix
#
bot.on('message', msg => {
    if (msg.content.startsWith("/kick")) {
        var SplitMessage = msg.content.split(" ");
        const user = SplitMessage[1];
        const reason = SplitMessage[2];
        if (user) {
            const member = msg.guild.member(user);
            if (member) {
                user.send(`You have been kicked from ${msg.guild.name}: ${reason}`);
                msg.channel.send(`> ${user.tag} has been kicked.`);
                member.kick();
                msg.delete();
            } else {
                msg.channel.send("> User is not a valid member of this channel!");
            }
        } else {
            msg.channel.send("> User must exist");
        }
    } else if (msg.content.startsWith("/ban")) {
        var SplitMessage = msg.content.split(" ");
        const user = SplitMessage[1];
        const reason = SplitMessage[2];
        if (user) {
            const member = msg.guild.member(user);
            if (member) {
                user.send(`You have been banned from ${msg.guild.name}: ${reason}`);
                msg.channel.send(`> ${user.tag} has been banned.`);
                member.ban()
                msg.delete();
            } else {
                msg.channel.send("> User is not a valid member of this channel!");
            }
        } else {
            msg.channel.send("> User must exist"); 
        }
    } else if (msg.content.toLowerCase() === "!twodoritos") {
        msg.channel.send("");
        console.log("Yo");
    }
});```
#

why does it say everything twice

opal plank
#

cuz u have 2 bots running

viscid gale
#

why does it say everything twice
@earnest phoenix ohhhhh yea

earnest phoenix
#

i do?

opal plank
#

._.

#

yes

earnest phoenix
#

how do u know

viscid gale
#

someone came to me with that error before

opal plank
#

if you clicked that button it should've started a debugging session

viscid gale
#

and they realised they had multiple sessions running

earnest phoenix
#

it did this with vs too

opal plank
#

then you got one bot running on vs, one on vsc

earnest phoenix
#

nope

#

i closed vs

#

but

#

it only prints yo once

#

but it sends the link twice

viscid gale
#

why does it say everything twice
@earnest phoenix if this is ur only error, the problem isn't with the code

#

most likely

opal plank
#

huh?

earnest phoenix
#

How can i check if a member has a role with administrator permissions?

I tried

guild.members.cache.get(executor.id).roles.cache.filter(u => {
    u.permissions.has(['ADMINISTRATOR', 'BAN_MEMBERS', 'KICK_MEMBERS'])
})

But returning an empty collection

sudden geyser
#

<GuildMember>.hasPermission(...)

earnest phoenix
#

no i want to check roles permissions

opal plank
#

they want roles

#

not members

sudden geyser
#

o

#

Did you forget the return keyword?

earnest phoenix
#

guys i figured it out

#

i still had cmd open

opal plank
#

filter returns all values with true

#

though it shouldnt have brackets

sudden geyser
#

The brackets are probably there just so the line isn't too long.

earnest phoenix
#

idk but

#

u.permissions.has returning a boolean

opal plank
#

remove the brackets

sudden geyser
#

Yeah, and you aren't returning in the body, which is defaulting to undefined, which is falsely. Hence, empty collection.

#

Either remove the brackets or add a return statement in there.

opal plank
#

^^

#

its a one line

#

remove brakets lmao

#

theres no need for em'

sudden geyser
#

Imo it would look long. Like, look at this: js guild.members.cache.get(executor.id).roles.cache.filter((role) => role.permissions.has(['ADMINISTRATOR', 'BAN_MEMBERS', 'KICK_MEMBERS']))

viscid gale
#

i still had cmd open
@earnest phoenix

#

๐Ÿ—ฟ

sudden geyser
#

Then again whitespace helps so no braces is fine.

viscid gale
#

the brackets r a mental helper to me

earnest phoenix
#

ah yeah working thx

hasty lotus
viscid gale
#

quite intuitive

hasty lotus
#

what do i need to do ?

#

sorry i'm not a god english speaker

#

good

quartz kindle
#

@hasty lotus show your intents in your code

hasty lotus
#

where am i supposed to find it ? (it's not my bot but one of a friend im only hosting it)

quartz kindle
#

in the main file

sudden geyser
#

where you initialize your client

opal plank
#

probably
bot.js
index.js
main.js

quartz kindle
#

it will have new Discord.Client({ stuff here })

hasty lotus
#

const client = new Client({ws:{intents:["GUILD_PRESENCES", "GUILDS", "GUILD_MEMBERS", "GUILD_MESSAGES" ,"GUILD_BANS", "GUILD_EMOJIS" ,"GUILD_INTEGRATIONS", "GUILD_INVITES", "GUILD_MESSAGE_REACTIONS", "GUILD_PRESENCES"]}});

#

is that it

#

?

quartz kindle
#

there you go

#

you have GUILD_PRESENCES

sudden geyser
#

GUILD_PRESENCES?

quartz kindle
#

that requires the presence intent to be turned on

hasty lotus
#

ok

opal plank
hasty lotus
#

yeah ok

#

thx

dreamy thistle
#
    const channel = member.guild.channels.cache.find(channel => channel.name === `welcome`);
    if (!channel) return;
    const { guild } = member
    const { name, memberCount, owner } = guild
    const joinembed = new Discord.MessageEmbed()
        .setColor('GREEN')
        .setTitle(`Welcome to "${name}"`)
        .setThumbnail(member.user.displayAvatarURL())
        .addFields(
            {
                name: 'New user!',
                value: member,
            },
            {
                name: 'Member count:',
                value: memberCount,
            }
        )
        .setFooter('Time Joined', member.guild.iconURL())
        .setTimestamp()


    channel.send(joinembed);
});
#

anyone knows

#

why this does not work?

#

it used to do

sudden geyser
#

What doesn't work about it?

dreamy thistle
#

on join

opal plank
#

is there a good way to get a files own name?

image the scenario
a folder with 10 .js files
each with different contents inside
is there a way to get the file name of the file from within it self?

sudden geyser
#

isn't there __filename?

opal plank
#

not sure, thats why im asking

#

fs i assume?

sudden geyser
#

__filename represents the current file's absolute path. It's a variable.

#

I'm not sure about this, but you could then use the path module to resolve the file name from the absolute path.

opal plank
#

or i could split and grab last

#

if it returns a string , split('/')

#

then just do length - 1

sudden geyser
#

You could, but that doesn't support every platform. Windows uses backslashes, while other Unix-based systems use forward slashes.

#

Unless you don't care about that

dreamy thistle
#

but

opal plank
#

hmmmm

#

yes and no

#

im not gonna be using this on prod

sudden geyser
#

What about in development?

opal plank
#

its just better to ahve it the way i got rn with a simple string

#

this is just for science tbh

dreamy thistle
#

did they updade member.guild.channels.cache.find(channel => channel.name === ``welcome``) syntaxis?

#

because it does not seem to work

opal plank
#

i was just wondering, why the heck even bother with the name when the file itself has that already

dreamy thistle
#
2020-11-08T00:01:14.195780+00:00 app[worker.1]: (node:4) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit```
opal plank
#

though its much better to have a simple string rather than add more logic to it

earnest phoenix
#

How can I get two mentions in one message? (discord.js)

@earnest phoenix | @earnest phoenix

message.mentions.members.first()

opal plank
#

performance wise

sudden geyser
#

.members is a collection.

#

So you'll have your mentioned members there.

opal plank
#

you wanna get only first and second?

#

or n amount?

#

do you wanna send multiple mentions, or when the message is recieved?

#

i didnt get much of that question tbh

#

get 2 mentions in on message, as in , reciveing a message or sending on?

earnest phoenix
#

for example I used test @aproxthethat#1000 | @xtest. I want to takeboth.

opal plank
#

just 2?

earnest phoenix
#

yeah

opal plank
#

you could simply do

dreamy thistle
#

channels.name does not exist now?

opal plank
#

let a = [...members]
a[0] and a[1]

sudden geyser
#

What is channels?

#

Did you mean to have the "s" at the end?

opal plank
#

thats probably the shortest way you could do it

dreamy thistle
#

channel*

sudden geyser
#

It should exist.

#

You could debug it via logging

dreamy thistle
#
    const channel = member.guild.channels.cache.find(channel => channel.name === `welcome`);
    if (!channel) return;
    message.channel.send('asdasdadsasd')```
#

idk why this is not working

#

im getting mad at it

sudden geyser
#

Because message doesn't exist in that scope.

#

Use channel.send(...) instead.

opal plank
#

@earnest phoenix ```js
let a = [...message.mentions.members.values()];
let mentions = a.slice(0,1);

@earnest phoenix thats the shortest i can think of
#

actually, no

earnest phoenix
#

yes

dreamy thistle
#

truers

opal plank
#
let mentions = [...message.mentions.members.values()].slice(0,1);```
#

there, 300iq one liner

earnest phoenix
#

thx

#

I am trying

sudden geyser
#

Or just members.first(2)

opal plank
#

reminder, it may not always have 2

#

it'll error if the user doesnt input 2 mentions

sudden geyser
#

Yours or mine

opal plank
#

didnt even know first took params

#

use that then

#

it probably does exaclty what i did though

#

not quite

#

ah, its using arrays too

#

but not in the same way

#

im destructuring

#

damn thats some complicated stuff they doing

#

i'd still use what i did though

umbral zealot
#

I was the one who added that feature ๐Ÿ˜

opal plank
#

well....

#

hmmm

umbral zealot
#

Back in the day. That's not my code anymore but I introduced the feature.

opal plank
#

well.... mine is probably on par with that

#
return [...this.values()].slice(0,amount);
#

this is what i'd use

#

for lastjs return [...this.values()].slice(this.size - amount, this.size);

earnest phoenix
#
bot.on('message', msg => {
    if (msg.content.startsWith("/kick")) {
        var SplitMessage = msg.content.split(" ");
        const user = SplitMessage[1];
        const reason = SplitMessage[2];
        console.log(user)
            const member = msg.guild.member(user);
                console.log(member)
                user.send(`You have been kicked from ${msg.guild.name}: ${reason}`);
                msg.channel.send(`> ${user.tag} has been kicked.`);
                member.kick();
                msg.delete();```
sudden geyser
#

I was the one who added that feature ๐Ÿ˜
good

earnest phoenix
#

why is member null

sudden geyser
#

because it's nullable

earnest phoenix
#

and user.send "not a function"

#

how do i make it not nullable

sudden geyser
#

actuallSplitMessage[1] is going to be a string.

earnest phoenix
#

so string > userObject

#

how do i do that

sudden geyser
#

Not a GuildMember or User instance.

earnest phoenix
#
bot.on('message', msg => {
    if (msg.content.startsWith("/kick")) {
        const user = msg.mentions.members.first()
        if (user) {
            const member = msg.guild.member(user);
            if (member) {
                user.send(`You have been kicked from ${msg.guild.name}: ${reason}`);
                msg.channel.send(`> ${user.tag} has been kicked.`);
                member.kick();
                msg.delete();
            };
        };```
#

i know i can do this, but then i cant have a reason

#

wait actually

#

yes i can

#
bot.on('message', msg => {
    if (msg.content.startsWith("/kick")) {
        const user = msg.mentions.members.first()
        const reason = SplitMessage[2];
        if (user) {
            const member = msg.guild.member(user);
            if (member) {
                user.send(`You have been kicked from ${msg.guild.name}: ${reason}`);
                msg.channel.send(`> ${user.tag} has been kicked.`);
                member.kick();
                msg.delete();
            };
        };```
#

this should work

sudden geyser
#

Yes, like that.

earnest phoenix
#

if i wanted a reason

weary socket
#

How can I do a background like that?

rustic nova
#

@weary socket use inspect element

#

It can be quite useful

weary socket
#

@weary socket use inspect element
@rustic nova what?

#

I dont understand Hope

#

Cant find how they ve done that

rustic nova
#

If you don't understand what i mean with "inspect element", then you are not ready to do that yet and should come back to it once you have experience

weary socket
#

No I kno what you mean with that....I just cant find what you mean in that code

viscid gale
#

huh vald ur still here hiii

#

If you don't understand what i mean with "inspect element", then you are not ready to do that yet and should come back to it once you have experience
agreed.. inspect element was the reason i learned what i learned

#

anywho.... umm got an error UnhandledPromisRejectionWarning: FetchError: request to https://discordapp.com/api/v7/channels/***/messages failed, reason: getaddrinfo ENOTFOUND discordapp.com discord.com:443

sudden geyser
#

Did your internet die

viscid gale
#

no

#

that's y it's strange

#

it happened bfore when internet died, but now idk y

sudden geyser
#

Try with another site (e.g. Google) and try again with Discord

viscid gale
#

i did... it's strange i tell u

#

i have a feeling i know what caused it, but as to how it would cause that, wack

weary socket
#
  position: relative;
  overflow: hidden;
  padding-top: calc(7rem + 72px);
  padding-bottom: 7rem;
  background: linear-gradient(0deg,#ff6a00,#ee0979);
  background-repeat: no-repeat;
  background-position: 50%;
  background-attachment: scroll;
  background-size: cover;
}```
#

Can i put this Code in the description and get a background?

viscid gale
#

basically, when bot receives message, it makes a global var m5g = the messages msg

#

but theoretically, if message is recieved at the same time, what on earth happens to var m5g?

#

i guess my bot's getting famous for it to recieve 2 msgs in under the time it takes to return a response

#

but if i fix that hole in my code and it still happens... i call bug

solemn latch
#

its pretty common to get two messages at the same time

#

discord lags for a moment and two messages are received at the same time.

viscid gale
#

i mean.. i send the msg string into an object that just returns(the obj's keys r functions)

#

for 2 msgs to pass that quick.. oof

#

but, as u said, y didn't this happen sooner?

#

hmm prob just my internet that dipped for a bit..

#

still was a strange event

weary socket
#
header.masthead {
  position: relative;
  overflow: hidden;
  padding-top: calc(7rem + 72px);
  padding-bottom: 7rem;
  background-color: linear-gradient(0deg,#ff6a00,#ee0979);
  background-repeat: no-repeat;
  background-position: 50%;
  background-attachment: scroll;
  background-size: cover;
}
</style>```
#

Would that work for my Background?

solemn latch
#

global variables cause a lot of weird things

#

which is why they are not reccomended

#

๐Ÿคทโ€โ™‚๏ธ I always just play with css till it does what I want

snow urchin
#
    async fetch(type: "ticket" | "message" | "channel" | "author", arg: any) {
        const ticket =
            type === "ticket"
                ? arg
                : type === "author"
                ? await coll.findOne({ userId: arg })
                : await coll.findOne(type === "message" ? { ticketMessage: arg } : { supportChannel: arg });

        if (!ticket) return false;
        if (!ticket.logs) coll.findOneAndUpdate({userId: ticket.userId}, {$set: {logs: []}});
        
        this.id = ticket.ticketId;
        this.userId = ticket.userId;
        this.status = ticket.status;
        this.attachments = ticket.attachments;
        this.acceptedAt = ticket.acceptedAt;
        
        try {
            this.ticketMessage = await ticketsChannel.messages.fetch(ticket.ticketMessage);
            this.embed = this.ticketMessage.embeds[0];
        } catch (e) {
            console.log(e);
        }

        if (this.status === 1) {
            this.channel = ticketsChannel;
            this.channelMessage = await this.channel?.messages.fetch(
                ticket.supportEmbed
            );
            this.supporters = await Promise.all(
                ticket.supporters.map((s: string) =>
                ticketsChannel.guild.members.fetch(s)
                )
            );
        }

        if (ticket.attachmentMessage)
            this.attachmentsMessage = await ticketsChannel.messages.fetch(ticket.attachmentMessage);

        try {
            this.user = await ticketsChannel.guild.members.fetch(ticket.userId);
        } catch {}
        return true;
    }

something here is giving unknown channel error, and I have not a clue why, anyone?

solemn latch
#

what line does the error say

snow urchin
#

Well discord's lovely and very handy API errors, DONT tell us the line

#

I have checked everything, I am 99% sure its between the try{}catch{} after this.acceptedAt, as I had console logs and it stopped there.

#

But I don't see how it could be

#

ticket.ticketMessage is in the db

#

and supportEmbed

#

etc

quartz kindle
#

unknown message happens when you're trying to edit, delete, fetch, react to, etc, a message that has already been deleted

#

it could be any of your messages.fetch lines

snow urchin
#

none of the message have been deleted.

#

which is why I am confused

quartz kindle
#

could be that some id in there is wrong

#

add a try catch to every single messages.fetch in there, and console.log something different on each one

#

so you know which one its coming from

snow urchin
#

this one gets the error, but I do not see why, the id match's with the database and the message has not been deleted

earnest phoenix
#
 if (msg.content.startsWith("/kick")) {
        var SplitMessage = msg.content.split(" ")
        const user = msg.mentions.members.first()
        const reason = SplitMessage[2];
        console.log(reason)
        if (user) {
            const member = msg.guild.member(user);
            if (member) {
                try {
                    user.send(`You Have Been Kicked From ${msg.guild.name}: ${reason}`);
                    msg.channel.send(`> ${user.member.tag} Has Been Kicked.`);
                    member.kick();
                    msg.delete();
                } catch(error){
                    console.error(error)
                }
            };
        };```
#

it kicked him but he didnt get the dm

snow urchin
#

because the bot no longer shares a server

#

or their dms are off

earnest phoenix
#

ok also

#

if u try kicking another admin it errors obviously

#

but the error is literally "DiscordAPIError"

#

so i can throw an exception to that without it ignoring every error regarding the bot

#

so how do i overcome this

snow urchin
#

I do this

process.on("unhandledRejection", (err: any) => {
    const ignoredErrors = ["Error [GUILD_MEMBERS_TIMEOUT]: Members didn't arrive in time.", "DiscordAPIError: Missing Access", "DiscordAPIError: Missing Permissions"]

    if(ignoredErrors.map(x => err.toString().includes(x)).includes(true)) return;

    error(err.stack.toString())
})
quartz kindle
#

well thats one option, although its not recommended

#

and also deprecated

earnest phoenix
#
try {
                    throw 'DiscordAPIError: Missing Permissions'
                    user.send(`You Have Been Kicked From ${msg.guild.name}: ${reason}`);
                    msg.channel.send(`> ${user.member.tag} Has Been Kicked.`);
                    sleep(500)
                    member.kick();
                    msg.delete();
                } catch(error){
                    console.error(error)
                }```
#

howcome im literally throwing an exception to this error

#

yet it still catches the same error and gives me it

#

wait am i misintepreting try

#

ahhhhhh hello again

quartz kindle
#

you're throwing the error then catching it again