#development
1 messages Β· Page 1329 of 1
(message.content.toUpperCase() == 'NO' || message.content.toUpperCase() == 'N')
```how do i merge this?
huh?
["no", "n"].includes(message.content.toLowerCase())
you pass a function
not a string
that whole query() thing
promisification is just getting rid of callbacks and returning you the value
try it
doesnt work
promisification depends on some compatibility constraints. if your sql library is compatible, it will be something like this:
i only had to use promisification a couple times
promisification depends on some compatibility constraints. if your sql library is compatible, it will be something like this:
@quartz kindle and then someone else sent a screenshot which was completely unrelated to what Tim was saying
// right after you define client.con
client.con.promisifiedQuery = util.promisify(client.con.query);
// your code here
let result = await this.message.client.con.promisifiedQuery(sql)
you promisify the function itself at the beginning of the code, then use the new promisifed version everywhere
that'd be smarter
in this case they could just do without the query(sql) and use query instead though
hi
you shouldnt even be using libraries that use callbacks these days xD
why do people hate global.<name> so much its useful
namespace pollution
^^
oof
its fine to use globals in your own projects
tim what do you think of me possibly attaching the whole client object with hundreads of other shit in it onto process ?

but if you ever write a library on npm for example, and it uses globals, it can easily interfere with other libraries
@opal plank well why not xD

holy fuck tim
saw someone's code one time and it was filled with so many constants he didnt even use
im really tired of passing around client on every single function i do
if you pass any other djs object/class, you dont need to pass client
global.exit = function exit(exitcode){
Blah code
}
im not even gonna lie, i barely touch classes
even though i make a shit ton of interfaces and types
im not even gonna lie, i barely touch classes
@opal plank That's schoolism
i mean like, if you use (client,message) => {}
you might as well use message => {}
@earnest phoenix i only enjoy alcoholism, sorry
no need for client
@sharp thicket yes you can
nice
k
i alr use .run(bot , message, args) tho so no need for it
not every time
but then theres this on twitch
wait is that the actual code of discord.js @opal plank
no
ik but im too lazy to type message
thats my interface
lol
oh k
and me redeclaring the client class
ok that smart
whats client.rip lmao
or i use global in my message.js (comand handler) and define it
erm
idk
maybe kills client?
Is there a reason why JavaScript timeouts sometimes last for 1 minute+ when I wrote with as 5000 miliseconds?
whats client.rip lmao
@quartz kindle sleep mode?
lets just say that shouldnt be there
@earnest phoenix it may be ur code
its a simple RIP command
@earnest phoenix nope
ok
lmfao
xD
@earnest phoenix if ur host/pc/server is slow/bad the other code can make a delay
yeah
yesterday that sharding took out every braincell i had
my computer thinks it's 11 AM even though it's 4:36 PM
i tried breaking a world record for most clients in one code
cant be bothered by delay/slow pc if everything is chained
what
ik world record
this is the code and this.receiving only changes back to a true after a minute of being changed into false
@earnest phoenix what do you host on?
@earnest phoenix check if that code is not being executed multiple times, like by multiple people using the same command
yeah thats smart
so once it turns back to true, another command makes it false again
@earnest phoenix what do you host on?
@sharp thicket digitalocean $40 tier
d3.selectAll("button").transition()
.style("display","none");
how do i change the delay?
for each slave/shard i have, i put 40+ on the event listeners to be able to handle that retarded amount of channels i can join in one go
oh okay
Can i remove an event with eval?
so once it turns back to true, another command makes it false again
@quartz kindle its not a command, itβs a function that executes on an interval of 60 seconds
client.emit("message" //blah)
if you declared the listener on a variable, you can
I know that@sharp thicket
like
@earnest phoenix are sure its no being executed multiple times? like multiple intervals running
@earnest phoenix removeListener() is a thing, though your Listener needs to be on a variable, accessible in the eval
var event = bot.on("message" //blah)
a!eval event.delete()
var
a! is ma perfix
whats wrong with var?
._events is also a thing
lemme grab a picture
hmm?
whats wrong with var?
Tim are u here
@sharp thicket
nothing wrong with var, just others are usually better, depending on your use case
U know the answer prob
vars are declared globally when they are initiated
this can cause some REALLY annoying to catch bugs
ok use let
let/const > var
message.mentions.members returns an empty collection even tho i mention someone and the content states: !force @tulip ledge
var DOES have its uses though
vars are function scoped, const/let are block scoped, so they are stricter
though they are quite specific
@quartz kindle it logs the function being executed only once and "Time shall move again." only logged after like 1 minute when itβs supposed to be 5 seconds
let eventman = bot.on() blah
!eval eventman.delete()
vars can overwrite other vars with the same name, const/let cant
u can however do
let a = b
a = c
thats not the same
@earnest phoenix can you show the full interval?
no, but has the same function
your changing the value of a variable not the name
Tim do u know my issue? I've been struggling with it for like 3 days now
message.mentions.members returns an empty collection even tho i mention someone and the content states: !force @tulip ledge
message.members.mentions ??
@tulip ledge that happens if the member is not cached
in d3 how can i repeat the same thing on a transition multiple times in a single method
oh
because i need to do smth 9 times and i don't want to type the same thing 9 times
message.cache.mentions.members?
CommandExecute() {
if(a) {
var a = a + 1
}
if(b) {
var a = 2;
}
}
im fairly certain var would re-assign the value of a once it passes, even though they are in different scopes, this can be one pain and a half to debug, specially for people like me who use common variable names eveywhere, like a, _a, e, _e, x, _x and so on
what are you on about?
anti capppppppppppppppppppppppppppppppppppsssssssssssssssssss
ew my bot is not a roblox caffe worker
none of these work
message.mentions.members.cache.first()
message.mentions.cache.members.first()
message.cache.mentions.members.first()
@earnest phoenix so STAR FATINUM logs immediately, then Time shall move again logs after 1 minute?
who even plays that game
@tulip ledge all of those are wrong
^^^^^^^^^^
mmh
message.mentions.<members/users/channels>.first()
i think there are others as well
@earnest phoenix so STAR FATINUM logs immediately, then Time shall move again logs after 1 minute?
@quartz kindle yes
i just dont remember back of my head
const mentionedUser = message.mentions.users.first();
const mentionedMember = message.mentions.members.first();
const mentionedRole = message.mentions.roles.first();
const mentionedChannel = message.mentions.channels.first();```
@tulip ledge
are you using msg or message
theres no cache
message.mentions.members.first() is correct, but it only works if the member is not cached
it. doesnt. work.
if the member is not cached, you need to use the user
and fetch the member with the user
user doesn't work either
it does, you used cache in both of them
have you tried msg?
members.cache doesnt exist on mentions
@still merlin message and msg are the same thing
message.mentions.users.first() doesnt work?
const mentionedUser = message.mentions.users.first();
const mentionedMember = message.mentions.members.first();
const mentionedRole = message.mentions.roles.first();
const mentionedChannel = message.mentions.channels.first();```
i use this
message.mentions.users.first(); --> Undefined
message.mentions.members.first(); --> Undefined
try and log message.content
content: '!force @tulip ledge',
was there a MENTION in it?
Good copying
Lol
I know @opal plank, but he or she might be using msg π€·ββοΈ
@slender thistle choto matte, you doing C now?
C# gang

OOP assignment
c# sux
korabi sux ngl
lel
so you went to C# but wont come with us on the js/ts gang?
bulli

@earnest phoenix add another console.log after users.forEach, see how long it takes for the second log to appear


I have to use C# for my OOP assignments
what does message.members return?
Collection
undefined
Tim is it possible to use message.members[2] ?
should be yes
@earnest phoenix add another console.log after users.forEach, see how long it takes for the second log to appear
@quartz kindle immediately as well, my bot player had their HPs decreased instantly
eh c# isn't terrible
@sharp thicket there is no message.members
The only thing I did was new Message(this, JSON.parse(JSON.stringify(message)), message.channel); but it should be exactly the same as the normal message class I just did it so I could add some methods
better than server side Javascript π
im afraid of updating my libs simply for the sheer amount of patches i put on them, its one pain and a half to re-patch everything

brb
l0l
"discord.js": "^12.3.1",
run npm i --save just to be safe
@sharp thicket --save is deprecated
Wait what did I do wrong there then?
@tulip ledge console.log(JSON.stringify(message))
rip to all the people that do --save-dev when you can just do -D
see
well how would I fix it then?
@slender thistle come to Ts, we got intelisense, tooling and a bunch of h**kers

ditch the C gangs and join us the smol breins
I've got intillisense in C# tho
do they have a bunch of h**kers though?
thought so
come, you get donuts for the first week
@tulip ledge discord.js's Message class is designed to work on discord's message objects

throw err;
^
Error: Could not locate the bindings file. Tried:
β /home/runner/Thunder/node_modules/better-sqlite3/build/better_sqlite3.node
β /home/runner/Thunder/node_modules/better-sqlite3/build/Debug/better_sqlite3.node
β /home/runner/Thunder/node_modules/better-sqlite3/build/Release/better_sqlite3.node
β /home/runner/Thunder/node_modules/better-sqlite3/out/Debug/better_sqlite3.node
β /home/runner/Thunder/node_modules/better-sqlite3/Debug/better_sqlite3.node
β /home/runner/Thunder/node_modules/better-sqlite3/out/Release/better_sqlite3.node
β /home/runner/Thunder/node_modules/better-sqlite3/Release/better_sqlite3.node
β /home/runner/Thunder/node_modules/better-sqlite3/build/default/better_sqlite3.node
β /home/runner/Thunder/node_modules/better-sqlite3/compiled/12.18.3/linux/x64/better_sqlite3.node
β /home/runner/Thunder/node_modules/better-sqlite3/addon-build/release/install-root/better_sqlite3.node```
stringifying a message instance does not produce a discord message object
oh
it produces a discord.js-specific version of a message
so do I not stringify it?
nope
whats this
what are you trying to do in the first place?
just message = new Message(this, message, message.channel);?
It's to make custom methods
u can just extend class thgouh
like message.mymethod()?
thouhg*
yes
you use class extensions for that
^^
oh ok
so I just ditch the message class then?
You could extend the classes or do something like
Message.prototype.myMethod = /* function body */```
Discord.Structures.extend("Message", OldMessage => class Message extends OldMessage {
mymethod() {
console.log(this.content)
}
})
at the top of your main file, before you create your client
ok ty
alr ty
?
omg
I still don't understand what prototype pollution means, about adding methods to the existing classes
@next flax where is your bot hosted?
Oh no, an error raised from quick.db installation again
@quartz kindle i m using
Try reinstalling it
k
no
Would a .sqlite file even work?
i used terminal for that
Then use repl's package manager to install it

try installing it from the package manager
k

No.
Yes
what is quick db sir
No
lol...
@strong tundra a database
is it fast data base
lol
what is quick db sir
@strong tundra It's meaning is simply "urmom"
It uses better-sqlite3
is it faster than rocksdb
no
@strong tundra use mongo
ew no
Everything is faster than quick.db 
is mongo db easy to use
Everything is faster than quick.db :LULW:
Json
mongodb is pretty fine
Mongo is hell to use, but best database for a bot
I can't even connect to it porperly
i just kinda like sql so
.txt database
lemme pull up some code
JSON database
I can't even connect to it porperly
@carmine summit Learn to read documents i guess
There is nothing wrong with SQL/nosql they each have their own good boyes
I like nosql more because nyoom
i use quick.db because
I cba to write proper SQL statements
i feel it easy
MongoDB atlas === Best database for a discord bot
Also voltrex idk what you mean, mongodb is easy to work with
Mongoose is sex
@slender thistle SELECT/UPDATE/INSERT only sql statements' gang
Yeah its better to use quick db
No stop
lol...
No stop
@pure lion sure just help me connect to my db
sqlx is niiiiice
Tim, those dots are telling me you are disappointed to a very high extent
I woyld like to use mongoose
lmfao
mongoose.connect("mongodb+srv:// thingy here")
amazing compile type checked sql
I know, i meant like it's functions, in quick.db you can insert anything to the database but in mongodb you have to check if it exists, if not insert one, if so, update the doc @pure lion
I am disappointed too
I meant that
i wish js had something like it
Then how do you define db??
Oh dear

im amused by db wars

This channel makes me go boomboom in headhead
bro just look up discord bot database mongodb youtube
Tim is probably cringing at this chat rn
I am too
fum
i just use sqlite :^)
yeah, its all futile. We all know postgreSQL is and will always be the superior DB, regardless of what the plebs say
sqlite is interesting

i just use sqlite :^)
@quartz kindle Falls off chair
I prefer !sql
Erwin banned for wrong opinion 

what is a SQL data base 
Quick.db is the best 
i do prefer postgres personally
SQL = Structured Query Language
or postgres-compatible
Quick.db is the best
@carmine summit
Hell, I had to do quite a clusterfuck of SQL in Delphi yesterday
nosql = not structured query language but somehow fast jajaajjajaj
Quick.db, the worst database in the west
Tim, you familiar with Delphi?
CQL is the best, Cassandra Query Language
quick.db is not even a database in itself, its a library that uses a database behind the scenes and creates an interface for it
quick.db's actual database is SQlite
the best part of this Database wars is that 99% of the people commenting havent tried any other database apart from the one they call best
yugabyte supports ysql as well
quick.db is not even a database in itself, its a library that uses a database behind the scenes and creates an interface for it
quick.db's actual database is SQlite
@quartz kindle i think then its a db wrapper
and redis for some reason
@slender thistle i tried to reverse enginner a delphi program and failed miserably, thats about it
The only databases I tried are SQLite and MongoDB 
.sqlite files are barely for database usages anyway, it should just be an alt to json that can be written to
postgres, redis, cassandra, in that order
Without corruption
Tim failing at something? That's something rare to encounter
Uh
sqlite is better than most people think
Like why would you write to a file on your machine when a dedicated server can handle it 
hi
begin
s := '';
op := ' ';
If CheckBox1.Checked then
begin
s := s + ' fio like ''' + Edit1.Text + '%''';
op := ' AND ';
end;
If (CheckBox2.Checked) and (Edit21.Text <> '') and (Edit22.Text <> '') then s := s + op + 'aip >= ' + Edit21.Text + ' and aip <= ' + Edit22.Text;
If (CheckBox3.Checked) and (Edit31.Text <> '') and (Edit32.Text <> '') then s := s + op + 'history >= ' + Edit31.Text + ' and history <= ' + Edit32.Text;
If (CheckBox4.Checked) and (Edit41.Text <> '') and (Edit42.Text <> '') then s := s + op + 'evm >= ' + Edit41.Text + ' and evm <= ' + Edit42.Text;
If (CheckBox5.Checked) and (Edit51.Text <> '') and (Edit52.Text <> '') then s := s + op + '((aip + history + evm) / 3) >= ' + Edit51.Text + ' and ((aip + history + evm) / 3) <= ' + Edit52.Text;
if s <> '' then
begin
Form1.ADOQuery1.SQL.Clear;
Form1.ADOQuery1.SQL.Add('SELECT * FROM ocenki WHERE' + s);
Form1.ADOQuery1.Open;
end;
end;
``` @quartz kindle
lmao
@carmine summit it's simpler than that
My eyes just died
This is a working clusterfuck I had to help my classmate with
Rip
@slender thistle shivaco, you are being promoted to outside of the door, shoo
I'm gonna go and isbfisbr9srhwihs
It was EVEN worse the way it was handed to me
RTNETLINK answers: Operation not permitted
RTNETLINK answers: Operation not permitted
We have an error talking to the kernel
RTNETLINK answers: Operation not permitted
v14.11.0
:/home/container$ node index.js
Thanks for using Factful.js
/entrypoint.sh: line 32: 18 Bus error (core dumped) node index.js``` whats this?
imo sqlite is pretty much the best option for small things, and by small things i mean less than 1000 operations per second
i do know winget uses sqlite
No
WDYM no
connect returns a promise
RTNETLINK answers: Operation not permitted
RTNETLINK answers: Operation not permitted
We have an error talking to the kernel
RTNETLINK answers: Operation not permitted
v14.11.0
:/home/container$ node index.js
Thanks for using Factful.js
/entrypoint.sh: line 32: 18 Bus error (core dumped) node index.js``` whats this?
@sharp thicket sotp
yeah.... totally under 100 π
sotp?
Factful.js

node-return-object-of-numbers-one-to-nine
its a good api
2020, the year where everyone uses APIs instead of coding it themselves
There is no const db
make your own api
THEN HOW DO YOU INTERACT WITH THE DATABASEE
@earnest phoenix here we have the https://github.com/abh80/ws-bot sitting in the wild
@pure lion That's boeing's repository, i was supposed to contribute to it but didn't have time
@carmine summit after you create the connection you can look at the docs and see how to do stuff
2020, the year where people code bots by copying code, use libs that are hand holding them, and theres an API/module for everything you can ever hope for
Dies of cringe
2020, the year the purple people died of brain cancer
bruh noone helping me im going
We literally don't have any idea about your issue
@earnest phoenix is boeing dead
lgtm
Idk, i have not seen him anywhere lately
Stackoverflow, BotMaker, Github clones => API's for everything => modules for everything and anything
making bots has never been easier imo, specially on discord / js
Well, we are all basically using an api tho, using discord api to send request and make bots, Everything is an API 
apis are how things connect with other things
API: ah yes, it's all coming together
i turned my bot's core functionality into a public api
use an API to get info for a command provided by an API, which then uses your own API to route stuff around within shards, which then sends it back to the API
xD
We are using the discord API even when we're not developing bots, cuz discord client is connected to discord api

and theres a very small possibility of the code becoming self aware and Dossing whoever makes requests to the api
shit will catch on fire way too fast
@opal plank Not faster than new bot devs running into an error while following outdated YouTube tutorials
THIS ^^^^^^^^^^^^^^^^
"how make bot"
"how get bot online"
"How to make bot NO CHEAT ENGINE working 2020 OCTOber 20 YOUTUBE english"
LMFAOOOOOO

Goto https://botcreator.gg then just click and drag things
"hello sir how to get free vps for host my discord botums"
New bot devs be like:
Writes 1 line of code
Wait why is there 99 errors
There's an error on line 500 but i only have one line
Ok 
you can get FREE VPS for only $5 
technically my vps is also free
technically mine too
got enough donations to cover several years
though its a whole cluster
I can imagine people making videos with the title of
"How to make a free and pro bot using lucky patcher 100% working 2020 NO CLICKBAIT π₯π₯π₯"
lucky patcher omg lmao
only andoird gang will get the ref
guys i m logging into vps server right now omgg
anyone ever edited an android firmware?
i did
Uh
and almost bricked the shit out it
lmao
i don't really know java so i don't think id know how

i dont know java either
guys i logged in to my vps server
noice
Me: decompiles app to java
10 seconds later: instant regret
i did it on my old galaxy pocket (android 2.7 i think) to remove the brightness slider from the notification menu, because it was a waste of space
lmao
i actually don't have anything to run on this lol
mine was a galaxy s2 iirc
that shit survived a 4 story high fall into concrete
and a car ran it over
nice
Bruh I'm glad it wasn't a nokia
scratched the side, the glass and phone were intact apart from that
It would have split the world in half
Just put a lil bit of toothpaste and it'll be good as new
toothpaste? poor kid, we all know we fix stuff with ramen noodles
put it in a jar of rice and asians will come at night and fix it for you
Just put it in rice
this convo is 100% related to #development btw
put it in a jar of rice and asians will come at night and fix it for you
@quartz kindle That asians be like: that rice looking sus, let's have a look at it
:^)
Yes

technicall support(be it by summon asians with rice) is still technical support
Fixing stuff with rice, totally development 
I am asian and I can smell the rice from here
theres a bunch of videos on yt where people fix holes and damaged parts with dry ramen noodes
i really wonder if you could technically fix the cellohone carcass to an extent with noodles
Nah just give those holes the documents link, they'll learn and fix themselves
Submerge it in ramen soup for 24 hours after that.
i was about to send my code regarding an error then i saw how i misspelled the word content at the last second smh
xD
no wonder it was undefined.
After that, dry it up using heat by putting it in a microwave in high heat
its 9AM and i have 2 braincells left, one for breathing, and the other one is typing, really think i'd be jugding someone rn cuz of grammar?
you been up all night?
yup, havent sleep in prob 24+ h
@opal plank Kill the otherone and just use V-Braincells
rip
Man i haven't slept in 2 days
i went to sleep at 11 and woke up at 7:30
go sleep people
sleep deprivation is bad
What's sleep in the first place
This guy's brain went SyntaxError
i've been getting messages from my old phone company saying i still owe them an unpaid bill
i login to their website to check, and i get a blank page
open f12 and see this
lmfao
oof
Epic code 100
fucking OI
Lmao
prefessionel webositoe
good job react
i saw a glimpse of the gates of hell in there
yes
yes
You know it's sus when a website url has oi in it
im dissapointed that TIm doesnt use Tim
Erwin whats an alternative for forEach?
for those who dont know, OI and Tim are brazilian mobile data providers
i think i had Telefonica, then switched to Net
Well, Erwin hates forEach so much, that he scolds users who uses it
forEach is slow
does NET still operate with cable? or do they have fiber now?
i don't think foreach has async
they have fiber
forEach has a callback
i got a special private pack from them for 1 gigabit internet
finally, i always hated NET because cable was bad for gaming
im fairly certain they still have cable
Tf
forEach will not await the callbacks correctly tho, it will execute them all concurrently
mine is def fiber
yeah that's the problem
WHY ARE ALL MY CODE ERRORS TYPOS
well, it was
lmao
PepegaReading
chanel, the perfume
Then I was confused why .send() is not a function
why did i just picture someone spraying perfume on someones face?
Yeah I once got console.log is not a function
ok yeah i did for key of list instead
Someone should pin a message in this channel saying "Risk of losing most of your brain cells, proceed with caution"
I was confused AF
who reads pins
i m unable to install Shit.db aka quick.db
tfw you blame the package on your inability to read README

quickdb requires native dependencies, read the readme
What if you, wanted to go to heaven but god said
uninstall quick.db first
quick.db is like JSON that doesn't corrupt
Everything can be corrupted
Still slow and it's better suited for other uses
it isn't as slow
What a coincidence, I encountered that error a while ago and fixed it by copying the package.json in my existing bot that has quick.db then pasting it then deleting package-lock.json
It's still overall worse than the big boyes
it's just super restrictive considering it's actually running on sqlite
quick.db is just basically an sqlite wrapper but very slow
But remember that it stores all your info given on a file so if that file gets deleted, all your data is lost

technically all dbs store data in files
redis 
But not all dbs create a file in your root directory to store the info tho
mongo stores in bson
But i think this only applies on cloud based DBs

boiled down all databases store in files yeah however the "proper" databases as we know are doing so much more in the background, caching, memory management, custom formatting etc.
it's why your typical json db won't be able to verse a database that hunderds of people are working on
and mysql is still used as an enterprise solution 
mysql is bad?
horrible
how come
sec
i see oracle and im out
Does that apply to quick.db??
what is that
the screenshot?
no since quick.db is just internally using sqlite
quick.db is just a high-level abstraction of SQLite
believe it or not sqlite is more powerful than mysql, it's just slower with exponential growth
amount is Promise { 0 }
personally i just use mongo
how can i get the number?
as its great for what i use it for
resolve the promise, i.e. await it @gentle lynx
uh
@gentle lynx .then(result => console.log(result))
the content of amount is given as the variable in the .then()
You can read about promises here, as you'll be using them a lot: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises
thanks Lite
and it seems the compiler is killed during building sqlite
because it takes too long
lmao
When beginners make Tim angry because they don't understand what he says
its actually a minor perf advantage compiling it from source
there are prebuilt versions, but apparently not the the node version replit uses
12.18
oof
it does
oh woot
lmao I kept thinking it was json
since everyone was not recommending it
XD
- why it doesnt return
- why is the "u have enough items!!" message sends before the "You don't have enough items" one
nice, it depends on better sqlite
when you return inside a forEach, you are returning that function
oh
you cannot return the outside code from inside a forEach
which means it needs separate package for prebuilt
oof
if you want to control the outside code as well, use a for loop instead
use for(...)
how can i use for loop with maps
theres iterators
oh hey glassy
hi
for(let [key,value] of amounts.entries()) {}
Because the loop goes on and doesn't wait until it's complete
ugh await/async and promises dont really go together
I'm sure you can await in for loops
hi
Can someone tell me how you make your bot reply when it gets mention in Discord.js V12 ?
nothing
not u
oh
Can someone tell me how you make your bot reply when it gets mention in Discord.js V12 ?
@neon jasper in the message event check if the<Message>.contentis equal to the bot's mention using RegEx
and then return a reply or whatever u wanna do
or use message.mentions
Okay thanks
@gentle lynx you need to use async/await syntax
nvm fixed it
can anyone help me with this
(node:9236) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse (<anonymous>)
at module.exports (C:\Users\Christopher\Desktop\Wobbles\node_modules\ytsr\lib\main.js:18:23)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async module.exports (C:\Users\Christopher\Desktop\Wobbles\node_modules\ytsr\lib\main.js:58:22)
(node:9236) 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:9236) [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.
Actually i had this problem today also
im trying to play music with term searchs
you're probably trying to parse html as json
Its a bug (already reported in github issues)
ok
112batman and Le Wobbles show your source code pls
That is is failing to parse the youtube response because youtube severely reworked this
@sudden geyser it is am ytsr issue
You can see in in the github issues of ytsr
All we dan do is wait, the owner is already working on it
ok my friend said i should use usetube
ah
big systems like youtube take time to apply changes, like discord releases features to only 5% of people at a time for example
This place is about everything's development @static nexus
I need help working the zero-two bot
The NSFW doesn't work for me
how do i use usetube in my discord bot where do i put it
i m unable to install quick.db
@white night what language?
||no idea how to help||
my code keeps saying that serverQueue is undefined despite the fact that i literally defined it, unless i did something wrong
const serverQueue = queue.get(message.guild.id)
Where is it saying it is undefined though
Show not only that code but the code around that
One message removed from a suspended account.
const channels = message.mentions.channels.filter(c => c.type === 'text')
const channelarray = channels.array()
let count = 0;
let found = false;
let channel = '';
var i;
for(i = 0; i < channels.size; i++) {
connection.query(`SELECT * FROM config WHERE guildid = '${message.guild.id}' AND id = '${channelarray[i].id}'`, async function (err, results) {
if(results[0] !== undefined) {
found = true
channel = `${channel} | ${results[0].id}`
}
console.log(found)
})
}
if(found === true) {
return message.channel.send(`Error attempting to disable channels. The following are already disabled: ${channel} Please remove these channels from the command and retry!`)
} else {
All is working
Other then, it isn't waiting on the loop to be done before checking if found is true or not
It is doing the if statement before the for
hi
because .query takes a callback, which is called later, like I said before.
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")
}
}
what tf is wrong here
when i type !catch {pkmns[pkmn]} nothing is displayed
You need to do your handling in the callback if you want it to be in order.
pls help
I assume you aren't literally typing out {pkmns[pkmn]}, correct
yea ik that
pkmns[pkmn] is an element of an array
not shown here
to be exact this it it
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)
if pkmns.includes(args[1])
you mean the opposite?
anyways ill try
you mean if (args[1].includes(pkmns[pkmn]) right? @carmine summit
no
Why
Can you tell me how its supposed to work
if pkmns.includes(args[1])
If you add [pkmn], Then it will return a string of a random pokemon, then if the args and the string is not the same, it will return false
If you place in pkmns.includes(args[1]), if the array had the args, it will return true
When I make shardmanager
can I send in every guild messages or just those which are in the shards?
you can, but its a bit different
yes
@sudden geyser Ok so, I am the worst at callbacks
Wanna like lowkey show me how I should do this ;p
yeah they suck
and that works 100%?
another question:
when I have normal commands
which changes do i have to do @quartz kindle?
Literally like so confusing
what is the difference between npm, yarn, homebrew and bower
goooooooogle
os I think
connection.query("<...>", (err, results) => {
if (results[0] !== undefined) {
// Do your stuff here
}
})```
They're package managers code
That is what I have, Lite
I know, you already have what you need to write one.
Or it can't be in a for
ohhhh
function callback(guild, id) {
connection.query(`SELECT * FROM config WHERE guildid = '${guild}' AND id = ${id}`, async function(err, results) {
console.log(id)
console.log(guild)
if (results[0] !== undefined) {
found = true
channel = `${channel} | <#${id}>`
console.log(found)
}
if (results[0] === undefined) {
found = false
console.log(found)
}
})
}
for (i = 0; i < channels.size; i++) {
callback(message.guild.id, channelarray[i].id)
This is very
VERY
wrong
lmfao
and spaghetti ugh
i love spaghetti

yarn is a package manager but or a thing used to make fabric 
yeah and string is one way to call something that's use on instrumentS
@earnest phoenix for example, npm and yarn are both targeted at JS. Yarn tries fixing some issues with npm/Node.js, but I personally stick with npm. Homebrew is for installing stuff on macOS easily, like brew install rust, and I don't know what bower is
yeah and string is one way to call something that's used on instruments
@foggy cove instruments were made with animal intestines in olden times
you call em membranes
wat
ok yeah that's too deep in topic of music classification uh
ok yeah i need help
client.on('message', async message => {
if(message.author.bot) return
if(!message.content.startsWith(PREFIX)) return
const args = message.content.substring(PREFIX.length).split(" ")
const serverQueue = queue.get(message.guild.id)
how is serverQueue not defined and how do i global scope
i do not know how to code and i am dying to hear why this is a thing please
@foggy cove donβt make a bot if you canβt code
do some research first
I know where you copy pasted that code from, at least I can make a guess
uh, you are trying to use a callback or make one?
Hey! I am trying to make dashboard, they have to login trought their discord account.
Now I want to make, that it joins the support server! How?
ah









