#development

1 messages · Page 1255 of 1

opal plank
#

on the process you can target the cache from client

#

since client is declared outside ot the process listener scope

solemn leaf
#

can we call my client bot now?

#

thank

opal plank
#

now thats step 1 out of 20

#

client or bot

vernal rivet
#

and if it were declared in a different scope

opal plank
#

it doesnt matter

solemn leaf
#

ok

opal plank
#

message wont always exist

#

client will

solemn leaf
#

yep

opal plank
#

and client(usually) has all your channels cached

solemn leaf
#

client.destory()

opal plank
vernal rivet
#

i meant if client were not in the current scope of process.on('error'), but we can go with that

opal plank
#

im not drunk enought o help him, brb

vernal rivet
#

good answer

solemn leaf
#

lol wat

vernal rivet
#

you know about types correct?

solemn leaf
#

types?

faint prism
#

data types..?

vernal rivet
#

^^^

#

well also Object Types

solemn leaf
#

like strings

vernal rivet
#

mhm

faint prism
#

yeah...

solemn leaf
#

ok

vernal rivet
#

those are data types

faint prism
#

that is a data type

solemn leaf
#

ok

#

we doing a pop quiz?

#

bcs I didnt study

faint prism
#

yeah

vernal rivet
faint prism
#

quick, tell me what a string actually is

solemn leaf
#

string

faint prism
#

like, what's it composed of

solemn leaf
#

is a small wire

vernal rivet
#

actually i want to see what your answer is

solemn leaf
#

used for clothes

faint prism
#

in programming you doink

solemn leaf
#

string

vernal rivet
#

i don't think js has that data type auger, tbh

solemn leaf
#

"hi:

swift void
#

"hi"

solemn leaf
#

no?

faint prism
#

it's a well known data type. I didn't specify it to JS

vernal rivet
#

['h', 'i']

faint prism
#

^

solemn leaf
#

lua

#

lets do lua

faint prism
#

it's a programming concept. not language specific

solemn leaf
#

ik

faint prism
#

korean has the right idea

solemn leaf
#

ok

#

so

#

wait

vernal rivet
#

thats because i know the actually definition of it

solemn leaf
#

you want me to add that to the proccess

faint prism
#

a string is just a character array

opal plank
#

k i think i got 10 before that shit kicks in

#

so lets try to rush this a bit

solemn leaf
#

LMFAO

#

erwin you gut?

opal plank
#

now you know how to send your message to a specific channel(likely your support channel in a closed server, or a dm)

solemn leaf
#

I can dm

#

rather dm actually

opal plank
#

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

solemn leaf
#

OL

opal plank
#

for dms you'd fetch yourself from the users cache

vernal rivet
opal plank
#

now thats out of the way

#

step 2

#

how attach it to a file

solemn leaf
#

message.member.send()

opal plank
#

not quite

#

thats member not user

solemn leaf
#

really?

#

author

opal plank
#

and i just noticed

#

stop using message

vernal rivet
#

member is the type of GuildMember, user is type of User

opal plank
vernal rivet
opal plank
#

i told you message doesnt exist

vernal rivet
#

i need that in my life

opal plank
#

stubborn

solemn leaf
#

fuck

opal plank
#

why fetching member

#

use users

vernal rivet
#

what is something that does exist that is not message, but you can get the channel from?

opal plank
#

if you say message once again i'll legit slap you dude

vernal rivet
#

OWO

opal plank
solemn leaf
#

🥺

vernal rivet
#

send a video of that i want to see a virtual slap be done

opal plank
#

anywho

#

you got the send bit almost sorte

#

dbut you need to grab syouself

#

fuck

#

grab yourself fromn the cache

solemn leaf
#

k

opal plank
#

do you know how to do that?

vernal rivet
#

erwin do you have an example code by chance?

opal plank
#

i do

#

but im against providing it

#

since he already proved himself not worthy as he copied my snippet above

vernal rivet
#

just something basic

opal plank
#

last thing i want is feed a vampire

#

teach > provide snippets

vernal rivet
#

nah nah, i meant basic structure to teach

solemn leaf
opal plank
#

w3schools

#

¯_(ツ)_/¯

vernal rivet
#

fair

opal plank
#

im giving you the framework, you as a dev should be the one to code it

vernal rivet
#

^^^^^

solemn leaf
#

client.users

opal plank
#

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

vernal rivet
#

yes

opal plank
#

thats it

#

im getting tipsy now

vernal rivet
faint prism
#

gg erwin

solemn leaf
#

client.users.get("485987127809671168")

#

?

opal plank
#

wrong

#

close

#

but wrong

vernal rivet
#

very close

solemn leaf
#

client.users.cache.get("485987127809671168")

vernal rivet
#

yes

opal plank
#

ding ding

#

i shouldnt but i will, brb

vernal rivet
opal plank
#

that shit delicious holy fuck

solemn leaf
opal plank
#

its just a couple more sips, chills

#

just a couple

#

anyway

solemn leaf
vernal rivet
#

how much of that bottle did you have tonight?

opal plank
#

erm

solemn leaf
#

all of the above

#

erwin

#

answer is yes

slender thistle
#

Slowly but surely getting off-topic GWahreeSure

vernal rivet
#

slowly

#

but not yet

solemn leaf
#
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

vernal rivet
#

ok

opal plank
#

anyway

solemn leaf
#

anyway

#

doesnt say anything afterward

opal plank
#

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

solemn leaf
#

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 => {})

?

opal plank
#

not quite

vernal rivet
opal plank
#

thats not how you attach message payload

#

also var

solemn leaf
opal plank
vernal rivet
#

when var is a thing dogekek

solemn leaf
#

erwin ran out of nitro

opal plank
#

indeed i have

#

i dont have money for that stuff unfortunately

vernal rivet
#

i mean erwin has better emojis than i do

opal plank
#

i have 13k emojis cached

vernal rivet
#

O,o

solemn leaf
vernal rivet
#

back on topic

opal plank
#

teechnically devlopment

#

its all thansks to @earnest phoenix

solemn leaf
#

@opal plank I made an emoji array with 256 emojis

#

🤯

opal plank
#

check bottom left

vernal rivet
#

back ontopic

solemn leaf
#

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

opal plank
#

👀

vernal rivet
#

wait why are you asking us? we were asking you

opal plank
solemn leaf
#

lets go

opal plank
#

you should REALLY at least skim thru the docs

solemn leaf
#

link

opal plank
#

both for JS AND d.js

solemn leaf
#

its still loading

#

.

#

;-;

opal plank
#

oh shit its hitting

vernal rivet
#

others: "What are docs?"
Me: dogekek wait your actually serious kellyded

solemn leaf
#

so

opal plank
#

doscs esential

solemn leaf
#

channel.send({
files: [{
attachment: err,
name: 'file.txt'
}]
})

vernal rivet
opal plank
#

thats copying snippets

#

learn from it

solemn leaf
#

it is

opal plank
#

you lil vampire

solemn leaf
#

when the only info on it is send local copy

vernal rivet
#

erwin put the sticks back

opal plank
#

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

vernal rivet
solemn leaf
#

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' }] })

})

vernal rivet
#

how much js do you know aki?

solemn leaf
#

I mean

#

like

opal plank
#

file.txt doesnt exist

solemn leaf
#

ok

opal plank
#

basically 0 from this conversation

#

@vernal rivet

solemn leaf
#

ok

vernal rivet
#

i want to see what we are working with, might have to take this a different direction depending on his knowledge

opal plank
#

im amazed i havent given up tbh, usually my response is linking the guide and saying learn js beforehand

vernal rivet
opal plank
#

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?

vernal rivet
#

wait i never got my answer

opal plank
#

which question?

solemn leaf
#

erm

#

idk

opal plank
#

we spoke of it before

#

Buffer

vernal rivet
#

how much do you know about js aki, i want to hear it from you

opal plank
#

oh me?

#

quite a bit

vernal rivet
#

nah

#

i meant aki

solemn leaf
#

enough to do stuff

opal plank
#

oh

vernal rivet
#

that doesn't answer my question

opal plank
#

he doesnt know listeners nor nesting/scopes, so quite a begginer

solemn leaf
#

I know what nesting i

#

is

opal plank
#

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

vernal rivet
#

whats nesting milk_think

opal plank
#

but this is the part where you going to have to put in some effort

solemn leaf
#

nesting is function in a function

vernal rivet
opal plank
#

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

solemn leaf
#

hold up

opal plank
#

that one you going to do it yourself

vernal rivet
#

last step is

solemn leaf
#

can I send a attachment

opal plank
#

which is buffer

solemn leaf
#

like embed

opal plank
#

no

#

the whole point of using a file is to remove its limit

#

discord has a 2000 char limit

vernal rivet
#

does it anyways

opal plank
#

so you will get errors by sending your error that way

#

heres where you will have to put in some effort yourself

solemn leaf
#

ok

opal plank
#

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

solemn leaf
#

oh

#

fs

opal plank
#

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

solemn leaf
#

what I dont need to copy with fs

opal plank
#

fs is the alternative

#

preferably i'd like you do use buffer

vernal rivet
#

oh

opal plank
#

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

solemn leaf
#

Im not running off vpn

#

vps*

opal plank
#

either way

#

its good practice

solemn leaf
#

ok

opal plank
#

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

solemn leaf
#

so

opal plank
#

?

solemn leaf
#

new Buffer()
buffer.write()

vernal rivet
#

??

opal plank
#

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

solemn leaf
#

new Buffer(err, encoding='utf8')

opal plank
#

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%

solemn leaf
#

mmh

opal plank
#

¯_(ツ)_/¯

#

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

vernal rivet
#

you didn't finish that bottle yet O<O

opal plank
#

keyword, YET*

#

bruh thats 47% vodka

#

even i have limits

cedar badge
#

Can someone help with this error?

vernal rivet
#

idk man i would have thought you finished by now

cedar badge
#
                                                                                  ^
TypeError: Cannot read property 'id' of undefined```
vernal rivet
#

whats id?

cedar badge
vernal rivet
#

yes

opal plank
#

cache dropping past 2k streams

solemn leaf
#

now that isnt nice

vernal rivet
#

go check what a buffer is

solemn leaf
#

wo

#

Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead

opal plank
#

i think i jsut watched my token get revoked live

vernal rivet
opal plank
vernal rivet
#

what

opal plank
#

bot still on

vernal rivet
#

are you triping?

opal plank
#

look at message/min

#

that means bot disconnected from all channels

ionic dawn
#

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?

opal plank
#

the fact that im receievng metrics from everything else means it got kicked off the IRC

#

oh, we getting back

vernal rivet
#

oofers

opal plank
#

bruh i swear im THIS far from writting my own twitch lib

vernal rivet
#

offtopic

opal plank
#

wdym offtopic?

#

its bot development

vernal rivet
#

lol

solemn leaf
#

erm

opal plank
#

@earnest phoenix isnt only a discord bot

solemn leaf
vernal rivet
#

its your life?

opal plank
#

its my baby, but yeah

#

it works with discord twitch and youtube

earnest phoenix
#

I do i make a level system for my bot, lol (Discord.js)

opal plank
#

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

solemn leaf
#

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' }] })
})
opal plank
#

last 10% dude

#

put some effort

solemn leaf
#

WHAT

#

that is

#

😦

opal plank
#

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

solemn leaf
#

my bot doesnt

#

the error is that it is too big for discord?

stark abyss
#

let msg = message.content.toLowerCase();
if(msg.startsWith(".cl donate" || " .clan donate")){
}

#

why is .cl donate working n other one not working

solemn leaf
#

&&

stark abyss
#

ah yes ty

#

no

opal plank
#

im pretty sure u need 2 startsWith() btw

pale vessel
#

doesn't work like that, you have to use startsWith() || startsWith()

opal plank
#

^^

stark abyss
#

ok

earnest phoenix
#

How do i make my bot able to let people choose the prefix

#

;-;

pale vessel
#

get a database

stark abyss
#

use a database

earnest phoenix
#

Whats a database

#

i need to learn more

#

;-;

pale vessel
#

persistent storage for data

stark abyss
#

a place where you can store information

earnest phoenix
#

So it like Pastebin

solemn leaf
#

.

stark abyss
#

not quite

earnest phoenix
#

I see

solemn leaf
#

npm i quick.db

stark abyss
#

you store useful data like user's id, server id, and stuff like that

earnest phoenix
#

I see

stark abyss
#

any question?

earnest phoenix
#

Yes

#

Is it a website, or-

stark abyss
#

there are database as a service that you can use (website)

faint prism
#

Whats a database
@earnest phoenix a database is more like a spreadsheet but a book of them

earnest phoenix
#

re

faint prism
#

and they are quite a bit more advanced

stark abyss
#

too advanced for my small brain

earnest phoenix
#

I'm new to this, why am i here

drifting wedge
#

@earnest phoenix a database is like a paper that your bot uses to do shit

#

Like it writes to that paper

earnest phoenix
#

Makes sense

drifting wedge
#

And stores it

faint prism
#

a database can be as simple as:
id, exp
1,100
2,428
3,162
4,17
...

drifting wedge
#

So it’s like a notebook in some ways

#

It puts the thing u want in it

faint prism
#

the id is how you search

drifting wedge
#

And stores it

slender thistle
#

Shortly said, database is a way to store stuff that doesn't get reset over program restarts

drifting wedge
#

Makes sense
@earnest phoenix what Lang?

solemn leaf
#

@opal plank

drifting wedge
#

Lib

solemn leaf
#

my code wont even run

faint prism
#

then debug it

solemn leaf
#
    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' }] })
    })
opal plank
#

^^

earnest phoenix
#

@earnest phoenix what Lang?
@drifting wedge Js

solemn leaf
#

debug

#

what you

faint prism
#

via more logging or breakpoints

opal plank
#

^^

earnest phoenix
#

Lib Discord.js

solemn leaf
#

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)
opal plank
#

thats the last bit dude

faint prism
#

Lib Discord.js
@earnest phoenix really glad you answered properly and didn't say something like "english"

opal plank
#

cmon

earnest phoenix
#

@earnest phoenix really glad you answered properly and didn't say something like "english"
@faint prism Lol

vernal rivet
#

whats javascript milk_think

solemn leaf
#

@opal plank HAHA not my fault I think

#

process.on(...).catch is not a function

#

i think it is

#

wait

opal plank
#

you just assigning a listener

earnest phoenix
#

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

opal plank
#

you need to use that in your code

#

also like i said before

solemn leaf
#

@earnest phoenix actually bet

opal plank
#

the event is NOT called 'error'

earnest phoenix
#

Lol

vernal rivet
#

milk_think sounds boring

solemn leaf
#

what is the event

opal plank
#

wait

#

wrong link

slender thistle
#

Imagine shitting on people for wanting to engage in programming

opal plank
#

wtf

solemn leaf
opal plank
#

'uncaughtException' and 'unhandledRejection'

solemn leaf
#

what is the event

earnest phoenix
#

Im still trying to figure out how to make my bot able to let people choose the prefix for it

solemn leaf
#

@earnest phoenix god dam

faint prism
#

database

#

by guild id

solemn leaf
#

@earnest phoenix db.set(`prefix_${message.guild.id}`, args[0])

earnest phoenix
#

Yes, but how do i go to this 'database'

solemn leaf
#

npm i quick.db

earnest phoenix
#

I did that inside of command prompt, and it did some long ass message that i was afraid of

solemn leaf
#

prefix = await db.get(`prefix_${message.guild.id}`)

earnest phoenix
#

Lmaoo, im a joke

agile lance
#

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

solemn leaf
#

@agile lance no

#

I dont need your code, I can see the code telepathy

agile lance
#

@agile lance no
@solemn leaf What you mean?

#

Ohh

#

I can show it for reasons of learning

solemn leaf
#

come on

opal plank
#

dont fetch your prefix every call

solemn leaf
#

that had to be funny

#

no?

opal plank
#

thats bad code

agile lance
#

if(!command === "//help") { return message.channel.send("Unknown command. //help for commands.") }

opal plank
#

store your prefix on startup on memory

solemn leaf
#

erwin

agile lance
#

Ah

#

That’s the issue then

opal plank
#

?

solemn leaf
#

I legit was spoon feeding bad code for a reason

opal plank
#

imagine giving bad example

slender thistle
#

Why give bad examples in the first place

solemn leaf
#

I mean

#

its not that bad

#

if you program it right

opal plank
#

at least write in a different language like TS so people complaint they cant copy paste

slender thistle
#

Beginners don't know how to apply it properly

opal plank
solemn leaf
#

yarn

earnest phoenix
#

Beginners don't know how to apply it properly
@slender thistle I know, i have that problem all the time

faint prism
#

I legit was spoon feeding bad code for a reason
@solemn leaf don't give bad code. just explain good concepts

slender thistle
#

^^^^

solemn leaf
#

I mean I did kinda like 10 mins ago explain it barely

#

¯_(ツ)_/¯

vernal rivet
#

never give bad code

faint prism
#

yeah

solemn leaf
#

what

opal plank
#

startup = require all prefixes from database
for every prefix => map them
on message event, fetch it from the map rather than database
@earnest phoenix

solemn leaf
#

you want me to write the whole thing now

faint prism
#

no

slender thistle
#

Explain the logic

faint prism
#

explain

solemn leaf
#

startup = require all prefixes from database
for every prefix => map them
on message event, fetch it from the map rather than database

#

ez

#

done

opal plank
#

same thing i was doing to you

solemn leaf
#

ptb?

vernal rivet
#

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

solemn leaf
#

ptb?

opal plank
#

yes

solemn leaf
#

what

opal plank
#

public beta test

#

oublic test branch

#

something along those lines

opal plank
#

im too drunk to bother about the name

earnest phoenix
#

I'm a joke if i dont even understand that, no wonder i get clowned on everytime i come here ;-;

solemn leaf
#

lol once someone said I was gonna ip pull them with the canary link

vernal rivet
#

have you thought about learning more than what you already know?

opal plank
#

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

earnest phoenix
#

have you thought about learning more than what you already know?
@vernal rivet Thats what im doing right now

slender thistle
#

You get clowned because this community is a shitshow of unhelpful people willing to yell at everyone for not knowing something

vernal rivet
#

^^^

solemn leaf
#

hey guys

#

I dont know java

earnest phoenix
#

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

solemn leaf
#

r/roastme

faint prism
#

hmm not everyone

slender thistle
#

no one will make fun of you for not knowing a language
Are you sure?

opal plank
#

no one SHOULD make fun of you for not knowing a lang

#

i will bonk you for being stubborn, not for not knowing though

vernal rivet
#

^^^

solemn leaf
#

erwin

opal plank
#

?

solemn leaf
#

what is the event

slender thistle
#

But Auger, how many times have I had to yell to be helpful at people for yelling at beginners

earnest phoenix
#

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

solemn leaf
#

so

faint prism
#

I'm not saying it is the majority shiv

opal plank
#

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

agile lance
#

we all started somewhere
@opal plank Correct

slender thistle
#

Aye I need to stay calm as a representative of the script kids gang

faint prism
#

lol

solemn leaf
#

can I do this or something on the lines?

#
.on('uncaughtException','unhandledRejection', (err) => {
opal plank
#

is it me or mainly shiv me auger and tim carry this channel?

slender thistle
#

Not really

opal plank
#

you can chain on's

#

thats best you can do

vernal rivet
#

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.

opal plank
#

on.().on()

#

should be valid sytanx iirc

faint prism
#

I'm not even a js dev lol

solemn leaf
#

wait

opal plank
#

ik but we are mainly the ones here all the time

#

at least from what i see

slender thistle
#

I know Python for the most part and not even that advanced when it comes to threading/async stuff tbh bloblul

faint prism
#

I just actually study CS

solemn leaf
#

you want me to do this

#

bot.on('uncaughtException', (err) => {
}).on('unhandledRejection', (err) => { })

earnest phoenix
vernal rivet
#

whats python? is that the snake? thats boring

opal plank
#

that would work yes

#

also

#

not bot

#

bot doesnt emit those events

#

process does

slender thistle
#

It's not boring when you need fast and rapid deployment of calculating projects :^)

solemn leaf
#

ik

earnest phoenix
#

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

vernal rivet
#

that sounds boring still

earnest phoenix
#

@earnest phoenix embeds are ez

slender thistle
#

Custom prefixes are always nice

solemn leaf
#

I didnt mean to put that their

faint prism
#

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

solemn leaf
#

@earnest phoenix bet

earnest phoenix
#

@earnest phoenix embeds are ez
@earnest phoenix Im new, and i just started, lol

opal plank
#

i was against it tbh at least in discord

solemn leaf
#

erwin

opal plank
#

i implemented custom prefixes on twitch but that was a link issue

earnest phoenix
#

N....N-- New bot dev?

#

Nice

solemn leaf
#

remember sending embeds without the new discord embed

earnest phoenix
#

Glhf

opal plank
#

twitch recognized periords as links

#

10/10 twitch

slender thistle
#

lol what

solemn leaf
#

gg

opal plank
#

so i had to keep n as the prefix for my bot

#

for consistency

vernal rivet
#

remember to send the actually embed

opal plank
#

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

earnest phoenix
#

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

opal plank
#

like i said dude, we all start somewhere

solemn leaf
#

@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)
earnest phoenix
#

Yeah, i guess

opal plank
#

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

solemn leaf
#

ok

opal plank
#

its an event handler

vernal rivet
#

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.

solemn leaf
#

so is the buffer right?

opal plank
#

¯_(ツ)_/¯

#

that bit im letting you solve

slender thistle
#

Development is development

solemn leaf
#

fu

opal plank
#

like i said, we already provided 90% of what you needed

#

figure out the last bit of how buffer() works

slender thistle
#

You may not be considered advanced but you're still a dev

opal plank
#

^^

#

but if you store minecraft worlds in mongo you lose those priviledges

vernal rivet
#

^^

#

ahhhhhhh shit

slender thistle
#

Erwin, better yet...

solemn leaf
#

@opal plank at least tell me how to send

opal plank
#

i did aki

solemn leaf
#

🥺

slender thistle
#

Minecraft worlds in base64-encrypted files path of which is stored in hardass-encrypted mongo collection

opal plank
#

you actually had it

solemn leaf
#

me.send({ files: [{ attachment: buf, name: 'file.txt' }] })

opal plank
#

i can do one bvetter shiv

slender thistle
#

Just store it in RAM

faint prism
#

I vaguely remember getting a deprecation warning when using buffers in JS

solemn leaf
#
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

opal plank
#

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

faint prism
#

I think that's what he's trying to do with the buffer

opal plank
#

then decrypt the image

#

like i explained before, dont use that on an eval

#

use it on actual code

solemn leaf
#

I was gonna

opal plank
#

event listeners and evals dont work well together

solemn leaf
#

it worked once

#

then sent like 80 of them

#

so I put it in a test command?

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
@opal plank or just send binary directly

opal plank
#

indeed

faint prism
#

in a msg

opal plank
#

ah yes

#

split the message into 2000 at a time

solemn leaf
#

api spam

faint prism
#

then send it as a file

opal plank
#

you make it sound like i didnt get ratelimited more than 100 times past few days

#

ratelimit?

faint prism
#

a text file lol

opal plank
#

whats that?

#

some food?

faint prism
#

#ratelimitking

opal plank
#

#RateLiteWho?

solemn leaf
#

@opal plank

opal plank
#

never heard of

solemn leaf
#

should I just

faint prism
#

we are jesting btw about the encoding and binary. don't do anything that way

earnest phoenix
solemn leaf
#

put it in a empty script?

opal plank
#

events need to be on ur index

solemn leaf
#

ok

#

like where the bot turns on>?

opal plank
#

wherver your index is

solemn leaf
#

in your mom

#

cough sorry

opal plank
#

@earnest phoenix while that works just fine, please take some time to listen about our religion

earnest phoenix
#

We can make that a religion

opal plank
#

holdup finding it

#

gimme a sec

solemn leaf
#

wait

#

okay its in my index

#

right before the bot is on

opal plank
#

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

solemn leaf
#

it was only 10 ms faster

earnest phoenix
#

im new, please be gentle step bro

solemn leaf
#

Hey Woah

opal plank
#

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

solemn leaf
#

erwin

opal plank
#

returns an object

#

its just building it for you

solemn leaf
#

Json.encode it

earnest phoenix
#

Should it take me this long to make an embed thing

solemn leaf
#

JSON.stringify

opal plank
#

indeed, send it directly

earnest phoenix
#

Wait, huh?

opal plank
#

.send({embeds: {/*your embeds here*/}})

#

look at the picture i sent above

solemn leaf
#

@opal plank is it possible to code an embed

earnest phoenix
#

Alright

opal plank
#

all of those 3 are literally exactly the same result

#

but as you can see embed builder is WAY slower

earnest phoenix
#

Yes

solemn leaf
#

I only didnt use my embed builder on my ping command

opal plank
#

this should make it a bit easier to see the 3 different loops

solemn leaf
#

erwin

#

do I just wait

#

for the event to happen

opal plank
#

patience little grasshopper

#

or throw an error purposefully

earnest phoenix
#

What is this "raw embed" is that the name of your embed? or

opal plank
#

raw embed is me declaring it direclty into an object rather than a variable

earnest phoenix
#

I see

#

I'm actually learning

opal plank
#

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?

vernal rivet
#

What type is embed?

opal plank
#

object

#

Discord.EmbedResolveable iirc

vernal rivet
opal plank
#

if you want TS type

vernal rivet
#

Your not wrong

#

But I was hoping for MessageEmbed

opal plank
#

actually

#

holdup

solemn leaf
#
{"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}
vernal rivet
#

But I will take the L on that

opal plank
#

i think it might be that tbh

#

MessageEmbed

vernal rivet
#

That’s because it is lol

solemn leaf
#

MessageEmbed was v11

opal plank
#

not in code

vernal rivet
#

No

opal plank
#

in type

vernal rivet
#

RichEmbed is v11

#

MessageEmbed is v12

#

You can fact check me if you want to

opal plank
#

yeah though thats for the builder iirc

earnest phoenix
#

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'})

vernal rivet
#

Mhm

opal plank
#

im sending them as objects directly without type definition

vernal rivet
#

Sadly

opal plank
#

@earnest phoenix wrong

earnest phoenix
#

re

solemn leaf
#

waiting for the error be like

opal plank
#

imagine this scenario

solemn leaf
#

soooo

distant ledge
#

in newer versions of discord mobile apps, can you copy link inside the embeds?

vernal rivet
#

Do we need to teach what formal and actual parameters are kellyded

slender thistle
#

Do those exist in JS

vernal rivet
#

they exist in any language

slender thistle
#

I've honestly forgotten how they work lol

opal plank
#
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

earnest phoenix
#

.setTitle("fuck this title")

slender thistle
#

Quick Google search might help later anyway

opal plank
#

WITHOUT embed builders

vernal rivet
#

Formal is what is being asked, and actual is what is actually being passed through during the call

solemn leaf
#

erwin

opal plank
#

as i mentioned, they are bad habit code wise

solemn leaf
#

he is new dev

#

go easy

earnest phoenix
#

://

opal plank
#

its object manipulation

earnest phoenix
#

@opal plank you make the const before the if

slender thistle
#

Isn't embeds an array

earnest phoenix
#

Then manipulate the object

vernal rivet
#

It shouldn’t be

opal plank
#

erm

#

lemme check

earnest phoenix
#

Isnt an array

opal plank
#

i dont think so shiv

earnest phoenix
#

Fields is an array

opal plank
#

its object shiv

vernal rivet
#

It should be type of object

slender thistle
#

Weird naming then 🤔

solemn leaf
#

@opal plank what does lavalink do to get the search results on youtube without api

opal plank
#

anywho

earnest phoenix
#

[{ name: stuff, value: test }] this is fields

opal plank
#

@earnest phoenix how do i add

let a = {} //let a be an object

how do i add a property b onto a?

solemn leaf
#

@opal plank THAT IS REALLY HARD

opal plank
#

BE PATIENT FFS

solemn leaf
#

also why add {} to it

opal plank
#

IM ONLY ONE PERSON

solemn leaf
#

let a

opal plank
#

helping one at a time

solemn leaf
#

nothing else

opal plank
#

im helping cosmetic now

solemn leaf
#

does my code even work before I abuse my bot for hours

earnest phoenix
#

In helping, do u mean destroying every ounce of brain cell inside of me

opal plank
#

yes

vernal rivet
opal plank
#

what doesnt kill u makes u strongewr

earnest phoenix
#

Seems legit, lets keep going

vernal rivet
#

What if it does kill me? Does it make me weaker?

opal plank
#

that makes u dead

earnest phoenix
#

Lol

vernal rivet
#

Fair

#

I will take that answer

opal plank
#

anyway

#

costmetic

#

how do u add a property inside an object?

solemn leaf
#

imagine breaking rules

#

@earnest phoenix I cant fucking try it and see

#

I have to wait for the error

#

to pop

#

up

earnest phoenix
#

how do u add a property inside an object?
@opal plank Ummmm, I'm gonna have to go through this whole thing again

opal plank
#

here, lemm give u some docs then

earnest phoenix
#

alright

vernal rivet
#

throws w3schools at them

opal plank
earnest phoenix
#

Hahahaha

solemn leaf
#

HOW YOU GUESS

vernal rivet
solemn leaf
#

LMFAO

opal plank
#

i can give them mdn but w3 has interactive snippets, its way more noob friendly

vernal rivet
#

THATS A FUCKING JOKE OH MY GOD

earnest phoenix
#

ℹ️

#

object.property = value;

vernal rivet
#

I AM DIEING

earnest phoenix
#

Dying*

opal plank
#

mdn is BETTER, though it doesnt provide interactive snippets

#

most people like to see shit in action

solemn leaf
#

Loads the sights, aims the magazine .

opal plank
#

rather than just read it

valid frigate
#

msn also has interactive snippets no?

opal plank
#

i dont think so vysion

valid frigate
#

they write the web standard

vernal rivet
#

Mdn is good

valid frigate
#

wait they do have sandboxes

vernal rivet
#

I would have thrown stackoverflow at them tbh

opal plank
#

it IS good, they just dont priovide easy/moewd down/snippets explanation

solemn leaf
#

when stackoverflow is down

opal plank
#

i actually PREFER MDN

valid frigate
#

verbose

vernal rivet
#

Sadness \

opal plank
#

but for newbies i rather give w3

#

as its simpler

valid frigate
#

w3schoools is a bad resource imho trole

opal plank
#

for getting started i think its better

vernal rivet
#

You know what is better? This think called the YouTube’s

opal plank
#

for proper docs? no

solemn leaf
#

epic

valid frigate
#

youtube is a good learning tool for everything

opal plank
valid frigate
#

beautiful

opal plank
#

@vernal rivet

vernal rivet
#

Oh no

opal plank
#

[say that again punk

vernal rivet
#

I should run

opal plank
#

i dare you mofo

solemn leaf
#

its for the kids

vernal rivet
#

Ok on topic now

solemn leaf
#

ow my ewars

opal plank
#

@solemn leaf throw shit on your code to make it error on purpose

solemn leaf
#

erwin I need ear bandages

#

ok

opal plank
#

write this and watch your compiler go brrr

solemn leaf
#

lol

vernal rivet
#

Oh no

#

It’s a bomb

opal plank
#

notAvariable.forEach(kk)

solemn leaf
#

no

vernal rivet
solemn leaf
#

but ill do anyways

opal plank
#

should nicely error

#

preferably in one of your commands

#

so you dont kill your index

vernal rivet
#

As we still wait for our question to be answered

solemn leaf
#

haha

#

nooby

opal plank
solemn leaf
#

didnt error anything

opal plank
#

read what i said above

earnest phoenix
#

I- i dont understand a thing in this "w3"

vernal rivet
#

Why are you hitting me ;-;

opal plank
#

im hitting aki

solemn leaf
#

you want me to put it in a command

#

ok

opal plank
#

for evaling it rather than putting on commands like i said

vernal rivet
#

Ah ok

opal plank
#

evaling is inside its own vm iirc

vernal rivet
#

Also hold on

#

Let me go to the YouTube’s to find docs

opal plank
#

you too punk

vernal rivet
solemn leaf
#

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

vernal rivet
#

I am too lazy to do it, so your lucky

opal plank
#

i remeber you calling your client bot

solemn leaf
#

yeah

#

I forgot that

opal plank
solemn leaf
#

buffer.js:1038
return this.utf8Write(string, 0, this.length);
^

TypeError: argument must be a string

#

now wha

vernal rivet
#

When someone says “w3” is confusing

opal plank
#

now fix it

solemn leaf
#

I dont know what the error means

vernal rivet
#

Shoot me Erwin

solemn leaf
#

no

opal plank
#

with pleasure

solemn leaf
vernal rivet
#

Read the error, it tells you what is wrong

solemn leaf
#

err is a string

#

?

vernal rivet
#

No

worldly oriole
#

Hello

opal plank
#

im not gonna give much more info but you using the wrong buffer method

#

just fyi

#

before you go deeper into the rabbit hole

vernal rivet
#

Aren’t we already in a rabbit hole

solemn leaf
#

var buf = new Buffer(10)

opal plank
#

im just drunk

#

¯_(ツ)_/¯

vernal rivet
#

Fair

opal plank
#

wrong

vernal rivet
#

I am just dead inside

opal plank
#

this is legit the LAST bit of help i'll give you aki

#

ive given you more than enough to work with

vernal rivet
#

Are you sure you gave more than enough to work with, I just see words

opal plank
#

coding is just words which do fancy things

vernal rivet
#

YOU KNOW WHAT, your right

solemn leaf
#

erwin

vernal rivet
#

Programming is just words that do fancy things like blowing things up, like your mind

solemn leaf
#

how is that wrong

#

var buf = new Buffer([10, 20, 30, 40, 50]); is the only other method?

opal plank
#

¯_(ツ)_/¯

#

ive even given you the link

#

not doing more

worldly oriole
#

Hello

opal plank
#

o/

solemn leaf
#

your link isnt helping me for shit

opal plank
#

if you OPENED it and READ IT

#

it would