#development

1 messages · Page 1509 of 1

static trench
#

ya that didnt work. ill figure it out

solemn leaf
#

hold up

earnest phoenix
#

@solemn leaf console.log(n.assets);

static trench
#

ok cool thx

solemn leaf
#
RichPresenceAssets {
  largeText: 'Akiisqt (rank #1,922,131)',
  smallText: 'osu!',
  largeImage: '373344233077211136',
  smallImage: '373370493127884800'
}
earnest phoenix
#

@solemn leaf console.log(n.assets.largeText);

solemn leaf
#

how

#

I did that last time

#

thanks

earnest phoenix
#

lmao

solemn leaf
#

okay got it

#
let n = message.member.presence.activities.find(x => x.applicationID === "367827983903490050"), h = n.assets.largeText; console.log(h.split(" ")[0]);
earnest phoenix
#

@solemn leaf you should use a regex to remove the rank

#

instead of split

solemn leaf
#

could I like do

#

wait no

#

Im not good at regex you got like a good giude

earnest phoenix
#

/\w*?/

#

that's it

solemn leaf
#

.match

earnest phoenix
#

replace split with match and put that regex there

solemn leaf
lusty quest
#

wow i just started to read into Rust and i like it already, so much nicer language than js

#

wrong channel i guess

earnest phoenix
static trench
#

can a bot in 2 different languages be sharded?

lusty quest
#

so you want to use a Multi Language system on a sharded bot?

static trench
#

well no?

lusty quest
#

or a bot written in 2 different Programing Languages?

static trench
#

im using a JS eval command and a py bot

earnest phoenix
#

bruh

static trench
#

lol

#

sue me

lusty quest
#

idk if its possible but i guess it could

static trench
#

ok

sudden geyser
#

It's possible.

#

just some FFI bindings

earnest phoenix
#

or a node process inside a python process

sudden geyser
#

ew

slender hamlet
#

thats uh

#

interesting

neat harness
#

@earnest phoenix Help me a little

slender hamlet
#

first time ive heard of something like that

neat harness
#

So uhh

#

I removed my bot's permissions

lusty quest
#

its quite common that you use 2 different languages to build applications

neat harness
#

And it responded properly

earnest phoenix
slender hamlet
#

oh um

#

thats odd, did it cause any issues?

lusty quest
#

its possible that an Website you use frequently uses a Backend that uses GO and JS

earnest phoenix
#

a lot of proper quality applications are built with 3+ languages

neat harness
#

And then

#

When I gave the bot the permission

slender hamlet
#

what do channel perms look like

earnest phoenix
#

@neat harness betterdiscord detected

slender hamlet
#

you might want to check the bot's perms for a channel before sending in it

neat harness
#
/home/kayuimineko/NekoNeko/node_modules/discord.js/src/rest/RequestHandler.js:154
      throw new DiscordAPIError(request.path, data, request.method, res.status);
            ^

DiscordAPIError: Missing Permissions
    at RequestHandler.execute (/home/kayuimineko/NekoNeko/node_modules/discord.js/src/rest/RequestHandler.js:154:13)
    at processTicksAndRejections (node:internal/process/task_queues:93:5)
    at async RequestHandler.push (/home/kayuimineko/NekoNeko/node_modules/discord.js/src/rest/RequestHandler.js:39:14) {
  method: 'post',
  path: '/channels/797092671944392735/messages',
  code: 50013,
  httpStatus: 403
}
[nodemon] app crashed - waiting for file changes before starting...
#

This turns out

slender hamlet
#

maybe that could help

slender hamlet
neat harness
#

When it doesn't this pops out

earnest phoenix
#

take use of discord's view as role feature and view your guild as your bot's roles and truly verify if you set the correct permissions

neat harness
earnest phoenix
#

I just do this:

bot.on("message", async (message) => {
if (!message.guild.me.hasPermission("SEND_MESSAGES")) return;
});
neat harness
#

I'm too old with discord to realize such a feature

slender hamlet
#

yeah

neat harness
earnest phoenix
#

it gets messy with channel overwrites

#

You cant

neat harness
neat harness
slender hamlet
#

otherwise return

neat harness
earnest phoenix
#

You need to send a message to warn them that you dont have send message perms

slender hamlet
#

^^

slender hamlet
#

my bot has a dm feature which you can opt in/out

earnest phoenix
#

It clearly says THAT CHANNEL not the current one

neat harness
slender hamlet
#

ik

#

so implement something that checks if the user wants dms, if so then dm then

#

otherwise, just return

#

i dont know if its against the rules to always dm for no perms

neat harness
earnest phoenix
#

Why do you want to remind people that your bot doesnt have perms to send messages when they dont want your bot to send messages

neat harness
#

As long as it's within the person using the command

#

Not some random text then saying the bot doesn't have perms

slender hamlet
neat harness
slender hamlet
#

its just a peace of mind feature

earnest phoenix
#

that channel not the current one

crimson vapor
#
  async fetchMessages(num) {
    const req = await this.#shard.client.api().channels[this.id][`messages?limit=${parseInt(num)}`].get()
    if(req.code) throw new Error(req.message);
    return req;
  }

  async bulkDelete(num) {
    const messages = this.fetchMessages(num).map(msg => msg.id);
    const req = await this.#shard.client.api().channels[this.id].messages['bulk-delete'].post({
      body: { messages: messages }
    })
    if(req.code) throw new Error(req.message);
    return req;
  }``` this is how I would fetch and delete messages right?
earnest phoenix
#

@crimson vapor what the fuck is this shit

slender hamlet
crimson vapor
#

this.#shard.client.api().x.y.z is essentially fetch('x/y/z')

earnest phoenix
#

how are you able to put $ or # as part of the property name

slender hamlet
#

so then you'd want it to be #shard.client.api().(this.id), no?

crimson vapor
#

makes it private or something

slender hamlet
#

or am i misunderstanding

earnest phoenix
#

what exactly does private mean

unborn venture
#

does anyone know how to make a confess order?

crimson vapor
#

like

slender hamlet
#

ah wait

crimson vapor
#

console.log() wont show it

#

and only accessable by this.#shard

slender hamlet
earnest phoenix
#

and you cant make references to it in other objects I presume

crimson vapor
#

nope

earnest phoenix
#

well fuck

crimson vapor
#

why?

slender hamlet
#

it means other classes can't refernce it iirc

crimson vapor
#

yep

#

no reason for them to

#

fetchMessages code works

slender hamlet
#

ok

#

im not too familiar with shards so my bad

pure lion
#

does anyone know how i can evaluate python code on node? I cant find any safe packages so i was wondering if there was an api

neat harness
#

I found the problem

#

It's discord's fault

slender hamlet
#

lmao rip

neat harness
#

I have 2 roles colliding

neat harness
#

@ everyone has the perms revoked

slender hamlet
neat harness
#

While the @ Bots has it granted

pure lion
neat harness
#

Discord shouldn't make that

slender hamlet
#

yeah i was just joking

#

roles can get kinda confusing, but i dont think discord is at fault

neat harness
#

So it detects that it has the role

earnest phoenix
neat harness
#

I mean perms

slender hamlet
#

they have a robust role system, its just hard to grasp

pure lion
neat harness
#

It has perms, then when it tries to send

earnest phoenix
#

I dont see the point of using more than one language for the backend

slender hamlet
#

^^

neat harness
#

I tried using the view as role

slender hamlet
#

but you do you

neat harness
#

I can

slender hamlet
neat harness
#

But then discord doesn't let my bot do it through the api

pure lion
#

code im not using more than one language i just want to eval stuff and get the result

earnest phoenix
#

@pure lion ok

#

you can make a repl

neat harness
#

How dumb is that...

earnest phoenix
#

with an http server

slender hamlet
#

or just eval in general

earnest phoenix
#

do some authorization to eval stuff there

#

done

slender hamlet
#

you can get some pretty good math modules

pure lion
#

hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

slender hamlet
#

on npm

pure lion
slender hamlet
#

ok i asked earlier

#

so what are you looking to do with eval

#

im not questioning you, just seeing if it could be solved otherwise

#

with a different method

shrewd creek
#

ppl i got this error how to get rid of it??

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In content: Must be 2000 or fewer in length

slender hamlet
#

message too long

earnest phoenix
#

have you tried reading the error

shrewd creek
#

yea

slender hamlet
#

what does the last sentence say?

shrewd creek
#

is there any work around

earnest phoenix
#

split your string into chunks every 2000 chars

slender hamlet
#

how do i take something long, and make it shorter 🤔

shrewd creek
#

ahhhhh

#

thx dumb me brain

slender hamlet
#

if its an embed then just make the fields shorter

slender hamlet
shrewd creek
#

thx guys

slender hamlet
#

sometimes errors can be quite cryptic

#

but what little you can get is sometimes more than enough

shrewd creek
#

hmmm

fervent goblet
#

anyone know anything about getting a color from args and converting into a hex?

#

discord.js

crystal wigeon
#

hey guys so umm can i pass a function to my jobs in node resque and then execute that function in the job?

#

more like dynamically create the name of the func in the jobs

#

and then exec it

earnest phoenix
#

!help

crystal wigeon
#

@umbral zealot if you're still here

slender hamlet
#

as in the user gives a color name?

#

that would be a little hard because you'd need a bit dataset of color names

fervent goblet
#

like changing the role color

#

idk i thought someone wouldve made an api for it or smth

slender hamlet
#

so a color name, or hex?

#

or both

fervent goblet
#

ye

#

search by either

slender hamlet
#

ok

#

let me check npm

#

maybe theres a module

#

a potential option

#

says it has hex and string constructors

fervent goblet
solemn leaf
#

you know how to edit the metadata length ?

slender hamlet
#

yeah i was boutta paste that

fervent goblet
#

lel

slender hamlet
#

so either one

fervent goblet
#

well

slender hamlet
#

your choice

fervent goblet
#

thanks

slender hamlet
#

np

slender hamlet
#

the role metadata or you talking about smth else

solemn leaf
#

I want to edit the hex data for the tag for length on a file

slender hamlet
#

tag for length?

solemn leaf
#

yes

slender hamlet
#

sorry could you explain

#

im not following lol

solemn leaf
#

its complex

slender hamlet
#

ok

solemn leaf
#

so

slender hamlet
#

ah wait

#

i just realized

#

ok

solemn leaf
#

ina-

slender hamlet
#

yeah

#

ik what uou mean

solemn leaf
#

you do?

#

how do I change the hex

slender hamlet
#

i'm not entirely sure thats possible

solemn leaf
#

it is

slender hamlet
#

at least, programmatically speaking

#

if it is, then i don't know a way

solemn leaf
#

that one didnt work

#

think I didnt remove the right byte array

slender hamlet
#

ah, i thought you meant with a node program or smth

#

lmao

#

lets see here

solemn leaf
#

Its how this is done

earnest phoenix
slender hamlet
#

yeah

solemn leaf
#

I know how to do it

#

just not how to translate it

#

like

#

what

#

maybe I can inspect it?

#

idk

slender hamlet
#

i tried a few days back

#

its a little difficult to grasp

solemn leaf
#

a little?

slender hamlet
#

yeah, just a little bit

solemn leaf
#

I spent 2 nights on it

#

heck soda cant even figure it out

slender hamlet
#

ill look at it again, maybe i can figure something out

solemn leaf
#

well here is the chase I got

#

mvhd is circled in red, time scale in black, and duration is highlighted.

slender hamlet
#

ok

solemn leaf
#
6D 76 68 64 00 74 35 B3 B2 63 B4 00 E0 2A 53 E6 80 C4 FF FB E4 44 ED 0E E7 3C 3D CC 03 DD D8 EB 67 A9 70 77 DB 50 5C BC F5 32 6F 77 61 43 A8 9E E6 09 DE 65 B2 88 6A B9 DE 17 28 4C 51 42 8C 29
#

gl

slender hamlet
#

so here's the thing, i've been able to replicate the effect before, but not manually

#

i only recently started looking into how i could do this through modification of the hex code

#

so i'll see what my method does that im missing

cinder patio
#

So that FF FF FF FF is the duration metadata of the audio?

slender hamlet
#

@solemn leaf, here's what i find most interesting...

#

you can actually see the borders between the two files

solemn leaf
#

its either the one before it or ff

#

also its in seconds

#

the video is 251 seconds long

slender hamlet
#

the first file

cinder patio
#

then FFFFFF cannot be the duration cause FFFFFF is 16777215

slender hamlet
#

im trying to figure out how they got it to stop

#

oggs is how an ogg file starts

#

so theres something up here

solemn leaf
#

no no

#

the data above was for the .mp4

#

this

slender hamlet
#

wait a minute

solemn leaf
#

well

#

for the ogg im pretty sure its vendor string length (32 bit unsigned quantity specifying number of octets)

#

@cinder patio so what is 00 00 03 E8

cinder patio
#

exactly 1000

solemn leaf
#

The length value is stored in Samples, so you can convert that to hex and search for the value. It should be just a few bytes behind the "OggS" string.

cinder patio
#

String OggS is 4F 67 67 53 in base-16

slender hamlet
#

yes

deft lark
#

hi

solemn leaf
#

hex to dec

slender hamlet
#

i'm gonna try something and it may or may not work

solemn leaf
#

1332176723

#

wait

#

guys

cinder patio
#

there can be multiple metadata containers

solemn leaf
#

yeah but this is something

#

so

#

I think they deleted all the bytes

cinder patio
#

they?

solemn leaf
#

the person who made the file

#

the file didnt just randomly appear

trim saddle
#

@pale vessel my buffer stuff isn't working

cinder patio
#

Oh so that's a file that's been tampered with

#

to delete the duration metadata?

solemn leaf
#

@trim saddle show

#

yeah

trim saddle
#
import * as f from "file-type"
import * as fs from "fs"

class PetalsFile {
    baseString: string
    buffer: Buffer
    constructor(path: string | Buffer) {
        console.log(path)
        if (Buffer.isBuffer(path)) {
            this.buffer = path
            this.baseString = path.toString("base64")
        }
        else {
            this.baseString = fs.readFileSync(path, { encoding: "base64" })
            this.buffer = Buffer.from(this.baseString)
        }
    }

    async stringify() {
        const b = await f.fromBuffer(this.buffer)
        console.log(b)
        return `data:${b.mime};base64,${this.baseString}`
    }
}

export default PetalsFile
solemn leaf
#

what are you buffering

#

also

trim saddle
#

any filepath or buffer that comes through

solemn leaf
#

Buffer#from()

#

has a encoding with it

#

you can change it

pale vessel
#

Buffer.from(this.baseString, "base64")

#

@trim saddle

trim saddle
#

am doing so

#

fricking module to get the mimetype keeps returning undefined

pale vessel
#

you need to use Buffer.from() to use toString("base64")

solemn leaf
#

a

#

a

#

My internet cu- just went back on

trim saddle
#

but path would be provided by the user

solemn leaf
#

top is a normal ogg file

#

its 4mins and 14secs long

#

@trim saddle what is the path

trim saddle
#

it's a buffer

#

i think i need a new module to find the mimetype

#

everything else seems to work just fine

solemn leaf
#

what is rn'

trim saddle
#

rn?

solemn leaf
#

@cinder patio I think I did it

#

I DID

#

but its 0/0

cinder patio
#

nice, which bytes did you delete?

solemn leaf
#

can you translate these to a number?

slender hamlet
#

im not sure if this worked

#

ok yeah it didnt looks like

solemn leaf
#

yeah

#

you did what I did

#

we need to add the length now

cinder patio
#

that would be a very large number Aki, the duration of the file would most likely be 4-8 bytes

solemn leaf
#

yeah

#

but where is it

slender hamlet
#

ah lmao

cinder patio
#

Are sure it's in the selected bytes in the screenshot

slender hamlet
#

i saved the bytes as plaintext

#

im an idiot

solemn leaf
#

send

#

that would be nice

slender hamlet
#

yah fixing it

solemn leaf
#

bcs you cant copy and paste here

#

@cinder patio according to the site yes

#

wait no

#

@cinder patio

#

its more

#

wait nvm

#

so

#

this is for the already broke .ogg

slender hamlet
#

ok lets see

#

well it kinda worked

solemn leaf
#

nice

#

I found a reddit page on it

slender hamlet
#

intersting

solemn leaf
#

dont mind the top

#

read the bottom

#

it defines the stuff you need to know about the headers

slender hamlet
#

ah

#

interesting

trim saddle
#

yeah i need help getting the mimetype

#

because what i'm using is not giving it to me

slender hamlet
#

lmao i just realized something

#

if you pause the second file it glitches out when you resume it

#

for me at least

#

oh never mind

solemn leaf
#

@trim saddle what you using rn

slender hamlet
#

when it reaches the end of file 2

#

then it does

#

ok imma eat now cya

solemn leaf
#

kk

trim saddle
#

file-type

solemn leaf
#

you only using it for that?

trim saddle
#

yeah

solemn leaf
trim saddle
#

doesn't look like i can retrieve with this

cinder patio
#

Aki... your goal is to change the duration metadata of an ogg file right

solemn leaf
#

@ember atlas

#

well it went to being mp4 to mp3 now ogg

ember atlas
#

hi

trim saddle
#

pov: you've never felt the touch of a woman

pale vessel
#

hi

solemn leaf
#

boss

#

you just gonna ignore the spam

ember atlas
#

No, I am doing other things that you do not have access to do.

#

:)

solemn leaf
#

now I do

#

im in the main frame

ember atlas
#

what did i do then

trim saddle
#

boss

#

you have a brain right?

cinder patio
#

Well, looking at the ogg header, it doesn't look like you can get the duration from it, so it won't be that simple

ember atlas
#

i do

#

why

trim saddle
#

i need help retrieving a mimetype from a buffer

solemn leaf
ember atlas
trim saddle
#

i can't retrieve with that

solemn leaf
#

what are you needing to retreive?

trim saddle
solemn leaf
#

now back to your room^

trim saddle
#

i need to get a mime type back from a buffer.

#

and file-type isn't working it seems

ember atlas
pale vessel
#

I use file-type for buffers

#

and it works

trim saddle
#

well then

cinder patio
trim saddle
solemn leaf
pale vessel
#

the path isn't a Buffer instance?

trim saddle
#

yes

pale vessel
#

why

trim saddle
#

it should always be

solemn leaf
cinder patio
#

Skull, what files are you trying the code against

trim saddle
#

i'm looking

#

i'm not excluding

cinder patio
#

no but like with what buffer are you testing if it works or not

#

buffer from what type of file

trim saddle
#

uhh

cinder patio
#

text file? png? svg?

trim saddle
#
const testFile = fs.readFileSync("./tsconfig.json", { encoding: "base64" })
// ...
await msg.channel.send({file: new PetalsFile(Buffer.from(testFile, "base64"))})

my tsconfig

solemn leaf
#

I think they want to do all

cinder patio
#

I'm pretty sure file-type cannot recognize json files

trim saddle
#

how

cinder patio
#

it can only recognize binary-based formats, aka files which store buffer (think png)

#

json stores plain text

trim saddle
#

i mean

#

yeah

#

but the module still isn't giving me anything back

cinder patio
#

did you try with a different type of file? like a png

#

or an audio file

trim saddle
#

uh i can get one for testing

drifting wedge
#

how would i make like a div or something, that stays in my bottom right of my screen

#

that would like be fixed, so if i scroll up, it would too

#

and it doesnt like interact with the other elements?

trim saddle
#

position: static iirc

mellow kelp
#

*fixed

drifting wedge
#

static?

trim saddle
#

i think so

drifting wedge
#

fixed just made the entire thing disapear lmfao

mellow kelp
#

Lmao

#

But like

#

Use bottom and left

drifting wedge
#

bottom and left?

#

wot

#

left auto

#

?

mellow kelp
#

Like

cinder patio
drifting wedge
#

top 100%?

mellow kelp
#

left: 0

drifting wedge
#

right 0?

mellow kelp
#

That makes it go to the left

trim saddle
#

hm,

cinder patio
#

so, you cannot use file-type to get the type of the buffer for some file types. I'm not sure what you're doing, but if the user has to choose a file, simply read the file's extension to figure out the right mime-type

trim saddle
#

alright

#

the image produced a different result

drifting wedge
#

uhh also, how can i make the width of the thing

#

like the amount of characters

trim saddle
#

now discord thinks i'm sending an empty message

drifting wedge
#

so like, its not constant

trim saddle
#

width: 95%

drifting wedge
#

like its however long the chars are

cinder patio
#

try auto

earnest phoenix
#

how can this return undefined

#

I'm seeing it more that the bot returns on normally working things, undefined.

trim saddle
#

message.channel?

earnest phoenix
#

should i try that?

quartz kindle
#

can you eval message.guild?

trim saddle
#

yes

earnest phoenix
drifting wedge
#

like auto makes it the entire pagee

earnest phoenix
#

If I eval message.guild

#

It's very weird

quartz kindle
#

are you using regular discord.js?

earnest phoenix
#

Yea

drifting wedge
#

i wanna make it like padding, but not the entire page

quartz kindle
#

which version?

drifting wedge
#

just however big the chars are

earnest phoenix
#

Lemme check

#

12.5..1

quartz kindle
#

did you ever do guild.fetch?

earnest phoenix
#

No

trim saddle
#

REEE

#

discord thinks i'm sending an empty message

quartz kindle
#

do you have any code that uses invites?

earnest phoenix
#

No

whole condor
#

Hmmm... Where do you see 400k? Because I never said that.

trim saddle
#

ah yes

solemn latch
#

Looks empty to me

quartz kindle
# earnest phoenix No

i've seen that happen in discord.js-light, and it was a bug with server invites, but i've never seen that happen in discord.js, no idea what it could be

trim saddle
#

i like how when i google my problems

#

the solutions are to libs

native narwhal
#

Hello all you awesome devs

trim saddle
#

joak is still alive

native narwhal
#

Always

trim saddle
#

you seem to have smarts

#

can i ask you for help with my predicament?

native narwhal
#

Go ahead

#

Perhaps I can help perhaps I can't

#

I will do what I can

trim saddle
#

discord thinks i'm sending empty messages when i try to send a data uri file

quartz kindle
#

data uri is not a buffer resolvable

trim saddle
#

what does that mean?

cinder patio
#

Turn the uri to a buffer

#

Buffer.from

trim saddle
#

so i should send a buffer to discord is what you're saying.

quartz kindle
#

Buffer.from(dataUrl.split(",")[1], 'base64')

native narwhal
#

A bunch of other smart people here to help you already

trim saddle
#

all they need is the base64 of the data???

quartz kindle
#

yes

trim saddle
#

I WASTED SO MUCH TIME

#

FUCK

quartz kindle
#

they get the file type from the file extension, so if you name it whatever.png it whould work

native narwhal
#

No time is wasted, it's all just a means to an end

cinder patio
#

base64 is just a different way to represent an image buffer

trim saddle
#

so i assume they actually need the data uri if i'm sending image data in edit payloads

quartz kindle
#

you cant send image data in edits

trim saddle
#

guild icon?

#

user pfp?

#

@quartz kindle so a little snag

#

discord also thinks the data string is empty

quartz kindle
#

files:[{attachment:Buffer.from(data), name:"whatever.png"}]

trim saddle
#

oh ok

earnest phoenix
#

It now does not returns undefined, but the server name

quartz kindle
#

yes but that should never happen in discord.js

#

guilds should always be cached

opal plank
#

past that point

earnest phoenix
#

hello i would like to get a rank, how do i get in?

opal plank
#

get your bot approved

earnest phoenix
#

how?

errant perch
opal plank
opal plank
solemn latch
#

well

earnest phoenix
#

ok

opal plank
#

verification in top.gg is not verification on discord

errant perch
opal plank
#

then you were unlucky like me

#

head over here

errant perch
#

ok

opal plank
#

ask in the =verificationc hannel

#

rabbit should be the one taking care of submissions iirc

prisma trail
#

Oops wrong link

opal plank
#

not testers, developers

errant perch
#

thanks for pointing me in the right direction

opal plank
#

np

prisma trail
#

Rabbit Tank?

opal plank
#

correct

whole condor
prisma trail
#

Rabbit tank is kadybat on discord

#

That's confusing

opal plank
#

which sounds really bad once we actually went and found out it wasnt anything like that

whole condor
opal plank
#

well yeah, like i said, its not me you need to talk to about it, its them

whole condor
#

Don't worry, I've already told him and he realized himself.

opal plank
#

all good

trim saddle
#

{files: [{attachment: "...", name: "e.png"}]}
@quartz kindle still empty

#

i thought only webhooks could use files

earnest phoenix
#

how do I make my bot say something when it joins someone’s server? like dank memes

timber fractal
#

how can i make my command like if someone used the command it waits for 3 options like "1" " "2" "3" and it waits for one of the options without a prefix?

craggy pine
#

Not quite sure what you were doing | but since you were talking about gifs and avatars... My bot is a static image with keyframes to animate it like it's floating.

trim saddle
#

on member join event?

earnest phoenix
#

Like, if it joins a server it says something

timber fractal
trim saddle
#

i just told you

#

oh

trim saddle
#

oh

#

guild join

#

or something

earnest phoenix
#

Yes you are

trim saddle
#

read your docs

earnest phoenix
#

Can ya send?

craggy pine
#

Coder is in the names but doesn't know how to find the docs of their library Thinkies Which lib are you using?

trim saddle
#

idk what lib you're using.

umbral zealot
#

Sounds like you need awaitMessages

timber fractal
#

ye i know

#

but how than?

earnest phoenix
#

@trim saddle discord.Js

timber fractal
#

i already tried some but dont really works

umbral zealot
#

Well... what, are you expecting us to write it for you? The library has examples.

earnest phoenix
#

There’s no about guild joins @umbral zealot

timber fractal
#

u have a github repo maybe?

earnest phoenix
#

Nope

craggy pine
#

There totally is

umbral zealot
#

If you've tried something, show us what you did and tell us what doesn't work instead of "how do I do this" from scratch?

earnest phoenix
#

Uh lol

timber fractal
earnest phoenix
#

@craggy pine what do I search in it?

craggy pine
#

"guild"

timber fractal
earnest phoenix
#

I did bruh..

timber fractal
#

thx

umbral zealot
craggy pine
#

wow that was hard.

umbral zealot
timber fractal
umbral zealot
#

screenshots? ShareX. Great app, awesome app 😄

timber fractal
craggy pine
solemn latch
#

what...

#

copy paste 😛

umbral zealot
#

We use a thing called... copy/paste ?

#

it's been around for like 30 years now.

trim saddle
#

jesus fuck

timber fractal
#

i know just kidding @solemn latch @umbral zealot

trim saddle
#

they don't keep a client#on anywhere

solemn latch
#

woo tech tips, control + c to copy, control + v to paste pogey

timber fractal
solemn latch
#

it scares me devs dont use hotkeys

craggy pine
#

To copy it's Alt + f4 have fun.

timber fractal
quartz kindle
#

alt + f4 enables cheats in video games

timber fractal
#

LMFAO

craggy pine
timber fractal
#

i know what happens LOL

quartz kindle
#

ngl i fell for that once

earnest phoenix
#

I can’t find it @trim saddle

timber fractal
#

||How do you use spoilers?||

craggy pine
#

I think we all have fell for it once in our lives.

trim saddle
#

i just sent you the event.

earnest phoenix
#

||Like this ||

#

@trim saddle can’t find

timber fractal
earnest phoenix
#

||Yes||

trim saddle
#

click the link instead of playing with spoilers

pale vessel
#

please stop

#

get some help

timber fractal
trim saddle
#

don't ask

timber fractal
#

oh okay

#

why not lol

earnest phoenix
#

Easy

#

Lol

timber fractal
earnest phoenix
trim saddle
#

because discord is giving me a headache

timber fractal
#

lol

earnest phoenix
craggy pine
#

earnest phoenix
timber fractal
#

HOOOOOOW

earnest phoenix
timber fractal
#

STOP SPAM

trim saddle
#

can you not spam

craggy pine
#

Chill @earnest phoenix

earnest phoenix
#

Ok lol

timber fractal
#

and tell me how

#

/\

#

///\

#

//\

umbral zealot
#

Guys, stop shitposting.

timber fractal
#

Tell me how pls

umbral zealot
#

This is not the place to teach you how to do spaces on your computer

mellow kelp
#

bruh you're giving him more attention

trim saddle
#

@pale vessel {file: {attachment: "FATFUCKINGBASE64STRING", name: "anything.png"}}
tell me this is wrong

timber fractal
pale vessel
#

this is wrong

umbral zealot
#

Go write your bot or something

trim saddle
#

i legit can't figure out the issue

#

i think discord is fucking with me

umbral zealot
#

can you repeat your original problem because at this point the children screaming and smearing crap everywhere have obscured what you needed help with

trim saddle
#

so

#

i'm trying to send a file to discord

timber fractal
#

_ _

#

FOUND IT

umbral zealot
#

Which lib/language?

trim saddle
#

i'm making my own lib

umbral zealot
#

which language then

trim saddle
#

js

umbral zealot
#

Ok and the issue you're having it.... ?

trim saddle
#

so i'm sending this basically
{file: {attachment: "FATFUCKINGBASE64STRING", name: "anything.png"}}

#

and discord keeps saying i'm sending an empty message

umbral zealot
#

You seem to be thinking that using the format Discord.js uses magically works... it doesn't.

trim saddle
#

@quartz kindle you fucked me

trim saddle
#

i still can't tell what i'm supposed to send a file as

quartz kindle
#

show your code

trim saddle
#

this is my file class

import * as f from "file-type"
import * as fs from "fs"

class PetalsFile {
    baseString: string
    filename: string
    buffer: Buffer
    constructor(path: string | Buffer, filename: string) {
        this.filename = filename
        if (Buffer.isBuffer(path)) {
            this.buffer = path
            this.baseString = path.toString("base64")
        }
        else {
            this.baseString = fs.readFileSync(path, { encoding: "base64" })
            this.buffer = Buffer.from(this.baseString, "base64")
        }
    }

    async stringify() {
        const b = await f.fromBuffer(this.buffer)
        return `data:${b.mime};base64,${this.baseString}`
    }
    get toJSON() {
        return { attachment: this.baseString, name: this.filename }
    }
}

export default PetalsFile
pale vessel
#

lmao

quartz kindle
#

you're supposed to send the buffer, not the string

#

@_@

trim saddle
#

sooooo

pale vessel
#

you need to change the content-type to multipart form-data and pass payload_json or something

trim saddle
#

a bare buffer

pale vessel
#

did you read docs

trim saddle
#

man

pale vessel
#

woman

umbral zealot
#

child

misty sigil
#

adult

pale vessel
umbral zealot
#

Just to give you an idea, it takes 37.4k lines of code for discord.js to work.

#

Keep that in perspective.

quartz kindle
#

i told you since the beginning that you're supposed to send the buffer

#

Buffer.from(dataURI)

umbral zealot
#

But it's also a complete library that does all that a library is expected to do.

knotty obsidian
#

When I get the UNKNOWN_BAN error in the handler I want it to return so it wouldn't continue. But it only returns the thread. How can I make it return the class?

ErrorHandler handler = new ErrorHandler();
handler.handle(ErrorResponse.UNKNOWN_BAN, (error) -> {
    event.getChannel().sendMessage("This user isn't banned!").queue();
    return;
});

(java)

umbral zealot
#

As I said. Just putting things into perspective.

quartz kindle
#

it does more than what a lib is supposed to do

#

it also babysits people

pure lion
#

cough ourcord

misty sigil
#

uncough i'm leaving

quartz kindle
#

lmao

umbral zealot
#

I mean discord.js devs literally keep saying they don't want to cater to noobs which is pretty funny I guess.

pure lion
#

bruh really

#

:l

misty sigil
#

thats fucking

#

hilarious

pure lion
#

also im gonna ask the question

#

let me just phrase myself

#

so I want to decode a gif so that i can iterate through each frame and add a picture as an alpha layer

#

but the lib that im using, gif-frames, throws an error when i try to decode the frame to canvas:

solemn latch
#

not compatible right?

knotty obsidian
pure lion
pure lion
solemn latch
#

oh, yeah gif-frames is looking for a document as in a webpage

#

which you dont have.

pure lion
#

feck

trim saddle
#

@umbral zealot alright so i got the multipart crap set up

pure lion
trim saddle
#

how exactly am i supposed to send the file, all discord leaves in docs is file content

solemn latch
knotty obsidian
#

how wud i do that ;-;

pure lion
solemn latch
#

then put it in canvas

pure lion
knotty obsidian
#

return me.scorpion37.scorp37.Moderation.class;?

#

never returned a class before >-<

#

@pure lion

pure lion
#

@knotty obsidian i dont do java

knotty obsidian
#

oh

pure lion
#

but in basically all of the coding languages

#
return "<thing you want to return>"```
knotty obsidian
#

Void methods cannot return a value

#

not every i guess

misty sigil
#

type it so that it can

knotty obsidian
#

wot

pure lion
#

the method returns a void so you need to change the return type

knotty obsidian
#

ou

pure lion
#

handler.handle probably returns a void

knotty obsidian
#

¯_(ツ)_/¯

pure lion
#

no it does

solemn leaf
#
if (bot.categories.owner.has(cmd) && !message.author.id === "485987127809671168") return;

How can I do soemthing like this error was

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'has' of undefined

I have no idea on how to do this it was just idea

gilded olive
#

F

solemn leaf
#

?

true ravine
#

I'm trying to make an object where the property name is a variable, but obviously if you just put the variable name it uses the variable name not the value. What is the correct way to do this?

Example of what I want:

name = "whateveriwant"
mything = {
  [name]:"epic"
}
solemn leaf
#

what

mellow kelp
#

that's exactly how you do it KEKW

solemn leaf
#

me?

mellow kelp
#

i meant @true ravine

true ravine
#

Wait

solemn leaf
#

ok

mellow kelp
#

wait you meant js?

#

or py

true ravine
#

Js

solemn leaf
#

can you help me with mine after

mellow kelp
true ravine
#

Wow I am too smart for my own good, thank you lol

mellow kelp
#

aight, np

solemn leaf
#

el

#

el

civic jasper
#

anyone know?

solemn leaf
#
    let ownerCMDs = bot.categories.has('owner');
    if (!ownerCMDs.toString().includes(cmd) && message.author.id !== "485987127809671168") return;

I want this to return if the member sending this uses a command that is in the categories, and if their id isn't mine.

#

all commands work but owner commands

#

it should be letting me us owner commands

earnest phoenix
#

Bruh

#

<Collection>#has() returns a boolean

solemn leaf
#

so

#

!(ownerCd

#

no?

#

ok

solemn latch
#

im confused on why you are tostringing a bool and then checking if it includes cmd

buoyant aspen
#

Assume my code is:

let array = ['a', 'b', 'c'];
array.forEach(element => console.log(???));
```How could I log the position of `element` to the console? (I.E. it should return:
```md
"0"
"1"
"2"
```)
civic jasper
solemn leaf
#

@ownerCMDs.includes is not a function

#

ownerCmds = [ 'eval', 'reload' ]

#

@buoyant aspen

solemn latch
#

@buoyant aspen foreach has an index

solemn leaf
#

why did you beat me to it

#

array.forEach((element, i) => console.log(???));

buoyant aspen
solemn latch
solemn leaf
#

woo

#

I need help

buoyant aspen
#

ah sorry aki I see

solemn latch
#

did you change your definition of let ownerCMDs = bot.categories.has('owner');

buoyant aspen
#

my bad

solemn leaf
#

no

#

why would I

solemn latch
#

npnp, i did the same thing too @buoyant aspen

#

ownerCMDs is a boolean

#

!ownerCMDs.toString().includes(cmd) makes no sense on a boolean.

solemn leaf
#

im idoit

#

thanks

quiet ridge
buoyant aspen
#

ffs

quiet ridge
#

:)

#

the one time I look at this channel and I see you

buoyant aspen
#

why do you just happen to be looking here

quiet ridge
#

I really don't know

buoyant aspen
#

the one time I use this channel

quiet ridge
#

what are the chances

buoyant aspen
#

my point

solemn leaf
#

hi

#

um

#

how do I remove something from bot.comamnds

solemn latch
#

like at runtime?

solemn leaf
#

wdym

solemn latch
#

while the code is running? or editing the code so its removed?

solemn leaf
#

while

solemn latch
#

assuming commands is an object, just set the property/method to undefined

solemn leaf
#

what about with walker

#

for subfolders too

#

or do I not need to worry about that

solemn latch
#

walker?

solemn leaf
#

npm walk

stark abyss
#

let x = 'S2'
let num = x.substring(1);
num + 1 won't work bc 1 is acting like string how to remove it from string?

solemn latch
#

assuming all references are removed for the property, garbage collection will remove it. @solemn leaf

solemn leaf
#

?

#

what do you mean

solemn leaf
#

is there a way to run a command thing from js

#

like process.run('rs')

#

soemthing like that

#

to refresh nodemon

#
    execSync('cd ...', { encoding: 'utf-8' });
    execSync('rs', { encoding: 'utf-8' });
grizzled raven
#

@solemn leaf require("child_process").execSync

still merlin
#

im getting the error "ReferenceError: Cannot access 'emb' before initialization" when emb (my embed) is defined ages ago

 const emb = new Discord.MessageEmbed()
            .setTitle(`New Suggestion`)
            .setColor(random)
            .setDescription(`New suggestion. Submitted by ${message.author}`)
            .addField("Suggestion:", suggestion)
            .setFooter(`private stuff || *${ServerIp}*`).then(messageReaction => {
                messageReaction.react("👍");
                messageReaction.react("🕰️");
                messageReaction.react("👎")
            },



                suggestionWebhook.send("<@&797248229829378078>", {
                    username: `SMP bot`,
                    avatarURL:
                        "https://cdn.discordapp.com/attachments/542043910818627584/797234326269984768/unknown.png",
                    embeds: [emb],```
solemn latch
#

i am not really sure whats going on here, the formatting ah

#

but it looks like your using emb in the definition of emb

#

specifically inside the set footer.

#

actually, why are you using then on an embed

still merlin
#

Not sure, I wasn't sure how to react on a embed and guessed

still merlin
solemn latch
#

programming isnt the place to guess stuff

still merlin
#

alr

#

how do i react on a embed?

solemn latch
#

you dont react to embeds

#

you react to messages

still merlin
#

i meant webhook

#

how to look like a idiot

solemn latch
#

dont think you can react to a webhook either, you can react to a message sent by a webhook iirc.

#

same as any other message.

still merlin
#

How would I do that then?

#

on the webhook message have a .then with the reactions?

solemn latch
#

yeah, on the send

still merlin
#

ok tysm

solemn latch
#

after the closing parenthesis of the send

still merlin
#

it doesn't work

proud horizon
#

Does somebody know how i can create a command which shows on how many servers my bot is?

ornate otter
#

ye

proud horizon
ornate otter
#

but thats effort

#

msg.channel.send(`${bot.guilds.cache.size}`)

#

@proud horizon

proud horizon
#

Ok thank you

trim saddle
#

@ornate otter you could just not string for one variable

#

that always makes me mad

ornate otter
#

fite me!

trim saddle
#

bet

ornate otter
#

join vc rn fite me

trim saddle
#

i'm too sleepy

crimson vapor
#

hi too sleepy im million

trim saddle
#

and i still need help with my issue

crimson vapor
#

files?

#

the file sending one?

trim saddle
#

yes

#

what exactly am i sending to discord?

crimson vapor
#

actually I have to work on sending files rn

#

lemme check the api

trim saddle
#

{"filename.png": "BASE64SHIT"}?

#

all that's in the api is

#

file contents

crimson vapor
#

no help kekw

trim saddle
#

what did i tell you

crimson vapor
#

that exactly

trim saddle
#

i saw a webhook example somewhere

crimson vapor
#

oh good idea

crimson vapor
#

sharex repo has one as well

trim saddle
#

this didn't help me as much because

crimson vapor
#

so payload_json is basically body for normal message

trim saddle
#

yes

crimson vapor
#

pog

trim saddle
#

if you were including a file

crimson vapor
#

yep

#

do we just include the base64 of the file?

#

fuck my hands are cold

#

typing is slow

#

wait

#

form-data

#

lemme try something rq

trim saddle
#

idk

crimson vapor
#

whatever you try you get Error: Cannot send an empty message?

#

@trim saddle

trim saddle
#

yeah i'm about to test something new

crimson vapor
#

alr

#

invalid form body

#

new error pog

trim saddle
#

@crimson vapor well i looked at how d.py does it

#
    def send_files(self, channel_id, *, files, content=None, tts=False, embed=None, nonce=None, allowed_mentions=None, message_reference=None):
        r = Route('POST', '/channels/{channel_id}/messages', channel_id=channel_id)
        form = aiohttp.FormData()

        payload = {'tts': tts}
        if content:
            payload['content'] = content
        if embed:
            payload['embed'] = embed
        if nonce:
            payload['nonce'] = nonce
        if allowed_mentions:
            payload['allowed_mentions'] = allowed_mentions
        if message_reference:
            payload['message_reference'] = message_reference

        form.add_field('payload_json', utils.to_json(payload))
        if len(files) == 1:
            file = files[0]
            form.add_field('file', file.fp, filename=file.filename, content_type='application/octet-stream')
        else:
            for index, file in enumerate(files):
                form.add_field('file%s' % index, file.fp, filename=file.filename, content_type='application/octet-stream')

        return self.request(r, data=form, files=files)

looks like making form-data, that depends on the number of files available

vernal basin
#
         myMember.roles.add(mutedRole);
                        ^

TypeError: Cannot read property 'add' of undefined

I have below myMember, which is found by using

myMember = message.guild.members.fetch("the id of the member")
Promise {
  GuildMember {
    guild: Guild {
      members: [GuildMemberManager],
      ...
    },
    user: User {
      id: 'REDACTED',
      bot: false,
      username: 'REDACTED',
      discriminator: 'REDACTED',
      avatar: 'e8c787520c7be3cb02d4da29fae41f29',
      flags: [UserFlags],
      lastMessageID: null,
      lastMessageChannelID: null
    },
    joinedTimestamp: 1601174973856,
    lastMessageID: null,
    lastMessageChannelID: null,
    premiumSinceTimestamp: null,
    deleted: false,
    _roles: [
      '759149961735962704',
      '759607789864615997',
      '760538441653026869',
      '760626202061832263',
      '763648330302488596',
      '766725841803280424',
      '771062599583662111',
      '776527344490774558',
      '777965104829956136'
    ],
    nickname: 'REDACTED'
  }
}

However, roles as a property of GuildMember exists, and I've tried both myMember.roles.add and myMember._roles.add, neither of which work, returning the same error. my package.json says I'm using v12.2, not sure why I can't add roles

trim saddle
#

it's a promise

#

either await when you get the member

#

or use .then

crimson vapor
#

application/octet-stream?

#

hmmmmm

trim saddle
#

no idea what that is

crimson vapor
#

idk either lol

#

something with data storage

#

@slim heart how do you send files?

#

@slim heart !

trim saddle
#

i don't think berry wants to offer us part of his brain

crimson vapor
#

example please

#

docs suck

slim heart
#

didnt i explain this yesterdya

#

how to uri

#

then send uri ez

crimson vapor
#

ur i ez

#

I speak in examples

#

just

#

become example berry

#

fuck now I have to find that then

vale raptor
#

is there a general getting started guide on receiving post requests with a webhook? do I just need to set up a basic web server or something?

mellow kelp
#

i'd suggest you learn about http servers and requests beforehand

#

the webhook itself is pretty simple

vale raptor
#

so it is just a little web server then. alright thanks, will do.

mellow kelp
#

aight, np

trim saddle
#

@slim heart so yeah you did but

{
payload_json: { content: 'wow' },
file1: 'data:image/jpeg;base64,...'
}

this no worky