#development
1 messages · Page 1255 of 1
and if it were declared in a different scope
it doesnt matter
ok
yep
and client(usually) has all your channels cached
client.destory()
i meant if client were not in the current scope of process.on('error'), but we can go with that
im not drunk enought o help him, brb
lol wat
you know about types correct?
types?
data types..?
like strings
mhm
yeah...
ok
those are data types
that is a data type
yeah

quick, tell me what a string actually is
string
like, what's it composed of
is a small wire
actually i want to see what your answer is
used for clothes
in programming you doink
string
i don't think js has that data type auger, tbh
"hi:
"hi"
no?
it's a well known data type. I didn't specify it to JS
['h', 'i']
^
it's a programming concept. not language specific
ik
korean has the right idea
thats because i know the actually definition of it
you want me to add that to the proccess
a string is just a character array
now you know how to send your message to a specific channel(likely your support channel in a closed server, or a dm)
i just mixed half a bottle of vodka and grape juice and chugged half of it
so you got 10 minutes to ask me for help
OL
for dms you'd fetch yourself from the users cache

message.member.send()
member is the type of GuildMember, user is type of User

i told you message doesnt exist
i need that in my life
stubborn
fuck
what is something that does exist that is not message, but you can get the channel from?
if you say message once again i'll legit slap you dude
OWO
🥺
send a video of that i want to see a virtual slap be done
anywho
you got the send bit almost sorte
dbut you need to grab syouself
fuck
grab yourself fromn the cache
k
do you know how to do that?
erwin do you have an example code by chance?
i do
but im against providing it
since he already proved himself not worthy as he copied my snippet above
just something basic
nah nah, i meant basic structure to teach

im giving you the framework, you as a dev should be the one to code it
^^^^^
client.users
step 1, event listener
step 2, grab yourself from cache
step 3, write a buffer with the error payload
step 4, with yourself target, send a message payload with attachment
yes

gg erwin
very close
client.users.cache.get("485987127809671168")
yes

that shit delicious holy fuck

















how much of that bottle did you have tonight?
erm
Slowly but surely getting off-topic 
process.on('error', (err) => {
let me = client.users.cache.get("485987127809671168")
var idk = new Buffer.from(JSON.stringify(err))
me.send.payload.attachments(idk)
})
client.on('message', message => {})
okay so we got this
ok
anyway
step 1, event listener
step 2, grab yourself from cache
step 3, write a buffer with the error payload
step 4, with yourself target, send a message payload with attachment
step 1 and 2 done
now do 3 and 4
so
wait
process.on('error', (err) => {
let me = client.users.cache.get("485987127809671168")
var idk = new Buffer.from(JSON.stringify(err))
me.send.payload.attachments(idk)
})
client.on('message', message => {})
?
not quite


when var is a thing 
erwin ran out of nitro
i mean erwin has better emojis than i do
i have 13k emojis cached
O,o

back on topic
check bottom left
back ontopic
yes
ontopic
process.on('error', (err) => {
let me = client.users.cache.get("485987127809671168")
var idk = new Buffer.from(JSON.stringify(err))
me.send.payload.attachments(idk)
})
client.on('message', message => {})
so how do I attach
👀
wait why are you asking us? we were asking you
lets go
you should REALLY at least skim thru the docs
link
both for JS AND d.js
others: "What are docs?"
Me:
wait your actually serious 
so
doscs esential
channel.send({
files: [{
attachment: err,
name: 'file.txt'
}]
})

it is
you lil vampire
when the only info on it is send local copy
erwin put the sticks back
sti forbit you to copy paste code that you yourself havet written
i forbid*
and dont you dare type it out either
learn from it
examples are there to give you an example of how things work not to copy

process.on('error', (err) => {
let me = client.users.cache.get("485987127809671168")
var idk = new Buffer.from(JSON.stringify(err))
me.send({files: [{ attachment: err, name: 'file.txt' }] })
})
how much js do you know aki?
file.txt doesnt exist
ok
ok
i want to see what we are working with, might have to take this a different direction depending on his knowledge
im amazed i havent given up tbh, usually my response is linking the guide and saying learn js beforehand

i guess booze does do miracles
condoning drinking, im a bad example
either way
now you know that the send method accepts an object with message payload
now how would you attach a file that doesnt exist?
wait i never got my answer
which question?
how much do you know about js aki, i want to hear it from you
enough to do stuff
oh
that doesn't answer my question
he doesnt know listeners nor nesting/scopes, so quite a begginer
now how MUCH he knows is out of my knonledge
no shame dude, we arent making fun of you
we all start somewhere
we just wanna know where you stand in js
whats nesting 
but this is the part where you going to have to put in some effort
nesting is function in a function

step 1, event listener
step 2, grab yourself from cache
step 3, write a buffer with the error payload
step 4, with yourself target, send a message payload with attachment
ive given you almost all these steps
theres only 1 left
hold up
that one you going to do it yourself
last step is
can I send a attachment
which is buffer
like embed
no
the whole point of using a file is to remove its limit
discord has a 2000 char limit
does it anyways
so you will get errors by sending your error that way
heres where you will have to put in some effort yourself
ok
this is buffer
you have 2 options
if you VPS allows, you can either use fs
and write a local file, then attach it
or use buffer, which is better
buffer im not TOO familiarized with, ive used it quite a few times but im not comfortable enough to give a comprehensive explanation on it
so you'll have to do some research
and DONT
YOU
DARE
COPY SHIT
i mean it
what I dont need to copy with fs
oh
which wont write files locally
some vps's dont allow writing shit locally
so its good practice for you not to need to write to disk to send stuff
and use buffer instead directly from your code
ok
learning new stuff is never bad
thats your last step to send your error
so put some commitment into it
do some research about how Buffer works in js
so
?
new Buffer()
buffer.write()
??
this is the bit where i told you to do some research
you wont always have a drunk dickhead like me to guide you thru stuff
if you truly want to become a dev you gotta get good habits
research and try & error
LOTS of try & error
new Buffer(err, encoding='utf8')
try it and see
you said you had an eval
try it till it works
we already gave you 90% of the code you needed
push yourself for that last 10%
¯_(ツ)_/¯
anyhow, im going to grab another big sip and go code my twitch bot again
the cache is still misbehaving once it reaches 2000 streams
you didn't finish that bottle yet O<O
Can someone help with this error?
idk man i would have thought you finished by now
^
TypeError: Cannot read property 'id' of undefined```
whats id?
The arrow is normally under client.shards.id
yes
wo
Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead
i think i jsut watched my token get revoked live

what
bot still on
are you triping?
I've been looking for info about using emojis from a certain server to display on an embed, but for some reason im not able to find anything, any hint?
the fact that im receievng metrics from everything else means it got kicked off the IRC
oh, we getting back
oofers
bruh i swear im THIS far from writting my own twitch lib
offtopic
lol
erm
@earnest phoenix isnt only a discord bot
its your life?
I do i make a level system for my bot, lol (Discord.js)
database
oh its reconnecting
@earnest phoenix use a database to store exp
on message => update user + exp
thats it
then use some formula to calculate exp
any closer?
process.on('error', (err) => {
let me = client.users.cache.get("485987127809671168")
const buf = new Buffer(100000)
len = buf.write("hi");
me.send({ files: [{ attachment: buf, name: 'file.txt' }] })
})
try it
try and error
its the last 10%
i believe in you
im starting to think twitch doesnt like unverified bots to have this much traffic
this is becoming a hindrance tbh
let msg = message.content.toLowerCase();
if(msg.startsWith(".cl donate" || " .clan donate")){
}
why is .cl donate working n other one not working
&&
im pretty sure u need 2 startsWith() btw
doesn't work like that, you have to use startsWith() || startsWith()
^^
ok
get a database
use a database
persistent storage for data
a place where you can store information
So it like Pastebin
.
not quite
I see
npm i quick.db
you store useful data like user's id, server id, and stuff like that
I see
any question?
there are database as a service that you can use (website)
Whats a database
@earnest phoenix a database is more like a spreadsheet but a book of them
re
and they are quite a bit more advanced
too advanced for my small brain
I'm new to this, why am i here
@earnest phoenix a database is like a paper that your bot uses to do shit
Like it writes to that paper
Makes sense
And stores it
a database can be as simple as:
id, exp
1,100
2,428
3,162
4,17
...
the id is how you search
And stores it
Shortly said, database is a way to store stuff that doesn't get reset over program restarts
Makes sense
@earnest phoenix what Lang?
@opal plank
Lib
my code wont even run
then debug it
proccess.on('error', (err) => {
const me = client.users.cache.get("485987127809671168")
const buf = new Buffer(600)
len = buf.write(err);
me.send({ files: [{ attachment: buf, name: 'file.txt' }] })
})
^^
@earnest phoenix what Lang?
@drifting wedge Js
via more logging or breakpoints
^^
Lib Discord.js
proccess.on('error', (err) => {
const me = client.users.cache.get("485987127809671168")
const buf = new Buffer(600)
len = buf.write(err);
me.send({ files: [{ attachment: buf, name: 'file.txt' }] })
}).catch(console.log)
thats the last bit dude
Lib Discord.js
@earnest phoenix really glad you answered properly and didn't say something like "english"
cmon
@earnest phoenix really glad you answered properly and didn't say something like "english"
@faint prism Lol
whats javascript 
@opal plank HAHA not my fault I think
process.on(...).catch is not a function
i think it is
wait
you just assigning a listener
whats javascript :milk_think:
@vernal rivet its something that dumbasses use when they have nothing else to do in life, and they want to do something dumb, so they go to making dumb shit like bots
@earnest phoenix actually bet
the event is NOT called 'error'
Lol
sounds boring
what is the event
wait
wrong link
Imagine shitting on people for wanting to engage in programming
wtf

'uncaughtException' and 'unhandledRejection'
what is the event
Im still trying to figure out how to make my bot able to let people choose the prefix for it
@earnest phoenix god dam
@earnest phoenix db.set(`prefix_${message.guild.id}`, args[0])
Yes, but how do i go to this 'database'
npm i quick.db
I did that inside of command prompt, and it did some long ass message that i was afraid of
prefix = await db.get(`prefix_${message.guild.id}`)
Lmaoo, im a joke
Hello. I have a issue. Every command shows as unknown. I can show the code if needed.
It shows unknown command. I’m trying to make a system where if the command isnt a current command it shows Unknown
@agile lance no
@solemn leaf What you mean?
Ohh
I can show it for reasons of learning
come on
dont fetch your prefix every call
thats bad code
if(!command === "//help") { return message.channel.send("Unknown command. //help for commands.") }
store your prefix on startup on memory
erwin
?
imagine giving bad example
Why give bad examples in the first place
at least write in a different language like TS so people complaint they cant copy paste
Beginners don't know how to apply it properly

yarn
Beginners don't know how to apply it properly
@slender thistle I know, i have that problem all the time
I legit was spoon feeding bad code for a reason
@solemn leaf don't give bad code. just explain good concepts
^^^^
never give bad code
yeah
what
startup = require all prefixes from database
for every prefix => map them
on message event, fetch it from the map rather than database
@earnest phoenix
you want me to write the whole thing now
no
Explain the logic
explain
startup = require all prefixes from database
for every prefix => map them
on message event, fetch it from the map rather than database
ez
done
ptb?
there is like a unspoken rule that we never give bad code. that doesn't mean spoon feed them it, it means don't give them bad code
ptb?
yes
what
im too drunk to bother about the name
I'm a joke if i dont even understand that, no wonder i get clowned on everytime i come here ;-;
lol once someone said I was gonna ip pull them with the canary link
have you thought about learning more than what you already know?
you shouldnt get clowned off unless you do some really stubborn stupid shit
no one will make fun of you for not knowing a language
have you thought about learning more than what you already know?
@vernal rivet Thats what im doing right now
You get clowned because this community is a shitshow of unhelpful people willing to yell at everyone for not knowing something
^^^
You get clowned because this community is a shitshow of unhelpful people willing to yell at everyone for not knowing something
@slender thistle I know
r/roastme
hmm not everyone
no one will make fun of you for not knowing a language
Are you sure?
no one SHOULD make fun of you for not knowing a lang
i will bonk you for being stubborn, not for not knowing though
^^^
erwin
?
what is the event
But Auger, how many times have I had to yell to be helpful at people for yelling at beginners
no one SHOULD make fun of you for not knowing a lang
@opal plank U should have seen the first time i started asking for help for my bot,it was like a war zone
so
I'm not saying it is the majority shiv
look, im only responsible for myself
i do not trash talk people for not knowing how to code
we all started somewhere
i cannot vouche for some of the douches that lurk in here
we all started somewhere
@opal plank Correct
Aye I need to stay calm as a representative of the script kids gang
lol
can I do this or something on the lines?
.on('uncaughtException','unhandledRejection', (err) => {
is it me or mainly shiv me auger and tim carry this channel?
Not really
if you don't know know a language, then thats fine, we all start somewhere. as long you are willing to put in the work and try and learn it, then you are fine.
I'm not even a js dev lol
wait
I know Python for the most part and not even that advanced when it comes to threading/async stuff tbh 
I just actually study CS
you want me to do this
bot.on('uncaughtException', (err) => {
}).on('unhandledRejection', (err) => { })
whats python? is that the snake? thats boring
It's not boring when you need fast and rapid deployment of calculating projects :^)
ik
I'm currently learning Embeds right now, so i dont even know why im asking people to help me with making my bot able to have its prefix changed by people
that sounds boring still
@earnest phoenix embeds are ez
Custom prefixes are always nice
I didnt mean to put that their
It's not boring when you need fast and rapid deployment of calculating projects :^)
@slender thistle lol that's all I've used it for so far tbh
@earnest phoenix bet
@earnest phoenix embeds are ez
@earnest phoenix Im new, and i just started, lol
i was against it tbh at least in discord
erwin
i implemented custom prefixes on twitch but that was a link issue
remember sending embeds without the new discord embed
Glhf
lol what
gg
remember to send the actually embed
but also allow the streamer to use !command
cuz that doesnt get detected
had to implement custom prefix on twitch cuz twitch url parser is shit, ontop of haivng shit api and shit docs
the whole thing is a shitshow

Lol, im new to bot developing, and people call me a New Bot Dev, and the term "Dev" in the title is a joke, the only bots ive made are basic shit bots, lol
like i said dude, we all start somewhere
@opal plank
process.on('uncaughtException', (err) => {
me = client.users.cache.get("485987127809671168")
var buf = new Buffer("err:", "utf-8")
len = buf.write(err);
}).on('unhandledRejection', (err) => {
var buf = new Buffer("err:", "utf-8")
len = buf.write(err);
}).catch(console.log)
Yeah, i guess
but i WILL bonk you the moment i say message doesnt exist and you stubborn'ingly say message the next 8 times even though i exaplined it dont exist

process wont ever error
no need for catch
ok
its an event handler
you want to know what i had a hard time doing when i first started programming. I didn't know how to print a simple message back then. we all start from somewhere.
so is the buffer right?
Development is development
fu
like i said, we already provided 90% of what you needed
figure out the last bit of how buffer() works
You may not be considered advanced but you're still a dev
Erwin, better yet...
@opal plank at least tell me how to send
🥺
Minecraft worlds in base64-encrypted files path of which is stored in hardass-encrypted mongo collection
you actually had it
me.send({ files: [{ attachment: buf, name: 'file.txt' }] })
i can do one bvetter shiv
Just store it in RAM
I vaguely remember getting a deprecation warning when using buffers in JS
process.on('uncaughtException', (err) => {
me = client.users.cache.get("485987127809671168")
var buf = new Buffer("err:", "utf-8")
len = buf.write(err);
me.send({ files: [{ attachment: buf, name: 'file.txt' }] });
}).on('unhandledRejection', (err) => {
me = client.users.cache.get("485987127809671168")
var buf = new Buffer("err:", "utf-8")
len = buf.write(err);
me.send({ files: [{ attachment: buf, name: 'file.txt' }] });
})
I did
@faint prism
bs64 encryp the world, then store them as imagees by generating a pixel corresponding to the char, then you post them on discord and use discord as a database
I think that's what he's trying to do with the buffer
then decrypt the image
like i explained before, dont use that on an eval
use it on actual code
I was gonna
event listeners and evals dont work well together
bs64 encryp the world, then store them as imagees by generating a pixel corresponding to the char, then you post them on discord and use discord as a database
@opal plank or just send binary directly
indeed
in a msg
api spam
then send it as a file
you make it sound like i didnt get ratelimited more than 100 times past few days
ratelimit?
a text file lol
#ratelimitking
#RateLiteWho?
@opal plank
never heard of
should I just
we are jesting btw about the encoding and binary. don't do anything that way
Is this all i need to make the embeds?
https://pastebin.com/y6Cm37Cy
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
put it in a empty script?
events need to be on ur index
wherver your index is
@earnest phoenix while that works just fine, please take some time to listen about our religion
We can make that a religion
found it!
here
i'd like you to present our religion
#NOEmbedBuilders
you can pass send() with an object directly
which is way more code friendly
it was only 10 ms faster
im new, please be gentle step bro
Hey Woah
im 100% not purposefully neglecting to mention that this is 100000 iterations and shouldnt cause much issues unless your bot is big
.send() accepts an object
{}
your embed builder
erwin
Json.encode it
Should it take me this long to make an embed thing
JSON.stringify
indeed, send it directly
Wait, huh?
@opal plank is it possible to code an embed
Alright
all of those 3 are literally exactly the same result
but as you can see embed builder is WAY slower
Yes
I only didnt use my embed builder on my ping command
What is this "raw embed" is that the name of your embed? or
raw embed is me declaring it direclty into an object rather than a variable
let embed = {embed}
send(embed)
=================
send({embed})
the latter being raw
unless you need to change things on the fly, you should directly pass the object inside the method(.send())
say you only want a title when a user is a bot
then you'd need a variable
.send({description: 'hi'})
now how do i add title in there if user is bot?
What type is embed?

if you want TS type
{"title":"Ping?","type":"rich","description":"Pinging...","timestamp":null,"color":5910085,"fields":[],"thumbnail":null,"image":{"url":"https://images-ext-1.discordapp.net/external/qSEYpNbf_KtEoNrmUNjeBZGzJ2IKOUyntU4amLrUAeg/%3Fcid%3Decf05e47zk5ykczbmm71ttz9ijhz4ajy4rr8y8zgj5d90axx%26rid%3Dgiphy.gif/https/media3.giphy.com/media/XmgaQnxOMQd3O/giphy.gif%27"},"author":{"name":"Help Command"},"footer":null}
But I will take the L on that
That’s because it is lol
MessageEmbed was v11
not in code
No
in type
now how do i add title in there if user is bot?
@opal plank .send({title: 'why does this have to be so frCIKIN hard'})
Mhm
im sending them as objects directly without type definition
Sadly
@earnest phoenix wrong
re
waiting for the error be like
imagine this scenario
soooo
in newer versions of discord mobile apps, can you copy link inside the embeds?
Do we need to teach what formal and actual parameters are 
Do those exist in JS
they exist in any language
I've honestly forgotten how they work lol
if(user.bot) //i want title to be 'bot' if user is bot
<channel>.send({embeds:{description:'a',}})
//How do i add title up there only IF the author is bot?
@earnest phoenix
.setTitle("fuck this title")
Quick Google search might help later anyway
WITHOUT embed builders
Formal is what is being asked, and actual is what is actually being passed through during the call
erwin
as i mentioned, they are bad habit code wise
://
its object manipulation
@opal plank you make the const before the if
Isn't embeds an array
Then manipulate the object
It shouldn’t be
Isnt an array
i dont think so shiv
Fields is an array
its object shiv
It should be type of object
Weird naming then 🤔
@opal plank what does lavalink do to get the search results on youtube without api
anywho
[{ name: stuff, value: test }] this is fields
I thought u just needed this, and u were done
https://pastebin.com/y6Cm37Cy
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
@earnest phoenix how do i add
let a = {} //let a be an object
how do i add a property b onto a?
@opal plank THAT IS REALLY HARD
BE PATIENT FFS
also why add {} to it
IM ONLY ONE PERSON
let a
helping one at a time
nothing else
im helping cosmetic now
does my code even work before I abuse my bot for hours
In helping, do u mean destroying every ounce of brain cell inside of me
yes

what doesnt kill u makes u strongewr
Seems legit, lets keep going
What if it does kill me? Does it make me weaker?
that makes u dead
Lol
imagine breaking rules
@earnest phoenix I cant fucking try it and see
I have to wait for the error
to pop
up
how do u add a property inside an object?
@opal plank Ummmm, I'm gonna have to go through this whole thing again
here, lemm give u some docs then
alright
throws w3schools at them
Hahahaha
HOW YOU GUESS

LMFAO
i can give them mdn but w3 has interactive snippets, its way more noob friendly
THATS A FUCKING JOKE OH MY GOD
I AM DIEING
Dying*
mdn is BETTER, though it doesnt provide interactive snippets
most people like to see shit in action
Loads the sights, aims the magazine .
rather than just read it
msn also has interactive snippets no?
i dont think so vysion
they write the web standard
Mdn is good
wait they do have sandboxes
I would have thrown stackoverflow at them tbh
it IS good, they just dont priovide easy/moewd down/snippets explanation
when stackoverflow is down
i actually PREFER MDN
verbose
\
w3schoools is a bad resource imho 
for getting started i think its better
You know what is better? This think called the YouTube’s
for proper docs? no
youtube is a good learning tool for everything
beautiful
@vernal rivet
Oh no
[say that again punk
I should run
i dare you mofo
its for the kids
ow my ewars
@solemn leaf throw shit on your code to make it error on purpose
write this and watch your compiler go brrr
lol
notAvariable.forEach(kk)
no

but ill do anyways
As we still wait for our question to be answered
didnt error anything
read what i said above
I- i dont understand a thing in this "w3"
Why are you hitting me ;-;
im hitting aki
for evaling it rather than putting on commands like i said
Ah ok
evaling is inside its own vm iirc

C:\Users\Owner\Desktop\discordjs2\index.js:49
me = client.users.cache.get("485987127809671168")
^
ReferenceError: client is not defined
at process.<anonymous> (C:\Users\Owner\Desktop\discordjs2\index.js:49:5)
epixxx
I am too lazy to do it, so your lucky
i remeber you calling your client bot

buffer.js:1038
return this.utf8Write(string, 0, this.length);
^
TypeError: argument must be a string
now wha
When someone says “w3” is confusing
now fix it
I dont know what the error means
no
with pleasure

Read the error, it tells you what is wrong
No
Hello
im not gonna give much more info but you using the wrong buffer method
just fyi
before you go deeper into the rabbit hole
var buf = new Buffer(10)
Fair
wrong
I am just dead inside
this is legit the LAST bit of help i'll give you aki
ive given you more than enough to work with
coding is just words which do fancy things
YOU KNOW WHAT, your right
erwin
Programming is just words that do fancy things like blowing things up, like your mind
how is that wrong
var buf = new Buffer([10, 20, 30, 40, 50]); is the only other method?
Hello
o/
your link isnt helping me for shit


