#development

1 messages ยท Page 993 of 1

earnest phoenix
#

bunch

quartz kindle
small prairie
#

thanks.

wicked pivot
pure lion
#

```discord.js when?```

wicked pivot
pure lion
#
  db.prepare(`CREATE TABLE IF NOT EXISTS ${options.table} (ID TEXT, json TEXT)`).run();

^error

var disabledSnipeDB = new db.table('Snipe-Blacklist-Table')
disabledSnipeDB.set('Guild-ID\'S', 1)
console.log(disabledSnipeDB.get('Guild-ID\'S'))

^code
help is appreciated

wicked pivot
#
const WebBlock = new Discord.WebhookClient("id web", "key web")

WebBlock.send(...)```
solemn latch
#

does it want you to run that @pure lion

pure lion
#

runwhat?

solemn latch
#

you need to create a database using that

pure lion
#

how?

#

im reading the docs rn and um

#

:confus:

solemn latch
#

i think the link i gave shows how to make a table

pure lion
#

i put that into the code tho

earnest phoenix
#

My database and VPS runs on separate CPU. Which CPU should I upgrade if database write requests are lagging?

solemn latch
#

do you mean to say your bot and database run on seperate VPS's?

pure lion
plucky heart
#

Hi, can anyone help me?

solemn latch
#

i have no idea dice sad

quartz kindle
#

@earnest phoenix first find the cause of the issue, its possible that the problem is not related to resource usage

pure lion
#

\๐Ÿ˜ข

solemn latch
#

if your two VPS's are not at the same location, it might be just latency pikathink

plucky heart
#

Level in leaderboard and rank card is not updated :v
I using quick.db

solemn latch
#

ooo

pure lion
#

tell me how to quickdb

solemn latch
#

dice someone who can help ya

pure lion
#

and i will help you

quartz kindle
#

@pure lion show full error

plucky heart
#

let xp = db.add(`xp_${message.author.id}`, 1); let level = Math.floor(0.1 * Math.sqrt(xp)); let lvl = db.get(`level_${message.author.id}`) || db.set(`level_${message.author.id}`,1);; if (level > lvl) { let newLevel = db.set(`level_${message.author.id}`,level); if(message.guild.id !== "264445053596991498") { message.channel.send(`๐ŸŽ‰ ${message.author.toString()}, You just advanced to level ${newLevel}!`); } }
My code for xp system :v

pure lion
#
C:\Users\(REDACTED)\Desktop\qBot\node_modules\quick.db\bin\handler.js:240
  db.prepare(`CREATE TABLE IF NOT EXISTS ${options.table} (ID TEXT, json TEXT)`).run();
     ^
SqliteError: near "-": syntax error
    at arbitrate (C:\Users\(REDACTED)\Desktop\qBot\node_modules\quick.db\bin\handler.js:240:6)
    at table.set (C:\Users\(REDACTED)\Desktop\qBot\node_modules\quick.db\bin\handler.js:184:14)
    at Object.<anonymous> (C:\Users\(REDACTED)\Desktop\qBot\index.js:91:17)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47
#

@plucky heart ok cool but how do you make tables that work

quartz kindle
#

sounds like table names with dashes are not supported

pure lion
#

balls

solemn latch
#

lol

quartz kindle
#

sqlite does not support prepared statements for table names, so the name is being injected as a string, which causes sqlite to think you're doing math with them

pure lion
#

epicccccc

quartz kindle
#

just use underlines

pure lion
#

if it logs 1 then im gonna sdiftghoeuhisgrt

#

it logged 1

#

i will now sdiftghoeuhisgrt

earnest phoenix
#

ok

#

he is sdiftghoeuhisgrting

solemn latch
#

:feelssdiftghoeuhisgrtingman:

pure lion
#

yes, i am sdiftghoeuhisgrting indeed

quartz kindle
#

@plucky heart show code for rank card and leaderboard

plucky heart
#
    let level = db.get(`level_${user1.id}`) || 0;
    level = level.toString();
    let exp = db.get(`xp_${user1.id}`) || 0;
    let neededXP = Math.floor(Math.pow(level / 0.1, 2))
  
    let every = db
    .all()
    .filter(i => i.ID.startsWith("xp_"))
    .sort((a, b) => b.data - a.data);
    let rank = every.map(x => x.ID).indexOf(`xp_${user1.id}`) + 1;
    rank = rank.toString();
    let img = await canva.rank({
      username: user1.user.username,
      discrim: user1.user.discriminator,
      currentXP: exp.toString(),
      neededXP: neededXP.toString(),
      rank,
      level,
      background:"https://i1.wp.com/static.web-backgrounds.net/uploads/2012/08/City_Landscape_Background.jpg",
      overlay: false,
      avatarURL: user1.user.displayAvatarURL({format: "png"})
    });
    return message.channel.send(new Discord.MessageAttachment(img, "rank.png"));```
rank card
#

let data = db.all().filter(i => i.ID.startsWith(`xp_`)).sort((a, b) => b.data - a.data); if(data.length < 1) return message.channel.send("No leaderboard!") let myrank = data.map(m => m.ID).indexOf(`xp_${message.author.id}`) + 1 || "N/A"; data.length = 10; let lb = []; for (let i in data) { let id = data[i].ID.split("_")[1]; let user = await Client.users.fetch(id); user = user ? user.tag : "Unknown User#0000"; let rank = data.indexOf(data[i]) + 1; let level = db.get(`level_${id}`); let xp = data[i].data; let xpreq = Math.floor(Math.pow(level /0.1, 2)); lb.push({ user: { id, tag: user }, rank, level, xp, xpreq }); }; const embed = new Discord.MessageEmbed() .setTitle("Leaderboard") .setColor("RANDOM") lb.forEach(d => { embed.addField(`${d.rank}. ${d.user.tag}`, `**Level** - ${d.level}\n **XP** - ${d.xp} / ${d.xpreq}`, true); }); embed.setFooter(`Your Position: ${myrank}`); return message.channel.send(embed)
leaderboard

pure lion
#

*steals*

#

Jk

earnest phoenix
#

@solemn latch my 2 VPSs are both from Singapore

#

the latency can not be too high right?

quartz kindle
#

where does the high latency happen?

#

does it happen when you run a command?

#

is the high latency actually from writing to the database or is it from sending sending/receiving a message from discord?

#

you can run a timer in your database write function to see how long it takes to write

amber fractal
quartz kindle
#

its there for you to take a deep breath and practice tolerance and compassion

amber fractal
#

I mean all it would end up doing is causing an error if, for whatever reason, message.member was undefined.

plucky heart
#

Level in leaderboard and rank card is not updated :v
I using quick.db
please help

pure lion
#

@amber fractal what are you trying to do/stop being rude to the Dev who wrote that

amber fractal
#

I'm saying that it would error and should be fixed

#

But if you think that it was rude, then let it error in production

#

I couldn't care less.

errant perch
#

how do i find out how many guilds my bot is in and set it as the status

solemn latch
#

depends on your library pikathink

misty sigil
#

lib?

errant perch
#

uh

#

javascript?

misty sigil
#

what one

#

is it d.js or eris

errant perch
#

js

winter basalt
#

lib not lang :>

#

js is the language, not lib

misty sigil
#

did you type
npm i discord.js
OR
npm i eris

solemn latch
#

or

errant perch
#

npm i discord.js

#

yes

misty sigil
#

ok so djs lib

#

client.guilds.cache.size will do that [@errant perch]

errant perch
#

ok

misty sigil
#

won't set it as status tho

errant perch
#

it worked

#

thanks

earnest phoenix
#

Tim, the latency only happens at writing. I know that because sometimes when reading, the database needs a few seconds to update properly.

solemn latch
#

reads are often cached, maybe your database has a really bad drive write?

#

try describing a write query

quartz kindle
#

could be many reasons, network having issues, the connection pool being reset or a new connection being slow to connect, etc...

#

since they are both in different machines, i would blame the network before blaming the cpu or the disk, unless you have a huge workload

#

which database is it btw?

earnest phoenix
#

MongoDB atlas

#

i use atlas because i need to access the same data from many places

quartz kindle
#

try using the profiler

earnest phoenix
#

will do thanks

#

Iโ€™m still on a shared cluster tho, does that mean I need to upgrade to a M10+ dedicated cluster?

quartz kindle
#

is the profiler not available on the shared cluster?

#

not sure if it works for a remote db tho

cerulean lake
#

Can someone help my bot wont go on. this is discord.js heres my index.js ```const Discord = require('discord.js');
const { prefix, token } = require('./config.json');
const client = new Discord.Client();

client.once('ready', () => {
console.log ("Ready!")
})

client.on('message', message => {
//console.log(message.content);

if(message.content.startWith(`${prefix}kick`)) {
    message.channel.send("Kick")
}

})

client.login(token)```

solemn latch
#

whats your error?

cerulean lake
#

Theres no error

#

it wont come on

solemn latch
#

when you run it?

cerulean lake
#

No error

#

Says Ready!

#

im using visual Code studio

solemn latch
cerulean lake
#

what/

#

can u help?

#

When I do node index.js doesnt turn on the bot

solemn latch
#

ready means its on

cerulean lake
#

IK

#

but

#

it doesnt turn on

#

its offline

#

here ill show u

solemn latch
#

what happens when you do the command

cerulean lake
#

It doesnt do anything

#

its suppose to say kick when i doo !kick

solemn latch
#

uncomment the console.log(message.content)

cerulean lake
#

wdym

solemn latch
#

turn //console.log(message.content);
to
console.log(message.content);

cerulean lake
#

kk

#

I got errors

solemn latch
#

what errors

cerulean lake
#

from doing that

#
    if(message.content.startWith(`${prefix}kick`)) {
                       ^

TypeError: message.content.startWith is not a function
    at Client.<anonymous> (C:\Users\12138\code\CraftyBot\index.js:12:24)
    at Client.emit (events.js:315:20)
    at MessageCreateAction.handle (C:\Users\12138\code\CraftyBot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\12138\code\CraftyBot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\12138\code\CraftyBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
    at WebSocketShard.onPacket (C:\Users\12138\code\CraftyBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:436:22)
    at WebSocketShard.onMessage (C:\Users\12138\code\CraftyBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:293:10)
    at WebSocket.onMessage (C:\Users\12138\code\CraftyBot\node_modules\ws\lib\event-target.js:125:16)
    at WebSocket.emit (events.js:315:20)
    at Receiver.receiverOnMessage (C:\Users\12138\code\CraftyBot\node_modules\ws\lib\websocket.js:800:20)```
#

what

wheat valve
#

Its startsWith()

solemn latch
#

ah

#

there you go

cerulean lake
#

wherer

solemn latch
#

in the one spot it could be

cerulean lake
#

startsWith() doesnt have that

solemn latch
#

startWith()
doesnt exist,
startsWith() does

cerulean lake
#

I dont see it tho

#

if(message.content.startWith(`${prefix}kick`)) {

solemn latch
#

yeah

#

change startsWith

cerulean lake
#

ohh

#

ok

#

I didnt see ur s

#

in starts

#

I only saw start

#

FACE PALM

#

thanks

#

I PUT IN THE WRONG TOKEN FOR WRONG BOT

#

UGH

solemn latch
#

lol

#

console.log(Logged in as: ${client.user.tag});

#

in your ready event

cerulean lake
#

wait

#

I got a error

earnest phoenix
#

what err

cerulean lake
#

hmhmh

#
internal/modules/cjs/loader.js:1175
    throw err;
    ^

SyntaxError: C:\Users\12138\code\CraftyBot\config.json: Unexpected end of JSON input
    at parse (<anonymous>)
    at Object.Module._extensions..json (internal/modules/cjs/loader.js:1172:22)        
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Users\12138\code\CraftyBot\index.js:2:27)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
PS C:\Users\12138\code\CraftyBot>```
earnest phoenix
#

line 2 char 27, some json is malformed

#

in your index.js

#

nvm im stupid

cerulean lake
#

wot

solemn latch
#

in the config.json, close the json

#

}

earnest phoenix
#

your config.json is malformed that you load in index.js

#

big doodoo head

cerulean lake
#

im confused

earnest phoenix
#

go to your config.json and fix the issue

#

its most likely a } missing at the end

cerulean lake
#

IDk

#

I have no ]

#

}

solemn latch
#

and that error

#

says it ended without }

#

for every { you need a }

cerulean lake
#
    "prefix": "!",
    "token": ""
}```
#

thats my config

#

can u show me whats suppose to look like?

#

cause im confused

earnest phoenix
#

that is correct

#

what

quartz kindle
#

did you save it?

cerulean lake
#

then y is there errors?

quartz kindle
#

make sure its saved

cerulean lake
#

ya

#

I fixed it

#

Seems like I copied and paste it weird

#

Its up and running

#

Thanks for the help guys

hardy vector
#

https://hasteb.in/adisutem.js
it does the role menu but then it crashes and gives me this error at Function.Module._load (internal/modules/cjs/loader.js:879:14)
(node:1704) UnhandledPromiseRejectionWarning: OverwriteModelError: Cannot overwrite ReactionRole model

marsh elk
#

well tbh i was going to post a github repo that i have just posted that has some features that u cant really find so i will put it here

it just has things that people can learn from or use https://github.com/ark-maker-bot/open-source-discord-bot
like custom welcome channels and custom welcome messages and it open source if anyone wants to use it
tag me if u want any help or u want it removed

#

i aint promoting

#

this is purely for people to use

#

just so u know admins

solemn latch
#

honestly, tim probably would know @hardy vector Hmmm

hardy vector
#

lmao

solemn latch
#

that is 100% promotion pikathink

hardy vector
#

^

marsh elk
#

nah

solemn latch
#

just because you say it isnt, doesnt make it not

hardy vector
#

@quartz kindle do you know how to fix my mongo issue

marsh elk
#

no like i am being serious i did it for my own learning and its open source and it has the custom server welcome channel and welcome messages and i cant find any tutorials for that

#

so if people wanted that

#

there it is

solemn latch
#

someone woulda asked pikathink

marsh elk
#

oh well there it is

solemn latch
marsh elk
#

i asked people and they didnt know

#

so i came up with a way

#

so i thought i would post it

placid hamlet
#

Does anyone know if there is something wrong with pinging between glitch and uptimerobot?

solemn latch
#

that was disabled by glitch

marsh elk
#

yh

#

i dont think they posted an update for the situation nor a est date for it to be enabled again

solemn latch
#

i think they decided to perma disable it

placid hamlet
#

That would screw me over

marsh elk
#

tbh i kinda understand why they did it

#

i mean it has screwed me over

solemn latch
#

its kinda abuse of their systems

marsh elk
#

yh

#

like both of my bots was ran off that

placid hamlet
#

Yes or yes, buy a vps to be able to continue with the project.

#

:/

solemn latch
#

heroku still works i think

#

but that will also very likly go the same route

#

of disabling

marsh elk
#

yh most likely

solemn latch
#

you can get a VPS for like $35 a year, or like $3 a month

#

thatll run multiple small bots no issue

placid hamlet
#

Yes .. But in my country .. The dollar issue .. uff

marsh elk
#

tbh i have some old pcs so i could just use one of those

#

but na

solemn latch
#

i got a nice home server, but i dont use it for anything really

placid hamlet
#

:/ xd

misty sigil
#

i got a nice home server, but i dont use it for anything really
@solemn latch same

hardy vector
#

a home server?

#

what

solemn latch
#

yeah

misty sigil
#

yeah

solemn latch
#

just some old pc parts, was a high end desktop at one point

hardy vector
#

ohhh

misty sigil
#

my dad works in a server room

hardy vector
#

lol

#

ok

misty sigil
#

gets old equipment from time to time

earnest phoenix
marsh elk
#

huge lmao

cerulean lake
#

Wait wia twait

quartz kindle
#

wia twait

earnest phoenix
#

wia twait

marsh elk
#

what?

cerulean lake
#

How do I set a bots status. Discord.js Do i like make a new file or put it in index.js?

misty sigil
#

docs

cerulean lake
#

kk

misty sigil
#

or wait gimme a sec

cerulean lake
#

I dont see it in the docs

misty sigil
#

client.user.setActivity(status in here)

cerulean lake
#

Which file tho

#

index.js?

#

or config.json

#

or which file?

misty sigil
#

index.js

#

in the client.on block

cerulean lake
#

What

misty sigil
#

give me your code.

cerulean lake
#

kk

#
const { prefix, token } = require('./config.json');
const client = new Discord.Client();

client.once('ready', () => {
    console.log ("Ready!")
})

client.on('message', message => {
    //console.log(message.content);

    if(message.content.startsWith(`${prefix}ra`)) {
        message.channel.send("Never gonna give you up!")
    }
})




client.login(token);```
solemn latch
#

i wish i could search all of the docs that fast

cerulean lake
#

?

#

Idk where to put it

solemn latch
#

he said to look in the docs, and in under 60 seconds you didnt find it

misty sigil
#

i just searched my code

earnest phoenix
#

i have d.py documentation in a bookmark, if i need to find smth i can find it pretty quickly

solemn latch
#

yeah, but he didnt find something, in under 60 seconds

#

y:p

misty sigil
#
client.once('ready', () => {
    console.log ("Ready!")
    client.user.setActivity("Activity goes here")
})```
cerulean lake
#

what

#

oh i see

#

gotg it

misty sigil
#
const Discord = require('discord.js');
const { prefix, token } = require('./config.json');
const client = new Discord.Client();

client.once('ready', () => {
    console.log ("Ready!")
    client.user.setActivity("Activity goes here")
})

client.on('message', message => {
    //console.log(message.content);

    if(message.content.startsWith(`${prefix}ra`)) {
        message.channel.send("Never gonna give you up!")
    }
})




client.login(token);```
cerulean lake
#

I did it

#

But idk if it works

winter basalt
#

try it and see mmulu

earnest phoenix
#

restart your bot and check

solemn latch
#

start the bot pikathink

misty sigil
#

there's some documentation on .setActivity

cerulean lake
#
    client.user.setActivity(WATER | Prefix !)
                                    ^^^^^^

SyntaxError: missing ) after argument list
    at wrapSafe (internal/modules/cjs/loader.js:1054:16)
    at Module._compile (internal/modules/cjs/loader.js:1102:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)

    at internal/main/run_main_module.js:17:47```
#

ERROR

solemn latch
#

gotta be a string

misty sigil
#

You need to put it in "", '' or ``

cerulean lake
#

wdym,

#

Oh

#

Ya

#

I forgot

misty sigil
#

it has to have quotation marks

cerulean lake
#

Im dumb

#

Ya ik

#

it works

#

@cerulean lakeBot

#

@austere bronze

#

How do you make commands non case sensitive? Discord.js

#

I searched but didnt work

midnight pike
#

you can just turn the whole message.content to lowercase and make the commands lowercase

solemn latch
#

.toLowerCase

cerulean lake
#

how so

midnight pike
#

its a string method

#

.toLowercase() I think that is it

#

toLowerCase()

cerulean lake
#

Do I put it in index.js?

#

@midnight pike

solemn latch
#

i think this would help you a ton

cerulean lake
#

?

#

this isnt helping me

#

with the lower case and upper case

#

non senitivity caps\

solemn latch
#

.toLowerCase()
is a property

cerulean lake
#

Ya BUT wHEre do I pUT it

solemn latch
#

yikes, method*

winter basalt
#

yikes

solemn latch
#

the video explains how to use properties and methods

#

so when someone says .toLowerCase()
you know exactly where it goes

lethal pike
#

It's a string function string.toLowerCase()

earnest phoenix
#

"AAAAAA".toLowerCase() == "aaaaaa"

lethal pike
#

Basically yes

winter basalt
#

so if your user types !cOmmAnd it will turn it into !command

lethal pike
#

^

earnest phoenix
#

^^^

solemn latch
#

<<<

#

i hate how people don't apricate resources to help them learn how to not ask the same questions all the time

earnest phoenix
dapper lynx
#

Does anyone know a decent tutorial or something for using separate files for commands, i've never really done it before and i tried it yesterday and all i kept getting was "can't use args before initialization" or something :/

solemn latch
#

Discordjs?

dapper lynx
#

Yeah

solemn latch
#

The discordjs guide command handler is a great tutorial

winter basalt
#

beat me to it

solemn latch
#

By a milisecond

winter basalt
#

i was waiting if you were gonna send it

#

and you didnt

#

then you sent it almost the same time mmlol

solemn latch
#

I had to look it up

#

I'm on mobile

dapper lynx
#

I believe that was nearly exactly how i was doing it but i was getting the "args" error thing, can't access before initialization

#

I assume i did it slightly wrong so i'll read through the website

solemn latch
#

Args need to be defined in your index file, and passed on in the execute

#

Or doesn't need to be, thats just how this specific handler does it

dapper lynx
#

Is there a way to just have the entirety of my play functions in a separate file? Or should i just do it the way i was going to and just have all the music code in index and have all the other commands in separate files?

solemn latch
#

Everything can be done through the command handler(seperate files)

dapper lynx
#

So i can have many commands in a single command handler file

solemn latch
#

File or folder?

dapper lynx
#

Yeah i assume that isn't possible to have?

#

I'd have to have a separate file for every command?

warm marsh
#

You can have files or a file

dapper lynx
#

But i could just organise into one folder

solemn latch
#

You can do it either way.
All the command handlers I know of are seperate files for each command.

#

All in one folder

warm marsh
#

I used to do one file per command category.

dapper lynx
#

Okay i'll just do it that way then, it's just easier than messing about trying to do it a different way

warm marsh
#

External and internal command handlers are just as easy as one another.

dapper lynx
#

I know how to have 1 command per file so for now i'll just stick to that and possibly change it when i add more commands

warm marsh
#

Whatever works for you, just stick to that.

earnest phoenix
#

what lang

#

im not sure if it works that way like in python, but im guessing that x became a pointer to y

lyric mountain
#

That's because you're not copying the object, but getting the reference to it

earnest phoenix
#

so my theory is right

lyric mountain
#

So X equals to Y, and Y equals to X

#

You need to create another array and add the values of Y

#

Else they'll represent the same object

earnest phoenix
#

x basically is now a pointer to y, any changes to x will reflect on y and vice versa

lyric mountain
#

Yep

#

That's called "passing an object by reference"

cerulean lake
#

I still dont understand how to make command non case sentitive for discord.js

#
const { prefix, token } = require('./config.json');
const client = new Discord.Client();

client.once('ready', () => {
    console.log ("Ready!")
    client.user.setActivity("WATER | Prefix !")
})

client.on('message', message => {
    //console.log(message.content);

    if(message.content.startsWith(`${prefix}invite`)) {
        message.channel.send("**INVITE BOT LINK**")
        message.channel.send("de")
    }
})




client.login(token);```
#

index.js

solemn latch
#

String.toLowerCase()

cerulean lake
#

YAS

#

BUT WHERE

wild cradle
#

Hm

solemn latch
#

after a string.

cerulean lake
#

whats string

winter basalt
#

sigh

cerulean lake
#

what

#

what string

#

lik

winter basalt
#

user message

solemn latch
#

The one you want to be lower case

cerulean lake
#

can u edit my index.js to show me

#

im rlly confused

solemn latch
#

I cant do that for you

lyric mountain
#

No spoonfeed

cerulean lake
#

y

winter basalt
#

you cant just expect people to fix your code

#

everytime

solemn latch
#

^

cerulean lake
#

im NOT SAYING THAT RE

lyric mountain
#

You are

winter basalt
#

you literally said that

#

lmao.

cerulean lake
#

boi

solemn latch
#

I gave you a fantastic video that explains how to use methods

cerulean lake
#

ok ignore the fact that u dont wanna help me

#

that video didnt help me

#

ok bye

solemn latch
lyric mountain
#

can u edit my index.js to show me
spoonfeed

winter basalt
#

can you like learn js basics atleast

#

pog

solemn latch
#

You should hire a teacher, but i doubt a hired teacher will edit your code for you

#

They will just teach you how to use properties and apply them CBPikaThink

maiden mauve
#

there should literally be a recurring spam in this chat from a bot

#

telling people they have to learn how to code

#

its the development version of "when will my bot be accepted"

#

if you don't think learning syntax is fun and generating "hello world" then programming probably isn't a passion for you

earnest phoenix
#

how can i put a 5s cooldown on slots?

sudden geyser
#

if message content includes help and message content includes pls then send codecademy link

maiden mauve
#

slots?

earnest phoenix
#

yes

#

in the economy

#

because you cand spam with slots and it can produce bot lag

solemn latch
#

Cooldown for commands?

#

What library?

earnest phoenix
#

js

solemn latch
#

Agreed @maiden mauve .
Thats the fun stuff

earnest phoenix
#

discord.js

solemn latch
earnest phoenix
#

ok thx

heavy anchor
#

Lol

maiden mauve
#

As much as I support learning on your own

#

I love having professional friends to help

#

friend helped me with Heroku being retarded

#

essentially Heroku needed to be force fed new mongo and node

vale garden
#

hi

#
.setDescription(stripIndents`Gamemode: ${gametype.slice(1, 2).toUpperCase() + gametype.slice(2)}`)
#

i got this from somewhere

#

but it doesnt work properly

#

so can someone tell me what it means

#

cuz im dumb and srsly dont understand

#
gametype = args[2]``` btw
vale garden
#

lol

earnest phoenix
#

that code is literal shit

vale garden
#

lol

#

how

earnest phoenix
#

like fr it looks as if someone took a big fat dump on that code

vale garden
#

lol

earnest phoenix
#

what does it even do

vale garden
#

tell me what it means

#

its supposed to

#

wait

#

why

#

wtf

#

its supposed to print the args[2]

#

why is it like this

#

lol

sick cloud
#

can you convert a date string (2020-06-26) to an actual js date object

earnest phoenix
#

whats the context, whats the function, why is there a random stripIndents at the beginning of that string

vale garden
#

i

#

have no idea

earnest phoenix
#

@sick cloud new Date(year,month,day) I believe

vale garden
#

i got it from github

earnest phoenix
#

if that doesnt work, use moment

sick cloud
#

so split by - basically

#

and use that

earnest phoenix
#

moment("string of date")

#

yeah

sick cloud
#

yeah i don't like moment and new Date works so

#

ty

vale garden
#
TypeError: Cannot read property 'execute' of undefined
#

what does this mean

sick cloud
#

whatever.execute
whatever doesn't exist so excute doesn't exist

earnest phoenix
#

and js doesnt like that

earnest phoenix
#

๐Ÿค”

sick cloud
#

my sorting is madly broken

#

how can i fix it

#

its supposed to show oldest at the top

grizzled isle
#

split by the date by "/" and arrange the middle array by number

sick cloud
#
                    if (props.sortBy === sorting.DATE_CREATED_NEWEST) gameList.sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
                    if (props.sortBy === sorting.DATE_CREATED_OLDEST) gameList.sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()).reverse();

that's what i'm doing rn

#

using the date

#

it can be in any year month or day

wet osprey
#

i'm wondering is it possible pull guild data instead of running the bot using python?

data like guild members, roles, channels(guilds that bot app in)

for the web dashboard i need bot data

earnest phoenix
#

look into oauth2

sick cloud
#
if (props.sortBy === sorting.DATE_CREATED_NEWEST) gameList = gameList.sort((a, b) => b.createdAt - a.createdAt);
#

i have zero idea why it won't sort

wet osprey
#

but i think i have to keep the bot running in loop but i don't want to do that

earnest phoenix
#

oauth2 doesn't require a bot at all

#

oh

#

i misread

#

i thought you wanted to pull data from certain users

#

data like guild members, roles, channels
guild members no, you'll have to use the gateway for that

#

for everything else you can using REST

#

however that can be very expensive and you can ratelimit yourself really quickly

#

so it's just suggested you pull data from the gateway

wet osprey
#

actually members not needed. i used it for example. i want pull only roles, channels

earnest phoenix
#

have you tried reading the error

#

mhm

#

i cant find anything wrong

#

it's a syntax error

#

yeah @wet osprey totally possible then, but beware of the ratelimits

#

give me a minute and i'll send you doc links

wet osprey
#

ok

earnest phoenix
#

@earnest phoenix where do i fix the syntax error?

#

@earnest phoenix where do i fix the syntax error?
@earnest phoenix
it tells you right there in the error

#

ive put in my bots token though-

pine sage
#

@earnest phoenix why did u download a premade bot

earnest phoenix
#

i had help with it

wet osprey
earnest phoenix
#

channels

#

plural

#

and yes

wet osprey
#

headers?

earnest phoenix
#

the only header needed is the Authorization header

pine sage
#

i had help with it
@earnest phoenix idrk what you just said but dont fricking downloaded premade bots it just means ur trash

earnest phoenix
#

Bot <token> should be the value of it

#

but once again i'm warning you of ratelimiting, you should probably handle those

#

@earnest phoenix idrk what you just said but dont fricking downloaded premade bots it just means ur trash
@pine sage i paid someone to custom make it

wet osprey
#

but once again i'm warning you of ratelimiting, you should probably handle those
@earnest phoenix waht is the limit?

pine sage
#

@pine sage i paid someone to custom make it
@earnest phoenix oh boy he didnt make that

earnest phoenix
#

there isn't a set in stone one

#

ratelimits are dynamic

#

returned in the headers of the request

#

@earnest phoenix oh boy he didnt make that
@pine sage oh

#

still, how do i fix it?

wet osprey
#

ok

pine sage
earnest phoenix
#

ight

#

how do i fix it?

pale vessel
#

read the error

earnest phoenix
#

SyntaxError: Invalid or unexpected token
at wrapSafe (internal/modules/cjs/loader.js:1054:16)
at Module._compile (internal/modules/cjs/loader.js:1102:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)
at /Users/bronwenblack/Downloads/dippy/index.js:11:19
at Array.forEach (<anonymous>)
at /Users/bronwenblack/Downloads/dippy/index.js:10:9
npm ERR! code ELIFECYCLE

pine sage
#

@earnest phoenix bro follow what i fucking said

earnest phoenix
#

i did

#

whats it suppost to do?

pine sage
#

@earnest phoenix put your index.js on https://hastebin.com so its much easier
@pine sage do u fuxking understand this

earnest phoenix
#

?????????????

#

it's a syntax error, they're perfectly capable of identifying the error themselves

#

i've never worked with them before

#

do you understand what a syntax error is

pale vessel
#

read the stack

earnest phoenix
#

no.

#

please explain

pine sage
earnest phoenix
#

thanks

#

i have

pine sage
#

bruh

#

then click fuckkng save then paste it here

earnest phoenix
lethal pine
#

how to get developer role

#

?

earnest phoenix
#

const Enmap = require("enmap");
const fs = require("fs");
const modules = "./modules/";
const Discord = require("discord.js");
const config = require("./config.json");
const client = new Discord.Client();
client.login(config.token);
fs.readdir("./events/", (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
const event = require(./events/${file});
let eventName = file.split(".")[0];
client.on(eventName, event.bind(null, client));
});
});
client.commands = new Enmap();
client.aliases = new Enmap();
fs.readdirSync(modules).forEach(file => {
fs.readdir(./modules/${file}/, (err, files) => {
if (err) return console.error(err);
let jsFile = files.filter(f => f.split(".").pop() === "js");
if (jsFile.length <= 0) {
return console.log("Couldn't find any commands.");
}
jsFile.forEach(f => {
let pull = require(./modules/${file}/${f});
client.commands.set(pull.data.name, pull);
pull.data.aliases.forEach(alias => {
client.aliases.set(alias, pull.data.name);
});
});
});
});

#

submit a bot and wait for it to get verified @lethal pine

#

and holy shit don't paste blocks of code here

lethal pine
#

lol

earnest phoenix
#

paste it in hastebin, save it and share the link

lethal pine
#

submit a bot and wait for it to get verified @lethal pine
@earnest phoenix thankx bro

pine sage
#

omg

earnest phoenix
pine sage
#

this guy is so fucking dumbbbb

#

ahhhh

earnest phoenix
#

they're most likely underage

#

they're not dumb

#

im illiterate xd

#

they just don't understand

pine sage
#

i have bad temper sorry

earnest phoenix
#

its allg

delicate shore
#

what is eror here?

#

why is token wrong?

earnest phoenix
#

a syntax error

delicate shore
#

like

#

it's required

earnest phoenix
#

you're not closing your if statement

pale vessel
#

yikes

earnest phoenix
#

therefore, unexpected

wet osprey
delicate shore
#

therefore, unexpected
@earnest phoenix oh

#

tyhanks

earnest phoenix
#

ive sent the link, what now?

delicate shore
#

what

#

@earnest phoenix help again

earnest phoenix
#

@pine sage ?

pine sage
#

what

earnest phoenix
#

whats wrong with the code?

delicate shore
#

now?

earnest phoenix
#

you still aren't closing your if statement

pale vessel
#

they definitely did not understand a single word

delicate shore
#

you still aren't closing your if statement
@earnest phoenix where me not getting it

earnest phoenix
#

how do i use nekobot API in my bot?
this is my current code:

no u
#

jkmy bot has 780 lins of code

pale vessel
#

that should work

delicate shore
#

i get it

earnest phoenix
#

lol

delicate shore
#

now what is error

earnest phoenix
#

now you aren't closing your catch

#

why you using it on catch block

#

else works on if statements obviously

pale vessel
#

and they are using it on an if statement

delicate shore
#

f(command === "kick") {
if (msg.member.hasPermission("KICK_MEMBERS")) {
if (msg.members.mentions.first()) {
try {
msg.members.mentions.first().kick();
} catch {
msg.reply("I do not have permissions to kick " + msg.members.mentions.first());
}else {
msg.reply("You do not have permissions to kick " + msg.members.mentions.first());
}
}

earnest phoenix
#

yeah inside the catch block

delicate shore
#

edit this pla

earnest phoenix
#

no

pale vessel
#

it's outside

#

read the code

earnest phoenix
#

and that try catch won't do anything since kick is a promise

pale vessel
#

they didn't close the catch

earnest phoenix
#

@delicate shore since you are on glitch, click the { parenthesis on your if statement and it will highlight the one where it is ending. Put your else statement there

pale vessel
#

should've used .catch or await it

earnest phoenix
#

wait are you telling me like C# you can use try () catch {}

#

In js also you can use try catch

#

teach me lol

#

thats what i said....

delicate shore
#

bruh

#

psl help

earnest phoenix
#

lemme fix your code

#

dm me

#

da code

#

@delicate shore which help

#

do not spoonfeed them lol

#

guide them to the fix

delicate shore
#

i got it

#

thanks

#

there was {} missing in try and catch

earnest phoenix
#

Do always ask2ask

#

yeah

#

thats what i was gonna say...

#

a friend said pommss broke, whats that?

delicate shore
#

can anyone help more

earnest phoenix
#

i just figured outthe try catch thingy, now can someone tell me the syntax

#

@delicate shore @_@

delicate shore
earnest phoenix
#

First ask

delicate shore
#

its not showing

#

that

#

where { closes?

#

of kick

earnest phoenix
#

can anyone help more
@delicate shore if you dont want us to spoonfeed you

#

where { closes?
@delicate shore click it glitch will highlight

#

the } where it ends

delicate shore
#

i did

#

@earnest phoenix its not showing

earnest phoenix
#

so you haven't closed it

#

@delicate shore it is alredy closed read the baractes

#

Open close open close

#

Like this

delicate shore
#

it was ending down in code

#

i fixed it

#

thans

earnest phoenix
#

It happens when you copy paste the code

#

H

lethal pine
#

how to get early supporter badge

earnest phoenix
#

can you give me your kick code please

#

im gonna use it

delicate shore
#

It happens when you copy paste the code
@earnest phoenix no

earnest phoenix
#

@lethal pine this not development topic

lethal pine
#

sad

earnest phoenix
#

can someone tell me the syntax of try catch

#

cuz my community would panic if it goes down because of an error (lies)

#

Try { your code}.catch(err =>{console.log(err)})

#

๐Ÿค”

#

how to get early supporter badge
@lethal pine
you cannot anymore, people who got nitro back when it was introduced have it

delicate shore
#

why can't it read mentions

earnest phoenix
#
const fs = require("fs");
const modules = "./modules/";
const Discord = require("discord.js");
const config = require("./config.json");
const client = new Discord.Client();
client.login(config.token);
fs.readdir("./events/", (err, files) => {
  if (err) return console.error(err);
  files.forEach(file => {
    const event = require(`./events/${file}`);
    let eventName = file.split(".")[0];
    client.on(eventName, event.bind(null, client));
  });
});
client.commands = new Enmap();
client.aliases = new Enmap();
fs.readdirSync(modules).forEach(file => {
  fs.readdir(`./modules/${file}/`, (err, files) => {
    if (err) return console.error(err);
    let jsFile = files.filter(f => f.split(".").pop() === "js");
    if (jsFile.length <= 0) {
      return console.log("Couldn't find any commands.");
    }
    jsFile.forEach(f => {
      let pull = require(`./modules/${file}/${f}`);
      client.commands.set(pull.data.name, pull);
      pull.data.aliases.forEach(alias => {
        client.aliases.set(alias, pull.data.name);
      });
    });
  });
});```
#

ive tried fixing it and it still doesnt work

#

it said something about pomsss@2.0.3

hushed vale
#

how to check if someone voted and reward them

earnest phoenix
#

why me minimodding

#

lol

#

whats pomsss@2.0.3

#

google

#

nothing comes up

#

why can't it read mentions
@delicate shore its supposed to be msg.GUILD.members.mentions.first()

hushed vale
#

yep

delicate shore
#

ok

earnest phoenix
#

imma steal your code hehehehhehehhe

pale vessel
#

no it was right

delicate shore
pale vessel
#

remove guild

delicate shore
#

it cannot read members

pale vessel
#

and it's mentions first and then members

earnest phoenix
#

wait what

pale vessel
#

mentions is a property for message

earnest phoenix
#

so the thingy i saw on youtube was for a REALLY old version of discord.js

pale vessel
#

mentions stores members

opal plank
#

dont use youtube

#

check docs

pale vessel
#

it wouldn't even work in older versions

#

you just forgot

earnest phoenix
#

docs make my head go crazy

opal plank
#

its the only reliable source you should go for

earnest phoenix
#

tf avast says discord.guide is safe to use but many people gave it a thumbs down cause they dont trust it

opal plank
#

specially when you start going into libraries that arent popular and dont have tutorials for

#

its a good practice to get used to docs

earnest phoenix
#

what is the emoji for the red cross thingy

delicate shore
#

@pale vessel should i remove GUILD?

earnest phoenix
#

yeah

pale vessel
#

removing it won't fix it

earnest phoenix
#

msg.mentions.users.first() he said right

delicate shore
#

users?

opal plank
#

that'll return user

pale vessel
#

members if you need those instead

opal plank
#

not member

earnest phoenix
#

why will you kick bots

opal plank
#

\โŒ @earnest phoenix

#

to get emoji use \ before it

earnest phoenix
#

ok thx

#

\โŒ

opal plank
#

\โŒ

earnest phoenix
#

wait its already escaped

opal plank
#

like that

#

yeah

#

normal emotes will return you their name:id

#

those are unicoded

delicate shore
earnest phoenix
#

and my bot cant use custom emojis unless he is in here

delicate shore
#

it cannot read mentions

earnest phoenix
#

mentions of undefined

#

hmm

opal plank
#

which version of d.js you using?

earnest phoenix
#

dj

opal plank
#

12.2

#

i just spotted

earnest phoenix
#

hey don't look at his private stuff

opal plank
#

lemme use my eval rq

earnest phoenix
#

imma go stalk em on glitch

opal plank
#

message.mentions.members.first()

delicate shore
#

that is what i use

opal plank
#

show me the snippet used

delicate shore
#

what\

earnest phoenix
#

BRO MESSAGE AND MSG ARE DIFFERENT THINGYS

#

YOU DEFINED MSG AND YOU USING MESSAGE

#

WHY ME YELLING

#

alright turned off caps

opal plank
#

are you passing message onto the command?

#

are you using command handler?

delicate shore
#

yes

opal plank
#

show the code snippet, post it on hastebin

#

i'll run it on my eval

delicate shore
#

where?

opal plank
#

hastebin

earnest phoenix
#
if(command === "kick") {
    if (msg.member.hasPermission("KICK_MEMBERS")) {
   if (msg.mentions.members.first()) {
     try {msg.mentions.members.first().kick();} 
catch {msg.reply("I do not have permissions to kick " + msg.mentions.members.first());}}
else {
        msg.reply("You do not have permissions to kick " + msg.mentions.members.first());
}
  } };
#

his code

#

i copied form glitch

delicate shore
#

@opal plank it worked

#

๐Ÿฅณ

opal plank
#

let msg = message

delicate shore
#

thanks

#

yes

#

but

opal plank
#

np

delicate shore
#

it is not sending

#

message

#

that he was kicked

earnest phoenix
#

can i copy your code under the MIT license

opal plank
#

that code is so simple i'd argue you cant even claim ownership of it

earnest phoenix
#

that he was kicked
@delicate shore because you are using else on catch lmao you put the message.channel.send("kicked em") INSIDE THE TRY BLOCK!!!

#

bro my head's gonna explode

opal plank
#

specially cuz its already on stackoverflow

steep garnet
#

lol.

#

anyway.

earnest phoenix
#

i fixed his code

delicate shore
#

@delicate shore because you are using else on catch lmao you put the message.channel.send("kicked em") INSIDE THE TRY BLOCK!!!
@earnest phoenix ??

steep garnet
#

guys, someone have worked with the google-translate-api?

opal plank
#

i did use the cloud api for some time

steep garnet
#

yeah, well i'm trying to do the same for my bot.

opal plank
#

though i moved to translate-api package

earnest phoenix
#

@delicate shore else {} doesn't work on catch so your bot sends the kick message when the kick command gets an error

#

basically you were using else on catch block

opal plank
steep garnet
#

yes, i've seen that.

#

the problem is that it gaves an error.

opal plank
#

theres barely any deifference between them, i'd recommend using the translate api instead

delicate shore
earnest phoenix
#

@delicate shore hard to explain you im gonna just fix your code

#

no

#

else is NSIDE if statement!!!

#

lemme fix it

delicate shore
#

where

pure lion
#

Okay what's going on

steep garnet
delicate shore
#

OK

earnest phoenix
#
if(command === "kick") {
    if (msg.member.hasPermission("KICK_MEMBERS")) {
   if (msg.mentions.members.first()) {
     try {msg.mentions.members.first().kick();
         msg.channel.send(" I Yeeted" + msg.mentions.members.first());} 
catch {msg.reply("I do not have permissions to kick " + msg.mentions.members.first());}}
}
  } } else {
        msg.reply("You do not have permissions to kick " + msg.mentions.members.first());
}

@delicate shore should work

steep garnet
#

wait, wut.

pure lion
#

@earnest phoenix ok cool but in future don't spoonfeed

earnest phoenix
#

hard to explain

#

he's just making errors

delicate shore
steep garnet
#

@opal plank, that module seems like 100 times easier.

opal plank
#

it is

steep garnet
#

what i've done all this time.

earnest phoenix
#

tf

pure lion
#

@delicate shore it's a catch block

opal plank
#

the cloud api is much harder to handle

steep garnet
#

shit, why i don't came here in first place? lmao.

#

ty so much! :D

earnest phoenix
#

@delicate shore goto that line on glitch imma see your code

opal plank
#

and the fact that the parser is chewing some of the errors is annoying

#

hard to debug when the only error is BAD REQUEST

steep garnet
#

yes.

#

lmao.

earnest phoenix
#

@delicate shore oh boy who told you to remove what i fixed partially

steep garnet
#

actually.

earnest phoenix
#

I GIVE UP

#

bye

steep garnet
#

i thought i wasted 60min of like figuring out what was happening.

earnest phoenix
#

hard to explain doggos

steep garnet
#

and then you come and say "hey, i have this cool module".

earnest phoenix
#

@delicate shore

steep garnet
#

and i just read it for 3sec and it looks easier

opal plank
#

its easier, performance is about the same, simplier/similar sytanx

#

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

steep garnet
#

damn.

opal plank
#

no reason NOT to use that instead if you only doing basic stuff

steep garnet
#

i luv you now

opal plank
#

๐Ÿ˜‰

steep garnet
#

you're my best friend now ok? oldEyes

earnest phoenix
#

bruh @delicate shore cant even read that "unexpected token OMMAND" typo it was supposed to be command

opal plank
#

sure

#

just a couple more till we get to double digits friendlist

earnest phoenix
#

GOTTA GOTOVISUAL STUDIO CODE and start from scratch on his kick command and i dont make typos

steep garnet
#

lol.

pure lion
#

Btw I'm kinda retarded inside but is there a way for me to log the guild ID on quick.db and then access each one when called? After the ID will be a number, 1 or 0 and I want this to be accessible per guild

opal plank
#

definetly use VSC or atom(preferably vsc, my opinion)

steep garnet
#

i use atom.

pure lion
#

Vsc best :chant:

steep garnet
#

vsc is good.

opal plank
#

atom had some nice features, but nothing that VSC extensions cant handle

steep garnet
#

but i rlly went more with atom.

opal plank
#

stuff like live commits are insanely fun

steep garnet
#

yeah.

#

lmao.

delicate shore
#

ok so

pure lion
#

Wait atom has live commits??

delicate shore
#

i changed code

#

myself

opal plank
#

yeah

pure lion
#

I'm gonna go download atom

steep garnet
#

damn.

#

yes.

opal plank
#

kinda like liveshare on vsc

pure lion
#

Wait are there any vsc add-ons that do that?

delicate shore
steep garnet
#

@opal plank, link to the extension of atom?

opal plank
#

liveshare

delicate shore
#

this is the error

#

rest is fine

opal plank
steep garnet
#

ah yes, ty so much.

opal plank
delicate shore
pure lion
#

You're doing member.id, you wanna do member.tag/member/member.username @delicate shore

delicate shore
#

i am not kicked

#

but

steep garnet
#

but for my bot, what it happens @opal plank?

pure lion
#

Yeah the formatting of the code was kinda bad it could be a lot simpler

opal plank
#

wdym?

earnest phoenix
#

lemme fix your code

steep garnet
#

like, if i do something wrong.

#

it would error all the time?

earnest phoenix
#

i swear you are hard to explain

opal plank
#

not sure i get the question, everyone will see the error on the code

pure lion
#

@steep garnet if there's an error we're here to help you

steep garnet
#

ty.

pure lion
#

Np :)

steep garnet
#

i just know js, but discord.js and their libraries.

#

damn god.

opal plank
#

the code doesnt run while you guys are editing, it only changes the code as everyone types

steep garnet
#

ohh, ok.

pure lion
#

Ah

#

But

#

Any add-ons that can do liveshare?

opal plank
#

you'd need to reload cache/ restart the bot to apply changes

pure lion
#

Not liveshare

#

Also uGh

opal plank
#

i sent both links up there to the extensions

#

both in atom and vsc

pure lion
#

Oh ye

steep garnet
#

yeah.

#

not erwin is a life-savior.

#

ngl.

pure lion
#

But what if you have no friends to edit with pandasad

opal plank
#

specially for support, it comes in quite handy when trying to debug someones code

pure lion
#

Yeah, instead of just typing it out here

delicate shore
#

what is wrong here

pure lion
#

Uh

delicate shore
#
    if (msg.member.hasPermission("KICK_MEMBERS")) {
   if (msg.mentions.members.first()) {
     try {msg.mentions.members.first().kick();
         msg.channel.send("***I yeeted him Lol***")}
catch {msg.reply("I do not have permissions to kick " + msg.mentions.members.first());}}
   } else {
        msg.reply("You do not have permissions to kick " + msg.mentions.members.first());
   }};
    ```
opal plank
#

though, usually when you need to do that, i do not assure mental sanity safety

pure lion
#

Okay first, I'd really reccomend switch-case

delicate shore
#

what?

opal plank
#

the spaguetti code i've seen thus far is beyond my level of bad code

pure lion
#

Over if (content) then

opal plank
#

dynamic command handler

steep garnet
#

But what if you have no friends to edit with pandasad
@pure lion ah yeah, i've none.

opal plank
#

your code will become a monster rather quickly if you go the if's approach

#

client.commands.get(command).execute(command.args).catch((err) => ())

pure lion
#

what?
So you wanna split up the response into individual words, this makes an array usually named (args). When you put this as a var into your code, you can do switch (args[0]). This will get the first word of the input. If you do switch (args[0]) {case'kick': -> code here}

opal plank
#

map the commands you have, then get, if it errors, do nothing(aka, it didnt find a command matching)

steep garnet
#

and that was the error.

opal plank
#

whats the errorr though?

#

thats not the full thing

pure lion
#

You can use args to get a mention, E.G

let person = msg.mentions.users.first() || msg.guild.members.fetch(args[1])
let reason = msg.content.substring(prefix.length + 4 + args[1].length)
try {
  person.kick()
  msg.channel.send('person.(tag or id) has been kicked because of ' + reason)
}  catch (err)  {
  msg.channel.send('I was unable to kick this user')
  console.log(err)
}

@delicate shore

steep garnet
#

wait a second.

earnest phoenix
#

wow

#

how this posible

lusty quest
#

when on of the server got 100k users

#

then its easy

earnest phoenix
#

na

#

12 servers

#

only

#

@_@

opal plank
#

hmmm

#

throw the code into hastebin

steep garnet
#

ok sir.

delicate shore
#

one last thing

#

how to say that

#

if user don't have perms

#

then

#

do this

opal plank
delicate shore
opal plank
#

pastebin is every devs worst nightmare

delicate shore
#

i wanna do if perms is missing

#

is it !

#

before that

#

@opal plank do you knwo

#

know

opal plank
#

@steep garnet wheres your const loading the api though?

#

do the opposite

steep garnet
#

is upper on the code.

opal plank
#

if (!Has_perm)

#

! is inverts the statement

steep garnet
opal plank
#

if NOT has_perm

delicate shore
#

if (!Has_perm)
@opal plank wait so it will be

#

error

#

a

opal plank
#

not that dude

#

! in the beggingin

#

if(!)

#

not if(something!something)

delicate shore
opal plank
#

! is in the beginning

#

yes

#

basically what you are doing is the following

delicate shore
#

thnx

opal plank
#

:/

delicate shore
#

ok tell

opal plank
#

nah dude, all good

delicate shore
#

k

#

bye

#

me noob

opal plank
#

tis why you usually wanna learn, thats just spoonfeeding

steep garnet
#

lol.

opal plank
#

@steep garnet rerun the command with console.log(langToTranslation) and log textToTranslate too

#

you might be getting an error while trying to use a non existant abreviation and sending a request

opal plank
#

did you log the variables?

steep garnet
#

wdym?

#

ah, no.