#development
1 messages ยท Page 1328 of 1
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
aparently you didnt do npm init
wait
bad
do node index.js
asumming ur file is called index.js
try running
npm init -yagain
@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
node index or init?
node . needs a main file
k
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
node . finds the main file from the package.json
then i was right
if there is none it will throw an error
running init -y skips it iirc
[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`.
absolutely infuriating
because they are fired independently i dont think i can assure it wont overflow

@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.
@tame kestrel in the loop right?
Try right next to x += 1;
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
ill log it before and after
and it send this stuff after 2 commands
change console.log(test) to like console.log(test, x) @gentle lynx
ok
how do i make it so that it sends the message after any 2 messags
not just 2 bot commands
the loop happens after I log x
so thats why its not adding
its first logging x and tables.length
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
mhm
so like, things will wait for other steps to finish before moving on
yes! They're really powerful if you get to use them where they work best
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

If you aren't comfortable and want to make it work, maybe .then is good to learn the concept first
CaLALlBAcKC HeLlLL
shrugs
broo ๐ญ
callbacks actually helped me learn a lot LOL

i always use callbacks
I don't even JS, count me out of this talk
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
D i v e r s i t y
fireship on youtube has a great video explaining async await
If I were to use JS, I'd suggest mixing both depending on the case
shrugs, after awhile you kinda stop using .then .catch
i cant make this into a normal, usual promise right?
the problem with await is that it halts the whole code, with .then() it should run independently with a promise
does it? I thought the whole point of await was to be non blocking
Can someone give scenarios on when message.content is null???
I have already accounted for Rich Presence and Images
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
Interesting
Lol I have a question but can I type these things same as it's written?
1โข @client.event @client.command()
async Def welcome(ctx): async def on_member_join(member)
Can I write these as written above or will I get an error?
I am making The welcome command
i nest events, wutchu gon' do punk?
Lmaoooo
*unless you know what you're doing
^^^^
@opal plank Can you give a scenario where as message.content === ''
embeds
on humans
yo
I think they are not deleteable
Images, rich embeds
after 7 crashes, a reddit post and one spam email to brendan eich Brave is finally NOT crashing every five seconds
richembeds and images i already accounted for
should i install the promise module
there, a message without content
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
alright
apart from that, maybe stickers
these = Welcome and leaving the server
Here's how it would go
stickers?
these = Welcome and leaving the server
@sick fable please stop being my algebra teacher and start using different symbols for comparing values
@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
so uh
๐

legit, if i were to school rn id be doing 2x^2 + 2x === 10 and trying to solve that
I already accounted rich embeds, and images. Not sure about system messages tho
HTML only has multiple line comments 
Do system messages have message.content???
Stop talking about HTML. I hate html
<!--- ---> iirc or some shit like that
<!--
-->
Stop talking about HTML. I hate html
@sick fable stop using websites that use HTML instead of PHP
@sick fable stop using websites that use HTML instead of PHP
@earnest phoenix
php is fun, its just.,....well.......php
I just destroyed my weird ballpit thingy
slapped da work in pogeyress label on it
@tame kestrel sorry for ping, but should it be like this?
- Create an on_member_join event OUTSIDE of the command;
- Attach a
member_logsproperty 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_channelreturns the object of the created channel), assign its ID (value) to the guild's ID (key) inclient.member_logs; - On member join/removes, use
client.member_logs.get(member.guild.id). That can returnNoneif there's no setting for the guild the member left. If it didn't returnNone, get a channel with the received ID (get_channelcan returnNonetoo), and send a message to it.
fuck you
a random quote
and 6 emotes.
are you going to keep on topic or just send random stuff? @earnest phoenix
@sick fable see my message above
Thanks :)) @slender thistle
@slender thistle gib this guy a mute no ban
@earnest phoenix Cut it out with the random emotes and off-topic content or I'll mute you, thanks
There's #general for chatting
^^
What should I type for the custom channel ID?!

@earnest phoenix you're not being funny bitch
some people....i swear...
Not putting up with this
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;
yeah
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
staph using var
their examples are cool but their code is weird
it causes unintended behaviour
@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 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!
is the text visible on the homepage of this: https://ballpit.code913.repl.co
lemme show a good example of why NOT to use var in your code unless you it need accesible in other scopes
is the text visible on the homepage of this: https://ballpit.code913.repl.co
@earnest phoenix there's text?
yes
ik, just for people seeing this chat
F12
Interesting.....
this can cause some really nasty bugs
on the top-center
theres text though
lemme make it white
work in pogeyress
omg
Jesus fucking Christ
bruh
thank you
(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)
reload
same thing
smh
oh, cached
i renamed the repl why is it still showing up in the old hosting URL
nothing here
i don't even have arc on it why is it cached??
ยฏ_(ใ)_/ยฏ
it's literally a pointless website I made because I'm bored
ask shivacowo
o k
OK
but how is it 0?
not quite
it should be 8
you are resolving the promise on a string
even if ur code is super slow, its fine
chain it directly onto the promise
even if your code doesnt give public errors, its fine
new Promise().then() =>
the only real reason you'd be assigning a promise value to a variable would be with await
if i put it here, its 0, if i put it outside the sql query its 8
for gods sake, why no one uses that preinsert or what ever SELECT * FROM (?) WHERE id = (?)
@opal plank is active and helps a lot give the @earnest phoenixManager
oh
have you ever heard of Beautify?
no
have you ever heard of Beautify?
@carmine summit who needs it while you can format yourself
so should i wait for the query too? or just change it to wait for the query
is it pointless to use a switch statement on a boolean that can only take two values?
ok
if() else
i love pointless stuff so time to use a switch statement on a boolean
usually i prefer using switch when its more than 3
but please use prepared statements kthx
wait you can use else without colons?!?!
otherwise youre vulnerable
who would win, one complicated database or one escaped boiye?
wait you can use
elsewithout colons?!?!
@carmine summit python or js?
if (false) else console.log(js)
yeah
๐
you need a statement after it though
if (false) something; else somethingelse
wait you can use
elsewithout colons?!?!
if (false) else console.log(js)
@carmine summit congrats, you've just merged braces and colons
false ? something : somethingelse is js' one-liner
^^^^
conditional coalesence something
in py it's "yes" if false else "no"
terminary operation or smth
thats the term
yes
When you type in d in Chrome, but discord.js.org didn't pop up in the first line.
Ok
almost sure 4 and 0 are ratelimited
wtf do i do though?
put websocket to sleep?
tryAfter?
i think i hardcoded it
When you type in
din Chrome, butdiscord.js.orgdidn't pop up in the first line.
@carmine summit discord.com/channels/@me pops up for me
lowkey i kinda wanna load discord.js on a browser
๐
just for the sake of it
make a bot in chrome
you could
kinda wanna do it lmao
but new host has issues
apparently theres seems to be cors problem on discord.com
but not discordapp.com
@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)
tomorrow

it's 1:30 PM for me
the worst part is i have absolutely no clue how im going to re-route the traffic
cuz it may turn out really poorly
even the RETRY is just looping, but it doesnt matter since they are Ratelimited
recommendations?
setTimeout() ?
websocket.sleep() ?
some other way ?
why not make your own
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
array.map.random is a thing?
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
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
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
-> 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
Lol
i mean, realistically you shouldnt rely on a lib for stability large scale
bot bot devs develop their own lib large scale
they are like: just cluster it. and here i am, clustering it, and the shitty lib still struggles

You probably have an intensive use case tho
im not at that scale to say tbh
even eris struggles after a while
the problem is how LOW i need to go in order for it to maintain stability
the more intensive your use case the more stability you lose at lower end
im playing with the threshold rn to see if it can support 1000 per shard
Yea
but even that seems a bit overboard
most libs with built in sharding wont like >1000
some dont even like >800
uh
yea uh
that seems a LOT more than it should
How many clusters
just one, its all into a single master
the processes are spawned dynamically
yes
rn? lemme check
how many shards
how does this look now
two setIntervals, one is adding a body every 0.5 seconds the other is removing a body every 0.5 seconds
imagine spawning shards in 2020
6, but yes
shard 0 and 4 struggling a lot cuz they were ratelimited
boooo 6 shards you stink
no lib, thats my sharding
im just contradicting everything you say
well, problem is that its Twitch
different API's and ways to handle websocket connections
HOLY SHIT

BRUH
you havent seen half of it
THOUGH this is what bugs me
i managed to join 100k channels here in voice chat and maintain stability within 40 seconds
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
nobody:
erwin: hehe twitch get rekt
It might be how ratelimits are being handled across sharding
thats the issue, they each are working individualy
@vale garden just send the question instead of waiting for someone to address you they're ready to help
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)
}
they are all importing and constructing it individually, the master just spawns the process
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
it only sends the message after 2 commands
i could store in the controller tbh
can i make it so that it sends the message after 2 normal messages
i already have a controller mapped with all the spawned childs
bruh help someone plz
and should also help you larger scale
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
or just build a queue
thats the thing
queing is the best way to ensure large scale request management
i already have a queue
check ROUTE and JOINCHAT
it re-attempts to join the chat
and routes if the shard is already full
hmmm
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
you should add a timeout for the next request to try and join
rather than it being instant
thats the thing that i was going on about
i need a way to check if the shard is already de-limited
just build a lastRequest system on each shard, you dont need to do it the hard way with tags
might add a property on its controller with RATELIMITED: true/false and call the function itself again on a timeout
and then just check the last request timing
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
example:
if(lastRequest > ratelimit && !ratelimitted) {
// do shit
} else setTimeout(callback, (ratelimit - lastRequest)) ```
You get the gist there
though i should likely get a math on that
setTimeout(selfFunction(), last.request + 10minutes - date.now())
so it fires again once timeout gets free
Not really, you just need to abide by api ratelimit retry_afters
thats the thing
and just check there is time in between
its the lib handling that
oh
Then rip that part of the lib out and build a better system
you cant request IRC info about when to TRY_AFTER

it simply errors or it doesnt
You seem like you're on the right track tho
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
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
why you adding counter on an if statement
counter++
if(counter === 2) {stuffs}
also what the heck you doing with that?
wdym
of course it would only run after 2 messages
ye but
you set it to only run when the count is at 2
see it runs after 2 commands
well yeah
kk i got it thx
agreed
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
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]
Can you send the stack @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.
Well it seems obvious
@vale garden you're gonna have to define a function to get pkmn when requested
what do you meaan
I believe if you define it like that it defines the let as that one number while the process is running
wdym
I'll send you a simple random int function
for server in self.bot.guilds: await ctx.author.send('-' + server.name)
any ideas how to put this in an embed
@pure lion can you tell me the issue?
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
there is no message.channel.send() in the user.js file
When does the error occur
kk thx
it does
does it console.log it?
console log what
no
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
So it needs a .then to return the value?
no
Sexy
@earnest phoenix wait times are long rn, also check pins in #support for accurate wait times
@pure lion
@vale garden no, it should be pkmns[getRandomInt(pkmns)]
wait ye sorry
on my said that we had to wait 8 weeks is it true? @pure lion
i meant that
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
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
@vale garden all i can say is that you're following a terrible way of programming
this will always be true, since you already included it in the filter
you can omit that
ok im done
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
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
smh
and you cant blame me since i didnt write that code
but im not using it anyways
bruh
and you cant blame me since i didnt write that code
@vale garden so you copy pasted?
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
if (args[0].startsWith("<@") && !args[0].startsWith("<@!") && !args[0].startsWith("<@&")) {
// Args0 is a mention
}
@earnest phoenix
ahh, i thought will be using discord.js internal function.
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
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]
ahhh okay, thank you
Np
guys is there something wrong with this code or am i going insane
Idk send it
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;
omg it works now
fuck the djs guide
they hadnt even put message.channel and fuck me cus i didnt check the code
That looks fine
i cant i had this problem like 4 days now ๐
its to big xD
How doesn't it work
setInterval(async () => { await
console.log("test
")}, 30000); ```
await is just vald in an async function
await client.guilds.cache.get(gid).channels.cache.get(cid).send({
^^^^^
SyntaxError: await is only valid in async function
does not work
Donโt need to await cache
donโt need to await that either
but the second message does not come xD
I wouldโve known there was a second one if you showed code
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
any ideas?
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
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
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
A little bit about the definition of polymorphism
im THIS
THIS
far from attaching client onto process
like, this TINY ITSY far from doing that[

Why not
ts will likely screech at me tbh
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.
ignore ts
return await result[0][column]
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"?
i added async
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?
@slender thistle i have a rough idea of what polymorphism is, but i cant give a good answer on that with 100% sure
Time to bother Auger and cry 
heres the code
Just a normal day using Brave browser
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")
}
}
its on discord.py rewrite
@glossy quartz Is that in a cog that you load later?
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 Is that in a cog that you load later?
@slender thistle yes


TIIIIIMMMMMMMMM
what have u done, fool!
Google Domains doesn't support the .GG ending
What is the freaking difference between domain endings?
ok
thats as far as i know
King, show how you load the cog
also is there a way I can run taskmgr.exe through a browser
file://path/to/System32?
try shift + esc
use win + r
win + r not working
are you sure
shift + esc is the Chrome task manager i want the windows one
ctrl shift esc
if you simply want to close the whole window, alt f4
@opal plank literally the only thing rendered on my computer is the browser
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
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
shure
koya hug @opal plank
bruh
Fuck you Erwin
better but still not prepared statement


uhhhhhhhhhhh
Fuck off with your camel case in Python
ctrl + click the query word and send screenshot
Stop harassing about pythons just because they have black dots on their skin, thatโs snakeism!
snake_case when?
I'm gonna try making a chain reaction in matter.js
doesntmatter.js when?
i want to see what query returns
ok, well it was working and now it isnt despite not changing the code at all
any?
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
can you add event listeners to Bodies in matter.js?
like:
engine.world.bodies[0].addEventListener("click",() => {
});
if its void you'll likely need to promisify it
doesnt it depend on what the datatype of thing im selecting is
you talking to me?
i was talking about ctrl + click
-> engine.world.bodies[0].addEventListener
<- undefined
F
its not doing anything
ok
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?
sec
is o an index?
hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
i got ignored 4 times here today
@earnest phoenix splice takes 2 indexes(numbers)
i forgot to put indexOf()
@vale garden discord.gg/plexidev they'll probably help
(at least i didn't ignore ya)
yeah i found it
you'll likely have to promisify it
since it needs a callback
there must be a different method tbh
i think yestrday u sent a code with util
eh i cant figure out whats wrong with the code, i'll just remove it entirely
its all callback hell on this
yikes
i cannot believe mysql doesnt return the actual value
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?
using libs that were made before promises is pain
^^^^^^
oh.
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?
gotta promisify the whole thing, its one hell of a bitch
but js provides helpful methods to convert callbacks to promises
there's also a lib that promisifies every method for you automatically
when somebody helps you with mysql they become your mysql friend my super qt-licious friend
banana is typing oh hi tim
lmfao
lmafo laughing my ass fucking off
is that a right start
look at all those successful things in my code
so proud of my perfect code
your code is sql injection pie
dafuq lmao
told em' to use prepared statements

who would win?
- an encrypted, powerful database?
- one escaped boie with DROP ALL TABLES?
@split hazel
3
NoSQL
YesSQL
well idk what a prepared statement is
basically makes your database take all input as only data not queries
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
-> "e,e,e,e,,e,e,e,".replace(/,/g);
<- "eundefinedeundefinedeundefinedeundefinedundefinedeundefinedeundefinedeundefined"
lmao
yeah, it was meant to drop/cascade the whole table/database, it was an easter egg for the curious players 
imagine not having role management and permission assignment
actually
i think mysql has roles recently
@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
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
thats precisely why i told you to search for it, the docs are quite hard to understand since they are a bit advanced
ok ty
const Engine = Matter.Engine,
Render = Matter.Render,
World = Matter.World ,
Bodies = Matter.Bodies;
@opal plank happy about the spacing?
also maybe a solution, what if I use a mysql package that uses promises? instead of mysql
i had to do message = message.first()
good luck switching the whole code
idk why
no only in the file
why not just util it?
me?
yeah
me?

anyone know how to use Ksoft's Lyrics API?
console.log(promise)
















