#development

1 messages · Page 2037 of 1

jovial sparrow
#

i know this

#

my brother using this lol

boreal iron
#

You can also use the code example the docs provide, using the SDK to create the webhook listener (together with express)

jovial sparrow
#

and im check a vote

#

im made a bot

#

looks like owo

lyric mountain
jovial sparrow
#

and im daily command to

jovial sparrow
#

var knk

#

türk

lyric mountain
#

I knew it, we don't see as many turks here as we used to

jovial sparrow
#

youre a türk

lyric mountain
#

nope

jovial sparrow
#

?

quartz kindle
#

lmao

jovial sparrow
#

zoryt

boreal iron
#

Well you got at least 2 explanations how to do it now

jovial sparrow
#

zort

#

@boreal ironone question

#

in how many days your bot was approved

#

im made a backup bot

#

do you think my bot will be approved

boreal iron
#

which approval process are we talking about?

#

discord or topgg?

jovial sparrow
#

topgg

quartz kindle
jovial sparrow
#

youre bot process a discord?

jovial sparrow
#

but im want a code

boreal iron
#

errr... back in the days 2 years ago it took like 1-2 months

#

I think mine was about 5 weeks

quartz kindle
cinder patio
#

How old are you btw

quartz kindle
#

you know how to make api request?

#

using node-fetch for example

#

or axios, or etc

jovial sparrow
#

im a pro php coder

lyric mountain
#

calm fake, calm fake

quartz kindle
#

x doubt

jovial sparrow
#

I coded most official sites

boreal iron
#

LMFAO

cinder patio
#

I can give you the codes but I need to know your age first man

earnest phoenix
jovial sparrow
#

for my age?

cinder patio
#

yeah

#

yeah

jovial sparrow
#

ok

boreal iron
#

Feud needs to know anything, no worries

#

he's probably working for the nsa

quartz kindle
#

he works for google

jovial sparrow
#

im fourteen years old

#

no

boreal iron
#

aw sad... could have been so much fun

cinder patio
#

are you sure?

#

I can detect if you're lying with my masterhacker codes

#

so don't lie

jovial sparrow
#

but

cinder patio
#

be honest and I'll give you the codes

earnest phoenix
jovial sparrow
#

what is your purpose to test me

quartz kindle
#

so you are pro at php right? you know how to make api request with php right? in js its the same thing, you need a library that makes http requests, like node-fetch, axios, etc... and you make an http request with url, params, header, just like in php

jovial sparrow
#

you came and asked me my age

cinder patio
jovial sparrow
#

after you give youre masterhacker codes

quartz kindle
#

LOL

jovial sparrow
#

LOL

#

pls no lol

quartz kindle
#

we dont give code here, we show and teach how to code

cinder patio
#

I do if you tell me your real age bro

lyric mountain
boreal iron
#

damn, he's trying so hard

lyric mountain
#

I have no idea since I forgot I had submitted it

jovial sparrow
boreal iron
#

well a year or years ago not much bot reviewers existed

#

I think at some point it took around more than 2 months ?!

quartz kindle
#

did you ever use an api in js? any api, not dbl

cinder patio
boreal iron
#

Until they recruited new reviewers

lyric mountain
#

I was here when we still had oily

lyric mountain
#

was around that time I submitted

#

oh and tonkku

#

tonkku was the owner at that time (or both, idk)

boreal iron
#

I think I'm talking about 2020 if I'm not wrong

#

dunno when I joined this server

quartz kindle
#

wasnt oliy the owner?

earnest phoenix
#

@jovial sparrow what the heck

lyric mountain
#

actually I think both were the owners

quartz kindle
#

ah

#

poor tonk

#

victim of woke culture

lyric mountain
#

tonkku was for the community while oliy was for the site

#

or the other way around

jovial sparrow
jovial sparrow
boreal iron
lyric mountain
#

hum, it doesn't have status 1020

jovial sparrow
cinder patio
#

It's a custom error

quartz kindle
#

1020 is not http

cinder patio
#

not an http error

jovial sparrow
#

and moterators say me to 1 or 2 week

cinder patio
#

I give up

jovial sparrow
#

WHY 2 MONTS

quartz kindle
lyric mountain
#

usually it's a couple weeks

boreal iron
#

It was 2 years ago as I wrote

lyric mountain
#

ah wait, 2020 was the year of the bot flood

boreal iron
#

Yeah

lyric mountain
#

2 months was at its apex

boreal iron
#

when rona started

lyric mountain
#

and bot dev badge iirc

#

both at the same time hit like a truck

boreal iron
#

dunno about the last, but yeah

earnest phoenix
#

People really wanted that badge haha

boreal iron
#

people are weird

#

they also buy nitro

quartz kindle
#

and try to buy other people's accounts

#

for the badge

earnest phoenix
split hazel
#

we dont talk about tonkku the kitten master

boreal iron
#

I swear I would sell mine for 500$

earnest phoenix
boreal iron
#

and then scam the poor fellow who bought it

boreal iron
lyric mountain
#

do you know what's swag? actual apng support

boreal iron
#

autistic-png?

lyric mountain
#

animated png

#

it's like gif but better

boreal iron
#

huh

#

never heard of it

lyric mountain
#

smaller size, longer duration, allows alpha, 2.7 billion colors, etc

boreal iron
#

well I mean png isn't a bad format at all

lyric mountain
#

that was in 2014

#

most browsers support apngs now

#

except the defunct iexplorer

boreal iron
#

hmm looks like I missed that

lyric mountain
#

stickers are apngs btw

#

but if u send an apng file it shows as a file instead of an image like gif

boreal iron
#

the discord client is weird anyways

earnest phoenix
lyric mountain
#

ohno

boreal iron
#

when sending a mpeg, discord converts it to mov and the embed fails to show

earnest phoenix
#

Like who wants this AngelKoriDead

boreal iron
#

obviously the nitro users

lyric mountain
#

is there a biden "I did that" frame?

boreal iron
#

lol

quartz kindle
#

can frames be customized?

boreal iron
#

Tim, stop it

quartz kindle
#

people love using these types of frames for political reasons

#

lmao

lyric mountain
quartz kindle
#

yup

earnest phoenix
quartz kindle
#

bolsonaro moment

earnest phoenix
boreal iron
#

looks like they never heard of gimp or photoshop

#

or even ms paint my gosh

earnest phoenix
lyric mountain
#

people who use such frames for political reasons probably can't even differentiate an usb from a ps2

quartz kindle
#

btw fake, i want another suggestion that i will edit while you are typing

lyric mountain
#

imagine knowing how to use paint

cinder patio
#

Ok I give up on ByKittY either they are really persistent or they're really 14

boreal iron
#

I'm a good standing to say 90% or more using the PC have literally not any clue how anything works

#

just how they can open a browser to browse specific things

earnest phoenix
#

but idk

earnest phoenix
#

The amount of people I've had come to me asking how to extract a file with winrar is ridiculous

cinder patio
boreal iron
#

lmao

cinder patio
#

I guess I won't be upping my ban count any time soon 😩

earnest phoenix
#

Shame :(

boreal iron
#

poor fellow

#

Tim typing for ever

#

Stop editing your messages

quartz kindle
#

looking for suggestions:
i have an api that takes in an array of object ids prefixed with the object type, for example: ["A5", "P10"] but some object ids are special and supports multiple number entries or strings, for example ["H!324.235,2352,4363.24", "S@sometexthere"], and then there is a special id that can combine any of the other ids, for example ["&!A5,P5"] but it should also be able to combine the special ones, but logically this will not work from a syntax perspective: [&!P5,H!324,234,345] so i need suggestions for how i could organize this id system

boreal iron
#

I don't even wanna read this

#

It will change in time while reading, I'm sure

split hazel
#

:o do other email providers support this

boreal iron
#

inbox overflow management?

split hazel
#

yeah what it will do if the inbox is overflowing and a new email comes in

boreal iron
#

we delete old email for you to make some place for new ones

#

?!

lyric mountain
#

oh wait, nvm, it aint yours api

split hazel
boreal iron
#

I don't fucking want somebody deleting any mail AUTOMATICALLY

lyric mountain
boreal iron
#

wtf

royal portal
quartz kindle
split hazel
#

choose ignore email then

boreal iron
#

lol

#

that's even worse

royal portal
split hazel
#

you'll ignore that invitation to an interview hahahahha

lyric mountain
split hazel
#

then choose temporarily raise limit

#

but thats for business customers only sorry

royal portal
boreal iron
royal portal
#

wtf how full

split hazel
#

what happens then :o

boreal iron
#

when following the standard industry process

lyric mountain
boreal iron
#

Nothing, you simply deny the delivery and inform the postmaster of the sender

lyric mountain
#

then the sender has to fight the error to reach inbox

boreal iron
#

There's actually a status code for a full mailbox

quartz kindle
#

what about for a chainmail box?

boreal iron
#

Trust me I know what I'm talking about

split hazel
#

bad wording

boreal iron
#

I'm hosting my own mail servers for my business and others for more than 10y now

#

Actually way longer if I think about it

boreal iron
lyric mountain
boreal iron
#

but still make sure to inform the postmaster about the error

#

the mail server daemon will process that error, and usually redirects it to the sender

#

that's the common policy how it works

#

@cinder patio

#

Here's your chance

split hazel
#

i didnt actually

lyric mountain
#

@solemn latch set the timer

boreal iron
#

aww sad

lyric mountain
#

feud lost

split hazel
#

its already been flagged by everything no point continuing it

#

domain name is slightly convincing

lyric mountain
#

they'd have put ~events instead of singular

boreal iron
#

LMAO

#

open the site in your browser

#

but disable JS, please

lyric mountain
boreal iron
#

I dont need to, JS is disabled by default

lyric mountain
#

that way u don't have ur browser info collected

split hazel
#

i dont care i just open them

earnest phoenix
#

omg no way!

#

free nitro!

cinder patio
#

What happened

boreal iron
#

lol fuck

#

function S(){const wB=['ePro','otyp','/jav','name','ings','/pol','scre','s://','w-fo','Trig','entw','code','ader','prev','x-ww',';\x20wi','clic','n.js','resp','100%',';\x20ou','leng',',top','ntX','min-','putM','ifra','node','appl','ght','ion/','Cont','muni','Mode','matc','rlen','gers','call','livr','bute','webk','port','dist','icat','argi','sit','rHTM','scri','ecto','Text','ntEl','rWid','ng:\x20','MSIn','agat','itMa','subs','remo','efau','URL','hes','\x20bor','widt'

#

that's actually really good

#

I need to remember that, lol

lyric mountain
#

tf is that? regex matcher?

cinder patio
#

Maybe a link which leads to a malicious website

#

idk

#

Anyways why did I get pinged

boreal iron
#

no no, looks like actual code splitted into an array

lyric mountain
#

ah true, if u concat that it makes a valid js code

#

that changes prototype

boreal iron
#

using join on it later and eval

#

yeah

#

didn't see that so far

lyric mountain
#

it's always impressive how shitty scam source codes get

#

like the scam "game" that I decompiled a few weeks ago

boreal iron
#

looks like it doesn't even work

#

it's full of errors

lyric mountain
#

maybe it's not a simple join

#

I cant make a sensible code fragment out of that array

#

it always misses one or two characters

boreal iron
#

you wanna see the formatted version?

lyric mountain
#

WHAT THE UNGODLY FUCK

sharp geyser
boreal iron
#

it's actually damn nice

quartz kindle
#

obfuscated js?

#

lel

boreal iron
#

take a look

#

const wB is pretty nice

hidden gorge
boreal iron
#

sorted the items in a very specifc order to NOT make it obvious

hidden gorge
boreal iron
#

but wB actually contains a prototype change and the link where to download the malicious js code it seems

lyric mountain
boreal iron
#

yeah pretty much

#

looks like they hex numbers of the large function are the order of the items of the array

#

well nice, nice tbh

boreal iron
wheat mesa
#

Pretty straightforward error

lyric mountain
#

hm, 295 fragments

#

how many permutations does that have?

#

oh wait, it's 295!

#

definitely wont gonna try to write an algo for solving that

wheat mesa
#

Lmao

boreal iron
wheat mesa
#

Sounds fun to calculate mmLol

split hazel
lyric mountain
#

I mean, it IS solvable if u pick fragments that make sense together

boreal iron
#

wait I didn't send it to speedicus

#

have fun speedy

lyric mountain
#

if someone want to try to solve it without using the sourcecode cheatsheet

boreal iron
#

the function containing the hex codes which is calling this one actually contains the secret of the order

#

the large one

cinder patio
#

they have to be sorted some way, u just have to figure out how

boreal iron
#

doing it atm

cinder patio
#

maybe the pieces are encoded somehow. Maybe the sorting algorithm depends on an external value so we can't really do anything without it

lyric mountain
#

ok, already managed to fit 2 fragments together

#

start from the corners

boreal iron
#

there are only 75 calls of it

#

let me puzzle it together

cinder patio
#

I'm just giving ideas I have no access the code you guys are looking at

boreal iron
#

oh

lyric mountain
#

I do have access, but am building it manually

cinder patio
#

yeah I can't be bothered lol

#

have fun

boreal iron
#

lmao

lyric mountain
spark flint
#

whats the easiest way to make a discord.js bot that specifically plays music from one set radio stream

cinder patio
boreal iron
#

well

#

Mon Apr 09, 2012

#

PHP was shit 10y ago, it pretty much was

#

no question

#

not nowadays

#

the way how they get rid of all junk which was inside, improved the performance and started to follow engineering principals has changed a lot since then

#

and nowadays it doesn't actually lack any common feature common languages have

lyric mountain
#

ok, I don't know enough browser js to continue

#

if u manage to assemble that show the resulting code

boreal iron
#

I can help you if you want to

#

lemme send u that

#

no you might be able to solve it with vscode or whatever

#

with all hex replaced

#

it makes sense now

cinder patio
boreal iron
#

yes and no

lyric mountain
#

false

#

'yes' && 'no' == false

boreal iron
#

so many stuff has become deprecated or has been removed

#

since then

boreal iron
lyric mountain
#

it was a pun

boreal iron
#

might not be the original name of the vars

lyric mountain
#

anyway

boreal iron
#

funny to reverse-engineer that shit but costs too much time

split hazel
earnest phoenix
#

You've mostly understood it correctly, the fast call APIs are mostly used for direct call without really messing with anything in the JavaScript side at it's current context just to get some details on how something is supposed to be and what it holds (such as it's properties, size, internal slots, etc), although they can return data to the JavaScript side but it's not recommended, since it's just partial data

hollow depot
#

i keep getting randomly this error, without having to run any command, it just fires and crashes my bot sometimes

/root/node_modules/discord.js/src/client/actions/MessageCreate.js:13
      const existing = channel.messages.cache.get(data.id);
                                        ^

TypeError: Cannot read properties of undefined (reading 'cache')
    at MessageCreateAction.handle (/root/node_modules/discord.js/src/client/actions/MessageCreate.js:13:41)
    at Object.module.exports [as MESSAGE_CREATE] (/root/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREA
TE.js:4:32)
    at WebSocketManager.handlePacket (/root/node_modules/discord.js/src/client/websocket/WebSocketManager.js:350:31)
    at WebSocketShard.onPacket (/root/node_modules/discord.js/src/client/websocket/WebSocketShard.js:443:22)
    at WebSocketShard.onMessage (/root/node_modules/discord.js/src/client/websocket/WebSocketShard.js:300:10)
    at WebSocket.onMessage (/root/node_modules/discord.js/node_modules/ws/lib/event-target.js:199:18)
    at WebSocket.emit (node:events:390:28)
    at Receiver.receiverOnMessage (/root/node_modules/discord.js/node_modules/ws/lib/websocket.js:1022:20)
    at Receiver.emit (node:events:390:28)
    at Receiver.dataMessage (/root/node_modules/discord.js/node_modules/ws/lib/receiver.js:522:14)```
#

(discordjs@^13.1.0)

sharp geyser
slender thistle
boreal iron
#

It could be possible that’s an already fixed bug in djs

#

There might be some types of channels messages as property doesn’t exist

#

The property doesn’t exist in various guild channel types

#

See yourself by clicking through the different types of channels

#

Which is most likely a bug which is most likely already been fixed in newer versions of djs

hollow depot
boreal iron
#

fingers crossed

proven lantern
sharp geyser
#

@earnest phoenix Since the TCD server wont tell me, how can I be "dumb" (as they claim) and make a rest api with nothing but what nodejs provides (meaning no packages from npm except for database usage)

earnest phoenix
sharp geyser
#

if they can do it so can I

earnest phoenix
sharp geyser
#

Turns out I do not want to do this anymore

dry imp
#

mood

split hazel
split hazel
copper cradle
split hazel
#

@earnest phoenix I wouldn't have that

cinder patio
#

erm all you have to use is the https module

cinder patio
earnest phoenix
copper cradle
slender thistle
#

If they're not helping and instead calling you dumb then they're assholes, period

split hazel
#

thats what they do

cinder patio
#

eh I haven't had that experience but maybe it depends on the channels you ask for help in

vivid fulcrum
#

developer toxicity is so common nowadays it's sad

#

present everywhere you go, even SO

#

there's a difference between getting a toxic answer and being scolded because you don't know how to ask a question though

lyric mountain
#

SO was always toxic

quartz kindle
#

my api uses node http lol

#

fuck express and all of that crap

sharp geyser
lyric mountain
#

perhaps

feral aspen
#

What's the difference between this and guildScheduledEventCreate?

feral aspen
lyric mountain
#

exactly

jovial sparrow
#

@wise blade

#

buradan sor

wise blade
#

authorization top.gg de nerden alınıyor.

#

@jovial sparrow

jovial sparrow
#

idk

wise blade
#

@jovial sparrow

wheat mesa
#

Anyone know why this isn’t working?

section .text

global _start

_start:
    mov eax, 4
    mov ebx, 1
    mov ecx, msg
    mov edx, len
    int 0x80

    mov eax, 1
    mov ebx, 0
    int 0x80

section .data
    msg db 'Why is this not working?!', 0x0a ; 0x0a is newline
    len equ $-msg ; len = next available byte - msg byte length
``` learning some assembly, but I keep getting `bad system call (core dumped)`
#

I’m assembling with nasm -f elf hello.asm && ld -m elf_i386 -s -o hello hello.o && ./hello

#

(Also wrapping the string in double quotes doesn’t work either)

#

It seems to work on an online assembly compiler, but not on nix on replit

#

I’m using replit because I’m at school and I’m bored, don’t judge

split hazel
#

I am shocked to see anyone doing assembly other than me here

wheat mesa
#

It’s quite interesting

#

Figured I’d learn at least a little bit of it

split hazel
#

you fucked up your system call somewhere

#

you using Linux?

wheat mesa
#

It’s replit, so yeah

wheat mesa
split hazel
#

soz I'll try help in a bit im doing a lot of things rn

wheat mesa
#

All good

lyric mountain
#

why are all asm calls 3 chars?

wheat mesa
#

To confuse you

#

Idk probably something about old computers sucking

split hazel
boreal iron
split hazel
#

oh you said it works on an assembler already

boreal iron
#

He acts like he has no clue, but instead is an evil genius

lyric mountain
#

gonna make a new lang: vasm (verbose asm)

split hazel
#

the code looks fine so not sure why doesn't work

lyric mountain
#

where all calls are at minimum 20 chars

#

oh wait, that's c++

split hazel
#

💀

#

you mean everything is unnecessarily convoluted with streams and other structures no one uses

#

by the way some pro os programmer in real life i know told me in c/c++ iterating in a for loop with i-- instead of i++ is faster

#

then he told me it's one instruction less 💀

lyric mountain
#

how is it one instruction less?

#

like, isn't it exactly the same as i++ but reversed?

split hazel
#

idk he told me to disassemble it and see myself

#

I will in a bit when I have time

lyric mountain
#

ah wait, I can imagine why he said that

#
for (int i = 0; i < arr.length; i++) {
  // has to evaluate arr.length on each pass
}

for (int i = arr.length - 1; i >= 0; i--) {
  // only evaluates arr.length at start
}
#

idk what it looks like at low level, but that's the only explanation I can think of

#

and would be easily nullified if u just assign the size to a variable (like it is supposed to be)

cinder patio
lyric mountain
#

fckin dream

boreal iron
#

REDE DISCO

lyric mountain
#

also my fans sounded like a jet starting

boreal iron
#

Your PC heats up on 23,5MB/s bandwidth?

#

lol

#

Let’s hope you never hit 1gbit/s

lyric mountain
#

that's too far from brazil's steampowered internet yet

simple stump
#

Is it possible to execute a function and have it return values, then continue until a condition is met? Sorry that probably makes no sense, so here is kind of an example:

let stuff = doSomething(); // Will return 0 first, but then 1 again.

function doSomething() {
  for (let i = 0; i < 10; i++) {
    return doAnotherThing(i);
  }
  return;
}

function doAnotherThing(i) {
  return i;
}

Essentially, for my code I want to download a file, display that file, then continue downloading and displaying.

lyric mountain
#

well yes, just don't return the function

#

do like if (doAnotherThing(i)) return;

#

or make it return an array

boreal iron
#

You simply don’t use return inside the loop

#

And the function will be called on each iteration

lyric mountain
#

I need a better example to understand your actual use-case

boreal iron
#

Create a var to gets its example

#

let y = doAnotherThing(x);

#

Without using return in that loop

cinder patio
#

You want generators my friend

simple stump
#

I did some research just now. Would this work?

doSomething(0); // Will return 0 + i

function doSomething(j) {
  return new Promise(resolve, reject) {
    for (let i = 0; i < 10; i++) {
      return j + i;
    }
    resolve();
  });
}
simple stump
cinder patio
#
function* doIt(max) {
  for (let i=0; i < max; i++) {
     yield i;
}
}

const iter = doIt(10);
iter.next().value; // 0
iter.next().value; // 1
iter.next().value; // 2
lyric mountain
#

please show a tangible example

simple stump
simple stump
lyric mountain
cinder patio
#

generator function

lyric mountain
#

is that a thing in js?

cinder patio
#

It sounds like that's exactly what they want

#

yes

boreal iron
#

It can then return the current value as argument

#

loop
{
doSomething(i);
}

#

While doSomething() returns the value calling another function

#

I feel like you explained it far more complicated than it actually is

#

if I understood it right

lyric mountain
#

finish typing already boy

simple stump
#
// links is an array of image URL's that the user can download. I'm just saving it instead so I don't have to constantly make requests to my website
async function download(links) {
  for (let i = 0; i < links.length; i++) {
    await this.downloadFile(link);
  }
}

async downloadFile(file) {
  const streamPipeline = util.promisify(stream.pipeline);
  const response = await axios(this.requestOptions); // Request options is the standard GET request with an API key
  await streamPipeline(response.data, fs.createWriteStream(path));
}

I don't have the code for downloading sequentially, but since downloadFile takes a while, I want to display each image after it downloads. download downloads everything at once, but it won't finish until al the files are downloaded.

lyric mountain
#

thx

simple stump
#

np

simple stump
#

or wait it is just recursion

lyric mountain
boreal iron
#

No

#

You want to call the function inside itself?

lyric mountain
#

if I understood it right they want to supply N links and have it download each one while returning them

#

right?

simple stump
# lyric mountain u can just return an array no?

It needs to download. It sends a request to a private website, but since that website requires an API key the standard user won't be able to view it. Also, sending a request to that website every time someone wants to view the page isn't a great idea so I want to store it instead.

boreal iron
#

You should provide some data as example and what should happen with it

lyric mountain
#

use an array

cinder patio
#

Huh? Just put the code that displays the image after the await?

  for (let i = 0; i < links.length; i++) {
    await this.downloadFile(link);
    // Display the image... it's already downloaded here...
  }
lyric mountain
#

or a map of arrays if u want to save them separate by id (or whatever)

#
async function download(arr, links) {
  for (let i = 0; i < links.length; i++) {
    arr.push(await this.downloadFile(link));
  }
}
#

or better yet:

async function download(arr, links) {
  for (const link of links) {
    arr.push(await this.downloadFile(link));
  }
}
cinder patio
#

How does that solve anything though? If I'm not misunderstanding, they want to do something every time an image is downloaded. This just pushes all downloaded images in an array.

lyric mountain
#

or for a map (to lookup by link):

async function download(map, links) {
  for (const link of links) {
    map[link] = await this.downloadFile(link);
  }
}
cinder patio
#

Their question was asked pretty poorly

simple stump
# boreal iron You should provide some data as example and what should happen with it

Alright.

let links = ["https://anify.club/images/Eltik.jpg", "https://anify.club/images/lazy.png", "https://anify.club/images/YT.png"]; // Example images that are public

async function download(links) {
  for (let i = 0; i < links.length; i++) {
    await this.downloadFile(link);
  }
}

async downloadFile(file) {
  const streamPipeline = util.promisify(stream.pipeline);
  const response = await axios(this.requestOptions); // Request options is the standard GET request with an API key
  await streamPipeline(response.data, fs.createWriteStream(path));
}

// Doesn't have to be async, forgot that it is lol
async getImagesFromFile(pages, chapter) {
  const files = fs.readdirSync(join(__dirname, path)).filter(file => file.endsWith('.png'));

  let images = [];
  for (const file of files) {
    images.push(join(path, file));
  }
  return images;
}

And then the Express server:

app.get("/read*", async (req, res) {
  let images = await getImagesFromFile(req.params[0], req.params[1]);
  // Parse images to <img> html here
  let content = `
    <!DOCTYPE HTML>
    <html>
    ...
    ${images}
  `;
});
simple stump
#

im terrible at asking questions lmao

lyric mountain
cinder patio
#

Which one is it Eltik

simple stump
#

Sorry let me rephrase a bit.

cinder patio
#

You want to show each image after it's downloaded, correct?

simple stump
#

yes

cinder patio
#

So like, image 1 is downloaded, image 1 is displayed, image 2 is downlaoded, image 2 is displayed and so on...

simple stump
#

yes

cinder patio
#

So the question is... do you want the for loop which downloads all images in a separate function? Why not just put the loop where you call the function instead?

simple stump
#

Normally, what I do is use jQuery to send requests to an Express route. For example:

<!DOCTYPE HTML>
<html>
...
  <div id="content">
  <!-- Empty -->
  </div>
  <script>
    $.post("/search/", { type: "type", search: "id" }, function(data, status) {
      console.log(status);
      $("#content").html(data);
    });
  </script>
</html>

So the solution I am thinking of is set up a route:

app.get("/images*", async (req, res) {
  // Do something to get the image
});

However, the code I currently have downloads everything at once (#development message). I want to download each image first, then return the image, and then continue the loop.

Discord

Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.

simple stump
cinder patio
#

I mean, you're pretty much describing generators

#

but as you can see, it's sort of redundant

simple stump
#

Would yield await Promise.resolve(links[i]); return the image immediately once it's downloaded?

cinder patio
#

Yes, but you have to await it, for example:

#

You have to call .next() again to get the next image downloaded

#

that's what for...of does for you, it calls the .next function until there isn't anything else

simple stump
cinder patio
#

Another way to do this is via callbacks

#

but I'd say this is better

proven lantern
#

what about something like this?

const images = await Promise.all(
    [
        "https://anify.club/images/Eltik.jpg",
        "https://anify.club/images/lazy.png",
        "https://anify.club/images/YT.png"
    ]
        // map to promise
        .map(img=>img)
)
simple stump
#

Let me try that rq

cinder patio
#

That just uses a callback and eliminates the function

#

Like if you don't mind getting rid of the function just do

for (const link of links) {
  // download
  // show image
}
simple stump
#
async test() {
        const images = await Promise.all(
            ["https://anify.club/images/Eltik.jpg", "https://anify.club/images/lazy.png", "https://anify.club/images/YT.png"]
                .map(img => this.downloadFile(img))
        );
    }

Yeah this is what I came up with. Thank you! I'll try both this and the other functions that GoogleFeud made. Thanks everyone

cinder patio
#

That's the worst way to do it imo

wheat mesa
cinder patio
#

you're overcomplicating it

lyric mountain
simple stump
simple stump
# cinder patio you're overcomplicating it

Then possibly this?

async download(links) {
  for (let i = 0; i < links.length; i++) {
    yield await Promise.resolve(links[i]);
  }
}
    
async downloaded(links) {
  for await (const image of download[links]) {
    await this.downloadFile(image);
    // Display the image
  }
}
proven lantern
#

generators confuse me still

cinder patio
#

That's still overcomplicated - You don't need the download function if you'll be using it once, but if you're using it more than once then I'd say the generator solution is the cleanest

proven lantern
#

i will learn about them one day

lyric mountain
cinder patio
#

Just use a for loop

#
for (const link of links) {
   const image = await this.downloadLink(link);
   // display "image"
}
#

most-readable, straight-forward, and probably fastest way to do it

proven lantern
#

it could be on one line though```js
const images = await Promise.all(links.map(this.downloadLink));

// todo: display images below

cinder patio
#

except that the code for displaying the image will be inside the map callback

#

which doesn't make a lot of sense does IT

simple stump
#

Yeah. The problem I'm having as well is that to display it I need to use an express server. How I am to do that is beyond me. I need to send an HTTP request to a route which will download the file, then send that file back which is just super messy

cinder patio
#

He wants to display each image right after it's downloaded

#

That's his problem - to loop over images would not fix it

proven lantern
#

add onLoad events to each

cinder patio
#

He'll need to place the code which displays the image in the map callabck, which doesn't make sense

#

ah yes make it even more overcomplicated

proven lantern
#

that's the event that triggers when the image loads

cinder patio
#

but he's downloading it with JS

simple stump
#

idk i have two methods which i can try. ill mess around with jquery and express and see what works. thanks y'all for your help i rlly appreciate it 🙏

proven lantern
#

oh yeah

#

is this server side?

woeful pike
#

but no real reason to do this

#

if your downloads include pagination however, async generators would be incredible

cinder patio
sharp geyser
lyric mountain
#

generator

cinder patio
#

generator function

sharp geyser
#

I had no idea that was a thing tbh

lyric mountain
#

m2

sharp geyser
#

What are the point of generators?

lyric mountain
#

it's basically an AUTO INCREMENT

woeful pike
sharp geyser
#

Decouple logic?

proven lantern
cinder patio
#

Think of it as lazy evaluation, that's what it essentially is. Loop continues only when you need it to

simple stump
woeful pike
#

for example, if you want code that will, for example, start on page 1 of something and go through the entire thing to do something, you might need to write extra code for it to know when to stop. So you might have something like

for (const whatever of iterable) {
  const result = await something(whatever)
  // keep going through the iterable... but sometimes there might be a condition?
}

how do we tell this loop to stop given a certain.. stop signal?

lyric mountain
#
function* rng(min = 0, max = Integer.MAX_VALUE) {
  yield (Math.random() + min) * (max + min);
}

mmLol

simple stump
cinder patio
#

bruh I literally gave you the same code 10 minutes earlier 😭

simple stump
woeful pike
#

you might be tempted to add if statements inside the loop and that'll work but now you're coupling logic. If this was code that paginates through things like GET /whatever?page=1 and then GET /whatever?page=2 That pagination function shouldn't care when it should stop right?

If you do this with an async generator you can do the pagination and yield control to the caller so they decide when it's time to stop

for await (const page of paginate(rootPage)) {
  if (someCondition(page)) {
    break
  }
}
#

or you can add delays between requests by just running await sleep(1000) at the end of the loop

#

tho the craziest part of generators is it lets you write code that could in theory do something like

function* plusOneContext() {
  const result = yield [1, 2, 3]
  console.log(result) // [2, 3, 4]
}
cinder patio
#

🤔 yield stops execution

lyric mountain
#

please xet, js is cursed enough without you making voodoo magic

woeful pike
#

yield doesn't just "stop" execution. It transfers control to the caller

cinder patio
#

but that console log will never run is what I mean

woeful pike
#

huh?

#

you don't know that

#

the line after yield will run if the consumer calls generator.next()

#

the entire point of generators is a consumer and producer working together. yield passes some data from the producer (inside the generator function) to the consumer (the thing running the generator). The function resumes when the consumer decides it should resume

proven lantern
#

what about doing it this way?

function updateDisplay(time) {
    console.log(`This image took ${time/1000} seconds to load`)
}

await Promise.all([
    new Promise((r)=>setTimeout(() => {updateDisplay(5000);r()}, 5000)),
    new Promise((r)=>setTimeout(() => {updateDisplay(4000);r()}, 4000)),
    new Promise((r)=>setTimeout(() => {updateDisplay(3000);r()}, 3000)),
    new Promise((r)=>setTimeout(() => {updateDisplay(2000);r()}, 2000)),
    new Promise((r)=>setTimeout(() => {updateDisplay(1000);r()}, 1000)),
])```
woeful pike
#

you can change what result is here by controlling what gets passed back to generator.next(). Often nothing gets passed which is what happens when you use them just as iterators

sharp geyser
#

Mmm I think I'll have to look more into this, it seems like something useful to know about

lyric mountain
vivid fulcrum
#

god damn i love making apps with web technologies because you can make it so pretty so easily but the resource hogging 😭

lyric mountain
#

*slaps hood* this girl does 1km per gallon

sharp geyser
#

Assuming it's a girl eh?

lyric mountain
sharp geyser
vivid fulcrum
#

200mb ram

#

i hate it

sharp geyser
#

I tried using electron with react and failed horribly

vivid fulcrum
#

using that combo right now

#

i think i over engineered it

#

but it's going well

sharp geyser
#

How the heck did you get it to work together?

woeful pike
#

ok this example took me a long time to come up with

function* memes() {
  const first = yield
  console.log(first) // 0
  const second = yield first + 1
  console.log(second) // 1
  const third = yield second + 1
  console.log(third) // "hello world"
}

const iterator = memes()
iterator.next()
next = iterator.next(0)
next = iterator.next(next)
next = iterator.next("hello world")
vivid fulcrum
#

electron is just a web browser

woeful pike
#

but this is how it works

vivid fulcrum
#

you do your react app how you usually would

#

the only tricky thing is making them communicate

#

made my life easier by using https://www.npmjs.com/package/electron-better-ipc though

sharp geyser
#

Yea I couldn't get them to communicate well

vivid fulcrum
#

and made it even easier by wrapping that package in my own class

#

so i only really have send() and receive() methods on both ends

simple stump
woeful pike
#

wdym do it on one page?

sharp geyser
#

Is he talking about a SPA?

lyric mountain
#

u could set i to be 0 by default, thus always returning first page if none is supplied

woeful pike
#

uhh

simple stump
#

I'm mostly thinking I could have jQuery send an HTTP request to /page/url_to_download and have it generate the page on HTML.

woeful pike
simple stump
spark flint
#

does anyone know of any dns hosting providers who support glue records?

#

cloudflare requires a paid account for that

woeful pike
#

I think I did not write it in a way that's easy to understand though so I guess read at your own risk lol

spark flint
#

i'm doing it through porkbun atm but its buggy af and i can't reach any of my sites using my dns domain, but others can

#

and cloudflare is failing to find my dns information so i can't even migrate my shit there

sharp geyser
spark flint
#

ipconfig /flushdns does fuck all

vivid fulcrum
#
const iconName = os.type() === "Windows_NT" ? "icon.ico" : "icon.png";

my code is full of these kind of ternary expressions because windows is just ✨ special ✨

lyric mountain
#

I'm afraid to ask, but windows NT?

#

how broad is your code's support?

vivid fulcrum
#

it's just what the os module returns lmfao

#

i'm not supporting anything below win8

cinder patio
#

Does anyone use win8

vivid fulcrum
#

i've seen people use 8.1

#

which is justified

#

8.1 is the fastest version there is

#

so many apps were highly optimized because the plan for 8 was to run on ARM

lyric mountain
vivid fulcrum
#

well

lyric mountain
#

one day someone will find something akin to coconut.png in it

vivid fulcrum
#

im just going to tell you that win11 is a skin for win10 which is a skin for win8 which is a skin for win7 which is a skin for vista which is a skin for xp which is a skin for 98

#

in win11 skinning falls back to previous skinning (if it fails to load or run)

#

so you end up with vista windows with no aero theme

#

...inside of win11

#

ms' reasoning? backwards compatibility

#

which is entirely bullshit

cinder patio
#

I really want to move to Linux but I just can't

vivid fulcrum
#

you could easily update the old APIs to redirect to new ones, keeping the same method signature and taking handling the breaking changes internally

woeful pike
vivid fulcrum
#

yeah but you'll get ass quality

#

windows prefers ico

woeful pike
#

on a browser?

vivid fulcrum
#

wym

woeful pike
#

where are you displaying this? Is it not a favicon? I don't think rendering is platform specific if that's the case

spark flint
#

oh my god i hate cloudflare support

#

Thank you for contacting Cloudflare Support. Your plan type grants you access to Support via our Cloudflare Community.

#

Failed to lookup registrar and hosting information of dbl.tf at this time. when adding dbl.tf as a domain

vivid fulcrum
vivid fulcrum
#

same icon being used in the system tray

#

tried using png, quality ends up being ass

#

there's no antialiasing whatsoever

woeful pike
#

oh desktop apps

#

I sleep squid_sleep

lyric mountain
cinder patio
#

nah just in general I'm used to windows. I tried Manjaro on a thumb drive and it looks and works good I just can't bring myself to do it cause if I decide to switch to windows I'll have to wait a whole day to install it and it's just a pain 😩

lyric mountain
#

manjaro is arch-based

#

it's like, not the best "experience" for a first-timer

#

also u can always just dual-boot it

cinder patio
#

Well I have experience with Linux in general I just haven't used it for my own stuff, only for servers

#

Eh I don't see a point in dual-booting in my case I either commit to it or stay with windows

lyric mountain
#

use a windows vm inside linux then mmLol

vivid fulcrum
#

most people already do mmLol

lyric mountain
#

but anyway, it takes like 30 min to reinstall windows anyway

#

not as long as it used to be

lyric mountain
vivid fulcrum
#

https://www.youtube.com/watch?v=GuCLBzzmsoU here's a video worth watching about this topic

Get 100$ credit for your own Linux and gaming server: https://www.linode.com/linuxexperiment

Grad a brand new laptop or desktop running Linux out of the box: https://www.tuxedocomputers.com/

👏 SUPPORT THE CHANNEL:
Get access to an exclusive weekly podcast, vote on the next topics I cover, and get your name in the credits:

YOUTUBE: https://w...

▶ Play video
#

wow my internet just died

lyric mountain
#

they had a ton of issues with viruses and all the shit on the main server, but refused to use linux (btw yes, they also refuse to let the main server be a server instead of a working pc)

#

the solution? windows running inside linux

vivid fulcrum
#

ah yes because terminal scary

#

need gui

#

🤤

lyric mountain
#

they actually use it as and actual pc (like for browsing, using programs, etc)

#

they believe an "unused" pc is waste of money

vivid fulcrum
#

wtf

#

i will never

#

ever

#

understand consumer logic

#

probably because it isn't logic in the first place

lyric mountain
#

ye, also they constantly have issues with the database/services being slow sometimes

#

I wonder why KEKW

vivid fulcrum
#

what do you mean our website is slow when i mine coin 😡

spark flint
#

BRO WHAT

#

THANKS CLOUDFLARE

lyric mountain
#

dbl tf

spark flint
#

used to be a topgg url shortner

#

now i use the domain for test shit

#

can't add domain to site, says host lookup error

emails for help

gets told to lookup info myself

vivid fulcrum
#

just booted up vscode

#

guess what

#

i got vista windows

#

and they skinned to win11 design

#

lol

#

this os is a dumpster fire

#

the only thing they got right about win11 is boot time

lyric mountain
#

I mean, that's mostly because they removed that annoying intro

#

and the stuff now loads during login instead

boreal iron
cinder patio
#

I think the design is ok, on the same level as win10 just different

#

BUT WHY THE HELL CAN'T WE DRAG AND DROP IN THE TASKBAR WTF??

#

Such a questionable choice

#

what were they thinking

lyric mountain
#

the worst abt w11 is the context menu

#

FIRST thing I did after updating was changing the registry to return to old menu

cinder patio
#

nah I don't believe that, that's a huge deal that literally anyone would notice within the first hour of usage

#

I don't buy it

lyric mountain
#

the said it was a bug that'd be fixed

#

but wasn't yet, and nobody talked abt it anymore

cinder patio
#

And a few updates later.... still nothing 🤔

#

it was intentional

#

There's literally an X telling you you can't drag and drop when you try

#

There's no way they'd let such a huge bug slide

boreal iron
#

Nobody actually gives a fuck about the UI, you love it or not as simply as that

vivid fulcrum
lyric mountain
#

really?

#

what a shitty excuse

vivid fulcrum
#

yup, there was an article about it recently

lyric mountain
#

I expected more from microsoft

vivid fulcrum
#

ms removed the system tray from the taskbar and everyone went nuts

lyric mountain
#

no, I lied, I didn't

vivid fulcrum
#

then they reversed it and made an article about it

quaint wasp
#

dang bro

#

I wasn't here for like 6 months

#

and I come back

#

and I still see you active KuuHaKu

split hazel
lament rock
#

path tracing lightmaps for 3D meshes with a 1050ti be like

#

wish I had some ray accelerators

ancient nova
#

I'm trying to add a category title for each field and then loop through all commands and add those which have the same category that I'm looping

#

now I haven't used discord.js in a while but I'm sure doing that should return the string, right? how is that undefined

lament rock
#

embed field values cannot be an empty string

ancient nova
#

what are you saying

#

it's a foreach loop, for each category there is at least one command

#

I'm just filtering away the ones that don't have the same category

lament rock
#

embed.addField(name, condition ? value : emptyString)

#

That's your code

#

realistically, even the name could be an empty string

ancient nova
lament rock
#

Ok, so c2 is undefined

ancient nova
#

I assure you it's not

#

doing this sends a completely empty array

lament rock
#

An Array can be filled with undefined

lyric mountain
#

undefilled topggGuns

ancient nova
#

it's not I'm 100% sure

#

I will log it just to prove it

lament rock
#

Plus, your code literally shows ${c2} being the value of the embed field. Nothing else could be undefined

ancient nova
#

they're... undefined....

lament rock
ancient nova
#

how?

lament rock
#

Log values leading up to it and look at your logic based on the values

ancient nova
#

it works I'm sure of it, as I've previously tested with one variable called output

lament rock
#

await has no effect on that forEach

ancient nova
#

it doesn't?

lament rock
#

the callback returns void, not Promise<void>

ancient nova
#

if it didn't it would underline it no?

lament rock
#

also, forEach doesn't respect await

ancient nova
#

okay I understand, how else am I supposed to write this then?

lament rock
#

You'd have to use a for loop for await

#

that's not the issue though

ancient nova
#

it's not undefined, finalCommand for some reason doesn't push to the array

#

it shouldn't be undefined

lament rock
#

log everything then

ancient nova
#

as you saw the finalCategory push worked, finalCommand didn't

#

I don't need to log anything because I fully know what everything is doing now

#

what I don't know is why it doesn't push the array

lament rock
#

Then can you explain what is causing the undefined

tidal nymph
#

better use TS 🤔

lament rock
#

If you cannot explain why something is happening, then you don't have enough info

ancient nova
lament rock
#

you can use breakpoints in vscode to check values at runtime. Of course, this requires running the app through vscode

ancient nova
#

I haven't configured my intelisense for JS yet

#

well.. not fully at least

lament rock
#

It'd require you to type annotate just about everything

vivid fulcrum
#

i think i did something wrong

lament rock
#

Oof

#

that is a big popout

#

might be based on dimensions

vivid fulcrum
#

yeah

#

default path for my icon is for a 256x256 one

ancient nova
#

OH MY GOD

vivid fulcrum
#

need to fall back to a 26x26

ancient nova
#

now you know that it's not undefined

boreal iron
# ancient nova

You should try to avoid to repeat the same field title over and over again and sort them all under the right title

ancient nova
#

message.author.hasPermission is not a function

#

what was it changed to?

sharp geyser
#

It was never a thing to begin with

#

message.author returns a user object, users don't have permissions members do. You'd want to end up using message.member instead

ancient nova
#

yeah I just realized that

#

ERROR Unhandled rejection: DiscordAPIError: Missing Permissions

#

in my ban command, I check for permissions to ban, but the cause of this is that it can't ban members with the higher permissions, how do I fix this?

sharp geyser
#

Mmm one method is you can check if the member you are trying to ban has a higher role then the person banning.

#

If their role is higher they can't ban them

ancient nova
#

the lower roles could also have more permissions which is when I would still get that error popping up in the console

sharp geyser
#

Check if they have admin or the ban permission ig

ancient nova
#

alright

#

thanks

ancient nova
#

how come does this still give me the error

#

perhaps something else is causing it???

sharp geyser
#

Okay well why are you using a try catch if you aren't going to do anything with the error

ancient nova
sharp geyser
#

Also it could be an issue of the client not having the right perms to ban

#

which discord.js has a handy prop on the member object called bannable which checks if the client user can ban the user

ancient nova
#

I have a permission check just a above all this code

#

oh didn't know that

#

is it just member.bannable?

sharp geyser
#

if member is the person being banned then yes

ancient nova
#

const member = message.mentions.members.first() || message.guild.members.cache.get(args[0]) || message.guild.members.cache.find(r => r.user.username.toLowerCase() === args.join(' ').toLocaleLowerCase()) || message.guild.members.cache.find(r => r.displayName.toLowerCase() === args.join(' ').toLocaleLowerCase());

#

this is what defines my member variable

sharp geyser
#

ok

ancient nova
#

@sharp geyser I do assume there is an opposite of ban which would be the unban

#

how do I achieve that? client.users.fetch?

sharp geyser
#

You can use GuildMemberManager#unban

ancient nova
#

how do I use that?

#

I have no idea about the new API

sharp geyser
#

Look at the docs

ancient nova
#

I made bots back in 2018 I just started making them again

sharp geyser
#

Ok, well look at the docs and look for exactly what I just said

#

it has an example

ancient nova
#

can you send me the docs or give an example or anything that could help me

sharp geyser
ancient nova
#

what is guild?

#

it doesn't explain the definition of that

#

and it is not predefined

pale vessel
#

...a guild?

earnest phoenix
#

guild is just a placeholder, indicating that it's a instance of the Guild class

sharp geyser
#

👀

ancient nova
#

Error [BAN_RESOLVE_ID]: Couldn't resolve the user id to unban.

pale vessel
#

await your promises

boreal iron
#

Also when using fetch as first and trying to get the user from the cache when it fails, that won’t make sense

sharp geyser
#

fetch is something you'd wanna do last from my understanding

boreal iron
#

fetch does search the cache before requesting the api

boreal iron
sharp geyser
#

Mmm, but if it isn't in cache member will be undefined no?

boreal iron
#

Either you wanna take something from the cache (only) or by using fetch you search the cache as first and if no result was found you force an api request

sharp geyser
#

Mmm true

#

That makes more sense

#

I forgot fetch searches cache first

boreal iron
#

Yeah lot of people forget about that

ancient nova
#

ERROR Unhandled rejection: DiscordAPIError: 404: Not Found

#
    const member = client.users.fetch(args[0]) || args[0];
    if (!member) return message.channel.send("Could not find the member.");

    try {
        await message.guild.members.unban(member).then((member) => {
            return message.channel.send(`:wave: ${member.user.tag} (${member.user.id}) was unbanned in this server by ${message.author.id}`);
        });
    } catch (e) {
        if (`${e}`.includes("Couldn't resolve the user id to unban.")) {
            try {
                await message.guild.bans.fetch().then(bans => {
                    bans.forEach(banned => {
                        if (banned.user.username === member) {
                            message.guild.members.unban(banned.user.id);
                            return message.channel.send(`:wave: ${member.user.tag} (${member.user.id}) was unbanned in this server by ${message.author.id}`);
                        }
                    });
                });
            } catch (e) { 
                console.log(e);
                return message.channel.send('I do not have the permissions to unban that specific person.');
            }
        } else {
            console.log(e);
            return message.channel.send('I do not have the permissions to unban that specific person.');
        }
    }
#

what's wrong? :/

earnest phoenix
#

The <Client>.users.fetch() method returns a promise, resolve it

boreal iron
#

Isn’t that what flazepe already said?

sharp geyser
#

Sometimes it takes 2 people to finally get something through to people

earnest phoenix
#

Yeah, they don't seem to either understand I suppose stuff

quartz kindle
#

also that forEach wont be caught by the try catch

ancient nova
quartz kindle
#

if you already had it why did you remove it

ancient nova
#

if I have no idea what's causing it I have to trial and error until it works

boreal iron
#

You didn’t await the first fetch

#

Means the member will be the argument

#

Probably just a mention

#

Which is no valid member resolvable

#

Therefore it fails

ancient nova
#
    if (!member) return message.channel.send("Could not find the member.");

    try {
        await message.guild.members.unban(member).then((member) => {
            return message.channel.send(`:wave: ${member.user.tag} (${member.user.id}) was unbanned in this server by ${message.author.id}`);
        });
    } catch (e) {
        if (`${e}`.includes("Couldn't resolve the user id to unban.")) {
            try {
                await message.guild.bans.fetch().then(bans => {
                    try {
                        bans.forEach(banned => {
                            if (banned.user.username === member) {
                                try {
                                    message.guild.members.unban(banned.user.id);
                                    return message.channel.send(`:wave: ${member.user.tag} (${member.user.id}) was unbanned in this server by ${message.author.id}`);
                                } catch (e) {
                                    return message.channel.send("I do not have the permissions to unban that specific person or that person doesn't exist or was not banned.");
                                }
                            }
                        });
                    } catch (e) {
                        return message.channel.send("I do not have the permissions to unban that specific person or that person doesn't exist or was not banned.");
                    }
                });
            } catch (e) {
                return message.channel.send("I do not have the permissions to unban that specific person or that person doesn't exist or was not banned.");
            }
        } else {
            return message.channel.send("I do not have the permissions to unban that specific person or that person doesn't exist or was not banned.");
        }
    }
#

well this is my current, very terrible code

#

still doesn't work and Tim made me even more parandoid

boreal iron
#

Now you cut off where member is defined

earnest phoenix
boreal iron
#

Which is still missing the await on the fetch

ancient nova
ancient nova
#

I'm getting 404: Not Found error

earnest phoenix
#

You have way too many try-catch blocks for no reason, I would rewrite it for you but that's just spoonfeeding

ancient nova
#

does that ever happen Cry

boreal iron
#

const member = …

ancient nova
#

it's literally 3 AM

ancient nova
sharp geyser
ancient nova
sharp geyser
#

This is a joke

ancient nova
ancient nova
sharp geyser
#

Voltrex just makes my shit code that works better

boreal iron
#

lol Voltrex making something better

#

Best joke ever

ancient nova
sharp geyser
#

🤔

earnest phoenix
# boreal iron Best joke ever

I would love to hear you say that again when I transfer you to a better place when I detonate those bombs in your car and house

boreal iron
sharp geyser
boreal iron
#

I bought Tim for 1000 bucks means I can abuse him as much as I like to

sharp geyser
#

LMFAO

#

I missed the tim auction?

#

damn

boreal iron
#

He said 1000 is enough

earnest phoenix
#

I've promised to not spoon-feed someone much, but okay I'll do so just for you; this time

ancient nova
#

thanks MRhappy

sharp geyser
#

Voltrex make sure they understand what is happening if you actually do spoonfeed

#

spoonfeeding without learning is useless

ancient nova
#

I feel like I've won at life right now

ancient nova
#

you have a general idea of what it's doing and when you recieve the code you go through it and make your own changes that's how you learn

sharp geyser
#

I somehow doubt this when you don't understand how async/await works

ancient nova
#

so @earnest phoenix how's it going?

sharp geyser
#

Be patient

#

damn

ancient nova
#

I wasn't expecting you to write anything large, just show me how to make it work

ancient nova
boreal iron
#

Your code is a horrible mess, so give him a few minutes

ancient nova
#

I wrote it this badly because of what Tim said

#

all of my other scripts are written much better, neater and with much better syntax

#

if you saw how I program things in Java and c# you'd be surprised

quartz kindle
#

:^)

quartz kindle
#

your entire code can be greatly simplified if you stop mixing await and .then

#

just stick to await

boreal iron
quartz kindle
#

and remove all .thens

sharp geyser
#

Damn

#

FakE violent to tim

boreal iron
#

After cleaning the floor

quartz kindle
#

money first

boreal iron
#

:P

ancient nova
quick terrace
sharp geyser
#

completely yours

ancient nova
#

no

#

it is absolutely not

quartz kindle
ancient nova
#

why is everybody saying that

sharp geyser
#

You can't push the blame onto someone else cause you can't write code

ancient nova
#

no, I'm blaming JavaScript and the way it is made

quartz kindle
#

lol

#

you think js is bad because you're writing it in an ugly way?

sharp geyser
#

I mean there is a lot I find fault with js but you are just using it wrong that is that

ancient nova
#

we'll see what Voltrex does

quartz kindle
#

of course you did

#

as i said, dont mix await and .then

ancient nova
quartz kindle
#

what did i say?

sharp geyser
#

there is no point in using .then when using await as far as I know

ancient nova
#

to add await and that the try catch won't work

#

so I added more of them

#

and more awaits

sharp geyser
#

👀

quartz kindle
#

i didnt say to add more .thens

ancient nova
ancient nova
#

I only added 1 more

#

of then

#

because I needed to

quartz kindle
#

you didnt

lament rock
#

You can chain Promises with .then such as request.get(url).then(r => r.json())

sharp geyser
#

I'd ask my question about using glob here but this guy is the prominent topic rn so I will wait

quartz kindle
#

if you use async await syntax everywhere, you only need one trycatch for everything

quartz kindle
#

and if you want to catch separate errors differently, you can use a null then combined with an if

ancient nova
#

I'm scared of what Voltrex is writing

boreal iron
#

He’s probably crazy enough to write it on mobile, so.. be patient

sharp geyser
#
 await application.addMultipleIn('routes/**/*.ts')

addMultipleIn keeps returning an empty array when trying to look in the routes folder for ts files. I haven't used globs before but this seems to be how you'd do it

#

I might be wrong tho

ancient nova
#

I know how tedious that can be

earnest phoenix
# ancient nova thanks <:MRhappy:945435807500607548>
// Before all of this, check if the client has the `BAN_MEMBERS` permission, as that permission is required to unban a banned member.
if (!message.guild.me.permissions.has('BAN_MEMBERS')) {
  await message.reply({
    content:
      'I need the `Ban Members` permission to unban a member.'
  });

  return;
}

const arg0 = args[0];
const member =
  // Fetch the banner member by ID using the first argument.
  await client.users.fetch(arg0).catch(() => {
    // If the client has the permission to manage the server, get the member by username or tag from the banned members list.
    if (message.guild.me.permissions.has('MANAGE_GUILD'))
      return message.guild.bans.fetch(arg0)
        .then((ban) => ban.user)
        .catch(() => undefined);

    // Otherwise return undefined
    return undefined;
  });

// If the member is still not found by their username or tag, return and do something.
if (member === undefined) {
  await message.reply({ content: 'Member not found.' });

  return;
}

// Try unbanning the banned member
try {
  await message.guild.members.unban(member.id);

  // Clarify that the member has successfully been unbanned.
} catch {
  // Clarify that there was an error unbanning the banned member, probably a permission error or something from Discord's end.
}
#

My god

sharp geyser
#

Oh god voltrex finally finished

#

do you need some water?

sharp geyser
ancient nova
#

really nice thanks