#development

1 messages ยท Page 1328 of 1

earnest phoenix
#

the rest is usually useless

#

k

#
      throw err;
      ^

Error: Cannot find module 'C:\Users\Adwait Misra\Desktop\YesBot\index.js'. Please verify that 
the package.json has a valid "main" entry
    at tryPackage (internal/modules/cjs/loader.js:315:19)
    at Function.Module._findPath (internal/modules/cjs/loader.js:528:18)
    at resolveMainPath (internal/modules/run_main.js:12:25)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:54:24)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  path: 'C:\\Users\\Adwait Misra\\Desktop\\YesBot\\package.json',
  requestPath: 'C:\\Users\\Adwait Misra\\Desktop\\YesBot'
#

this is the error

#

@earnest phoenix

#

your package.json is setup wrongly

opal plank
#

aparently you didnt do npm init

earnest phoenix
#

in cmd

#

i did

#

try running npm init again

#

in cmd

#

or terminal

opal plank
#

wait

earnest phoenix
#

of vsc

#

you didn't specify the main file

opal plank
#

holdup

#

which command you run?

#

node .?

earnest phoenix
#

Of course

#

yes

opal plank
#

bad

earnest phoenix
#

node .

#

then

opal plank
#

do node index.js

earnest phoenix
#

k

#

b r u h

opal plank
#

asumming ur file is called index.js

earnest phoenix
#

try running npm init -y again
@earnest phoenix

#

k

#

that will set it up with default settings that can be changed anytime

#

(yes i forgot the -y flag)

#

yes it worked

#

thanks

opal plank
#

node index or init?

earnest phoenix
#

but whats the difference between node . and node main.js

#

node . could be used?

opal plank
#

node . needs a main file

earnest phoenix
#

k

opal plank
#

if you skipped all the init you likely wont have a main

#

iirc

#

i think what i said is completely wrong though, it sounds off

earnest phoenix
#

node . finds the main file from the package.json

opal plank
#

then i was right

earnest phoenix
#

if there is none it will throw an error

opal plank
#

running init -y skips it iirc

earnest phoenix
#

k

#

good

opal plank
#

SO CLOSE

#

NOOO

opal plank
#

goddammit

#

3 overflows

#

why is it so hard to fine tune that?

hasty mulch
#
[NODE-eu-127.0.0.1:2333] Invalid response received; this may indicate that Lavalink is not running, or is running on a port different to the one you passed to `add_node`.
opal plank
#

absolutely infuriating

#

because they are fired independently i dont think i can assure it wont overflow

gentle lynx
#

why is it not adding to x?

#

it logs test 8 times, x should be 8 right?

earnest phoenix
#

you know something is wrong when brave starts properly without crashing

#

๐Ÿ™‚

tame kestrel
#

@gentle lynx try console logging x and seeing if your scope is being messed up somewhere. Arrow functions should access global scope and javascript just doesn't usually play nice so honestly I can't tell you an answer off the top of my head.

gentle lynx
#

@tame kestrel in the loop right?

tame kestrel
#

Try right next to x += 1;

vale garden
#

hi

#
bot.on('message', function(message) {
  if (!message.content.startsWith(PREFIX) || message.author.bot) return;

  const args = message.content
    .slice(PREFIX.length)
    .trim()
    .split(/ +/g);

    const channel = message.channel.id;

    if (++counter === 2) {

    setInterval(() => {

      let pkmns = ["Caterpie", "Metapod", "Butterfree", "Weedle", "Kakuna", "Beedrill", "Pidgey", "Pidegotto", "Pidgeot", "Scyther", "Pinsir", "Rhyhorn", "Rhydon", "Shellder", "Cloyster", "Psyduck", "Golduck", "Zubat", "Golbat", "Horsea", "Seadra", "Paras", "Parasect"]

    let pkmn = Math.floor(Math.random() * pkmns.length)

      bot.channels.cache.get(channel).send(pkmns[pkmn]);
     
    }, 5000)
    }
#

so i have this thing

gentle lynx
#

ill log it before and after

vale garden
#

and it send this stuff after 2 commands

tame kestrel
#

change console.log(test) to like console.log(test, x) @gentle lynx

gentle lynx
#

ok

vale garden
#

how do i make it so that it sends the message after any 2 messags

#

not just 2 bot commands

gentle lynx
#

the loop happens after I log x

#

so thats why its not adding

#

its first logging x and tables.length

tame kestrel
#

I see, if you have tasks that take time, it may be best if you find ways to break up your code a bit and use promises

gentle lynx
#

mhm

tame kestrel
#

so like, things will wait for other steps to finish before moving on

gentle lynx
#

thats really good since i learned about promises yestrday

#

i get to use them more

tame kestrel
#

yes! They're really powerful if you get to use them where they work best

gentle lynx
#

yeah

#

so i should log the x in the .then right?

tame kestrel
#

sure, if you're feeling experimental and ready to learn, I recommend using async & await keywords as they help you make things more readable and manageable after awhile

gentle lynx
tame kestrel
#

If you aren't comfortable and want to make it work, maybe .then is good to learn the concept first

slender thistle
#

CaLALlBAcKC HeLlLL

tame kestrel
#

shrugs

gentle lynx
#

broo ๐Ÿ˜ญ

tame kestrel
#

callbacks actually helped me learn a lot LOL

slender thistle
gentle lynx
#

i always use callbacks

slender thistle
#

I don't even JS, count me out of this talk

tame kestrel
#

callbacks are important for some parts of javascript, like how you handle events and all that

#

but like, nesting .then blocks and catching errors, making changes wears down on you for awhile

slender thistle
#

D i v e r s i t y

tame kestrel
#

fireship on youtube has a great video explaining async await

slender thistle
#

If I were to use JS, I'd suggest mixing both depending on the case

tame kestrel
#

shrugs, after awhile you kinda stop using .then .catch

gentle lynx
opal plank
#

the problem with await is that it halts the whole code, with .then() it should run independently with a promise

tame kestrel
#

does it? I thought the whole point of await was to be non blocking

carmine summit
#

Can someone give scenarios on when message.content is null???

#

I have already accounted for Rich Presence and Images

opal plank
#

as you can see, the first promise doesnt wait its completion for the .then() which is 5 seconds

#

it runs it only when its comepleted

#

hence why 'await' returns first

#

await makes the last promise not run UNTIL its been finished

#

so for multi execution, running .then() is good if you dont want to halt the code from continuing

#

@tame kestrel

#

promises and async have their pro's and con's, its more about where you want/need to use them

tame kestrel
#

Interesting

sick fable
#

Lol I have a question but can I type these things same as it's written?

1โ€ข @client.event @client.command()

  1. async Def welcome(ctx): async def on_member_join(member)

Can I write these as written above or will I get an error?

slender thistle
#

Oh my God don't do that

#

DON'T NEST EVENTS PLEASE

sick fable
#

I am making The welcome command

opal plank
#

i nest events, wutchu gon' do punk?

sick fable
#

Lmaoooo

slender thistle
#

*unless you know what you're doing

opal plank
#

^^^^

slender thistle
#

in any case

#

How do you want your welcome command to work?

carmine summit
#

@opal plank Can you give a scenario where as message.content === ''

opal plank
#

embeds

carmine summit
#

on humans

earnest phoenix
#

yo

opal plank
#

system messages?

#

idk if they are considered content

#

probably attachments too

carmine summit
#

I think they are not deleteable

slender thistle
#

Images, rich embeds

earnest phoenix
#

after 7 crashes, a reddit post and one spam email to brendan eich Brave is finally NOT crashing every five seconds

carmine summit
#

richembeds and images i already accounted for

opal plank
gentle lynx
#

should i install the promise module

opal plank
#

there, a message without content

sick fable
#

I want it like if I type ,welcome enable it should create a new channel naming it like Welcome-leave and from that time, whosoever joins the guild or leaves it. It should only send these at that channel @slender thistle

slender thistle
#

alright

opal plank
#

apart from that, maybe stickers

carmine summit
sick fable
#

these = Welcome and leaving the server

slender thistle
#

Here's how it would go

opal plank
#

spotify links?

#

join spotify type of thing

#

idk if that goes under content

gentle lynx
#

stickers?

opal plank
#

yes

#

new thing

earnest phoenix
#

these = Welcome and leaving the server
@sick fable please stop being my algebra teacher and start using different symbols for comparing values

sick fable
#

@sick fable please stop being my algebra teacher and start using different symbols for comparing values
@earnest phoenix lmao. I just defined the word that was in my paragraph

carmine summit
#

so uh

earnest phoenix
#

๐Ÿ‘Œ

sick fable
opal plank
#

legit, if i were to school rn id be doing 2x^2 + 2x === 10 and trying to solve that

carmine summit
#

I already accounted rich embeds, and images. Not sure about system messages tho

sick fable
#

Holy, today's my school exams result

earnest phoenix
#

HTML only has multiple line comments angeryBOYE

carmine summit
#

Do system messages have message.content???

sick fable
#

Stop talking about HTML. I hate html

opal plank
#

<!--- ---> iirc or some shit like that

earnest phoenix
#
<!--
-->
#

Stop talking about HTML. I hate html
@sick fable stop using websites that use HTML instead of PHP

opal plank
#

eeew php

sick fable
#

@sick fable stop using websites that use HTML instead of PHP
@earnest phoenix angeryBOYE

opal plank
#

php is fun, its just.,....well.......php

earnest phoenix
#

I just destroyed my weird ballpit thingy
slapped da work in pogeyress label on it

gentle lynx
slender thistle
#
  • Create an on_member_join event OUTSIDE of the command;
  • Attach a member_logs property to your bot object. The property's value will be a dictionary, where the key is guild ID and value is channel ID;
  • In the command, create a channel (guild.create_text_channel returns the object of the created channel), assign its ID (value) to the guild's ID (key) in client.member_logs;
  • On member join/removes, use client.member_logs.get(member.guild.id). That can return None if there's no setting for the guild the member left. If it didn't return None, get a channel with the received ID (get_channel can return None too), and send a message to it.
opal plank
#

fuck you
a random quote
and 6 emotes.
are you going to keep on topic or just send random stuff? @earnest phoenix

slender thistle
#

@sick fable see my message above

sick fable
#

Thanks :)) @slender thistle

earnest phoenix
#

@slender thistle gib this guy a mute no ban

slender thistle
#

@earnest phoenix Cut it out with the random emotes and off-topic content or I'll mute you, thanks

opal plank
#

^^

sick fable
#

What should I type for the custom channel ID?!

opal plank
earnest phoenix
#

@earnest phoenix you're not being funny bitch

opal plank
#

some people....i swear...

slender thistle
#

Not putting up with this

earnest phoenix
#
var Engine = Matter.Engine,
    Render = Matter.Render,
    World = Matter.World,
    Bodies = Matter.Bodies;

why does matter.js' example show this why can't they just do:

var {Engine, Render, World, Bodies} = Matter;
opal plank
#

VAR

earnest phoenix
#

yeah

slender thistle
#

What should I type for the custom channel ID?!
@sick fable

channel = await ctx.guild.create_text_channel(name="name_of_the_channel")
client.member_logs[ctx.guild.id] = channel.id
opal plank
#

staph using var

earnest phoenix
#

their examples are cool but their code is weird

opal plank
#

it causes unintended behaviour

sick fable
#

@sick fable

channel = await ctx.guild.create_text_channel(name="name_of_the_channel")
client.member_logs[ctx.guild.id] = channel.id

@slender thistle thanks (:

tame kestrel
#

@tame kestrel sorry for ping, but should it be like this?
@gentle lynx try testing it :> Personally, I would have made the queries async and just waited for all of them

I'm about to go to bed, and my knowledge isn't that good to teach LOL, you can ask erwin maybe or something!

earnest phoenix
gentle lynx
#

aight ty

#

gn

opal plank
#

lemme show a good example of why NOT to use var in your code unless you it need accesible in other scopes

earnest phoenix
#

bro

#

it's their blasted examples

slender thistle
earnest phoenix
#

yes

slender thistle
opal plank
#

ik, just for people seeing this chat

earnest phoenix
#

F12

opal plank
#

to NOT use vars

#

var is initialized with hoisting

carmine summit
opal plank
#

this can cause some really nasty bugs

slender thistle
#

Nada, ain't seeing any text

#

only an empty canvas tag

earnest phoenix
#

on the top-center

opal plank
#

theres text though

earnest phoenix
#

lemme make it white

opal plank
#

just a 300iq choice of background color

slender thistle
#

work in pogeyress

patent geyser
#

omg

slender thistle
#

Jesus fucking Christ

patent geyser
#

after more then two months

#

my bot has been accepted

#

i am very happy

carmine summit
#

bruh

opal plank
#

@patent geyser gratz

patent geyser
#

thank you

carmine summit
#

black text font + black ackground

earnest phoenix
#

(people are gonna kill me for inline CSS and some other people are gonna kill me for giving an ID to a single tag and setting it's styling in the stylesheet so I left it as that terrible color with the terrible font and the terrible text size)

opal plank
#

VARS EVERYWHERE

#

AAAAH

earnest phoenix
#

reload

opal plank
#

same thing

earnest phoenix
#

smh

opal plank
#

oh, cached

earnest phoenix
#

i renamed the repl why is it still showing up in the old hosting URL

opal plank
#

nothing here

earnest phoenix
#

i don't even have arc on it why is it cached??

opal plank
#

dunno

earnest phoenix
#

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

restive furnace
#

why not use modern website fframework

#

like react

opal plank
#

cuz this

earnest phoenix
#

it's literally a pointless website I made because I'm bored

gentle lynx
#

is this a correct usage of promises?

earnest phoenix
#

ask shivacowo

gentle lynx
#

it's the same code i did before

#

x should be 8

opal plank
#

stop using vars for the love of god

earnest phoenix
#

o k

opal plank
#

not u code

#

@gentle lynx

gentle lynx
#

OK

opal plank
#

thats not even the only thing var causes

#

they have some weird scoping behaviour

gentle lynx
#

there

opal plank
#

lmao

#

as long as the point gets across, its fine

carmine summit
#

as long as it works as intended

#

its fine

gentle lynx
#

but how is it 0?

opal plank
#

not quite

gentle lynx
#

it should be 8

opal plank
#

you are resolving the promise on a string

carmine summit
#

even if ur code is super slow, its fine

opal plank
#

chain it directly onto the promise

carmine summit
#

even if your code doesnt give public errors, its fine

opal plank
#

new Promise().then() =>

#

the only real reason you'd be assigning a promise value to a variable would be with await

gentle lynx
opal plank
#

query() is also a promise

#

which you arent waiting

restive furnace
#

for gods sake, why no one uses that preinsert or what ever SELECT * FROM (?) WHERE id = (?)

umbral zephyr
#

@opal plank is active and helps a lot give the @earnest phoenixManager

gentle lynx
#

oh

carmine summit
#

have you ever heard of Beautify?

gentle lynx
#

no

restive furnace
#

have you ever heard of Beautify?
@carmine summit who needs it while you can format yourself wesmart

gentle lynx
#

so should i wait for the query too? or just change it to wait for the query

opal plank
#

just write like in jquery

#

no semicolons, no spaces

earnest phoenix
#

is it pointless to use a switch statement on a boolean that can only take two values?

opal plank
#

i'd say so, yeah

#

its either true or false

earnest phoenix
#

ok

opal plank
#

if() else

earnest phoenix
#

i love pointless stuff so time to use a switch statement on a boolean

opal plank
#

usually i prefer using switch when its more than 3

restive furnace
#

but please use prepared statements kthx

carmine summit
#

wait you can use else without colons?!?!

restive furnace
#

otherwise youre vulnerable

opal plank
#

who would win, one complicated database or one escaped boiye?

earnest phoenix
#

wait you can use else without colons?!?!
@carmine summit python or js?

carmine summit
#

if (false) else console.log(js)

opal plank
#

yeah

#

๐Ÿ‘€

#

you need a statement after it though

#

if (false) something; else somethingelse

carmine summit
#

sad

#

it would be much easier if

earnest phoenix
#

wait you can use else without colons?!?!

if (false) else console.log(js)
@carmine summit congrats, you've just merged braces and colons

restive furnace
#

false ? something : somethingelse is js' one-liner

earnest phoenix
#

^^^^

opal plank
#

conditional coalesence something

restive furnace
#

in py it's "yes" if false else "no"

opal plank
#

i forgot the term

#

no wtf am i on about

#

fuck i forgot the term for that

#

ternary!]

restive furnace
#

terminary operation or smth

opal plank
#

thats the term

restive furnace
#

yes

carmine summit
#

When you type in d in Chrome, but discord.js.org didn't pop up in the first line.

opal plank
#

why this happening

#

fuck, i need to handle ratelimit better

earnest phoenix
#

Ok

opal plank
#

almost sure 4 and 0 are ratelimited

#

wtf do i do though?

#

put websocket to sleep?

#

tryAfter?

gentle lynx
#

i think i hardcoded it

earnest phoenix
#

When you type in d in Chrome, but discord.js.org didn't pop up in the first line.
@carmine summit discord.com/channels/@me pops up for me

gentle lynx
#

and its still not fucking working

opal plank
#

lowkey i kinda wanna load discord.js on a browser

#

๐Ÿ‘€

#

just for the sake of it

#

make a bot in chrome

fluid basin
#

you could

opal plank
#

kinda wanna do it lmao

fluid basin
#

but new host has issues

#

apparently theres seems to be cors problem on discord.com

earnest phoenix
#

@opal plank I changed some stuff and now i am able to add things like randomly generating bodies and...just randomly generated bodies (which wasn't possible with the olden system)

opal plank
#

hmmm

#

do i debug this now or tomorrow?

#

lowkey its 5AM

earnest phoenix
#

tomorrow

opal plank
earnest phoenix
#

it's 1:30 PM for me

opal plank
#

the worst part is i have absolutely no clue how im going to re-route the traffic

#

cuz it may turn out really poorly

#

recommendations?

#

setTimeout() ?
websocket.sleep() ?
some other way ?

fluid basin
#

wot

#

you should try to follow ratelimits

opal plank
#

blame the lib not me

#

i complained to them

#

but they refused to fix it

restive furnace
#

why not make your own

opal plank
#

they were like we deal with ratelimiting internally, just make it join and the lib handles it,
but hey, it dont work well after 1000 channels

#

non-scalable lib

#

gotta love it

restive furnace
#

make ur own then

#

make scalable lib

earnest phoenix
#

array.map.random is a thing?

opal plank
#

the lib is quite huge to work from the ground up

#

it might be more worth spending time to see how they deal with it and try to patch it myself

delicate zephyr
#

they were like we deal with ratelimiting internally, just make it join and the lib handles it,
but hey, it dont work well after 1000 channels
@opal plank thats cause after like 1000 channels rate limits are.... fun mmulu

opal plank
#

though to be fair, i did a bit too many patches on their lib on my end already

#

well whats the point of having a lib that doesnt scale and gets unstable after 500 ish channels?

#

works for low end bots, yeah, but then you fucked

earnest phoenix
#
-> engine.world.bodies.map
<- ฦ’ map() { [native code] }
-> engine.world.bodies.map()
<- VM607:1 Uncaught TypeError: undefined is not a function
    at Array.map (<anonymous>)
    at <anonymous>:1:21

wat

fickle sapphire
#

Lol

delicate zephyr
#

i mean, realistically you shouldnt rely on a lib for stability large scale

#

bot bot devs develop their own lib large scale

opal plank
#

they are like: just cluster it. and here i am, clustering it, and the shitty lib still struggles

delicate zephyr
#

You probably have an intensive use case tho

opal plank
#

indeed, but the lib is suppose to handle that

#

"""""""suppose""""""""

delicate zephyr
#

Not really

#

Most discord libs cant handle large scale

#

cough discord.js

opal plank
#

im not at that scale to say tbh

delicate zephyr
#

even eris struggles after a while

opal plank
#

the problem is how LOW i need to go in order for it to maintain stability

delicate zephyr
#

the more intensive your use case the more stability you lose at lower end

opal plank
#

im playing with the threshold rn to see if it can support 1000 per shard

delicate zephyr
#

Yea

opal plank
#

but even that seems a bit overboard

delicate zephyr
#

most libs with built in sharding wont like >1000

opal plank
delicate zephyr
#

some dont even like >800

opal plank
#

this is the problem

#

100K

delicate zephyr
#

uh

opal plank
#

that be 200 shards

#

200 individual node processes relying on a single master

delicate zephyr
#

yea uh

opal plank
#

that seems a LOT more than it should

delicate zephyr
#

How many clusters

opal plank
#

just one, its all into a single master

delicate zephyr
#

Ok

#

how many shards

opal plank
#

the processes are spawned dynamically

delicate zephyr
#

yes

opal plank
#

rn? lemme check

delicate zephyr
#

how many shards

earnest phoenix
trim saddle
#

imagine spawning shards in 2020

opal plank
delicate zephyr
#

only 5 shards

#

what

opal plank
#

6, but yes

delicate zephyr
#

yea

#

but like

#

what lib are you using

opal plank
#

shard 0 and 4 struggling a lot cuz they were ratelimited

trim saddle
#

boooo 6 shards you stink

opal plank
#

no lib, thats my sharding

delicate zephyr
#

yikes

opal plank
#

wdym?

trim saddle
#

im just contradicting everything you say

delicate zephyr
#

Discord JS handles 1.2 million channels fine

opal plank
#

well, problem is that its Twitch

delicate zephyr
#

OH

#

YOURE BEING RATELIMITED BY TWITCH

opal plank
#

different API's and ways to handle websocket connections

delicate zephyr
#

HOLY SHIT

opal plank
delicate zephyr
#

BRUH

opal plank
#

you havent seen half of it

delicate zephyr
#

I used to dev a bot

#

that used twitch apis and shit

opal plank
#

THOUGH this is what bugs me

delicate zephyr
#

and I hated it

#

Twitch's api is so unfriendly to it's developers

opal plank
#

i managed to join 100k channels here in voice chat and maintain stability within 40 seconds

vale garden
#

hi

#

can someone help me

opal plank
#

it stabilized after that

#

but now when i cluster shit goes wry

#

it makes absolutely no sense

#

and when i do it on a single process it doesnt handle more than 2k

earnest phoenix
#

nobody:
erwin: hehe twitch get rekt

vale garden
#

dude erwin could you help me ou

#

t

delicate zephyr
#

It might be how ratelimits are being handled across sharding

vale garden
#

or code could you help me

#

anyone

#

lol

opal plank
#

thats the issue, they each are working individualy

earnest phoenix
#

@vale garden just send the question instead of waiting for someone to address you they're ready to help

vale garden
#

ok the

#

n

#

``js

#
bot.on('message', function(message) {
  if (!message.content.startsWith(PREFIX) || message.author.bot) return;

  const args = message.content
    .slice(PREFIX.length)
    .trim()
    .split(/ +/g);

    const channel = message.channel.id;

    if (++counter === 2) {

    setInterval(() => {

      let pkmns = ["Caterpie", "Metapod", "Butterfree", "Weedle", "Kakuna", "Beedrill", "Pidgey", "Pidegotto", "Pidgeot", "Scyther", "Pinsir", "Rhyhorn", "Rhydon", "Shellder", "Cloyster", "Psyduck", "Golduck", "Zubat", "Golbat", "Horsea", "Seadra", "Paras", "Parasect"]

    let pkmn = Math.floor(Math.random() * pkmns.length)

      bot.channels.cache.get(channel).send(pkmns[pkmn]);
     
    }, 5000)
    }
opal plank
#

they are all importing and constructing it individually, the master just spawns the process

vale garden
#

i have this in my bot

#

and

delicate zephyr
#

yea, I would recommend using redis or something to store the last request time and store a retry_in or process_in and start queuing requests

vale garden
#

it only sends the message after 2 commands

opal plank
#

i could store in the controller tbh

vale garden
#

can i make it so that it sends the message after 2 normal messages

delicate zephyr
#

Yea

#

so build a request queue

opal plank
#

i already have a controller mapped with all the spawned childs

delicate zephyr
#

Ah cool

#

that should help with stability and ratelimiting

vale garden
#

bruh help someone plz

delicate zephyr
#

and should also help you larger scale

opal plank
#

i COULD add a property in their objects for FAILS and then if after a threshHold, add a new key called RATELIMITED: true and possibly add a timeout function to remove that tag

#

that might be a decent approach now that i think about it

delicate zephyr
#

or just build a queue

opal plank
#

thats the thing

delicate zephyr
#

queing is the best way to ensure large scale request management

opal plank
#

i already have a queue

delicate zephyr
#

yes, what I mean is

#

a global queue that all the shards can see

opal plank
#

check ROUTE and JOINCHAT

#

it re-attempts to join the chat

#

and routes if the shard is already full

delicate zephyr
#

hmmm

vale garden
#

aaa

#

can you ppl help me now

opal plank
#

index => join this channel on this shard => handler , this shard already full, route somewhere else => other shard

#

it checks if all shards are full, if they are, it spawns a new one

delicate zephyr
#

you should add a timeout for the next request to try and join

#

rather than it being instant

opal plank
#

thats the thing that i was going on about

delicate zephyr
#

ah ok

#

then yea

#

build that mmulu

opal plank
#

i need a way to check if the shard is already de-limited

delicate zephyr
#

just build a lastRequest system on each shard, you dont need to do it the hard way with tags

opal plank
#

might add a property on its controller with RATELIMITED: true/false and call the function itself again on a timeout

delicate zephyr
#

and then just check the last request timing

opal plank
#

thats the issue though

#

the events are fired individually

#

i need a way to stop all the simultaneous connects

#

by adding the property on the controller, i can access the shard meta from other functions

delicate zephyr
#

example:

if(lastRequest > ratelimit && !ratelimitted) {
   // do shit
} else setTimeout(callback, (ratelimit - lastRequest)) ```
opal plank
#

if(this.ratelimit) => retryAfter(1000)

#

hmmm that actually might work

delicate zephyr
#

You get the gist there

opal plank
#

though i should likely get a math on that

#

setTimeout(selfFunction(), last.request + 10minutes - date.now())

#

so it fires again once timeout gets free

delicate zephyr
#

Not really, you just need to abide by api ratelimit retry_afters

opal plank
#

thats the thing

delicate zephyr
#

and just check there is time in between

opal plank
#

its the lib handling that

delicate zephyr
#

oh

opal plank
#

and its IRC

#

theres no info on it

delicate zephyr
#

Then rip that part of the lib out and build a better system

opal plank
#

you cant request IRC info about when to TRY_AFTER

delicate zephyr
opal plank
#

it simply errors or it doesnt

delicate zephyr
#

You seem like you're on the right track tho

opal plank
#

on first error i might add meta with lastRequest and block it from continuniung

#

since i got the retry, blocking them all might clog things up but it should flow slowly

#

20 requests = > on third, it gets ratelimited, now there at 17 requests in queue, once ratelimt expires, it'll just dump all 17 again on it which may lead to another timeout

#

though that would ensure that all channels are joined if there are timeout errors

#

or ratelimit

vale garden
#

hi

#

bruh can you people just tell me

#

if its possible

#

to send messages from the bot after a fixed amount of messages sent by users in a channel

opal plank
#

why you adding counter on an if statement

#

counter++
if(counter === 2) {stuffs}

#

also what the heck you doing with that?

vale garden
#

wdym

opal plank
#

of course it would only run after 2 messages

vale garden
#

ye but

opal plank
#

you set it to only run when the count is at 2

vale garden
#

see it runs after 2 commands

opal plank
#

well yeah

vale garden
#

ik but thats not the thing

#

ye so how do i

#

replace commands with messags

opal plank
vale garden
#

like is that even possible

#

oh

#

shit

#

lmao

opal plank
#

you are returning if its not prefixed lol

vale garden
#

kk i got it thx

opal plank
#

@delicate zephyr thanks for that chat luke, i might try that tomorrow

delicate zephyr
#

๐Ÿ‘Œ

#

Always good to have a chat

opal plank
#

agreed

gentle lynx
#

when I do this, I get an unhandled promise rejection, doesnt that mean my code has an error?/

#

not that i should make it into a promise

vale garden
#

hi

#

ok so

#
counter++

    if (counter === 2) {


      let pkmns = ["Caterpie", "Metapod", "Butterfree", "Weedle", "Kakuna", "Beedrill", "Pidgey", "Pidegotto", "Pidgeot", "Scyther", "Pinsir", "Rhyhorn", "Rhydon", "Shellder", "Cloyster", "Psyduck", "Golduck", "Zubat", "Golbat", "Horsea", "Seadra", "Paras", "Parasect"]

    let pkmn = Math.floor(Math.random() * pkmns.length)

      bot.channels.cache.get(channel).send(pkmns[pkmn]);

      const filter = m => m.author.id
      const collector = message.channel.createMessageCollector(filter, { time: 15000 , max: 1});

    collector.on('collect', m => {
     if (m.content == pkmns[pkmn] && m.author) {
     message.channel.send(`You caught a ${pkmns[pkmn]}`)
   }
   else {
     message.channel.send("That's the wrong pokemon")
   }
  });

collector.on('end', collected => {
    console.log(`Collected ${collected.size} items`);
});

      counter = 0;

    }
#

here after the .send(pkmns[pkmn])

#

if i type anything

#

it says you caught a pokemon

#

how do i fix this

#

cuz its only supposed to be when the m.content is pkmns[pkmn]

gentle lynx
#

why am i still getting an unhandled promise rejection error lol...

pure lion
#

Can you send the stack @gentle lynx

gentle lynx
#
    at RequestHandler.execute (C:\Users\RoG\Desktop\Almas\node_modules\discord.js\src\rest\RequestHandler.js:170:25)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:29432) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:29432) [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.
pure lion
#

Well it seems obvious

#

@vale garden you're gonna have to define a function to get pkmn when requested

gentle lynx
#

what do you meaan

pure lion
#

I believe if you define it like that it defines the let as that one number while the process is running

vale garden
#

wdym

pure lion
#

I'll send you a simple random int function

remote orbit
#

for server in self.bot.guilds: await ctx.author.send('-' + server.name)
any ideas how to put this in an embed

gentle lynx
#

@pure lion can you tell me the issue?

pure lion
#
function getRandomInt(array) {
  return Math.floor(Math.random() * array.length);
};
// ... 
let theMon = getRandomInt(pkmn);
#

@vale garden

#

@gentle lynx that's not where the error is coming from

#

Show me an instance of message.channel.send()

#

@vale garden idk if you saw my ping

gentle lynx
#

there is no message.channel.send() in the user.js file

pure lion
#

When does the error occur

gentle lynx
#

when i make an instance of "user", i put the message variable

vale garden
#

kk thx

pure lion
#

Okay, maybe it can't get the user

#

@vale garden let me know if it works

gentle lynx
#

it does

pure lion
#

does it console.log it?

gentle lynx
#

console log what

pure lion
#

Also does the .get need to be async?

#

console.log user

gentle lynx
#

no

earnest phoenix
#

Also does the .get need to be async?
@pure lion Collection.get is a sync function

#

it returns the object or null if it can't find it

pure lion
#

So it needs a .then to return the value?

earnest phoenix
#

no

gentle lynx
pure lion
#

Sexy

earnest phoenix
#

it's a sync function that blocks the rest of the code

#

i think

gentle lynx
#

his is the user

#

t

pure lion
#

console.log(user.get(stats, Coins));

#

Also that's a discord user object

gentle lynx
earnest phoenix
vale garden
#

btw

#

shouldnt it be

#

pkmns[getRandomInt]

#

?

pure lion
#

@earnest phoenix wait times are long rn, also check pins in #support for accurate wait times

vale garden
#

@pure lion

pure lion
#

@vale garden no, it should be pkmns[getRandomInt(pkmns)]

vale garden
#

wait ye sorry

earnest phoenix
#

on my said that we had to wait 8 weeks is it true? @pure lion

vale garden
#

i meant that

restive furnace
vale garden
#

hey

#

@pure lion

#

i realized why it was automatically sending the caught msg nw

#

its actually cuz its reading its own msg where it spawns the pokemon

#

how do i resolve that

#

actually nvm

#

lol

#

bruh this is weird af

pure lion
#

Codeing

#

โ„ข

vale garden
#

lol

#

alr so i have this now

#
counter++

    if (counter === 2) {


      let pkmns = ["Caterpie", "Metapod", "Butterfree", "Weedle", "Kakuna", "Beedrill", "Pidgey", "Pidegotto", "Pidgeot", "Scyther", "Pinsir", "Rhyhorn", "Rhydon", "Shellder", "Cloyster", "Psyduck", "Golduck", "Zubat", "Golbat", "Horsea", "Seadra", "Paras", "Parasect"]

    let pkmn = Math.floor(Math.random() * pkmns.length)

      bot.channels.cache.get(channel).send(`\`${pkmns[pkmn]}\``);

    /*  function getRandomInt(pkmns) {
   return Math.floor(Math.random() * pkmns.length);
   };
 
   let theMon = pkmns[getRandomInt(pkmns)];

   console.log(theMon)  */

      

      const filter = m => m.author.id !== '766906495244828693'
      const collector = message.channel.createMessageCollector(filter, { time: 15000 , max: 3});

    collector.on('collect', m => {
     if (m.content == pkmns[pkmn] && m.author.id !== '766906495244828693') {
     message.channel.send(`You caught a ${pkmns[pkmn]}`)
   }
   else {
     message.channel.send("That's the wrong pokemon")
   }
  });

collector.on('end', collected => { 
    console.log(`Collected ${collected.size} items`);
});

      counter = 0;

    }

#

and it works kinda fine

#

but now i need to know

#

how do i end the previous collector when the next one starts

#

aaa

earnest phoenix
#

@vale garden all i can say is that you're following a terrible way of programming

vale garden
#

why what

#

you cant leave me hanging there

#

tell me why tho

pale vessel
#

you can omit that

vale garden
#

not really

#

see

pale vessel
#

ok im done

vale garden
#

the thing is the bot starts taking in its own messags

#

dude

#

oh wait

earnest phoenix
#
let pkmn = Math.floor(Math.random() * pkmns.length);
function getRandomInt(pkmns) {...}
let theMon = pkmns[getRandomInt(pkmns)];

This will 50% not work and can literally be a single line

vale garden
#

nvm

#

forget what i said

#
let pkmn = Math.floor(Math.random() * pkmns.length);
function getRandomInt(pkmns) {...}
let theMon = pkmns[getRandomInt(pkmns)];

This will 50% not work and can literally be a single line
@earnest phoenix um

#

the last 2 lines are commented

earnest phoenix
#

smh

vale garden
#

and you cant blame me since i didnt write that code

#

but im not using it anyways

#

bruh

earnest phoenix
#

and you cant blame me since i didnt write that code
@vale garden so you copy pasted?

vale garden
#

no i took help from this server

#

scroll above

#

and youll see it

#

ok gtg bye

earnest phoenix
#

ok

#

soo uhhhh,
how to check if args[0] is a mention user?

#

Hi i need help

#
    message.channel.send("Hello!"())
  }
  if (message.content.toLowerCase().includes("Hello")){
    message.channel.send("Hello!"())
  }
#

i run it and it shows wrong?

#

why

#
if (message.content.toLowerCase().includes("Hi")){
    message.channel.send("Hello!")
  }
  if (message.content.toLowerCase().includes("Hello")){
    message.channel.send("Hello!")
  }```
#

invalid syntax i guess

#

k

#

me beginner

pure lion
#

if (args[0].startsWith("<@") && !args[0].startsWith("<@!") && !args[0].startsWith("<@&")) {
// Args0 is a mention
}

#

@earnest phoenix

earnest phoenix
#

ahh, i thought will be using discord.js internal function.

pure lion
#

and to get the mention from the message just do message.mentions.users.first()

#

You can do that^

#

But it doesn't care about args

earnest phoenix
#

yeah

#

thats why I ask check args if it user mention or not

pure lion
#

if (args[0].startsWith("<@") && !args[0].startsWith("<@!") && !args[0].startsWith("<@&")) {
let mention = msg.mentions.users.first()
}

#

Then mention will be the mention in args[0]

earnest phoenix
#

ahhh okay, thank you

pure lion
#

Np

sly marten
#

guys is there something wrong with this code or am i going insane

pure lion
#

Idk send it

sly marten
#
        case 'embed':
            const exampleEmbed = new Discord.MessageEmbed()
                .setColor('#0099ff')
                .setTitle('Some title')
                .setURL('https://discord.js.org/')
                .setAuthor('Some name', 'https://i.imgur.com/wSTFkRM.png', 'https://discord.js.org')
                .setDescription('Some description here')
                .setThumbnail('https://i.imgur.com/wSTFkRM.png')
                .addFields(
                    { name: 'Regular field title', value: 'Some value here' },
                    { name: '\u200B', value: '\u200B' },
                    { name: 'Inline field title', value: 'Some value here', inline: true },
                    { name: 'Inline field title', value: 'Some value here', inline: true },
                )
                .addField('Inline field title', 'Some value here', true)
                .setImage('https://i.imgur.com/wSTFkRM.png')
                .setTimestamp()
                .setFooter('Some footer text here', 'https://i.imgur.com/wSTFkRM.png');

            channel.send(exampleEmbed);
            break;
pure lion
#

What's not work

#

@sly marten have you defined channel as message.channel?

sly marten
#

omg it works now

#

fuck the djs guide

#

they hadnt even put message.channel and fuck me cus i didnt check the code

tired panther
#

need help with async interval

#

does not work

#

setInterval(async () => {

cinder patio
#

That looks fine

pure lion
#

@sly marten lmao

#

@tired panther send the full block

sly marten
#

i cant i had this problem like 4 days now ๐Ÿ˜‚

tired panther
#

its to big xD

cinder patio
#

How doesn't it work

tired panther
#
setInterval(async () => { await 
console.log("test
")}, 30000); ```
#

await is just vald in an async function

misty sigil
#

no

#

itโ€™s already a function

tired panther
#

await client.guilds.cache.get(gid).channels.cache.get(cid).send({
^^^^^

SyntaxError: await is only valid in async function

#

does not work

misty sigil
#

Donโ€™t need to await cache

tired panther
#

it is sending a message

#

so i have to await

#

it

misty sigil
#

donโ€™t need to await that either

tired panther
#

but the second message does not come xD

misty sigil
#

I wouldโ€™ve known there was a second one if you showed code

tired panther
#
 client.guilds.cache.get(gid).channels.cache.get(cid).send({
          embed: testr,
         })
         client.guilds.cache.get(gid).channels.cache.get(cid).send(`<@${test}>` );
#

that just execute the first ones

#

@misty sigil

vale garden
#

hi

#

does anyone know how you can end a collector if a new one starts

tired panther
#

any ideas?

gentle lynx
#

so the query function is a promise

#

how can i do then and catch with it?

opal plank
#

2 things

#

you misunderstood what we said about prepared statements

#

check mysql VALUES($)

#

also result may not always be there

#

undefined[colum] will likely not exist if your query doesnt retun results

gentle lynx
#

the function only works if there is a result, ive check for this in the message event

#

check mysql VALUES($)
@opal plank i dont understand

opal plank
#

google what i said

#

thats what a prepared statement is

#

also promises dont work like that

#

you need to await it

#

otherwise that return is scoped blocked

#

it'll return from the callback,not the getter

slender thistle
#

A little bit about the definition of polymorphism

opal plank
#

im THIS

#

THIS

#

far from attaching client onto process

#

like, this TINY ITSY far from doing that[

misty sigil
#

Why not

opal plank
#

ts will likely screech at me tbh

glossy quartz
#

im having some trouble trying to figure out why two of my commands arent working even though they worked previously. The bot doesnt respond to the commands and the console doesnt seem to even acknowledge the existence of the commands.

misty sigil
#

ignore ts

gentle lynx
#

return await result[0][column]

slender thistle
#

I have 2 classes that inherit one with a method Say. The method will output something like $"X said: {input}".

In those 2 classes (e.g. Y and Z), I want to override the method in both where $"Y said: {input}" and $"Z said: {input}" respectively.

Is that considered "polymorphism"?

gentle lynx
#

i added async

opal plank
#

the whole point of ts though

gentle lynx
slender thistle
#

im having some trouble trying to figure out why two of my commands arent working even though they worked previously. The bot doesnt respond to the commands and the console doesnt seem to even acknowledge the existence of the commands.
@glossy quartz code please?

opal plank
#

@slender thistle i have a rough idea of what polymorphism is, but i cant give a good answer on that with 100% sure

slender thistle
#

Time to bother Auger and cry KEKW

glossy quartz
vale garden
#

yo

#

now wtf is wrong here

earnest phoenix
vale garden
#
let pkmns = ["Caterpie", "Metapod", "Butterfree", "Weedle", "Kakuna", "Beedrill", "Pidgey", "Pidegotto", "Pidgeot", "Scyther", "Pinsir", "Rhyhorn", "Rhydon", "Shellder", "Cloyster", "Psyduck", "Golduck", "Zubat", "Golbat", "Horsea", "Seadra", "Paras", "Parasect"]

    let pkmn = Math.floor(Math.random() * pkmns.length)

      bot.channels.cache.get(channel).send(`\`${pkmns[pkmn]}\``);

      if (args[0] === "catch") {
        if (args[1] === pkmns[pkmn]) {
          message.channel.send(`You have caught a ${pkmns[pkmn]}`)
        }
        else {
          message.channel.send("That is the wrong pokemon")
        }
      }
glossy quartz
vale garden
#

dude @earnest phoenix

#

lol

slender thistle
#

@glossy quartz Is that in a cog that you load later?

opal plank
#

legends say if you say djs-light 3 times, Tim the Destroyer, is summoned onto this mortal realm to help you with questions @slender thistle

glossy quartz
#

@glossy quartz Is that in a cog that you load later?
@slender thistle yes

slender thistle
earnest phoenix
#

how do i fix my windows now

#

explorer.exe is gone

#

don't wanna restart windows

opal plank
#

kill the street pole transformer

misty sigil
#

djs-light

#

djs-light

#

djs-light

#

doesnโ€™t work

opal plank
slender thistle
#

TIIIIIMMMMMMMMM

opal plank
#

what have u done, fool!

earnest phoenix
#
Google Domains doesn't support the .GG ending

What is the freaking difference between domain endings?

opal plank
#

some are commonly used for scams

earnest phoenix
#

ok

opal plank
#

thats as far as i know

slender thistle
#

King, show how you load the cog

earnest phoenix
#

also is there a way I can run taskmgr.exe through a browser

#

file://path/to/System32?

opal plank
#

try shift + esc

misty sigil
#

use win + r

opal plank
#

or alt + f4

earnest phoenix
#

win + r not working

opal plank
#

task manager you can run with ctrl + shift+ esc

#

but BROWSER manager

earnest phoenix
#

are you sure

opal plank
#

i think its shift + esc

#

if you simply want to close the whole window, alt f4

earnest phoenix
#

shift + esc is the Chrome task manager i want the windows one

opal plank
#

ctrl shift esc

earnest phoenix
#

if you simply want to close the whole window, alt f4
@opal plank literally the only thing rendered on my computer is the browser

glossy quartz
#

the bot.botsettings stuff is just a thing that allows me to prevent it from loading certain cogs upon restart but i made sure it loads the required cog

opal plank
#

the day i get on py imma rename all that shit to be Js compliant just to be a dick

#

cogs? not on my watch, Functions/Commands/Execute

earnest phoenix
#

YES

#

FIXED

#

@opal plank can i hug you

opal plank
#

shure

boreal iron
#

lol

#

Iโ€™m here

earnest phoenix
#

koya hug @opal plank
bruh

glossy quartz
#

wait i think its working now

#

hold on

opal plank
gentle lynx
slender thistle
#

Fuck you Erwin

opal plank
#

better but still not prepared statement

slender thistle
opal plank
gentle lynx
#

uhhhhhhhhhhh

slender thistle
#

Fuck off with your camel case in Python

opal plank
#

imma wreck the whole thing

gentle lynx
#

i get an error btw

#

the promise is pending

opal plank
#

ctrl + click the query word and send screenshot

gentle lynx
opal plank
#

ctrl click

#

to follow type definiton

boreal iron
#

Stop harassing about pythons just because they have black dots on their skin, thatโ€™s snakeism!

opal plank
#

snake_case when?

earnest phoenix
#

I'm gonna try making a chain reaction in matter.js

opal plank
#

doesntmatter.js when?

gentle lynx
#

i dont get what u mean tbh

opal plank
#

i want to see what query returns

glossy quartz
#

ok, well it was working and now it isnt despite not changing the code at all

gentle lynx
#

any?

opal plank
#

its clearly a promise, but i need to see its return value

#

no, no any

#

it usually has a shape

#

its a promise, its returning something

earnest phoenix
#

can you add event listeners to Bodies in matter.js?
like:

engine.world.bodies[0].addEventListener("click",() => {

});
opal plank
#

if its void you'll likely need to promisify it

gentle lynx
#

doesnt it depend on what the datatype of thing im selecting is

earnest phoenix
#

you talking to me?

opal plank
#

no

#

also no

gentle lynx
#

it's not working

#

not showing anything

#

im doing what u said

opal plank
#

did you read what i said?

#

show me the type definition of the promise

gentle lynx
#

i was talking about ctrl + click

earnest phoenix
#
-> engine.world.bodies[0].addEventListener
<- undefined

F

gentle lynx
#

its not doing anything

opal plank
#

just go onto the library manually and search for query

#

actually

gentle lynx
#

ok

opal plank
#

its prob gonna take a while

#

link me the lib u using

#

@gentle lynx

earnest phoenix
#
engine.world.bodies.splice(o, 1);

will this remove both o and the second object after it cuz arrays are zero-indexed and there's a 1 here?

gentle lynx
#

sec

opal plank
#

is o an index?

gentle lynx
#

it's the normal mysql

#

u want the docs?

#

in npm ^

vale garden
#

hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii

earnest phoenix
#

is o an index?
@opal plank it's an object

#

oh wai

vale garden
#

i got ignored 4 times here today

opal plank
#

@earnest phoenix splice takes 2 indexes(numbers)

earnest phoenix
#

i got ignored 4 times here today
@vale garden it's not our job to help man

#

yeah

vale garden
#

bruh

#

you could

earnest phoenix
#

i forgot to put indexOf()

vale garden
#

atleast

#

not ignore

#

you know

#

lol

earnest phoenix
vale garden
#

well ye

#

wat

gentle lynx
opal plank
#

yeah i found it

#

you'll likely have to promisify it

#

since it needs a callback

#

there must be a different method tbh

gentle lynx
#

i think yestrday u sent a code with util

glossy quartz
#

eh i cant figure out whats wrong with the code, i'll just remove it entirely

opal plank
#

its all callback hell on this

#

yikes

#

i cannot believe mysql doesnt return the actual value

earnest phoenix
#

btw this was what i was trying to do
the interval sometimes deletes the ground so all bodies just fall out of the screen

setInterval(() => {
    let o = engine.world.bodies[Math.floor(Math.random() * engine.world.bodies.length)];
    if (o == ground) return;
    engine.world.bodies.splice(engine.world.bodies.indexOf(o), 1);
}, 500);

is it worth it?

split hazel
#

using libs that were made before promises is pain

opal plank
#

^^^^^^

gentle lynx
#

oh.

carmine summit
#
        message.channel.send(`Are you sure?`)
        let filter = m => m.author.id === message.author.id
        let collector = message.channel.createMessageCollector(filter, {
          max: 1,
          time: 10000,
          errors: ['time']
        })
        collector.on('collect', async message => {
          console.log(message)
          if (message.content.toUpperCase() == 'YES') {
            message.channel.send(`Deleted`)
          } else if (message.content.toUpperCase() == 'NO') {
            message.channel.send(`Terminated`)
          } else {
            message.channel.send(`Terminated: Invalid Response`)
          }
        })
```How can I put Timeout?
opal plank
#

gotta promisify the whole thing, its one hell of a bitch

split hazel
#

but js provides helpful methods to convert callbacks to promises

opal plank
#

yup

#

util.promisify()

gentle lynx
#

how do i use it?

#

sec

split hazel
#

there's also a lib that promisifies every method for you automatically

opal plank
#

lemme grab it rq

earnest phoenix
#

when somebody helps you with mysql they become your mysql friend my super qt-licious friend

opal plank
#

why people use mysql and not postgres?

split hazel
#

I love the name mysql

#

it's the best

earnest phoenix
#

banana is typing oh hi tim

opal plank
#

TIM APPEARED

#

๐Ÿ‘€

split hazel
#

tim come out from hiding

#

or no head pats

opal plank
#

@quartz kindle

#

it worked

#

delayed, but worked

split hazel
#

lmfao

earnest phoenix
#

lmafo laughing my ass fucking off

gentle lynx
opal plank
split hazel
#

your code is sql injection pie

quartz kindle
#

dafuq lmao

opal plank
#

told em' to use prepared statements

#

who would win?

  1. an encrypted, powerful database?
  2. one escaped boie with DROP ALL TABLES?
#

@split hazel

split hazel
#

3

slender thistle
#

NoSQL

split hazel
#

YesSQL

gentle lynx
#

well idk what a prepared statement is

split hazel
#

basically makes your database take all input as only data not queries

opal plank
#

basically you run into that sort of security problem with escaped characters, one big issue is that 300iq database like mysql only has admin user, so you likely have full access to drop all tables or delete the whole database. With shit like postgres, you only need to grant your bot access to delete/add/query rows, nothing scary like dropping the whole table. Thats another reason why i tell people to use postgres, its much more advanced and secure than mysql. either way, prepared statements is basically VALUES or $ like i told you

'QUERY VALUES($1,$2)' => now on this, i can insert strings from an array that'll match $1, $2, but they are done separatedly, so you dont run into the issue of escaped characters possibly causing harm on your database @gentle lynx

earnest phoenix
#
-> "e,e,e,e,,e,e,e,".replace(/,/g);
<- "eundefinedeundefinedeundefinedeundefinedundefinedeundefinedeundefinedeundefined"

lmao

opal plank
#

looks good lmao

#

not a bug, just a surprise feature

earnest phoenix
#

ye

#

like who needs second parameter anyways?

opal plank
#

yeah, it was meant to drop/cascade the whole table/database, it was an easter egg for the curious players 02dumb

#

imagine not having role management and permission assignment

#

actually

#

i think mysql has roles recently

gentle lynx
#

@opal plank i kind of get it ig, but how do I use it? just change sql to QUERY VALUES? also if u have a tutorial on it tell me the name or link me

carmine summit
#
let filter = m => m.author.id === message.author.id
message.channel.send(`Are you sure?`).then(() => {
  message.channel.awaitMessages(filter, {
      max: 1,
      time: 30000,
      errors: ['time']
    })
    .then(message => {
      console.log(message)
      if (message.content.toUpperCase() == 'YES') {
        message.channel.send(`Deleted`)
      } else if (message.content.toUpperCase() == 'NO') {
        message.channel.send(`Terminated`)
      } else {
        message.channel.send(`Terminated: Invalid Response`)
      }
    })
    .catch(e => message.channel.send(e.message));
})
```Cannot read property 'toUpperCase' of undefined
opal plank
#

thats precisely why i told you to search for it, the docs are quite hard to understand since they are a bit advanced

gentle lynx
#

ok ty

earnest phoenix
#
const Engine = Matter.Engine,
      Render = Matter.Render,
      World  = Matter.World ,
      Bodies = Matter.Bodies;

@opal plank happy about the spacing?

opal plank
#

what spacing?

carmine summit
#

ok bye

#

nvm

gentle lynx
#

also maybe a solution, what if I use a mysql package that uses promises? instead of mysql

carmine summit
#

i had to do message = message.first()

opal plank
#

good luck switching the whole code

carmine summit
#

idk why

gentle lynx
#

no only in the file

opal plank
#

why not just util it?

gentle lynx
#

me?

opal plank
#

yeah

carmine summit
#

me?

opal plank
foggy cove
#

anyone know how to use Ksoft's Lyrics API?

gentle lynx
#

i asked if i did this right

opal plank
gentle lynx
#

i mean

#

i cant do promise.then

#

shouldnt i do

#

promise('something here').then

opal plank
#

console.log(promise)