#development

1 messages · Page 1424 of 1

green kestrel
#

but we're already forgiving in english by using edit distance

quartz kindle
#

yeah i saw, and yeah you can do that

drifting wedge
#

how can i make an element appear/disappear on click

viscid gale
#

class logic

drifting wedge
#

but then also allow certain things to be clicked

#

and it not disappear

viscid gale
#

remove class.. have that class determine visibility

long marsh
#

MongoDB - Lacks ACID, can get expensive to host with a cloud provides, and annoying to host yourself.
DynamoDB - Schema must match access pattern, or costs will climb very quickly (which is hard to maintain)
MySQL/Postgres - Traditional SQL problems that we all know + hosting can be annoying to host yourself .. managed hosting is also expensive.

drifting wedge
long marsh
#

Is there a 'database as a service' that I'm not thinking of?

drifting wedge
#

but if u click on the div

#

it disappears

#

on the div that oppens

lyric mountain
#

brasillian form of "não": n, ñ, nah, nn, nhe

green kestrel
#

@long marsh what do you call 'traditional sql problems'?

#

transaction locks and stuff?

drifting wedge
#

html:html <div> <div class="clicker" tabindex="1">Click me</div> <div class="hiddendiv"></div> </div>
css: ```css
.clicker {
width:100px;
height:100px;
background-color:blue;
outline:none;
cursor:pointer;
}

.hiddendiv{
display:none;
height:200px;
background-color:green;
}

.clicker:focus + .hiddendiv{
display:block;
}```

quartz kindle
#

probably vertical scaling

long marsh
#

Vertical scaling as well, yes

viscid gale
green kestrel
#

hmm, well youre not supposed to change the schema of a production system in sql

#

in mongo you just give it extra fields and it goes meh ok then

viscid gale
#

like what are the params when it's invisible.. u dont know and html don't care

#

RIP

long marsh
#

How can you ensure that you understand your full use case with ever growing features?

green kestrel
#

you cant ever understand a changing feature set

quartz kindle
viscid gale
#

as in ever did inspect element

long marsh
#

Facts

green kestrel
#

this is what feature freezes are for

viscid gale
#

ad looked at an invis element

#

it says width and height but it just meshes with all kinds of things all over the place

#

at least in sites i've checked

drifting wedge
#

?

#

im confused

quartz kindle
#

@green kestrel did you ever work with node-addon-api? for using c++ in nodejs

long marsh
#

What was your preferred option Brian / Tim: leveraging a DaaS, hosting MySQL yourself, using a managed database service (such as AWS RDS for TraditionalSQL)?

#

Or maybe something else I'm not thinking of.

quartz kindle
#

what is your target scale?

long marsh
#

Ah, nice correction 😄

quartz kindle
#

xD

viscid gale
#

lol someone upvoted my stackoverflow question

#

was it one of u guys?

quartz kindle
#

wasnt me lmao

viscid gale
#

well that might remain unanswered for some weeks

#

or forever depending on if it's impossible

quartz kindle
#

all my stackoverflow questions never got answered

viscid gale
#

lol..

quartz kindle
#

wasnt a lot, only like 2 or 3, then i never asked in SO again

viscid gale
#

this will be my second question unanswered

lyric mountain
#

only question I ever made in stackoverflow got answered with another question

quartz kindle
#

lul

long marsh
#

Stack Exchange, when getting super specific, can yield 0 responses.

lyric mountain
#

mine was about normal map smoothing (interpolation between Z-level changes)

viscid gale
#

ite for history time im gonna go to my first question

green kestrel
#

@quartz kindle nope never touched node at all

viscid gale
#

ah yes putting cursor on input tab

quartz kindle
#

ah rip

long marsh
# quartz kindle what is your target scale?

I'm not really great at gauging memory usage. I just know that each user is going to have the basic economic attributes: coins, inventory, wallet, bank - and perhaps more informaiton: game wins, total profit from gambling, command usage, etc.

Assuming that I, optimistically have 10,000 - 100,000 users - what exactly would that entail?

quartz kindle
#

if done correctly, even sqlite can handle that

lyric mountain
#

that's very few data database-wise

viscid gale
#

the thing is that.. my question wasnt the duplicate

lyric mountain
#

most dbs will handle that as if it was nothing

viscid gale
#

i was such a noob i was wondering why i get undefined right after

livid lichen
#
  fs.readdir(`${cat}/`).forEach(file => {
    if (!file.endsWith(".js")){
      return;
    }

    let FileJs = require(`./commands/${cat}/${file}`);
    let commandname = file.split(".")[0];

    Bot.commands.set(commandname, FileJs);
    console.log(`✅Successfully loaded command: ${commandname}!`)
  });
 ``` `Uncaught Exception TypeError [ERR_INVALID_CALLBACK]: Callback must be a function. Received undefined`. Not sure what I did wrong here?
long marsh
#

I mean, I'm not looking at the scale of dank meme bot; however, it could certainly grow to that point. I just want to make sure I have the correct schema / database technology.

green kestrel
#

@long marsh since september, ive scaled from 2000 servers to 43000 servers

#

its ...interesting

livid lichen
long marsh
#

Wow, congratulations.

green kestrel
#

but C++ has made it easier to scale

long marsh
#

That's insane

green kestrel
#

so i can talk about what ive had to do for scalability if youre interested

lyric mountain
green kestrel
#

i use mysql

#

and ive split the bot clusters from the api backend/dashboard

long marsh
#

Do you host your own database?

green kestrel
#

api backend/dashboard run thru apache

#

yeah i do

long marsh
#

Ah, gotcha

sterile lantern
#

does sqlite/quickdb have a limit for data or smth

lyric mountain
#

not at all

quartz kindle
#

no

sterile lantern
#

oh perfect

green kestrel
#

so the frontend bot clusters are C++, and the backend api/dashboard is php, theres a mysql database that connects the lot

quartz kindle
#

im using sqlite at 6000 servers, no issues at all

long marsh
#

php 😢

green kestrel
#

the bot makes http rest api queries to its own api for most of the functionality

lyric mountain
#

sqlite is a singularity basically

green kestrel
#

sqlite is ok until you need to have multiple processes accessing the db concurrently, right?

#

accessing the sqlite db locks it

long marsh
#

I was going to leverage AWS's serverless suite for handling my API. AWS API Gateway + Lambda for handling api transctions. It communicates directly with DynamoDB.

quartz kindle
#

only if your app is write heavy

#

sqlite is fine with concurrent reads

#

only locks for writes

lyric mountain
#

^ this

quartz kindle
#

i can only say this about AWS: they suck

#

lmao

long marsh
#

I 100% whole heartedly disagree with that statement.

lyric mountain
#

even if it's write-heavy you can always create a second sqlite file xD

quartz kindle
#

xD

long marsh
#

Tim, why has your experience been poor with AWS? What happened?

#

Brain, I started API-first; however, to minimize complexity for now, I've just connected the bot directly with the database. That may backfire; however, for now, I'm in 4 servers 😄

quartz kindle
#

i've actually never used AWS, but i've been reading a lot of benchmarks and they are one of the worst performers in cost efficiency

earnest phoenix
#

Is there a reason why my css files are "mixing" in Reactjs

long marsh
#

Oh, I agree with that.

green kestrel
#

I convince sqlite users to move off onto full SQL stacks if they want to scale their bot

lyric mountain
earnest phoenix
#

im not

green kestrel
#

Just because I know it works

long marsh
#

SQLite doesn't seem that it was intended for production usage, unless I'm mistaken.

quartz kindle
#

i'll move to an sql server if i ever need to multi process

green kestrel
#

My bot is very read and write heavy and transaction heavy too

quartz kindle
#

sqlite is more than production ready

long marsh
#

Is that its intention, though?

green kestrel
#

It was designed to turn local storage data files into ones you can access via SQL commands

#

As a really advanced ini file basically

lyric mountain
#

sqlite is way too good for caching

long marsh
#

Why both?

#

Ah, cache

quartz kindle
#

sqlite is intended for an embedded database, inside a phone app, a car software, IoT, etc

long marsh
#

I prefer a key/value store for cache.

green kestrel
#

Nearly all android apps use sqlite for local storage don't they?

#

It's baked into the OS

quartz kindle
#

ye

long marsh
#

I use Redis, normally

#

For now, I'm just using in-memory 😄

green kestrel
#

As a cache?

quartz kindle
#

i ditched redis because my vps only has 1gb ram

green kestrel
#

I use redis only for PHP session cache

#

Instead of flat file

#

Flat file session storage can't scale horizontally

long marsh
#

I'm using KeyV, which allows me to switch over to a hosted option when I want too in the near future. (Memcache / redis)

green kestrel
#

Redis can

earnest phoenix
#

Does anyone else know why my css files are conflicting with each other? (Reactjs)

long marsh
#

So, Brain, at the ending of the day - you recommend leveraging some sort of production-grade SQL system? And, for my database size aforementioned above, that should be sufficient IF done correctly.

#

Brain, do you have any background as a software developer?

#

Tim, I also appreciate your insights as well 😄

green kestrel
#

I've designed my bot to scale out, basically I can run a shard cluster anywhere but to do that I'd need to move to a managed SQL cluster with transparent failover

#

My db isn't that big but it takes a battering

long marsh
#

I'm honestly scared of scaling.

#

It's a great problem to have, but, man, will it hurt you if your foundation is wrong.

quartz kindle
#

if you need write heavy and have the resources for it, go mysql or postgre
if you dont need it, go sqlite
if you need multi-machine go mysql or postgre in a dedicated vm over network

long marsh
#

Or a managed database service 😄

quartz kindle
#

if you have money for that and dont mind the extra latency, sure

long marsh
#

Such as AWS RDS; however, like you alluded to earlier Tim, it's expensive.

green kestrel
long marsh
#

This is awesome, thank you

quartz kindle
#

my total operating costs are $2.77/mo

long marsh
#

Maybe my worry isn't warranted.

#

What worries me about selecting MySQL, or any traditional SQL for that matter, is database schema development. I haven't completed an Entity Relationship diagram since college 😬

green kestrel
#

My operating costs are £70 a month but I use my server for far more than the bot, plus I'm only using 3gb of my 32gb ram, and 10% CPU on my bot atm

quartz kindle
#

the sqlite website claims that their own website runs on sqlite, and that it handles 500k page views per day, with some pages running several multiple-way join queries

green kestrel
#

I can scale up much more before I have to scale out

long marsh
#

Gotcha.

#

Brain, would you be willing to showcase your ERD (assuming you have one). That's a big ask, so no worries if not.

#

That's proprietary information 😬

opal plank
#

does anybody have a link for that meme in C# with the guy being fired and doing true = false and false = true?

long marsh
#

Essentially, you can do things like this:

Key = 608120740100964372
Sort Key = BEGINS_WITH('USER#')
( Pulls all information for user)

All the keys are incoherent because DynamoDB charges per kb returned. So, I shorten the field names so that it can stay below that threshold for as long as I can.

#

g1p = global index partition key
g1s = global index sort key

So, I can additionally query (as a global leaderboard):

Key = tw
Sort Key = > 0

What about server-specific leaderboards? Forget about it. And, that's what worries me. I may want to include that later on.
How many users leverage my bot? I have no clue. Can't query for it.

#

Sorry for the blow up, was just curious on what you guys thought of that 😬

slender wagon
#
const name = args.slice(0).join(" ")
TypeError: args.slice(...).join is not a function
#

any way i can fix this

lyric mountain
#

All the keys are incoherent because DynamoDB charges per kb returned
that's a dick move

opal plank
#

slice its not split

#

@slender wagon

slender wagon
#

oh

solemn leaf
#

@slender wagon I think it is args.split(0).join(' ')

#

nvm erwin beat me

opal plank
#

slice() removes the first bits

solemn leaf
#

erwin

slender wagon
#

oop my bad

opal plank
#

though you can use on string too, so theres that

solemn leaf
#

erwin

opal plank
opal plank
solemn leaf
#

give me a good theme song from any anime

#

or just any song

lyric mountain
#

args.slice(0).dice(' ')

#

xD

opal plank
#

Jujustu no kaisen

solemn leaf
#

args.slice(n).dice(' ')

opal plank
lyric mountain
solemn leaf
#

@opal plank Im looking for a osu map to level up more

livid lichen
#
    .map(cat => `**${cat[0].toUpperCase() + cat.slice(1)}** \n${Commands(cat)}`.join("\n"))
    .reduce((string, category) => string + "\n" + category); ````Unhandled rejection! TypeError: (cat[0].toUpperCase(...) + cat.slice(...))Commands(...).join is not a function`?
unborn cosmos
livid lichen
#

LOL

high berry
#

@livid lichen .join goes outside of .map

livid lichen
#

@high berry Yeah. I fixed that but the same error showed.

#

Unhandled rejection! TypeError: Bot.categories.map(...).join(...).reduce is not a function

high berry
#

are u sure Bot.categories is an array?

livid lichen
#

That's an array.

#

Right?

hollow hearth
#

O

#

Nie śpicie jeszcze?

high berry
#

honestly im not sure i dont know much about discord objects

hollow hearth
#

Bo ja tu po polsku pisze

hollow hearth
#

Sobie

#

Tak o

high berry
#

o

hollow hearth
#

I fron Poland

livid lichen
#

I am from USA

high berry
#

i didnt realize

livid lichen
#

?

high berry
#

.reduce only applies to arrays

livid lichen
hollow hearth
#

My English was not gud

livid lichen
#

English*

hollow hearth
#

?

#

Thanks

errant perch
#

how do i add a voice channel to a category without requiring admin permissions

livid lichen
#

@hollow hearth Co masz na myśli mówiąc „ja, tak o”?

hollow hearth
#

Where are you from? Everyone

livid lichen
#

I used Google Translate.

lyric mountain
errant perch
#

i tried that but it didnt work for some reason

#

i'll show code

lyric mountain
#

any error?

errant perch
#

missing permissions error

lyric mountain
#

which permission does it ask for?

main trench
#

hey does anyone know how to push an array into a database? (yes i know db.push im talking about how to set up an array for a db)

high berry
#

@livid lichen did u figure it out?

errant perch
#

it doesnt ask it just says missing permissiond

main trench
livid lichen
main trench
#

i just need to know how to set up an array

#

im making a blacklist command

errant perch
#
message.guild.channels.create((`${args[1].toUpperCase()}`), {type: 'category',}).then((cat) => {
message.guild.channels.create((`Price: ${resp.lp}`), {type: 'voice',}).then((vc) => {

  })
})```
lyric mountain
#

you're not even using cat variable

hollow hearth
#

A ja nie moge

errant perch
#

chill g

high berry
#

@livid lichen what exactly are u trying to do?

errant perch
#

tried to make it less complicated

#

i did use it

hollow hearth
#

Who play MC??

lyric mountain
#

we love complication

high berry
#

im a bit confused what ur trying to do with that map/array/string

lyric mountain
#

show us the complex code

errant perch
#

lol its not that complex it just strays from the point ok

hollow hearth
#

Who play Minecraft??

#

?

livid lichen
#

Roblox is better.

errant perch
#
message.guild.channels.create((`${args[1].toUpperCase()}`), {type: 'category',}).then((cat) => {
message.guild.channels.create((`Price: ${resp.lp}`), {type: 'voice',}).then((vc) => {
  vc.setParent(cat.id)
channels[message.guild.id] = {
  id: vc.id,
  catid: cat.id,
  stock: (args[1].toUpperCase())
};

fs.writeFile("./data/channels.json", JSON.stringify(channels, null, 2), (err) => {
    if (err) console.log(err)
    })
  })
})```
livid lichen
#

My opinion

errant perch
#

add a voice channel to a category without requiring admin permissions

#

i've tried manage channels permission

livid lichen
#

Last I checked vc.setParent(cat.id) didn't exist. I don't know tell me if I am wrong.

errant perch
#

it works with administrator privileges

livid lichen
#

What's the error?

boreal iron
#

cat.id doesn’t exist in this function (out of scope)

hollow sedge
main trench
#

hmm

past needle
hollow sedge
#

How?

main trench
#

if i push one word it works fine but as soon as i push another word it doesn't work

#

i just need to know how to seperate the words

boreal iron
#

Any db is able to store it as string alias JSON (data type)

past needle
#

using the push functions ?

hollow sedge
#

That is a terrible idea

#

@boreal iron

#

Please do not suggest that

#

They are not meant for that

boreal iron
#

Did I suggest it or just answer the question? Ask yourself.

hollow sedge
#

it will be more inefficient than using a proper DB

main trench
#

deep

hollow sedge
#

So you answered the question with something that you do not suggest?

#

makes sense

main trench
#

yep

past needle
#

,_, he's just saying a fact

#

don't act like that

#

@hollow sedge

hollow sedge
#

I realize that but if he says that to people, they might actually do it

past needle
#

:l

main trench
#

JSON would work if i had a automatic number of words though im trying to make it so the owner can set there own words to be blacklisted

hollow sedge
#

So maybe just add "but I do not suggest this"

boreal iron
#

If I would answer questions only if they make sense 75% of all the trash code snippets being posted here wouldn’t be answered

high berry
#

just use an array bruh

past needle
main trench
#

smh

#

when i push multiple words it fails

hollow sedge
#

is quick.db like redis?

#

If so that would make sense

past needle
#

<_<

#

idk

main trench
#

since you would need to say the words in the order they where pushed to work

past needle
#

i use quick.db alot

hollow sedge
#

If it is not just a key-value pair system why are you using ".blacklisted" to identify what it is

past needle
high berry
#

i mean

#

u could just do

past needle
#

also works

main trench
#

this pushes db.push(`bldb_${message.guild.id}`, word) and this fetches if ([words].some(b => message.content.toLowerCase().includes(b))) { message.delete() message.author.send(badlink1); } im thinking its an issue with how im fetching though

past needle
hollow sedge
#

Why is there a :

high berry
#

json

hollow sedge
#

oh...

#

confusing

#

Ig I would need to know more about how this db works to fully understand what you're doing

high berry
#

yeah

hollow sedge
#

But JSON in DBs is usually not a good idea

high berry
#

sheee

#

i only use json in mine

#

lmfaooo

past needle
#

like for example

#

having ee a bad word, i could say i saw a bee

main trench
high berry
#

u would need to set up a schema for the database

past needle
#

try ```js
if ([words].some(b => message.content.toLowerCase().split(' ').includes(b))) {

past needle
#

i changed it

#

a little bit

main trench
#

ah .split

past needle
#

yes

main trench
#

im still thinking itd an issue with how im fetching but ill try it

past needle
#

qvq

boreal iron
#

What are you going to do actually?
Scan each message for blacklist words?

main trench
#

yeah

#

but it fails if multiple words are pushed in the db

boreal iron
#

Multi server use or one guild only?

main trench
#

multiple

past needle
boreal iron
#

The database doesn’t support full tables?

main trench
#

not yet

high berry
#

if i were u id make a redis db and a seperate db

main trench
past needle
#

,_,

#

"ID" and "DATA" are automatic and we can't change that btw

boreal iron
#

I would actually use the guild id as primary key and add another column adding the words per guild separated by a whitespace

#

As string

high berry
#

^

#

thats what i was saying

boreal iron
#

Getting the string and split by whitespace to create an array and done

hollow sedge
#

Exactly

boreal iron
#

Then check if message includes your array

past needle
#

yesh

high berry
#

bro just get a free mongodb atlas cluster and install mongoose problem solved

main trench
#

main problem is im not too familier with making arrays

high berry
#

arrays are basic js

main trench
#

never fully learned basic js

#

still learning it now

boreal iron
#

split creates the array for you

past needle
#

yea you can find some mdn methods etc in the website

high berry
#

take a course or something

past needle
#

codacademy :o

#

best course ever ngl

high berry
#

sololearn is also good if u want more content than codacademy

boreal iron
#

Finding help here how to deal with the array is easier than the inefficient and complicated way you wanna pass

hollow sedge
#

codeacademy is pretty bad imo

high berry
#

yeah its too short

#

paywall for all the necessary things u need to learn

hollow sedge
#

Yeah

past needle
high berry
#

incase u need

main trench
#

yeah i see how to do it now but the problem of pushing custom words still exists

#

which is where im stuck now

high berry
#

i think u should change your method of blacklisting

main trench
#

yeah

high berry
#

and do something similar to what we said earlier

main trench
#

ill try to push the words in a proper array format and see if that works

past needle
#

i think you should change your bdd system :l

#

i mean it's my opinion

boreal iron
#

Custom words?

past needle
high berry
#

for simple data like this using a json schema is pretty good

main trench
boreal iron
#

You can push and slice and word to/from your array to expand or reduce the list and save it as string in the db again

high berry
#

and u can do that with any format db

#

^ what fake said

boreal iron
#

Yo create a command which adds the arugements to the database with the guild id

#

And another command which can show the current words in the database, and one to remove them

past needle
main trench
#

I know

high berry
#

when you query/fetch from your db, alter the array that contains the custom words however you want and then set the primary key (guild id) to the new array

main trench
#

I set it to admin

#

Hmm

green kestrel
#

Set it to honk

boreal iron
green kestrel
#

Oh wait wrong goose

high berry
#

yeah

main trench
high berry
#

but its the same concept whichever way u do it

main trench
#

*bl add, *bl clear, *bl list

boreal iron
#

Unfortunately I can’t write an example while driving okeh

green kestrel
main trench
#

*bl add works and it shows the words in the list but fetching the word to detect is the issue

boreal iron
#

Reading Brains and Time convo earlier he can

green kestrel
#

there are reasons why, I forget them

boreal iron
#

Yo that’s why I suggested it

#

Not only because the speed but yeah

#

nvm 👀

green kestrel
#

INSERT INTO table (pk, field1,field2) VALUES (1,2,3) ON DUPLICATE KEY UPDATE field1 = 2, field2 = 3

#

Like that

#

Make sure to use something big enough and NOT string for a guild id pk

#

BIGINT(20) UNSIGNED is about as correct as can be

boreal iron
#

BIG INT

#

Aye

green kestrel
#

Unsigned is important

#

Also if you're using js, js sucks and you must enable the "get bigints as strings" option on connect

#

In c++ no such issue

boreal iron
#

I see you know what you’re doing after following your convo with Tim

green kestrel
#

Also if you don't know what an SQL injection is, learn before writing any code

#

You'll be glad you did

midnight blaze
#

INSERT INTO table, what is so hard about that

boreal iron
#

Guessing the libs they use will suppress that anyways

green kestrel
#

@midnight blaze we are discussing the pros and cons of REPLACE INTO vs ON DUPLICATE KEY UPDATE, plus other stuff that beginners overlook at their peril

#

@boreal iron nope not if you're lazy or don't know about it

#

Brb switch to laptop so I can talk better

boreal iron
#

Unfortunately I will leave the highway in a few seconds

#

Guess we will continue this later

#

The next case somebody requires help won’t be far away pogey

high berry
#

sheesh even im learning new things here bro

#

i started learning js in june

green kestrel
#

ok so

#

in sql libs you usually have two ways to do a query

#

you can do it what looks like the simple, straightforward newbie friendly way (this is an example using a made up sql library):

#
dbquery("SELECT * FROM table WHERE col = '" + myval + "'");```
static trench
#

how do i allow people to edit and see my private repository?

green kestrel
#

and theres most likely a way called stored queries or similar, that looks like this:

#
dbquery("SELECT * FROM table WHERE col = ?", [ myval ]);```
#

difference is... the first one is a huge security vulnerability waiting to happen, the second one wont let someone hack your bot

#

because in the first, youre not escaping the value

#

which means that someone can just trick it into having a value like this in the var myval:
'; 1

boreal iron
#

Hmm we had a convo a few days ago just because somebody wondered why his string including special chars got escaped

green kestrel
#

if they do that, then every call to the query returns true, always, with the first row

boreal iron
#

That’s why I said most libs will probably do it

green kestrel
#

or they could do THIS in myval:
'; DROP TABLE table;

#

and then your table is gone, glhf

#

yeah libs will do it, if you know how to use the lib properly

#

if you dived in without knowing this, youd be tempted to do it the first way because the internet is full of bad tutorials that will tell you to do stuff like that

boreal iron
#

You’re trying to explain what SQL injection is to me or just generally talking about it?

green kestrel
#

generally talking about it for anyone that doesnt know

#

and why its important to know your libs

boreal iron
#

Alright

green kestrel
#

🙂

boreal iron
#

Aye

#

Agreed

#

Gonna leave you for a few minutes

green kestrel
#

how on earth are you typing on discord while driving on a highway

hollow sedge
#

Hm that's actually pretty interesting, thank you for that

boreal iron
#

lmao why not, not on the highway anymore

#

brb

green kestrel
hollow sedge
#

Lol

#

Please sanitize your inputs guys

sudden geyser
#

oh yes I do love naming my child huca'; DROP TABLE <...>;--

green kestrel
#

why not call your kid this:
``` rm -rf /

#

with the backticks

earnest phoenix
#

:(){ :|:& };:

green kestrel
#

haha

#

"yeah, thats his name, little bobby forkbomb"

earnest phoenix
#

what's the chance they would be running windows machines

green kestrel
#

forky mcforkbomb, aka ascii sadface

#

quite high tbh

young flame
#

uh so

midnight blaze
#

ups

#

xD

young flame
#
 let role = args[0]
 await message.channel.awaitMessages(m => (m.author.id === message.author.id) && (m.content === `${role}`), {
                    max: 1,
                    time: 20000,
                    errors: ["time"]
                }).catch((err) => {
                    return message.channel.send(new Discord.MessageEmbed()
                    .setColor('#ff3636')
                    .setDescription(`${no} | Setup has been canceled, didnt send a message in 20 seconds.`))
                });
                db.set(`muterole_${message.guild.id}`, role);
green kestrel
#

another one most people dont know about... anyone else here know about killer regexes?

young flame
#

how would you define role

midnight blaze
#

linux killer regexes?

young flame
#

because on setup it says there is no value to set

green kestrel
#

in general, you can use them in any platform supporting a regex

#

from C# to java to linux

main trench
#

@young flame message.mentions.roles.first()

sudden geyser
green kestrel
#

yeah, if youve properly sandboxed your code worst that can happen is it might eventually wipe the home dir

young flame
sudden geyser
#

create new thread where thread creates new thread of continued loop

main trench
young flame
#

okay brb

sudden geyser
#

I think it'd be cooler to rename every field in the database with "e" to show your dominance

#

much more fun than deleting everything

green kestrel
#

haha

#

e1,e2,e3,e4?

#

thats different to a production 'enterprise' database how?

young flame
#

i wanted it by id- because i dont think

empty badge
#

yo, im getting an error on my code: UnhandledPromiseRejectionWarning: Error [SHARDING_READY_DIED]: Shard 0's process exited before its Client became ready. can anyone help me figure this one out?

young flame
#

<@&ROLENAME>

#

would work

green kestrel
#

i work daily in my day job with real 'enterprise' production dbs, for expensive pieces of off the shelf software, where they have like 300 fields on the end of each column, 30 varchars, 30 ints, 30 bigints, 30 dates called like customvarchcar1, custombigint1, customdate1...

#

and they use these for "user extension"

#

its like major WTF moment

#

BRUH doesnt come close

static trench
#

how do i allow people to edit and see my private repository?

green kestrel
#

you have to add them to your team and give them read access

empty badge
#

anyone?

green kestrel
#

in github

static trench
#

ok?

#

how?

empty badge
#

bruh

static trench
#

im sorry mr genius. im kinda new to github

green kestrel
#

settings -> manage access

#

invite teams or people, big red button half way down the page

#

settings tab is the last one to the right of the tabs in your repository page

young flame
main trench
#

show me your code

green kestrel
#

then put the details of the person you want to add

static trench
young flame
# main trench show me your code
 let role = message.mentions.roles.first() 
 await message.channel.awaitMessages(m => (m.author.id === message.author.id) && (m.content === `${role}`), {
                    max: 1,
                    time: 20000,
                    errors: ["time"]
                }).catch((err) => {
                    return message.channel.send(new Discord.MessageEmbed()
                    .setColor('#ff3636')
                    .setDescription(`${no} | Setup has been canceled, didnt send a message in 20 seconds.`))
                });
                db.set(`muterole_${message.guild.id}`, role);
main trench
#

just define role as message.mentions.roles.first() set that in the db then fetch the role

green kestrel
#

when you put their name in @static trench set the access to 'read':

young flame
#

it cant fetch a role that isn't set.

young flame
#

and i dont think role is the issue

green kestrel
#

unless of course you want them to change the repo

#

ok good 🙂

main trench
#

are your args configured correctly?

green kestrel
#

yw

young flame
#

yes

#

args[0] gets a role by id

#

i want it so like

main trench
#

where are you fetching it?

young flame
#

it ask for the role id

#

and you type it

#

and it sets it

main trench
#

message.guild.roles.cache.get(args[0])

#

id say try this for role id

young flame
#
await message.channel.awaitMessages(m => (m.author.id === message.author.id) && (m.content === `${role}`)
#

that would work right?

#

so you just have to enter the role id

#

not ${role}

boreal iron
young flame
#

hi fake

boreal iron
#

Oh god

earnest phoenix
young flame
#

its not about developing

#

just saying hi

boreal iron
#

Puhh ... alright 😅

stark abyss
#

so when I do control+c and then node . in visual studio, it sometimes does thing multiple times, how can I prevent that?

#

there is no need for picture

#

I am sure I am not the only one who had this issue

pseudo wadi
#

Because the process didnt fully end yet

stark abyss
#

I see

#

so i rerun it too fast?

pseudo wadi
#

Yh

stark abyss
#

ok ty

pseudo wadi
#

Or if u do it after running nodemon it does the sane

obtuse knoll
#

Hey guys! I would like to add this feature to my bot, but i am not sure if it is possible.
In the on_guild_join() function. Is it possible to make it so that the bot creates an invite to the server? So that way, I can join the server myself?

#

I have notifications to a webhook whenever he joins a server, but i'd like an invite link too.

#

ah

#

do what i did

#

use discord webhooks

#

🙂

pseudo wadi
#

With the on guild create event

obtuse knoll
#

Who are you answering that too?

#

Me or TSM

#

Lol*

pseudo wadi
#

Tsm lol

#

Idk about creating an invite

#

Never tried it

obtuse knoll
#

there is a thing called ctx.channel.create_invite()

#

But that's with ctx

#

And my on_guild_join can only pass the guild parameter.

pseudo wadi
#

Im not good with python
Im mainly javascript

obtuse knoll
#

ah cool

slender thistle
#

why are you doing that Azure

pseudo wadi
#

Prob to join the servers of which the bot is in

drifting wedge
#

how would i show a div when you click on something?

quartz kindle
#

with js

earnest phoenix
#

^
onclick listener, apply display: initial styling

stark abyss
#
  client.channels.cache.get(<channel>).createInvite()
    .then(invite => console.log(`Created an invite: https://discord.gg/${invite.code}`))```
#

@pseudo wadi is this what you were looking for

pseudo wadi
#

Well not me

stark abyss
#

ah opps sorry wrong person

pseudo wadi
#

@obtuse knoll but in python

stark abyss
#

oh

pseudo wadi
#

What event triggers

#

When the bot joins a server

stark abyss
#

guildCreate I think

pseudo wadi
#

How do i get it to send a message to a random channel

earnest phoenix
#

Filter the guild's channel that allows the bot to send a message, get a random one then send

stark abyss
#
client.guilds.cache.get(<guild>).channels.cache.random().id```
#

i think

earnest phoenix
#
<Guild>.channels.cache.filter(c => c.type === "text" && ["VIEW_CHANNEL", "SEND_MESSAGE"].every(p => c.permissionsFor(<client>.user).has(p))).random().send(<content>)```
stark abyss
#

oh wow

#

that is like so mind blowing

pseudo wadi
#

Lol

drifting wedge
#

in js, how can i get the state of a checkbox and do something if the checkbox is checked and do another thing if it isnt

#

html//js

pseudo wadi
#

Website?

drifting wedge
#

yes

#

@pseudo wadi

pseudo wadi
#

Idk

bitter jungle
drifting wedge
#

how do i select which checkbox in specific?

bitter jungle
#

the result is an array, if there are none is null

drifting wedge
#

well i have many checkboxes

#

wait

#

can i toggle stuff?

#

instead?

boreal iron
#

I really suggest you to use jQuery instead of using raw JS

drifting wedge
#
    function showdivsb() {
   document.getElementById('sidebardrop').style.display = "block";
  }```
#

so if its shwoing

#

i want to not show

#

if it is, i want it to show

boreal iron
#

Don’t need a function, add an event listener and check the current state clicking on it

earnest phoenix
#

.display = <display> === "none" ? "block" : "none";

boreal iron
#

If hidden then show else hide

earnest phoenix
#

That's JS

drifting wedge
#
    function showdivsb() {
   document.getElementById('sidebardrop').style.display === "none" ? "block" : "none";
  }```?
#

this didnt work

earnest phoenix
#

Look at the edited one

drifting wedge
#

o ok

bitter jungle
#

you need to set the variable again

drifting wedge
#
   document.getElementById('sidebardrop').style.display = <display> === "none" ? "block" : "none";
  }``` still nothing...
pseudo wadi
#

Thxs voltrex btw for the help

drifting wedge
earnest phoenix
#
function showdivsb() {
let style = document.getElementById('sidebardrop').style;
return style.display = style.display === "none" ? "block" : "none";
}```
drifting wedge
#

thanks man

boreal iron
#

Don’t get me wrong but just to repeat:

I really suggest you to use jQuery instead of using raw JS

If you’re going to build in a lot more dynamic content or playing with elements and their conditions

earnest phoenix
#

Holy fuck, why did it take you so long to write that lmao

boreal iron
#

Huh nah bad connectivity

#

Driving in ... dunno where I am

#

Country side however

earnest phoenix
#

You're always driving

#

Seems legit

bitter jungle
#

Just to ask? Why?

style.display = style.display === "none"

xd

boreal iron
#

lmao looks like always if youre online

boreal iron
earnest phoenix
#

That's cursed, setting CSS properties to a boolean

boreal iron
#

Just without ()

#

Guess he thought you define it twice

#

You know like let var === lmao

haughty bough
#

Does anyone know how to get more details in simple-youtube-api searches? As the length of the video and number and views

earnest phoenix
#

<property> = <check if property is equal to none> ? <If none set to block> : <if block set to none>

drifting wedge
#

how many <inputs> can i have per thing?

#

mines bugging out when i have more than 1 html <input type="button" id="checkbox" onclick="showdivsb()">

#
<input type="checkbox" id="checkbox">```
boreal iron
#

As many as you want

drifting wedge
#

the 2nd one just doesnt work

earnest phoenix
#

That's not what we're really doing, that just checks if the property is equal to none @bitter jungle

drifting wedge
#

regardless

#

like the order doesnt matter

boreal iron
#

Or use selects and groups

earnest phoenix
#

So we're doing a conditional operator check on it

boreal iron
#

If the user should have a choice instead of being able to check all

obtuse knoll
#

👀

pale vessel
#

Omg it's another FakE!!!!

boreal iron
#

Wut

#

Where

earnest phoenix
#

There's 1 imposter among us

bitter jungle
#

There's 1 FakE among us

#

Really 2

boreal iron
#

Hey hey don’t abuse my name

#

Still got some bad evidence @earnest phoenix

earnest phoenix
#

I saw you vent

#

Guys vote him out

boreal iron
#

I swear I will use it and tell Tim about

#

finally I’m not driving anymore
Now waiting to solve your important issues Mr. Voltrex KEKW

drifting wedge
#

can i have 2 labels inside eachother?

earnest phoenix
atomic geode
#

hi can anyone help me out with fixing a error on my bot? -- if this aint against tos

boreal iron
#

Sure, you can nest 1000s inside each other but that might destroy your style (if set)

atomic geode
#
(node:8280) UnhandledPromiseRejectionWarning: ReferenceError: message is not defined
    at Client.client.on (C:\Users\user\Desktop\discordbot\index.js:84:5)
    at Client.emit (events.js:198:13)
    at MessageCreateHandler.handle (C:\Users\user\Desktop\discordbot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)    
    at WebSocketPacketManager.handle (C:\Users\user\Desktop\discordbot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:108:65)
    at WebSocketConnection.onPacket (C:\Users\user\Desktop\discordbot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:336:35)
    at WebSocketConnection.onMessage (C:\Users\user\Desktop\discordbot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:299:17)
    at WebSocket.onMessage (C:\Users\user\Desktop\discordbot\node_modules\ws\lib\event-target.js:120:16)
    at WebSocket.emit (events.js:198:13)
    at Receiver.receiverOnMessage (C:\Users\user\Desktop\discordbot\node_modules\ws\lib\websocket.js:789:20)
    at Receiver.emit (events.js:198:13)
(node:8280) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:8280) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
#

thats error code

boreal iron
#

Obviously your var message is not defined
But without the actual code we can’t help you solve this.
It’s like telling a car mechanic to repair your car but without touching it

hollow sedge
#

why do people post their entire error messages

#

ReferenceError: message is not defined it's pretty clear this is the error

atomic geode
#

the code

#

i didnt include the token and above

drifting wedge
#

hastebin it

atomic geode
#

k

haughty bough
#

Does anyone know how to get more details in simple-youtube-api searches? As the length of the video and number and views

atomic geode
boreal iron
#

Line 76 and below

atomic geode
#

start of the poll bot

boreal iron
#

You defined "msg" being your var name not "message"

opal plank
#

just wanted to share how amazing JS date manipulation is for those who want to get in that field

blissful coral
#

Any ideas?

opal plank
#

recommendation: roughly 6 Liters of Vodka or 3L of absinthe

blissful coral
#
<link rel="stylesheet" href="index.css">
hollow sedge
#

that's the entire line?

blissful coral
#

Ye

hollow sedge
#

are there any other link css lines?

blissful coral
#

no

hollow sedge
#

🤷

bitter jungle
#
<link type="text/css" rel="stylesheet" href="index.css">
atomic geode
#

shud i change the "message" to "msg" then @boreal iron

hollow sedge
#

you dont need type

earnest phoenix
#

you're serving your css file as a html file from your backend

opal plank
#

NEVER

#

AGAIN

blissful coral
#

Fixed

opal plank
#

@quartz kindle next time i need time manipulation im calling you

boreal iron
atomic geode
#

ok ty

blissful coral
#

Is there a way to get this error in console?

#

Going to display a message if someone pulls up the URL in a browser

opal plank
#

yes

boreal iron
#

Using rewrite rules for example to deny external access and forward back to your index

quartz kindle
opal plank
#

dynamic cron jobs

blissful coral
#

Express

#

@quartz kindle

quartz kindle
#

make a catch-all endpoint

atomic geode
#

sorry to bother u

boreal iron
#

Would get a longer conversation generally speaking about your code but at least you’re trying to start somewhere

boreal iron
atomic geode
#

uh

#
    if(msg.author.client || msg.channel.type === "dm") return;

    const msgArray = msg.content.split(' ');
    const cmd = msgArray[0];
    const args = msgArray.slice(1);

    if (cmd === '!poll'){
        let pollChannel = msg.mentions.channels.first();
        let pollDescription = args.slice(1).join('');

        let embedPoll = new Discord.MessageEmbed()
        .setTitle('New Poll!')
        .setDescription(pollDescription)
        .setColor('YELLOW')
        let msgEmbed = await pollchannel.send(embedPoll);
        await msgEmbed.react('👍')
        await msgEmbed.react('👎')
    }
    }
})```
#

thats all i changed if i post whole code will send as a txt document

bitter jungle
boreal iron
#

Which command did you try to call in Discord?

atomic geode
#

!poll #poll-channel this is test

hollow sedge
#

That will only get this @atomic geode

#

Because you are splitting args on spaces

blissful coral
#

@bitter jungle Is there a way to just check in <var>.get('/api/webhookendpoint', (req, res) => { if it is a JSON response or a user in a web browser?

atomic geode
#

i did !poll #poll-channel hi @hollow sedge as well and still no poll showed up

hollow sedge
#

No error?

boreal iron
#

msg.author.client ?

#

Don’t wanna check the dev docs

atomic geode
#

no error

tardy drift
#

hi

bitter jungle
boreal iron
#

Nah what is that check supposed to do?

hollow sedge
#

Yeah I think you mean msg.author == client

blissful coral
#

@bitter jungle yes

boreal iron
#

If true it will return

#

What’s inside the property author.client <— ?

quartz kindle
#

you can check for user agent or referrer for example

atomic geode
#

uhh

quartz kindle
#

browsers will set those headers, most direct post requests wont

atomic geode
#

nothing

boreal iron
#

Just remove this condition of your statement then

atomic geode
#
    if(msg.channel.type === "dm") return;

    const msgArray = msg.content.split(' ');
    const cmd = msgArray[0];
    const args = msgArray.slice(1);

    if (cmd === '!poll'){
        let pollChannel = msg.mentions.channels.first();
        let pollDescription = args.slice(1).join(' ');

        let embedPoll = new Discord.MessageEmbed()
        .setTitle('New Poll!')
        .setDescription(pollDescription)
        .setColor('YELLOW')
        let msgEmbed = await pollchannel.send(embedPoll);
        await msgEmbed.react('👍')
        await msgEmbed.react('👎')
    }
    }
})
#

so like this

boreal iron
#

Hmm

atomic geode
#
(node:6896) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'client' of undefined```
bitter jungle
#

If you wanna check whole requests:

<var>.use(express.json({
    verify : (req, res, obj, encoding) => {
      try {
        JSON.parse(obj);
      } catch(e) {
        //some catch stuff
      }
    }
  }));
blissful coral
#

I forgot that there was obj

bitter jungle
#

then only look for the req.originalUrl to check if it is the requested

blissful coral
#

big brain

boreal iron
#

Unable to spot the line which causes the rrror on mobile

#

Just tell me

atomic geode
#
if(msg.channel.type === "dm") return;``` that line
boreal iron
#

lmao can’t be that line causing this error

#

Just comment the line out

#

It’s not that line causing the error

atomic geode
boreal iron
#

It’s not inside what u posted a code

atomic geode
#
(node:2384) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'client' of undefined
    at new MessageEmbed (C:\Users\user\Desktop\discordbot\node_modules\discord.js\src\structures\MessageEmbed.js:13:60)
    at Client.client.on (C:\Users\user\Desktop\discordbot\index.js:94:25)
    at Client.emit (events.js:198:13)
    at MessageCreateHandler.handle (C:\Users\user\Desktop\discordbot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (C:\Users\user\Desktop\discordbot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:108:65)
    at WebSocketConnection.onPacket (C:\Users\user\Desktop\discordbot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:336:35)
    at WebSocketConnection.onMessage (C:\Users\user\Desktop\discordbot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:299:17)
    at WebSocket.onMessage (C:\Users\user\Desktop\discordbot\node_modules\ws\lib\event-target.js:120:16)
    at WebSocket.emit (events.js:198:13)
    at Receiver.receiverOnMessage (C:\Users\user\Desktop\discordbot\node_modules\ws\lib\websocket.js:789:20)
(node:2384) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, 
or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:2384) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
boreal iron
#

Sorry it’s impossible to see on mobile using pastebin

#

Looks like there’s a } too much

#

The error is a Djs related issue I’m not familiar with

#

Use hastebin to post your code with syntax highlighting

bitter jungle
pale vessel
#

that's too much

#

Just use if (!msg.guild) return; or the other one

boreal iron
#

It’s not that line

atomic geode
#

it aint that, the error msg still pops up

#

like @boreal iron said

boreal iron
#

Can’t open up the URL in Discord, it’s just awful

#

nvm I see you didn’t

sonic lodge
#

@atomic geode what version of d.js are you using

boreal iron
#

Makes my explanation obsolete

atomic geode
#

how do i check that

#

hmm

#

it shud be latest

sonic lodge
#

go to your package.json file and it's next to discord.js in the dependencies

atomic geode
#

"discord.js": "^11.6.4",

sonic lodge
#

ooh that's way outdated

atomic geode
#

rlly

#

how shud i update it

sonic lodge
#

latest version is 12.5.1

#

in terminal type npm i discord.js

atomic geode
#

huh i thought i just did that when i was downloading ytdl and stuff

#

alr lemme do

earnest phoenix
#
  throw err;
  ^

Error: Cannot find module 'C:\Users\parthiv\Desktop\WhisBot'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}``` um i've coded discord bots before and never got this. i installed discord.js too... how come it doesn't work?
#

btw nternal is actually internal

atomic geode
#
+ discord.js@11.6.4
updated 1 package and audited 201 packages in 18.539s
found 29 vulnerabilities (6 low, 10 moderate, 13 high)
  run `npm audit fix` to fix them, or `npm audit` for details```
pale vessel
#
+ discord.js@11.6.4```
sonic lodge
#

wot

atomic geode
#

ya

earnest phoenix
#

11.6.4 lol

#

the actual version is the V12

bitter jungle
#

"discord.js": "^12.5.1"

#

this is mine

earnest phoenix
#

V11 got's obsolete at some points

bitter jungle
#

latest version of npm?

atomic geode
#

redownloading vs rq

pale vessel
#

Why

mint charm
bitter jungle
#

change the package.json

{
  "dependencies": {
    "discord.js": "^12.5.1"
  }
}
pale vessel
#

I don't think that came from ytdl-core

earnest phoenix
#

they more than likely copypasted their package.json from an older project

#

the recommended version (not the actual) is npm@6.14.8

mint charm
#

i didn't do anything to my code since 4d ago and that happen when i update the ytdl-core

pale vessel
#

older project
doubt

earnest phoenix
#

just uninstall djs and reinstall it, it should grab v12

atomic geode
#

k

earnest phoenix
#

howcome i get this error?

#
  throw err;
  ^

Error: Cannot find module 'C:\Users\parthiv\Desktop\WhisBot'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}```
#

idk, how come you got that error?

pale vessel
#

idk, if you coded that then you probably would know what you did wrong

bitter jungle
#

put this in your dependencies:
"discord.js": "^12.5.1"
and then "npm install"

atomic geode
#

"discord.js": "^12.5.1"
npm install

#

got it

#

lemme refresh

#

"discord.js": "^12.5.1",

#

"discord-ytdl-core": "^5.0.0",
"discord.js": "^12.5.1",
"ffmpeg-binaries": "^4.0.0",
"index.js": "0.0.3",

#

either way still the same error message

atomic geode
mint charm
#

npm WARN deprecated har-validator@5.1.5: this library is no longer supported,
nvm

atomic geode
#

this for poll bot ;-;

#

ok finally updated the js

#

the new error code when i do command is (node:11572) UnhandledPromiseRejectionWarning: TypeError: fields.flat is not a function

#

even doe i dont have that word in my entire code

bitter jungle
#

true ;-;

#

i see

#

:p

atomic geode
#

:p

#

i feel like remaking a new poll bot script would be easier but idk other ways ;-;

solemn leaf
#

can I do this to make sure that the reacted role isnt a bot
const filter = (reaction, user) => [':heavy_check_mark:', ':heavy_multiplication_x:'].includes(reaction.emoji.name) && !message.bot;

pale vessel
#

!message.author.bot;

solemn leaf
#

thank

pale vessel
#

Message can't be a bot

#

It's a message

solemn leaf
#

but what if it wants to be

atomic geode
#
(node:11572) UnhandledPromiseRejectionWarning: TypeError: fields.flat is not a function
    at Function.normalizeFields (C:\Users\user\Desktop\discordbot\node_modules\discord.js\src\structures\MessageEmbed.js:450:8)
    at MessageEmbed.setup (C:\Users\user\Desktop\discordbot\node_modules\discord.js\src\structures\MessageEmbed.js:78:91)
    at new MessageEmbed (C:\Users\user\Desktop\discordbot\node_modules\discord.js\src\structures\MessageEmbed.js:18:10)
    at embedLikes.map.e (C:\Users\user\Desktop\discordbot\node_modules\discord.js\src\structures\APIMessage.js:166:40)
    at Array.map (<anonymous>)
    at APIMessage.resolveData (C:\Users\user\Desktop\discordbot\node_modules\discord.js\src\structures\APIMessage.js:166:31)
    at TextChannel.send (C:\Users\user\Desktop\discordbot\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:166:62)
    at Client.client.on (C:\Users\user\Desktop\discordbot\index.js:98:42)
    at Client.emit (events.js:198:13)
    at MessageCreateAction.handle (C:\Users\user\Desktop\discordbot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
(node:11572) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:11572) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
pale vessel
#

Update your node.js

atomic geode
#

i dont see that on dependencies

#

wait i forgot its a installed

#

do i just reinstall it or

bitter jungle
atomic geode
#

"discord.js": "^12.5.1"

opal plank
#

cool, now if you leak your IP people will get into your db thru the exposed port

stark abyss
opal plank
bitter jungle
stark abyss
atomic geode
opal plank
stark abyss
#

I am gonna try exporting

#

Yeah

#

But I am doing little tests

bitter jungle
#

you write in the terminal/command prompt
node --version

opal plank
#

4 days ago mmulu

stark abyss
#

so it's doesn't really matter

#

I learned how to create, and insert S3RaphiSmile

opal plank
#

now update, delete, drop cascade, functions, relation keys, restrictions and 2006 other things

stark abyss
#

oh the password wasn't -

opal plank
stark abyss
#

I am getting there

#

I don't need everything tho

opal plank
#

i just need to know if, arrays, objects in js

#

thats the same as what you're saying rn

stark abyss
bitter jungle
#

:p

stark abyss
#

Yes ASyes

bitter jungle
#

but no

opal plank
stark abyss
opal plank
#

Imagine learning 3 operations in pg and then ditching it

#

at that point why even use postgres

#

use SQL

stark abyss
#

I am not gonna ditch it, I am just not gonna learn everything at the moment

cunning roost
#

hello have some question, why this status offline ? thanks mod Server Status. thanks

vague imp
stark abyss
opal plank
#

its like using TS to write console.log()

stark abyss
#

big brain ASbigBrain

bitter jungle
atomic geode
#

ok i just downloaded the latest one@bitter jungle @pale vessel

stark abyss
#

I am also working on learning react native so my brain just tired 😔

opal plank
atomic geode
#

i have v15.3.0

pale vessel
#

nice

atomic geode
#

it worked

#

finally

#

ty

bitter jungle
atomic geode
#

ty everyone who helped me fix my bot!

bitter jungle
atomic geode
#

ty

bitter jungle
#

:p

atomic geode
#

welp

#

the poll worked

#

and the timer broke

#

lmao

#

error: Cannot access 'args' before initialization

bitter jungle
#

weird windows 2000 bsod sounds

atomic geode
#

thats the response when i do !settimer sreng 10s

#

was working before

#

one error after another

#
        if (command === "settimer") {
            try {
            sendmsg(`Timer: "${args[0]}" has been created for ${toTime(args[1]).humanize().toLowerCase()}.`);
            setTimeout(() => {
                sendmsg(`@everyone Timer: "${args[0]}" has finished after ${toTime(args[1]).humanize().toLowerCase()}.`);
            }, toTime(args[1]).ms());
            } catch(e) {
                return sendmsg(`error: ${e.message}`);
            }
        }// timer bot ends```
coarse topaz
#

Hey there, I have a problem with my code..
I'm using Discord.js / Node
This command should make the bot say how much people have this "Votes Role", however, it doesn't work, as it says that only one person has it when it's not true.
This error is happening since some weeks ago.. And from a day to other it started to happen even though I did never modify the bot's code!

This's how it looks like in the code:

  let votes_role = "717328453757829202";
  let votes_role_members = message.guild.roles.cache.get(votes_role).members;``` and ```  if (message.content === `${prefix}VotesRoleMembers`){
    message.channel.send(`The current amount of members with the **Votes Role** is: **${votes_role_members.size}**`)
  }```
bitter jungle
#

also have a 'g' at the end?

const args = msg.content.slice(prefix.length).trim().split(/ +/g);
bitter jungle
#

/ +/g

atomic geode
#

oh ya i have that

earnest phoenix
#

@coarse topaz enable server members intent

bitter jungle
atomic geode
#

oh so get rid of g

sonic lodge
#

that shouldn't matter

coarse topaz
atomic geode
#

ya it didnt change

#

the error is same

sonic lodge
#

you have a const args declaration twice

#

on ln 15 and 88

atomic geode
#

shud i change one

sonic lodge
#

you can't have more than one

stark abyss
#
    pool.query(`INSERT INTO afkTable(id, msg)values({message.author.id}, {afkMsg});`)

I am getting syntax error, how do you use the variables in this postgres insert

sonic lodge
#
pool.query(`INSERT INTO afkTable(id, msg)values(${message.author.id}, ${afkMsg});`)
                                                ^                     ^```
earnest phoenix
stark abyss
#

ah fuck I forgot kek too tried

#

omg i meant tired

sonic lodge
#

it's time to nap good sir

stark abyss
#

yeah i should sleep lmao

earnest phoenix
#

that query is sql injectable

stark abyss
#

what does that mean

earnest phoenix
#

google sql injection

stark abyss
#

ok

atomic geode
#

i changed the things and it works

#

its all good now from what i can see

#

ty for help

stark abyss
#

SQL injection is a code injection technique, used to attack data-driven applications, in which malicious SQL statements are inserted into an entry field for execution wtf kek

bitter jungle
#

ok

#

right

stark abyss
#

I mean I am still unsure what you mean @earnest phoenix

sonic lodge
#

imagine the afkMsg is 'a'); DROP TABLE afkTable -- or something

narrow marten
#

how do I change my bot's background in top.gg

sonic lodge
#

the query gets sent over as

INSERT INTO afkTable(id, msg)values('123123123', 'a'); DROP TABLE afkTable --);```
#

boom there goes your data

stark abyss
#
pool.query("INSERT INTO afkTable(id, msg)values(`${message.author.id}`, `${afkMsg}`);")
``` how about this
pale vessel
#

Use `

#

Not "

#

but that is NOT GOOD

#

Use prepared statements

#

You can get SQL injection from that

stark abyss
narrow marten
#

how do I change my bot's background in top.gg

pale vessel
stark abyss
#

Alright this is confusing I need docs

pale vessel
#

This is not good at all

earnest phoenix
#

see that

stark abyss
#

okay ty

pale vessel
#

If you used the same concept in your other code, consider changing it asap

stark abyss
#

no I am trying to learn psql

#

I have no db atm

narrow marten
#

how do I change my bot's background in top.gg

stark abyss
#

Okay I watched the video

coarse topaz
earnest phoenix
#

the snippet lite provided needs to go into client options

#

well, the snippet provided

#

is client options