#development

1 messages Β· Page 49 of 1

lyric mountain
#

And show how ur logging it

#

Console.log shouldn't ever error

viral swift
#

Nothing loging

#

Says this again

#

Restarted the project, logging it now, but nothing shows up

#

It says this when i send test

lyric mountain
#

That IS expected

#

Browsers send a GET request, GET is not POST so it errors

viral swift
#

I do this to get the vote info

#

And this my server

lyric mountain
#

You cannot fix, you'll never be able to access using a browser

#

Because you shouldn't

#

Topgg uses post, so it'll work

#

The test button is broken tho

viral swift
#

Then what should I change to get the vote info though? πŸ€”

viral swift
lyric mountain
#

Then print vote to see what it returns

viral swift
lyric mountain
#

I just noticed, are you even supposed to use it like that?

#

Isn't topgg sdk standalone?

viral swift
viral swift
lyric mountain
#

Well, then you put the wrong url on the bot page

#

If it isn't logging then it ain't even entering the scope

viral swift
lyric mountain
#

That's it, I give up

#

You really didn't understand that IS A VERY EXPECTED ERROR

#

You're trying to make a dog meow

viral swift
#

I have this as my code for getting vote info now: ```js
const port = 4000;
const express = require('express');
const { Webhook } = require(@top-gg/sdk);
const app = express()
const webhook = new Webhook('myPassword')

app.post('/dbl', webhook.listener(vote => {

console.log(vote)

if (!vote) return false;

if (!vote.user) return false;

console.log(vote)
.catch(e => {
console.log(e)
});

}));

app.listen(port, () => {
console.log(Webhook server online at ${port})
});

viral swift
lyric mountain
#

you don't access a post endpoint using a browser, that's what you do

viral swift
lyric mountain
#

Nothing, there's nothing to fix regarding that

#

You're not supposed to access it with a browser

earnest phoenix
#

If you want to test the webhook you can just use the Test webhook button on the webhook page of Top.gg

lyric mountain
#

Finally, volt he's all yours

earnest phoenix
#

You aren't supposed to access the endpoint with a browser

viral swift
earnest phoenix
#

No that's correct, go to the webhook page of your bot on Top.gg, and click on the Test webhook, if your webhook is configured properly it should emit the event you're listening to, so you can get the vote and work with it

viral swift
# earnest phoenix No that's correct, go to the webhook page of your bot on Top.gg, and click on th...

Like could it be my webhook problem?
This is I'm making my my server:

const http = require("http");
const { logInfo, logError } = require("../util/commands/log");

const server = http.createServer((req, res) => {
  res.setHeader("Content-Type", "application/json");

  let body = "";

  req.on("data", (data) => {
    body += data;
  });

  req.on("end", () => {
    let parsed;

    try {
      parsed = JSON.parse(body);
    } catch (e) {
      res.statusCode = 400;
      res.end('{"error":"CANNOT_PARSE"}');
    }

    res.end(
      JSON.stringify({
        error: false,
        username: parsed.username,
      })
    );
  });
});

server.listen(3000, () => {
  logInfo("Server", "Connected");
});
```From this, how would i actually get my webhook url?
earnest phoenix
#

You aren't even doing what I'm saying, try it and see if you get the desired response

viral swift
earnest phoenix
#

I literally said how you could do that, are you even reading?

viral swift
earnest phoenix
#

Just log something in your webhook listener, if it logs then it's properly configured, if not then it's not properly configured

#

For example:

app.post('/dblwebhook', webhook.listener((vote) => {
  console.log('It worked!');
}));
viral swift
#

I did console.log('running') to check if the event is running but nothing logs,
And on startup it says this error: (image 1),
Also, i enter the url of the webhook as the url in the image 2?

earnest phoenix
#

Have you tried logging the data you've received from the server? Try logging the body variable on the end event listener

eternal osprey
#

Hey why is my code stopping from working when i use sleep(5000)?

lyric mountain
#

because js is monothread

earnest phoenix
#

I think they mean that their program either crashes or halts, which it shouldn't; the code execution should stop for 5 seconds in that case

quartz kindle
neon leaf
#

ok so I have something like this

let dostuff
if (randomcheck) { dostuff = true }
if (!dostuff) return
...
}
continue some other code```
but it doesnt continue to the othercode if the check doesnt pass
quartz kindle
#

show actual code

neon leaf
#

the entire code is an async function

quartz kindle
#

also, return is function scoped, not block scoped

#
{
  {
    return
  }
   // this will not run
}
// this will not run
neon leaf
#

oh

#

can I somehow do what I want to do then? just wrap the ... code in a if instead of the return?

quartz kindle
#

yeah

lyric mountain
quartz kindle
#

its possible to use labels and break, similar to a batch script

#

but not really recommended

lyric mountain
#

then assume doStuff to always be true (since it had to be to enter that block)

timber fractal
#

So I'm coding a chrome extension, and I need to call a function when a url changes and matches a specific pattern, and when that tab's url changes again it needs to call a different function how would I accomplish this?

solemn latch
#

actually, probably the webNavigation events

timber fractal
#

i'll look into those again

#

i just couldn't find it i dont know

solemn latch
timber fractal
#

thank you, i will look at it

sterile lantern
#

if i have an html form:

<form>
  <label for="fname">First name:</label><br>
  <input type="text" id="fname" name="fname"><br>
  <label for="lname">Last name:</label><br>
  <input type="text" id="lname" name="lname">
</form>```

how would i make it so they can submit it, and when they submit it, compare their value to a github pages secret
#

i think theres some php involved but i just wanna check if the text put inside a certain field matches a secret

#

nvm found a way to do it with js

viral swift
quartz kindle
#

show code

viral swift
# quartz kindle show code

Server:```js

const http = require("http");
const { logInfo, logError } = require("../util/commands/log");

const server = http.createServer((req, res) => {
res.setHeader("Content-Type", "application/json");

let body = "";

req.on("data", (data) => {
body += data;
});

req.on("end", () => {
let parsed;

try {
  parsed = JSON.parse(body);
} catch (e) {
  res.statusCode = 400;
  res.end('{"error":"CANNOT_PARSE"}');
  console.log(body)
}

res.end(
  JSON.stringify({
    error: false,
    username: parsed.username,
  })
);

});
});

server.listen(3000, () => {
logInfo("Server", "Connected");
});

Vote stuff:```js
const port = 4000;
const express = require('express');
const { Webhook } = require(`@top-gg/sdk`);
const app = express()
const webhook = new Webhook('myPasswordHidedThat')

app.post('/dbl', webhook.listener(vote => {
  
  console.log('running')
    console.log(vote)
  
  if (!vote) return false;

  if (!vote.user) return false;

}));
viral swift
quartz kindle
#

whats that server for?

#

the error you posted previously is caused by your try catch not returning

#

it still tries to send the parsed json when it errors

#

its also running res.end() twice

viral swift
#

Is that what i need?

quartz kindle
#

that looks like a vote object yes

#

but i still dont understand why you have 2 servers

viral swift
quartz kindle
#

basically both codes you posted can be used to do the same thing

#

you dont need both, just chose one

viral swift
#

Also, is this the webhook url that i need to put or something else?

quartz kindle
#

its that plus whatever you put in your post function

#

in the code above you have .post("/dbl")

#

so its your replit url plus that

#

...repl.co/dbl

#

also, the port has to be taken from env

#

app.listen(process.env.PORT)

#

because replit uses dynamic ports

viral swift
#

Hmm

viral swift
#

@quartz kindle hey i did it and it works

#

Though if my server address starts with sftp, is there any problem?

#

Like my main bot address starts with sftp, so i did serverAddress/dblwebhook on the webhook url on top.gg page

#

When it was on replit it worked but on the main thing i do this it's not working for some reason

#

It must be some url issue that it's not working

#

Is serverAddress/dblwebhook correct? My server address starts with sftp though

lyric mountain
#

Sftp is for file transfer

viral swift
#

My server address with replit starts with https and that works now

#

But for my main project i use another host

#

@lyric mountain any idea what should I do?

lyric mountain
#

not much I can do with only that info

#

your server is very likely to not start with sftp, you're just using it to transfer files

#

servers themselves don't "start" with anything

lyric mountain
#

"SFTP Details"

viral swift
#

The host where i host my bot shows this as the server address

lyric mountain
#

it's showing u the address to transfer files into the server

#

not the public address

viral swift
#

Oh

lyric mountain
#

and no, I have no idea what url would be

viral swift
#

Ig i need to ask the support where i can find the public address

lyric mountain
#

never saw or heard about that provider

viral swift
#

But for my main bot i couldn't find the address

viral swift
#

Is there some way to get the server address through server id?

lyric mountain
#

Your server url would be your ip

#

Or the domain if ur provider gives one

#

Again, I have no idea what provider that one is, so I can't help but guess

viral swift
lyric mountain
#

Yes

#

Also note how it states a fixed port

viral swift
#

With https would i enter that or the up address only?

lyric mountain
#

Http

#

Not https

viral swift
#

Oh

lyric mountain
#

You don't have a domain, so u can't use ssl

viral swift
#

So http://ipAddress/dblwebhook ig?

lyric mountain
#

With port

#

And make sure you're listening to that specific port

viral swift
#

ipAddress:port ig?

lyric mountain
#

Yes

#

Remember it'll error if u try to put that in the browser

viral swift
#

Yeah it worked!!

neat ingot
#

so if my api has the route /broadcasts, which returns all broadcasts. should i have /broadcast/someid for routes which require an id, or should i keep it /broadcasts/someid, or allow any? πŸ˜›

viral swift
#

http://ipAddress:port/dblwebhook worked!

#

Thanks so much!

lyric mountain
#

Oh wait, just reread it

neat ingot
#

oh, /someid will be there regardless. but atm both routes (broadcasts, and broadcast) work

#

so like, js /broadcast /broadcasts /broadcast/someid /broadcasts/someid are all valid

lyric mountain
#

But yeah, it's better to have channels instead of a global broadcast

neat ingot
#

i feel like, /broadcasts is better for getting all items, where it's more logical to have without the s for individual id pages/data

#

but then, its not really sticking to a true rest api then i dont think

lyric mountain
#

U can cut that in half and use the same endpoint but with GET for reading and POST for posting

neat ingot
#

i mean, im using the same enpoint for all crud operations

#

~ wip

#

codes actually messy af, sorry to anyone who looked at it's eyes πŸ˜„

lyric mountain
#

Not the worst I saw around here

neat ingot
#

ye, its not the worst, but im porting code from my old api, and updating a bunch, so its a huge mess atm

#

but thats not really relevant. just gotta proove not all my code sucks πŸ˜„

#

~ think im just gonna go with the routes with the 's' as its more inline with standard resful naming conventions

green kestrel
#

nice, my new server can build my bot in 44 secs πŸ˜„

#
real    0m44.899s
user    15m45.678s
sys     1m1.034s
#

it does use like 25gb ram to do it that quick though

radiant kraken
#

c++ moment

green kestrel
#

its ok im not short on ram lol

#

or cpus

elder oxide
#

your bot is using c++?

surreal sage
#

If it works, it works shrug

#

If it works, it works shrug

pearl trail
#

6 months later: omg omg pls help my crypto module throws an error, something something is not a function!1!11!1

quartz kindle
#

"it worked before, i didnt change anything!!"

ocean jay
#

Hello, I would need some help.

if (!interaction.channel!.nsfw) return;

When I hover over nsfw it would say

spark flint
#

which version of djs?

#

nvm itsthe same anyways

#
if (!interaction.channel?.nsfw) return;```
pearl trail
ocean jay
pearl trail
#

np πŸ‘Œ

surreal sage
#

How do you disable caching previous pages?
I navigated to the page before after logging out, I don't want that possible

#

Or smthn similair idk lol

lyric mountain
#

that ain't cache

surreal sage
#

Whatever it is then πŸ˜…

lyric mountain
#

I imagine you have some kind of token or id saved on the cookies right?

surreal sage
#

Yeah

#

All I want to be removed is them using pagination to view the previous page

lyric mountain
#

you're thinking it the wrong way tho, you dont need to prevent going back, you just need to check if the cookie exists

#

if it doesn't exists, redirect the user to the landing/login page

surreal sage
#

Local code instead of server?

lyric mountain
#

local obviously

surreal sage
#

Is there an event I can listen to see if the user focused or smthn?

lyric mountain
surreal sage
#

Thanks

covert ingot
#

Ive got a quick question

#

can someone link me to a place where to help me open apps with js

#

server side

lyric mountain
#

wdym "open apps"?

covert ingot
#

Lets say i open google

#

I wanna open google, i run my js and it opens google and firefox

#

Im terrible at explaining

lyric mountain
#

I can see it lmao

#

u want to call executables from js?

covert ingot
#

Yeah

lyric mountain
#

what about the "server side" part?

covert ingot
#

when i googled it it comes up witn functions dom related

#

theres no dom in node

lyric mountain
#

this is what u want to call the executables

#

but I didn't understand the part where u specify "server side"

#

server cannot open stuff on client side

covert ingot
covert ingot
lyric mountain
#

it's not impossible, but I doubt it's even legal

covert ingot
#

Yeah, im not doing anything client side lmao

lyric mountain
#

anything u need to run on the client should be clientside (duh)

covert ingot
#

i jus wanna make a program which opens rocket league, spotify and bakkesmod (a mod for rocket league) instead of having to open it 3 times lmao which is gonna save me a good 30 seconds every time i wanna play rocket πŸ‘

lyric mountain
#

that's entirely clientside

#

I believe ur mistaking what client and server means

covert ingot
#

oh wel

#

Ive stopped programmin long time ago it dont bother me much anymore im jus bein lazy a bit

lyric mountain
#

client would be what you see, for example ur executable is entirely clientside

covert ingot
#

Thanks anyways for pointing me in the right direction tho

#

Ye after acc thinkin abt it it makes sense

lyric mountain
#

server is what you don't see, like the internals of apis (api pages themselves are clientside) which are neither visible nor accessible without having access to the server itself

#

btw, you'll probably have an easier time doing that though batch scripts

#

since they dont need to be built to be executable

hallow compass
#

Can any one solve this with python

earnest phoenix
#

If we solve it for you, you don't learn anything.

#

You have an editorial and hint written, and even instructions.

#

Best is to try it out yourself, that's how you learn fastnod

hallow compass
#

Bro 30min left my exam

earnest phoenix
#

We definitely won't solve your exams for you

#

If you can't solve it, rethink about it after the exam and rethink about how you could've learned it better for the next time

rustic nova
#

yeah we wont solve exams for you

spark flint
#

thats the point of exams

#

to challenge you

#

also thats your last question

#

so spend your 30 mins on that

hidden gorge
#

is this a good status page?

earnest phoenix
#

scoopy kryptonThinking

hidden gorge
#

?

#

my friend scoopy?

earnest phoenix
#

yeah

hidden gorge
#

lol

earnest phoenix
#

i mean, that status page looks like those normal and often used status page providers

#

so yes it's fine

hidden gorge
#

i run the fricken twitter account for scoopy lol

surreal sage
#

Making some HTML pages and I got this nice line of CSS

        @media screen and (min-width: 500px) {
            .too-small-screen {
                display: none
            }
        }```
I want to know, how do I change a variable in JS if this is active
#

Just a true and false variable

earnest phoenix
hidden gorge
earnest phoenix
#

ok?

hidden gorge
#

scoopy owns globalx hosing lol

#

hosting*

neat ingot
#

whats a scoopy?

earnest phoenix
#

what does this have to do with development or the context of the conversation though

hidden gorge
surreal sage
#

"it's"

earnest phoenix
#

yeah so kind of better to stick to topic kryptonCrown

hidden gorge
#

hes*

neat ingot
#

'it is'

neat ingot
#

((inputnum) => {
    const input = inputnum.toString();
    if (input.length < 2) return 'length error';

    const splitter = str => str.split('').reduce((r,i)=> r+= parseInt(i), 0);

    const one = splitter(input.substring(0, 2));
    const two = splitter(input.substring(input.length-2, input.length));

    const pro = one * two;

    return {one, two, pro}
})(4563275);
``` js answer to that exam question no one wanted to answer in python ~ cause why not
earnest phoenix
surreal sage
earnest phoenix
#

Or you can probably also use getComputedStyle

surreal sage
lyric mountain
surreal sage
#

!= ""*

#

Works out

earnest phoenix
#

Well since you use .too-small-screen probably want to use something else than getting the element by it

#

And otherwise try it and see

surreal sage
#

Yeah ID

earnest phoenix
# neat ingot ```js ((inputnum) => { const input = inputnum.toString(); if (input.len...

It can just be

function solve(input) {
  input = input.toString();

  const firstTwo = input.slice(0, 2);
  const lastTwo = input.slice(-2);

  const firstSum = parseInt(firstTwo[0]) + parseInt(firstTwo[1]);
  const lastSum = parseInt(lastTwo[0]) + parseInt(lastTwo[1]);

  console.log(firstSum, lastSum);

  const productSum = firstSum * lastSum;

  console.log(productSum);
}
surreal sage
#
        setTimeout(() => {
            if (document.getElementById("too-small-screen").style.display != "") {
                document.getElementsByClassName("too-small-screen-child0").item(0).innerHTML = "Gettin' there"
                document.getElementsByClassName("too-small-screen-child1").item(0).innerHTML = 'Fetching moderations... <div class="spinner-border text-secondary" role="status"></div >'
                document.getElementsByClassName("too-small-screen").item(0).classList.add("too-small-screen-active")
            }
        }, 200)```
#

200ms is now 10ms*

earnest phoenix
earnest phoenix
#

What?

neat ingot
#

but your missing the addition yea

#

the first two and last two nums need to be added together

earnest phoenix
#

It's (first + second) * (last + second last)

#

Ah yeah the addition

#

Let me edit it rq

woeful pike
#

it's a longshot but anybody made a bot for feishu/lark before?

#

I need someone to manually approve my "1234 just testing account bbbbb" bot just to give myself permission to receive messages on the bot? lmfao

#

can't even find anything online because everything is in chinese lol

neat ingot
#

chinese doc is always fun. i remember trying to decypher dragonbones chinese doc for ages before finding some helpful info in english πŸ˜„

woeful pike
#

the docs are like:
create a bot app
verify the webhook url
write all the code
submit the bot for review
done! now you can message it

#

but like.. how do you test it OMEGALUL

neat ingot
#

how to code 101: type.

earnest phoenix
neat ingot
#

lol tbh, i think we can mash our solutions together to create a better one

#

i always forget about the 'slice' function, so i think incorporating that into my solution would be good, or perhaps incorporating a reduce call into your solution

#

but that likely wouldnt be quite as performant as grabbing from array index

earnest phoenix
#

Yeah

#

Although it's also possible to get the digits from the specifics indexes instead of number to string and string to number conversion, but it's pretty trivial

#

wonderful

neat ingot
#
((inputnum) => {
    const input = inputnum.toString();
    if (input.length < 2) return 'length error';

    const add = (r,i) => r += parseInt(i);
    const map = (str) => str.split('').reduce(add, 0);

    const one = map(input.slice(0, 2));
    const two = map(input.slice(-2));
    const pro = one * two;

    return { one, two, pro };
})(4563275);

i quite like that as a solution. loooks neat. and really the performance loss is minor for such a call. i mean, if it was being called thousands of times per second, sure, optimize, but yea...

neat ingot
surreal sage
surreal sage
#

computedStyle nvm lol

lyric mountain
neat ingot
#

that is a function though...

#

"immediately invoked function expression" i beleive is its technical name

#

easier to copy paste into console for tests πŸ˜›

lyric mountain
#

yes but use a regular function

#

ah wait, is it for testing?

#

then it's fine

neat ingot
#

yea lol, i have no need for the code, it was some guy doinga python test who was asking, i just solved it in js, cause why not πŸ˜›

#

ofc if i was using it, it'd be an actual function, likely in some class πŸ˜›

lyric mountain
#

at least there's still people that didn't convert fully to functional programming

#

classes ❀️

neat ingot
#

functionally programming in an object oriented language is just dumb imo

surreal sage
#

lol

earnest phoenix
#

(The solution functions were called 99,999 times)

neat ingot
#

i mean, we knew getting from array index would be faster. but imo, for 100k iterations, thats not too bad. i guess it'd really depend on if performance was the main focus

lyric mountain
#

100k is pretty low for benchmarking

#

try 1m

neat ingot
#

yea thats fair lol

lyric mountain
#

usually I go with even higher values, since JIT kicks in after some time

neat ingot
#

i mean, its still gonna be about half as quick πŸ˜›

lyric mountain
#

array access is pretty much as fast as possible since it's a O(1) operation

neat ingot
#

ye for sure

lyric mountain
#

works like a charm (command-specific help command)

earnest phoenix
#

100k is also pretty low ASthink

earnest phoenix
lyric mountain
#

it only caches if the value follows a pattern

neat ingot
#

tbf, the exam question didnt mention the function had to run any more times than 1 πŸ˜›

lyric mountain
#

JIT will notice that and replace ur function with a linear scale

neat ingot
#

so performance obviously wasnt the focus, just getting the correct result was

earnest phoenix
#

Yeah, but we're benchmarking for fun

#

In the end, who the hell cares about performance for that yeah

neat ingot
#

lol

earnest phoenix
#

You would first not go for node

neat ingot
#

where a bench can be marked, wild voltrex will spawn πŸ˜„

earnest phoenix
#

Then we can talk about benchmarking again

neat ingot
#

lmao, very fair.

#

ill come back later with a rust or go solution πŸ˜›

earnest phoenix
#

And then the Rust users enter the chat

#

Oh well

#

Rust users?

#

gosh i hate when people straight up think about Rust

#

tells already a lot

#

I don't see what's wrong with that, Rust is almost as fast as C which is the fastest programming language, while being completely memory safe

#

Not going in that useless debate again

#

I'm saying that although I don't even use Rust, I just maintain it's codegen back-end

#

It's completely pointless and you know it yourself

cinder patio
#

imagine hating on rust

earnest phoenix
#

Having an opinion is hating?

#

Getting better

wheat mesa
#

Rust is based

#

You’re outnumbered

#

Bandwagon fallacy

cinder patio
earnest phoenix
#

My point is, when people think about speed everyone comes with Rust because of that overhype

#

That everyone blindly follows like a sheep

cinder patio
#

I mean there are benchmarks out there which show that rust is almost as fast as C

#

there's no "overhype" on that end

#

it's fast and it's proven

earnest phoenix
#

Yeah there is no overhype, it's just the truth

#

And guaranteed memory safety is what sells it mainly

cinder patio
#

yeah it's not only the speed

earnest phoenix
#

Your 100k functions called that are exactly the same is not called benchmarking

#

It's called playing around

#

Most of the people don't even know how to benchmark correctly, myself included

#

Yet they come with their own meaningless "benchmarks"

#

When you call the same function with the same parameters all the time in two different languages there is a difference playing

cinder patio
#

Those benchmarks are looking pretty good for Rust anyways lol

earnest phoenix
#

Yet not faster than C

#

We never said it's faster, almost as fast

cinder patio
#

And yet it uses less memory and CPU load

earnest phoenix
#

Never claimed you did

cinder patio
#

on most of these tests

earnest phoenix
#

whatever

#

node fastest

#

Blazingly fast πŸš€πŸ”₯

cinder patio
#

yikes the go benchmarks tho

fickle hawk
#

Hey Dev's

#

I have an err. While checking that client is in voice channel or not

#

The code
message.guild.me.voice.channel.id === message.member.voice.channel.id
I know that this is v12 code but i can't get how to to with v14

#

Thanks in advance

earnest phoenix
#

But be sure to check if the channel property is null or not

fickle hawk
radiant kraken
# earnest phoenix We never said it's faster, almost as fast

it's actually undeniable that C/C++ is (a bit) faster and smaller compared to Rust; the things i love about Rust is that it fixes literally pretty much all of my complaints on C/C++ and it even has several other good features that i haven't found in any other language

earnest phoenix
#

Yes we were just trying to say that

radiant kraken
#

a wrapper will always be slower compared to its predecessor

earnest phoenix
radiant kraken
rustic nova
radiant kraken
pure sage
#

how can i get message content in discord.js v14

wheat mesa
#

message.content

#

I don’t see what’s different about that than usual

pure sage
#

its not working

neat ingot
wheat mesa
#

You’re gonna need to be more specific than β€œit’s not working”

neat ingot
#

enable message permissions on the dev portal

#

but your already getting the content of 'd', so that suggests you already have the intent enabled

pure sage
pure sage
#

like this message.reply(meesage.content)

rustic nova
#

elaborate "not working" on that above

#

what error are you getting

neat ingot
#

as long as you are watching for the messageCreate event, and handling things within that, it should work fine.

pure sage
rustic nova
#

then it does not reach that line in your code, debug your code

neat ingot
#

message content is a string, why are you performing math operations on it?

#

and your trying to reply with the message itself

#

not the content

pure sage
#

for exaple if the member type 200 the bot will be be accepte the number and multiply it

#

@neat ingot

neat ingot
#

no, i get what your trying to do, but your not converting the message.content, which is a string, into a number before performing math on it

#

which will likely lead to strange results

lyric mountain
#

I believe js allows that, still a terrible thing to do without any check

#

plus that var over there

neat ingot
#

yea, it still 'works', but its pretty bad to get into the habbit of doing it

lyric mountain
#

for sure

neat ingot
#

and if its not an exact number, NaN occurs

#

fair chance 'db.get' either needs a callback or to be awaited too

lyric mountain
#

unless db isn't what we expect it to be

#

might be a map

neat ingot
#

yea thats fair

#

and then, a channel will never be equal to a server

#

unless somehow the db.get calls when passed different ids, for channel and server, somehow return the same data

lyric mountain
#

I miiiight believe that's some kind of "trading channel" or stuff, so db.get(server) would return the configured allowed channel

neat ingot
#

and then ~ you should never trust user input for such things. there are actual libraries out there to use for performing math with user input

#

i mean, tbf if your only doing the one operation on the given number, thats fine, but if you need to actually perform user input math

neon leaf
#

how do I get the total bot user count? aka the usercount of every server the bot is in combined? discord.js v14

lyric mountain
#

iterate over each server, getting memberCount property

neon leaf
#

how do I go through every server though?

lyric mountain
#

client.guilds

neon leaf
#

🧐

#

I get as far as client.guilds.fetch() but idk what to do with it

lyric mountain
#

iterate over it

neon leaf
#

the data doesnt seem to have a user count anywhere though

lyric mountain
#

memberCount

#

guilds dont have users, they have members

neon leaf
#

the data doesnt even list all servers for some reason

lyric mountain
#

well it'll show all guilds for that shard

#

not that you're even supposed to count all members

#

imo it's just additional processing to show a big number that nobody cares or would bother to check if u didn't simply put a random value

neon leaf
lyric mountain
#

yes more servers = more ram, but it's not the major bottleneck usually

neon leaf
lyric mountain
#

a fun fact, is that many shopping sites do that to bias the consumer

#

yk, those with "XX looking at this product" or smth

neon leaf
lyric mountain
#

.reduce()

neon leaf
#

pretty vague, not too much but I dont know what params I need for it to work

lyric mountain
#

it's indended to be vague so you search in google

#

gave u the name, throw it on the docs and see how it works

neon leaf
#

I couldnt find anything, I just did this in the end

lyric mountain
#

inline try-catch 😩

#

also u should start using for more than while for iterators, it was made for that

rustic nova
#

cant you just loop through the json instead of whatever that mess is ?

#

define a total variable

for loop through json array

get json object at index nth, get value from money key
add to total

#

dunno what conrun would do

lyric mountain
#

continue run

pale vessel
#

sawconrun = true

surreal sage
#

Uncatched promise spam πŸ˜ƒ

#
        async function deleteModeration(uuid) {
            return new Promise((resolve) => {
                let request = new XMLHttpRequest()
                request.open("DELETE", "/api/moderations/" + uuid + "/delete")
                request.send()
                request.onload = (target) => {
                    resolve()
                }
            })
        }```
#

waitin' for sharex

lyric mountain
#

well yeah, it's indeed uncatched

surreal sage
#
        async function deleteModeration(uuid, element) {
            deleteModeration(uuid).then(() => {
                element.parentElement.remove()
            }).catch(err => {
                console.error(err)
            })
        }```
lyric mountain
#

doesn't work like that

surreal sage
lyric mountain
#

what errored is inside the promise

surreal sage
#

try {}?

lyric mountain
#

no

surreal sage
lyric mountain
#

.catch

surreal sage
#

And where should I place that?

lyric mountain
#

inside the promise where ur doing api requests

#

but well, what's the error?

surreal sage
#

Yes.

lament rock
#

why are you calling the same function inside of the function

lyric mountain
#

yes?

surreal sage
#

oh dam

#

wait

#

ah yes my dumbass is using the same function names πŸ˜…

lament rock
#

max call stack size reached would be the error

surreal sage
#

Fixed it

#

I'm just better LUL

ancient nova
#

hello

quartz kindle
#

hellno

wheat mesa
#

let’s go I have made it to the interviewing process for a summer internship with State Farm

rustic nova
#

pog

surreal sage
#

display: flex new line?

#

2 flex divs under each other (well beside each other)

#

I want to make them below each other

#

nevermindo

#

flex-wrap: nowrap;
flex-direction: column;

sharp geyser
wheat mesa
#

you know I just want to point out that this was my first message here

#

I've come a long way since then πŸ₯²

sharp geyser
versed niche
#

When will you accept my Bot?

#

how much time

wheat mesa
#

It takes time

#

Be patient

#

"You're not the first in queue, nor are you the last"

versed niche
#

How can I get development role?

wheat mesa
#

When your bot is accepted, you'll get the role automatically

versed niche
#

ok, thanks

#

Do they accept a bot named Arabic?

wheat mesa
#

I don't see why not

versed niche
#

okay , thanks

neon leaf
#

how can I check if a user sent a message in the last 5min in a specific channel? discord.js v14

pale vessel
#

fetch the channel messages and filter the timestamp to be message.timestamp >= Date.now() - 300000 and try to find a message by that user

earnest phoenix
#

I had prepared my ticket system private for it in transcript i want to save transcript and i am succesfull in creating html file for transcript but cant understand how to do it for a link like provided in tickettool

rustic nova
#

the way tickettool does it is by having a tickettool-based transscript and just providing the html file to its website

#

that then parses it to what it supposed to look like

#

you can also just echo back the whole html file theoretically

stuck dawn
#

is it possible, when a state is true he uses Grow component else use Fade?

tulip ledge
#

Hi I've been coding the quickSort algorithm using Hoare's partition scheme but I've ran into a problem with my version. Whenever the array has 2 equal values the partition scheme gets stuck in an infinite loop when moving the pivot points

slender wagon
#

alright so i got sent a nextjs project and there is a weird section on the static pages

#

it's static/chunks

#
/*
 * ATTENTION: An "eval-source-map" devtool has been used.
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */

the source code in these folders looks kinda obfuscated

civic scroll
#

it's weird that they didn't provide an intermediate component for this

stuck dawn
#

yeah kinda weird

#

it is what it is

civic scroll
#

it provides 'variants' which also includes this if you define correctly

stuck dawn
#

will definitely look at that ty

wooden ember
#

is there any way to make all websites load a "basic html" version? or does it have to be built into the website to be an option to beginwith?

civic scroll
#

you will have to implement them yourself

pure sage
#

im trying to use an external emoji in my bot but i see this

#

can some one help me

sharp geyser
#

Does your bot have access to said emoji

pure sage
#

yes

#

i giv it administrator

#

perm

wooden ember
#

just wanted to know if there was a way to make shit load faster

sharp geyser
wooden ember
#

dont see why websites should use so many resorces for no reason

sharp geyser
#

what are you asking fire?

pure sage
sharp geyser
pure sage
sharp geyser
#

yes, the thing you are trying to use

#

To use the emote everywhere outside of that server, you must have the bot be in the server where the emote is

pure sage
#

wait

sharp geyser
#

As long as matches returns a bool value that should work

#

isn't there a startsWith method in java?

fervent moss
#

Some good sorters over here
https://discord.com/api/sticker-packs
Considering this link i wanna make a object like :

emoji : [
description : Id
description : Id
]

Or sort do thing so that i can get description and I'd... Like from a http request something (ig this is not possible)
I can't find a possible working way out

#

Or any other npm yk which can give me link of sticker gif or image when given name

quartz kindle
#

can you elaborate? i dont really understand what you want

fervent moss
#

Ik i need to use map and reduce but idk how

quartz kindle
#
stickers.map(x => ({ [x.description]: x.id }))
fervent moss
quartz kindle
fervent moss
#

Oh cool , is that browser or some website for this things?

lyric mountain
#

simply paste \πŸ“Œ on its place

quartz kindle
fervent moss
#

So...

sticker_packs.stickers.map(=> ({ [x.description] : x.id }))
fervent moss
quartz kindle
#

no

#

sticker_packs is an array

fervent moss
#

So in a array it's [0] right?

#

Wait no

#

Ah...so sticker_packs[0].stickers?

quartz kindle
#

sticker_packs is an array of sticker packs

#

then each sticker pack contains an array of sticker objects

#

if you want all stickers from all packs you have to map both things

fervent moss
#

Oh yeah like i want all stickers

#

Like a huge sort of object or array

quartz kindle
#

easier with a loop then

#

or with map and reduce

#

actually a double reduce

fervent moss
#

Like
for (stickers of stickerpacks) =>

quartz kindle
#
const total = {};
for(const pack of sticker_packs) {
  for(const sticker of pack.stickers) {
    total[sticker.description] = sticker.id;
  }
}
#

or with a reduce + forEach

#
const total = sticker_packs.reduce((acc, pack) => pack.stickers.forEach(sticker => (acc[sticker.description] = sticker.id)) || acc, {})
proven lantern
quartz kindle
#

just add a () and it works

proven lantern
#

i bet my code is more efficient πŸ˜‰

#

jk

earnest phoenix
#

Hello, where I can calculate the results?

astral path
#

the results of?

quartz kindle
proven lantern
#

this is the setup block js Array.from({length: 100}, (v, i) => ({ stickers: Array.from({length: 100}, (v, i) => ({ id: "adsf" + Math.random(), description: "adsf" + Math.random() })) }));

cinder patio
#

looks like Tim's code is faster

proven lantern
#

how dare you

cinder patio
#

just facts bro

quartz kindle
#

btw your code returns different results

proven lantern
#

whoops

#

that's why it's slower

#
const total = sticker_packs
    .reduce((acc, {stickers}) => ({
        ...acc,
        ...stickers.reduce((acc, sticker) => ({...acc, [sticker.description]: sticker.id}), {})
    }), {});
#

fixed

quartz kindle
#

91 seconds lmao

proven lantern
#

my code wins 11 times

quartz kindle
proven lantern
#

yeah you got some wins in there too

#

but i got 11 wins

quartz kindle
#

lmao what

#

how can a code that is literally 30x slower win "sometimes"

proven lantern
#

idk what type of tests they run

pale vessel
#

Ben you are coping

proven lantern
#

how dare you

#

you only won 3133 of the tests

#

i won a huge 11 of them

lyric mountain
quartz kindle
#

thats not what the numbers mean

#

lmao

#

the numbers are a performance indicator, ie operations per second

#

not the number of times the code "won"

proven lantern
#

no it's the elo rating

quartz kindle
#

lmao

proven lantern
#

and in this case lower elo is better

quartz kindle
#

wood division 4

slender wagon
#

help code no work

let lol = "undefined"
console.log(lol)
#

it throws undefined

sharp geyser
#

that should solve it

quaint rampart
#

anyone know how i can translate a slashcommandbuilder to a string? for example

SlashCommandBuilder {
...data
}
to
/(commandname)
or
/(commandname) (subcommand1)
/(commandname) (subcommand2)
/(commandname) (subcommand3)

#

discord.js v13 ^

lyric mountain
#

that's the worst possible highlighting I ever saw

#

I better, didn't saw

#

is ur whole code inside a comment?

boreal iron
vagrant sail
#

Hey! I’m not good at coding my bots but I really need help by someone that is good at coding them and I am Unexperienced in bot coding
Mind someone helping me?

quaint rampart
#

cuz

#

no work

quaint rampart
#

what language

#

etc

#

if your looking for someone to make a bot for you here then u prolly wont find it

#

maybe for money but

lyric mountain
quaint rampart
#

thats it

vagrant sail
#

Well I want my bots to include slash commands and get online

quaint rampart
vagrant sail
#

And I’m not sure how to do that.

quaint rampart
#

this is just some testing

lyric mountain
quaint rampart
#

what library too ^

vagrant sail
#

But i do need help programming the bots

lyric mountain
#

so u dont have any bot yet

quaint rampart
quaint rampart
lyric mountain
#

ok, tf

quaint rampart
#

OK

#

I WAS TRYING

#

STUFF

#

THEN I GAVE UP

vagrant sail
lyric mountain
#

which one is the most recent one?

vagrant sail
#

I’m just not good at Coding

quaint rampart
#

honeslty scraping this code

lyric mountain
quaint rampart
#

this code was me just testing

lyric mountain
#

"making a bot" isn't just going to discord dev site and creating bot account

quaint rampart
#

theres gotta be an easier way to do it

lyric mountain
#

well, kinda

quaint rampart
#

@vagrant sail no one is gonna make a bot for you unless its paid

vagrant sail
quaint rampart
#

and you will also need to pay for hosting

#

monthly

vagrant sail
#

I just made the bots

quaint rampart
#

that means nothing

vagrant sail
#

…

lyric mountain
#

no, u made the accounts

#

not the bots

quaint rampart
#

its like making a discord account

vagrant sail
#

How do I even make the bots?

quaint rampart
#

but the discord account isnt gonna speak by it self

quaint rampart
#

using a library

#

such as discord.js

lyric mountain
#

with code, that alone is what gives life to bots

vagrant sail
quaint rampart
#

if your starting coding, i wouldnt suggest python

#

but

lyric mountain
#

anyway, this isn't the right place to find coders for hire, a mod will probably appear here soon telling that

quaint rampart
#

all ab preference

quaint rampart
#

but what u can do is look on top.gg for servers that have coders and u can askthere :D

lyric mountain
#

may I say, I don't think you'll find anyone willing to code and host for free, so there's that

#

coding isn't hard, but you need to study the topic (coding, not specifically making bots)

quaint rampart
#

^

neat ingot
#

i've written a number of bots for clients. its not cheap.

#

if you have time, and want to learn, do it yourself πŸ™‚

quaint rampart
#

oh

neat ingot
#

else, get a deep wallet

quaint rampart
#

nvm

vagrant sail
#

I still have time but where do I begin?

quaint rampart
#

youtube

#

thats how i learned tbh

lyric mountain
#

no, no god hell no

quaint rampart
#

then i would analyze code

#

and then

#

i understood what certain things do

#

and

#

i memorized

lyric mountain
#

is terrible to start from youtube because u get dependant

quaint rampart
#

thats it

#

now i can code

quaint rampart
lyric mountain
#

first u need to choose a language, I'd say either js, java or python

vagrant sail
#

I don’t know where to start coding…that’s the problem

lyric mountain
#

those are pretty beginner-friendly langs

vagrant sail
#

Where do I start coding?

lyric mountain
#

once u choose, go to udemy or codeacademy and take a few courses

#

some are free so u don't need to spend anything

vagrant sail
#

Which ones are free?

neat ingot
#

imo, javascript would be the best place to start. but im super biased. love js ❀️

lyric mountain
#

you'll need to look at thsoe sites to know, there are many

#

do not think about bots yet, focus on learning how to code

vagrant sail
#

I need a link to them first…invalid

lyric mountain
#

once u get a good grasp of the language, attempt a simple project like calculator or snake

neat ingot
#

yea, if you dont know any coding at all, starting with a bot is not going to be a fun experience. learn how to do basic junk in some language first

wheat mesa
#

Learn syntax => learn logical thinking => build your own projects such as discord bots

lyric mountain
#

THEN attempt a bot (a simple one, with stuff like ping and 8ball)

vagrant sail
#

How about I try Dyno?

lyric mountain
#

try to make a bot like dyno?

vagrant sail
#

Well something different it

lyric mountain
#

that's like trying to fight a bear with a stick and some potatos

neat ingot
#

what are you actually wanting/needing a bot for?

vagrant sail
#

I might try doing one like Dank Memer but with economy + more.

vagrant sail
neat ingot
#

any economy bot is a huge undertaking, you need knoledge of databases, data structures, how to perform api calls, and a lot of knowledge of whatever coding language your writing the bot with

vagrant sail
#

I already created the bot accounts now I need the bots…which Is a hard part

neat ingot
#

it took me like, 6 months to write my first discord bot, and ive been coding for almost 10 years. its not something you can just throw together overnight without prior knowledge

vagrant sail
#

Well because it was easier for you for other beginners it may be hard and some may get more experience than others

neat ingot
#

theres a guide for a basic bot with discord.js, using javascript

wheat mesa
#

Do not start programming with a discord bot

#

You will regret it

#

95% of the time

neat ingot
#

but yea, its not advisable to begin with just coding a bot, you will be so overwhelmed its not even funny πŸ˜„

#

gotta learn the language your using to write the bot first

wheat mesa
#

You’ll struggle with so many basic things that the guide kinda hops over and assumes you know, which will lead to quick burnout and β€œI can’t do this” mentality

neat ingot
#

like, you wouldnt try to write a french novel when you only know english, right?

vagrant sail
#

Well that’s why I hate making bots when it comes to hard parts

wheat mesa
#

Then don’t make bots

lyric mountain
#

it's not the hard part lmao, it's the only part

#

bots are 99.999999999999% code

#

the remaining percentage is making the bot account

neat ingot
#

there are tools out there to help making basic bots. like, applications with a user interface that you can drag and drop components to build a bot

vagrant sail
#

Make that 100,00000000% to code

neat ingot
#

those bots are generally looked down upon though, as its not 'your bot', its some other persons bot you have customized

vagrant sail
#

I’m gonna try making one first but idk it wouldn’t be easier if I looked in YouTube for easier ways to get a better script

lyric mountain
#

looking at youtube is one way to make sure your bot dies early

#

always refer to official documentation or forums, they're the best places to find answers

neat ingot
#

official doc is intimidating af when your a nub tho.

lyric mountain
#

youtube guides are timeless (that is, they might not represent the current state of things), and discord api is HIGHLY volatile

#

so it changes a lot in a very little timeframe

vagrant sail
#

I once ordered a bot from a bot developer then it went offline in my server

lyric mountain
#

well, u need to host it

#

bots don't stay online by themselves

vagrant sail
#

Actually they needed to host it

#

They made the bot though.

neat ingot
#

no one is gonna perma host a bot for you, unless you are paying them monthly

lyric mountain
vagrant sail
#

That’s a waste of money if you literally do that

lyric mountain
#

they were tasked with making the bot, and they made it

#

making a bot doesn't include hosting or doing maintenance

#

those are separate services

#

it's like buying a car and expecting the seller to keep your tank full

neat ingot
#

ngl, thats why i dont write many bots for clients anymore. they always expect free maintenance, and im too nice lol

vagrant sail
#

If there’s no maintenance required then the bot is automatically gonna go offline

lyric mountain
#

not really, you can host the bot yourself in ur own pc

#

by "maintenance" we mean "fixing bugs and adding more features"

neat ingot
vagrant sail
#

I don’t have a PC correction…topggDotRed

neat ingot
#

^ bots been running for like 2 years without intervention

#

it reboots and such itself occasionally

lyric mountain
#

I'd charge like $5 only for being available to do regular maintenance

#

that for small bots

#

SAAS is not cheap, clients usually expect it to be

vagrant sail
#

I would Rather Copy & Pasting the code rather than typing a long code to write a big one

neat ingot
#

contabo is one of the cheapest i've found. there are some others like hetzner etc

vagrant sail
#

That Saves you more time.

lyric mountain
#

because copypasting makes maintenance hell

#

like, if the bot ever shows bugs, or u want to add something new, u wont be able to do

neat ingot
#

if you copy and paste code you have no idea what its doing, thats a huge security risk imo

lyric mountain
#

because you don't know what u copied

#

that too

#

too easy to expose ur token and get ur own account hijacked

neat ingot
#

too easy to get properly hacked too if your running the code locally

vagrant sail
#

Not unless you have a Safe Security System that prevents hackers installed.

neat ingot
#

i knew a dude who was writing hacks for rpgmaker mv, so the games he made would hack peoples systems.

#

there is no such thing as 'prevent hackers'

lyric mountain
#

as the wise man says, "Time saved from choosing the easy route will return ten-fold later on"

neat ingot
#

you can slow em down, but thats it

vagrant sail
lyric mountain
#

they wont

#

it's impossible to know who stole ur info

#

all discord will see is you doing weird stuff

#

if anything, ur own account will be the one punished

neat ingot
#

true πŸ˜„

lyric mountain
#

why do you think discord scammers use people's accounts instead of creating one themselves?

vagrant sail
#

Coding a Bot would waste half of your time

neat ingot
#

then have no bot ~ problem solved πŸ™‚

lyric mountain
#

I'd not say "waste", more like investing

vagrant sail
#

I feel like making a Discord bot is more harder than trying to enable Discord Party mode on your device

lyric mountain
#

coding skills are highly valuable nowadays

#

plus while it might seems like a "big code" you really don't feel like it took a long time

#

it's like writing a book ig

#

you simply "go with the flow"

vagrant sail
#

There are other ways to code bots

#

You could host them.

#

Instead.

neat ingot
#

what other ways? please do tell

vagrant sail
#

I once got suggested to do that.

#

With my bots

lyric mountain
#

yes, you yourself can host the bots

#

you just need to keep your pc online 24/7

vagrant sail
#

Literally that means it would be wasting a lot of battery

lyric mountain
#

yep

vagrant sail
#

Until 1% then it dies.

lyric mountain
#

there's no "free" hosting

neat ingot
#

well, glitch

vagrant sail
#

Well that’s the worst thing ever

lyric mountain
#

glitch has anti-pinging policy now

#

you'd be breaking the ToS if u used anything to keep ur bot online

neat ingot
#

lmao

vagrant sail
#

Well how are you gonna get a bot online without breaking the ToS

modern sable
#

paid host

neat ingot
#

at the end of the day, if you want your bot to run, it has to be on some computer running, if that computer goes off, the bot dies

#

this is why people pay for servers

lyric mountain
#

inb4: not that expensive

vagrant sail
#

I literally don’t have a computer…

neat ingot
#

then you literally, need a host

vagrant sail
#

Web hooks are also just like bots

lyric mountain
#

not really

modern sable
#

uh no - not really

lyric mountain
#

webhooks only send messages, they cant do any kind of processing

modern sable
#

There are small virtual servers for like €5/month - perfectly capable of running a small public bot

#

alternatively, if you want to host at home (and you have a stable internet connection) - i guess get a raspberry pi?

vagrant sail
#

…

#

I have stable internet but I need a good hosting platform

lyric mountain
#

it still wont be free since u need to pay for the pi + energy bill

modern sable
#

yea they're like €40 iirc

lyric mountain
#

just get a hosting service, it'll be the cheapest option

neat ingot
#

top end models are a bit more

lyric mountain
#

BUT before we talk abt hosting, you don't even have a bot yet

modern sable
#

^

neat ingot
#

and if you have no computer, you have no way to develop one

vagrant sail
#

Bruh

boreal iron
#

Imagine having one cable missing KEKW

#

The entire weekend

lyric mountain
#

I mean, u CAN code without a pc

lament rock
#

Develop your bot on mobile πŸ—‘οΈ

lyric mountain
#

it'll be an awful experience, but possible

vagrant sail
boreal iron
#

Just one is missing topggSob

neat ingot
#

can you run node.js mobile though? idk if you can

#

i guess, you could code a bot in something other than js lol

lyric mountain
#

afaik u can run console inside android

#

since it technically is linux

lament rock
#

There used to be a package for nodejs for iphone os and it was node 12 and I was able to host my bot on my iPhone, but just for memes

neat ingot
#

oh, so you can run a vm basically? neat.

lyric mountain
#

u can technically install ubuntu on a smartphone, the hard part is making it work with the processor and stuff

boreal iron
#

Delivery guys should fucking work 25/7

vagrant sail
#

If you make a bot then you would have to spend a lot of time with the errors

#

That would be a difficult issue

#

Cause if someone is reporting a error of your bot then it’s up to you to fix your bot.

lyric mountain
#

yep

neat ingot
#

well, there is no way someone will write a bot for you for free, host it for free, and perform maintenance for free πŸ˜„

#

thats just not how the world works unfortunately thankfully πŸ˜„

boreal iron
#

If you follow some basic coding principles handling errors, finding and fixing em won’t be a big deal

vagrant sail
#

That’s true.

lyric mountain
#

errors don't happen THAT often btw, unless u really dont know what ur doing

#

that why we said you should learn coding before learning to make bots

neat ingot
#

tbh, the last couple errors my bots have had, was caused by discord messing with their own api's and junk

#

oh, and one guy who had too many integrations and couldnt figure out why the bot wans't joining πŸ˜„

lyric mountain
#

IDEs also show most errors before u even try to run it

#

just make sure not to ignore what it says and ur fine

spark flint
#

I'm doing some mad code and getting the users with the most reports on my bot, i'm stuck trying to split after 10

#
const sorted = Object.entries(all)
                .sort(([,a],[,b]) => b.length-a.length)
                .reduce((r, [k, v]) => ({ ...r, [k]: v }), {})
            .splice(0, 10);```
#

An error occured: TypeError: Object.entries(...).sort(...).reduce(...).splice is not a function

#

then when I do js Object.keys(sorted).map(async reporter => `${await client.users.fetch(reporter).tag} - ${sorted[reporter].length} reports, it returns [object Promise]

sudden geyser
#

.splice doesn't exist on an object

spark flint
#

ah wait good point

sudden geyser
#

probably want to splice before reducing

spark flint
#
Object.keys(sorted).map(async reporter => `${await client.users.fetch(reporter).tag} - ${sorted[reporter].length} reports`).join("\n")```
#

I tried doing it on that just before join, got [object Promise]

sudden geyser
#

Since you use async in the mapper it returns a promise

spark flint
#

ah ok

#

ok im stuck wah

quartz kindle
#

.map(async anything) = [promise, promise, promise]

spark flint
#

how would I resolve said promise

#

await Object.keys... ?

quartz kindle
#

Promise.all()

spark flint
#

ah

quartz kindle
#

but in your use case its not recommended

#

you should use a for

#

to fetch users sequentially and not concurrently

uneven tartan
#

who smort in sql

#

idk sql and i got an assignment

lyric mountain
#

don't ask to ask mmLol

uneven tartan
#

im not sure how to alter order

#

or how to use sql at all besides getting specific parts

lyric mountain
#

ORDER BY column DESC

#

ORDER BY column (ascending, no need for ASC)

uneven tartan
#

so far i have this

#
1. 
SELECT * FROM Customers ORDER BY Country DESC
2.
SELECT * FROM Customers ORDER BY Country ASC
3.
SELECT * FROM Customers
SELECT * FROM Customers ORDER BY Country ASC
SELECT * FROM Customers ORDER BY CustomerName DESC
4.
SELECT * FROM Orders WHERE EmployeeId = '2' ORDER BY ShipperId
5.
i have no idea how to add things with sql```
#

im not sure if 3 is right cause its worded weirdly

#

all of the questions are worded weirdly tbh

#

i just tried this for number 5

#
INSERT INTO Customers (CustomerId, CustomerName, ContactName, Address, City, PostalCode, Country)
VALUES ('92', 'Acme Supplies', 'Frank Lesser', '123 Main Street', 'Norwalk', '06850', 'USA')```
#

had to look up how to do it

lyric mountain
#

3 is wrong, like, REALLY wrong

#

ORDER BY can have many columns separated by comma

#

they want u to do a double sorting

uneven tartan
#

OHH

lyric mountain
#

to add things u use INSERT INTO table (col1, col2, col3) VALUES (val1, val2, val3)

uneven tartan
#

im gonna put this into my brain rq

#

so it would look like

#

ORDER BY x DESC, y ASC

lyric mountain
#

no need for asc

#

it's implied

uneven tartan
#

ohh okay ty qt

#

i think i got it figured out should be ezpz now ty

lyric mountain
#

πŸ‘

#

🫰 when tf was this added??

#

🫡 and this

#

tf is happening in unicode council?

dry imp
#

twitter emote

#

πŸ«ƒ

#

like fr

lyric mountain
#

is...is that a---nevermind, I don't want to hear the answer

#

I wonder why tf did they even bother using unicode slots for human emojis

#

like, I have yet to see a SINGLE person using them in a normal conversation

sharp geyser
daring apex
#

@earnest phoenix

#

You are here tooo

radiant kraken
hidden gorge
#

This took alllllll day…….

lament rock
hidden gorge
pearl trail
neon leaf
#

does anyone why this turns into this (it turned the numbers into strings)

#

oh

#

I have a .toString() at the end KEKW

solid rampart
kind thunder
#

yo

manic crane
#
        
    
        await player.destroy();
      } else if (player.twentyFourSeven = true) {
        
        await player.stop();
     }``` wondering why its not working
royal portal
#

what are you trying to do