#development

1 messages · Page 40 of 1

boreal iron
#

I see a dot behind line 6 which shouldn't be there

#

let channelId = client.channels.cache.get(971718503914680340).

#

could also be an issue of sourcebin idk

feral aspen
#

Can an Express.JS post method return or res.send() an .html file?

lament rock
#

responses regardless of request method can include a body

#

well, I guess except for HEAD

surreal sage
#

module.exports = {test:()=>{}}

Test comes out undefined if I call it?

lament rock
#

the {} are seen as scope closures, if you want to return an Object, do …=>({})

surreal sage
#

I'm trying to call a function

#

Oh

#

Let me see

feral aspen
surreal sage
#

resolve(number) returning undefined when calling the async function using await function()

feral aspen
#

Right now, I'm at my index.ejs file and have the code of: <%= for (let result of local.results) %>.
If, supposedly, local.results return the following array:

[
  {
    template: Row {
      word: '(N.) Meow',
      definition: 'The characteristic crying sound of a cat.',
      synonym: 'Cry',
      antonym: 'No Antonyms',
      derivatives: 'No Derivatives',
      examples: 'With a meow the brown kitten jumped down.',
      translation: 'مواء'
    },
    pronounciation: 'You can check out the pronunciation of the word at here:<br>https://audio.oxforddictionaries.com/en/mp3/meow__us_1.mp3 (American English)'
  }
]

Is it possible to send a <p> with, let's say, the value of definition, if that made sense.

lament rock
feral aspen
#

Cause right now, I'm trying to loop through template's properties and send a <p> tag that has the property and the value.

lament rock
#

Oh yeah

#

Object.values(template).forEach

feral aspen
#

Right now, I have this object to work with:

for (let result of local.results) {
    for (const [key, value] of Object.entries(result.template)) {
        console.log(key, value);
    };
};
feral aspen
lament rock
#

You need to append a new element to a specific element you can get by ID

#

or to the body

earnest phoenix
#

Well they technically don't need to do that since they're using EJS

lament rock
#

idk the dom too much, but like HTMLElement.appendChild(…)

#

ah. Didn't know ejs was much different

feral aspen
#

I'm using EJS, yes.

feral aspen
#

And <% %> are pain to code with.

#

Still can't figure out how, eh.

surreal sage
#

Forgot return infront of new promise

earnest phoenix
# feral aspen Still can't figure out how, eh.

You can just do it directly:

<% for (const result of local.results) { %>
  <% for (const [key, value] of Object.entries(result.template)) { %>
    <p><%= `Key: ${key}, value: ${value}` %></p>
  <% } %>
<% } %>
#

EJS can be pretty hard to work with, sometimes

tribal crow
#

Hey guys! One of my buttons doesnt seem to work, even though i have done exactly the same as the other button which works.

#

I dont get any errors, but when clicking the button it says "This interaction failed".

boreal iron
#

means you don't respond to the interaction then

tribal crow
#

i mean i am trying to reply

earnest phoenix
#

Then your code is probably short-circuiting at an early point before being able to reply to it, such as a faulty condition

#

Show code

tribal crow
earnest phoenix
tribal crow
#

log what

lament rock
#

anything

#

just to confirm the code is being reached

boreal iron
#

first of all await your promises

#

then defer the interaction since you're doing async database calls

tribal crow
#

doesnt log anything

earnest phoenix
#

Then that means the conditions are faulty, try logging the values you have in the if statements and see if they're what you expect

tribal crow
#

ah

#

one is undefined

#

silly me

surreal sage
#

new Date().getTime() to unix timestamp?

#

new Date().getTime() / 1000?

#

yup

rustic nova
surreal sage
#

shush shush shush

quartz kindle
#

Date.now() is also a thing

wheat mesa
#

happy bday @earnest phoenix

earnest phoenix
wheat mesa
#

sane C++ developer and well known llvm god

quartz kindle
#

happy bird day

lyric mountain
#

wdym "github link"?

#

I don't think it got deleted, unless u deleted the branch

#

...you deleted the branch?

#

idk how to explain, but basically they're different versions of your project, usually sharing the same ancestor

#

check if the project files aren't still there

#

unless you deleted the branch, you cant lose the files

#

even then, u can restore the branch from history

#

ok that was dumb

#

no offenses but you really fckd up on this one lul

#

do you have any local copies of it?

sharp geyser
#

and that folks is what we call a major fuckup

#

If you didnt delete it permanently it should be in a recycling bin on your pc

#

unless you cleared that as well

#

yyea well

#

rewrite time

lyric mountain
#

that's like, you killed the man, fed to boars, killed the boars, made a soup, threw it in the trash, burned it and buried the remains

sharp geyser
#

I can tell you now it wont be fun

#

Unless you like busting your balls with css

#

You can't just use html

#

that aint web development

#

yes

#

and css is hell on earth

#

dont let anyone tell you otherwise

lyric mountain
#

react and html/css/js are mutually exclusive

#

don't try to use them both on one project

boreal iron
lament rock
#

css is alright

earnest phoenix
#

Noob question incoming..

I am currently setting up a tag system (kind of like lucas) but with slash commands...

What I have setup right now is a JSON file with different tags and the content is would send.

And what I am trying to do is when I go to grab something from the JSON file, I want one of the things to be "tag" so that it gets the name of the tag and then grab whatever it needs..

It's hard to explain in text and it would be better if I show it..

But here is the code so you can maybe get an idea of what I am trying to...

JSON Code:

{
    "tags": {

        "wrongdiscord": { 
            "title": "Looks like you have the wrong Discord!",
            "body": "Hey there!\n\nIt looks like you might have the wrong Discord server!\n\nThis is a server for the \"blub\" Discord bot, and not any other\nWe recommend that you join their Discord instead :)"
        }

    }
}```

**JS Code:**
```js
const { tags } = require('../tags.json')
const tag = interaction.options.getString('tag')

  if (tag === 'wrongdiscord') {

    interaction.reply({
      content: tags.tag.body
    })

}```
rustic nova
#

should be tags["wrongdiscord"], so essentially in your case you could skip the if part by going tags[tag].body

#

unless you wanna catch if a tag doesnt exist

#

since in your case, tag is a variable, you'd need to directly reference the json object by using tags[tag].body

earnest phoenix
#

god send

#

thank you aurel

rustic nova
earnest phoenix
rigid maple
#

how do i get the top middle of the box

#

i can get top middle coordinate of the box elements one by one but when i select two i can't find how to get it

quartz kindle
#

in xy coordinates?

rigid maple
#

it doesn't give me the x y coordinates of the box when i select both

quartz kindle
#

what program is that?

rigid maple
#

my website I'm using konvajs

quartz kindle
#

then you have to check the konvajs docs and ask their community

rigid maple
#

I didn't find anything about it in the docs :/

rustic nova
#

text-align center

#

?

surreal sage
#

String options? Asked before but didn't use it that time

#

Like these

rustic nova
#

yeah nevermind, no clue unfortunately

boreal iron
surreal sage
#

No need

earnest phoenix
#

For a chrome extension coded in JS, would an ip premium method be flexible enough?

#

like if your ip is in the code then you can use the extra features

spark flint
#

but then I could see the code and see a bunch of IPs

earnest phoenix
#

If so, how would I make it so the file (when inspecting the extension) is not visible to users? I don't want people's Ips being visible

#

Oh

#

so you can't hide it

spark flint
#

nope

earnest phoenix
#

what if you use a txt file?

spark flint
#

even worse

#

plain text IPs

earnest phoenix
#

shit

#

bruuhh

#

so is there any way to make a whitelist system?

quartz kindle
#

the only way is to have a server

#

then have the extension ask your server

#

about the ip

earnest phoenix
#

Oh so a database?

quartz kindle
#

yeah

earnest phoenix
#

betttt

#

thanks

earnest phoenix
# quartz kindle yeah

wait but the thing is can't my username and password for the db be leaked if i just add it to the code?

#

or do you use localhost?

quartz kindle
#

no

#

your extension sends a request to yourserver

earnest phoenix
#

Oh ok

quartz kindle
#

then your website checks your database

earnest phoenix
#

Alr

quartz kindle
#

then return the result

earnest phoenix
#

Ok

boreal iron
#

And how do you wanna prevent the user from finding out the URL and spamming requests?

earnest phoenix
#

I am kinda in a pickle, any1 knows how to store lists/arrays into a .json file and perhaps even access the .json file and use the saved list? Currently I am using the json library. I am using python for this.

import json
array_list_to_save = [992058629517742080,3012146008341360720]
# export list into .json file

# Extract array from .json file and save it.
extracted_list = [992058629517742080,3012146008341360720]
rustic nova
sudden geyser
#

That may not be a good idea.

#

But you can

wheat mesa
#

Yes please don’t use json as a database

rustic nova
#

and that

earnest phoenix
wheat mesa
#

Don’t use files as databases in the first place

#

Use a proper database like Postgresql or Mysql or Sqlite or Mongodb

#

Relying on files as your database is going to cause a lot of issues down the line

earnest phoenix
#

Thanks, I'll check those out.

sharp geyser
boreal iron
#

Imagine calling mongo and mysql a proper solution

solemn latch
#

Any file based database is a bad idea

boreal iron
#

nobody mentioning that any database is file based

solemn latch
#

You know what I mean ^_^

rustic nova
#

well technically, everything is file based smug

#

MySQL stores stuff in files iirc

#

Everything that essentially retains data after a restart is technically file based smug

rustic nova
boreal iron
#

Im not sure 🤔

#

You’re trying to copy me and steal my identity?

wheat mesa
#

Always

boreal iron
#

I will call the police if so!!1!

wheat mesa
#

Databases are designed to be efficient and cache friendly, and are often quite complex at a low level to achieve things like concurrency without any risk of data loss

boreal iron
#

Shut up nerd

rustic nova
#

I'll just be quiet and not say anything

#

this channel smells anyways

boreal iron
wheat mesa
quartz kindle
#

kick's waffle out

lyric mountain
#

Use proper database
or
Mysql

Choose only one waffle

wheat mesa
#

fuck…

sudden geyser
#

json

boreal iron
#

I mean tbf it’s pretty much a good database if you know it downsides

wheat mesa
#

Proper database

boreal iron
#

But since this is against Waffle… yeah let’s harass about him for this comment

wheat mesa
#

:c

boreal iron
#

Nuuuuuuuuub

boreal iron
#

Yee aurel is on the watchlist now!

hollow yarrow
#

what bot do you guys think is best for admin help? like clearing channels, adding triggers, mutes/bans/warns, etc?

#

commands are easier for me to use rather than diving into server settings

wheat mesa
#

#WrongChannel

carmine summit
#

is it illegal to send components in webhooks?

lament rock
#

even though the execute webhook (send message) endpoint is documented to have components

#

so…???

hollow yarrow
#

i put it in general but it didnt seem like the right place either

fervent moss
#

I may sound dumb but does someone know how to convert a normal website to a express website?

#

Static website

lament rock
#

for what purpose

#

express is quite bloated and if you're just gonna continue to use "static" website, then you're better off without

rustic nova
#

sounds like a reasonable thing to do if your site is partially static, such as having a login page within it. Though if its really entirely static like just a homepage, theres no need to, true

#

so mainly depends on the use case

lament rock
#

Even then, express is just... It has a nice interface, that's all I'll give it. I wrote my own route handler which I can control

sharp geyser
#

not everyone knows how to make their own route handler with the native http library or whatever you used

lament rock
#

http

civic scroll
#

http

raw sigil
#
const Discord = require('discord.js');
const config = require('../config.json')
module.exports = async (client) => {
    let channel = client.channels.cache.get(config.channelID.interactionsChannel);
    let msg = (await channel.messages.fetch({limit: 10}))?.filter(m => m.author.id === client.user.id)?.last()
    
    let toSendEmbed = [
        new Discord.MessageEmbed()
        .setTitle(`Interactions`)
        .setColor(`BLUE`)
        .setDescription(`📩 - Create a ticket\n💻 - Apply for beta tester\n👨‍💼 - Apply staff`)
    ]

    let timeZoneEmbed = [ 
        new Discord.MessageEmbed()
        .setTitle(`Assistance Info`)
        .setColor(`BLUE`)
        .setDescription(`Availability GMT+3 [08:00 - 12:00] \nIf the problem is related to javascript/python, try the channels [#1015668644862234664](/guild/264445053596991498/channel/1015668644862234664/)/[#1015668677569417256](/guild/264445053596991498/channel/1015668677569417256/) \nUse decent language, if you don't do this you will get **time out**.`)
        .setFooter({text: `Last Time Updated`})
        .setTimestamp()
    ]
    
    let ToSendComponents = [
        new Discord.MessageActionRow()
        .addComponents(
            new Discord.MessageButton()
            .setCustomId('CreateTicket')
            .setEmoji('📩')
            .setStyle('SECONDARY')
            .setDisabled(!config.settings.interactions.createTicket)
        )
        .addComponents(
            new Discord.MessageButton()
            .setCustomId('ApplyDeveloper')
            .setEmoji('💻')
            .setStyle('SECONDARY')
            .setDisabled(!config.settings.interactions.developer)
        )
        .addComponents(
            new Discord.MessageButton()
            .setCustomId('ApplyStaff')
            .setEmoji('👨‍💼')
            .setStyle('SECONDARY')
            .setDisabled(!config.settings.interactions.staff)
        )
    ]
    
    if(msg) msg.edit({embeds: toSendEmbed, components: ToSendComponents})
    else channel.send({embeds: toSendEmbed, timeZoneEmbed,  components: ToSendComponents})
}

#

i want to send toSendEmbed

#

and timeZoneEmbed

#

how?

civic scroll
#

embeds field is an array of embeds

#

you can just
embeds: [toSendEmbed, timeZoneEmbed]

raw sigil
#

what

civic scroll
#

or it only displays 1

raw sigil
#

display only 1

wooden ember
#

there was like 4k json files

#

worked pretty well

civic scroll
surreal sage
#

Named keys in an array?

#

On accident but still what

civic scroll
#

yes

surreal sage
wooden ember
#

how would you get the channel a 'voiceStateUpdate' event came from?

rustic nova
earnest phoenix
# surreal sage <:Hmm:460816286868570112>

Arrays are objects with indexes as keys and elements as values, technically everything is an object in JavaScript internally, so you can assign anything you want to them (except for nullish values, which are null and undefined)

digital swan
#

is there a way to get a user's server banner?

surreal sage
#

I have 3 objects in an array

#

All of those objects have a uuid to identify each

#

All properties except the uuid are equal

#

How do I only have 1 of each kind?

digital swan
#

array.filter ?

surreal sage
#

I don't think that'd work

surreal sage
#

[...new Set()] doesn't work since 1 of the properties aren't equal

digital swan
#

probably a shitty way to do it, but could loop through them all, add the names to another array (assuming the names are unique), and then delete it from the array if its already in that other array

surreal sage
#

Or store the name property in a object and don't continue the "for" statement?

#

Bad way to explain*

#

Stops the entire script hmm

#

nvm

#

Fixed

wooden ember
#

anyone have any experience using the node_microphone package?

#

cuz im trying to make it so that the bot can be in more than one vc but stream the same audio resorce

#

and when i try to use the same source it just bricks the entire bots ability to stream anything

#

at the moment i can run one vc command that streams an mp3 and the node microphon commands at the same time in diferent vcs

#

and that all works

#

wait i have an idea

wooden ember
#

nvm didnt work

lament rock
#

@wicked edgecordjs/voice allows you to do that already

#

love Discord's ping resolver

rustic nova
lyric mountain
#

lmao

#

worse than auto corrector

wheat mesa
#

Can you show the code

lyric mountain
#

´${time}´?

#

oh wait, they fixed using backticks in code markdown

#

oh nope, they didn't

wheat mesa
#

Yeah if you do that then it’s going to be confused, when it’s a string it’s expecting it to be in ISO format

#

Pass it in as a number directly instead of a string

#

👍

neon leaf
#

does someone know how to make a beg command using a button? Im not talking about coding it for the most part, more of the logic on how to know whos recieving money, this is how it should be:

user 12345 does /beg 1000
makes a message with a donate to him button

user 54321 presses the button

now user 54321 would loose 1000 and user 12345 would get 1000

lyric mountain
neon leaf
#

can I still execute the button that way?

lyric mountain
#

yes why wouldn't you?

neon leaf
#

someone said I need the id to be static to execute buttons

lyric mountain
#

that doesn't make any sense

#

I mean yeah, buttons will have static ids once sent, but you can set them to whatever you want

#

the event will still fire regardless

neon leaf
lyric mountain
#

whatever u need to do with the interaction you'll add inside this

#

also, don't simply copypaste code from the internet, try to learn what it does

#

bots aren't simply "code and forget", they require active maintenance which you'll not be able to do unless you understand your code

neon leaf
#

I do understand my code, I wrote about 90% of that file, I just dont understand how to execute buttons

lyric mountain
#

(more like 60% because 30% is button code)

neon leaf
lyric mountain
#

that line I sent u, it's where button handling should go

neon leaf
#

yeah, thats where it currently also is, after the interaction.isChatInputCommand() if statement

lyric mountain
#

so?

neon leaf
#

ok, I think I got most of the customid logic, the last part is how do I make button.execute execute the right button?

lyric mountain
#

you check the id

#

so you need to include other data aside from just the user id

neon leaf
#

for the custom id part I can just check the first three letters and if they are BEG I just get the other vars and send them to the button, but how do I execute it? like yes, button.execute, but what does it look for?

lyric mountain
#

wdym "look for"?

#

it doesn't do any check automatically, you're the one filtering what gets executed and what doesn't

neon leaf
#

ok, I think I got it now, last question; is interaction.customId the custom id I set in the beg command?

lyric mountain
#

yes

neon leaf
#

ok, thanks

wheat mesa
#

bro I wish I could just get good at langdev

#

this takes a lot of time :C

boreal iron
#

tf is wrong with npm

#

can't update anything

#

it just hangs to death

fallen holly
#

does anyone know how to get data from json file and store it into a var

proper storm
#

@neon leaf play ncs song

neon leaf
wheat mesa
craggy crane
#

SyntaxError: Unexpected token in JSON at position 0
at JSON.parse (<anonymous>)
at Y.json (/root/MELLIE/node_modules/petitio/dist/index.js:30:574)
at ke.json (/root/MELLIE/node_modules/petitio/dist/index.js:30:2499)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

sick agate
#

syntax error

wheat mesa
tight island
#

should i just opensource a modmail bot or try to code it in a way that makes it work with every server

sudden geyser
#

That depends on you.

#

Open source doesn't really exist so people can figure out how to adapt some software to their needs.

#

It exists more as a collaborative process in developing software.

#

You can develop a modmail bot to make it work in any server

#

You could also open source it at the same time.

#

So pick which one you want to do

tight island
#

fair

#

i'll decide once it's nearing completion

sudden geyser
#

If I were developing a modmail bot meant to be used privately, I would still make the bot work in multiple servers to make it invitable elsewhere and maybe consider open sourcing it.

sharp geyser
#

Although, isn't there already a modmail bot open sourced?

tight island
#

that's not really anything that is relevant though

#

seeing as its not limited to 1 bot being an opensource

sharp geyser
#

No its not

tight island
#

i'm not that good with embeds/stuff alike so would something like this be alright for it

sharp geyser
#

But with there being an already very popular open sourced bot, you will have to likely face challenges if you wanna get yours out there

#

so its good to expect it even if it doesn't happen

tight island
#

yea

sharp geyser
neat ingot
#

is tim a live per chance?

#

im sure you (tim) suggested some vps type provider in the past when iw as talking about contabo, could i ask if you recall what that was? 🙂

stuck dawn
#

how can I get each list length?

sharp geyser
#

@neat ingot

#

heres your conversation with tim about contabo

sharp geyser
#

actually

#

I think you can

#

I mixed it up

wheat mesa
#

Use Object.keys()

sharp geyser
#

yea

#

that

#

I haven't used js in a while my brain is mush

stuck dawn
#

like this?

#

i need to make a for loop for each array in the object

quartz kindle
#

key in object works, otherwise you can also do key of Object.keys(object)

stuck dawn
#

using key of i get

#

but how i access that array length?

sharp geyser
#

Object.keys(list) would be in the condition of the for loop

#

for(const key of Object.keys(list))

#

but what tim said should also work

quartz kindle
#

or for(const array of Object.values(list))

#

then array.length

stuck dawn
quartz kindle
#

thats a typescript issue, not a js issue, it works on js

#

but in typescript you need additional things

#

for example you cant use fixed array type

sharp geyser
#

You could do some weird typings

quartz kindle
#

you have to use a Record

stuck dawn
#

can you send me some example please?

sharp geyser
#

You can probably use a interface instead of just going for a record no?

stuck dawn
#
const TattoosList = {
  mpbusiness_overlays: [
    'MP_Buis_M_Neck_000',
    'MP_Buis_M_Neck_001',
  ],

  mphipster_overlays: [
    'FM_Hip_M_Tat_000',
    'FM_Hip_M_Tat_001',
    'FM_Hip_M_Tat_001',
    'FM_Hip_M_Tat_001',
  ],
}

#

there's the list if helps

quartz kindle
#

const array = (TatoosList as Record<string, string[]>)[key] something like this for example, but thers probably a better way

wheat mesa
#

Just type the variable, that works iirc

sharp geyser
#

couldn't you just put that type on the entire variable

#

like

const TattoosList: Record<string, Array<string>> = {
  mpbusiness_overlays: [
    'MP_Buis_M_Neck_000',
    'MP_Buis_M_Neck_001',
  ],

  mphipster_overlays: [
    'FM_Hip_M_Tat_000',
    'FM_Hip_M_Tat_001',
    'FM_Hip_M_Tat_001',
    'FM_Hip_M_Tat_001',
  ],
}
wheat mesa
#

Yeah that should work I believe

quartz kindle
#

you can type cast the entire variable yes, but you also lose access to its specific types

sharp geyser
#

Wdym

quartz kindle
#

you wont get intellisense for the exact key names for example

#

TattoosList wont autocomplete the object keys

wheat mesa
#

Record<keyof TattoosList, Array<string>> 😉

#

That probably does not work but still

stuck dawn
#

let me see

#

keyof TattoosList should be a type?

#

i am using this example

quartz kindle
#

in order for TattoosList to accept a dynamic key, it needs to have a dynamic type

#

like Record<> or { [key: string]: value }

#

but if you type the original as that, you lose the original type, which gives you the object specific keys intelisense

#

so you assign the original to a new variable and typecast that

earnest phoenix
stuck dawn
lyric mountain
#

Please store the result of Object.keys in a variable

#

So it doesn't need to eval that every single iteration

earnest phoenix
#

It doesn't evaluate it every iteration, it does it only once

#

That's what the iterator methods are for

lyric mountain
#

U sure? At least in java it'll check the condition on every iteration

#

So it'll need to evaluate it every time

wheat mesa
#

It’s not a condition

#

It’s like a foreach in Java

lyric mountain
#

Ah true, forof

#

Btw, wouldn't forin do whatever they're trying to do there?

wheat mesa
#

Personally I just cast it when I do something like that

quartz kindle
earnest phoenix
quartz kindle
#

keep TatoosList as the original object, without any type since its a static object

#

then make a typecasted variable

#

like const list = TattoosList as Record<string, string[]>

stuck dawn
#

i think i found a way using

#

c gives me the array of each object

sudden geyser
#

Object.keys(...) is c here

thorn spruce
#

Hey guys, im using sequelize (6.21.4) and typescript (4.8.2) and in my data class im getting this (Only on INTEGER, BIGINT etc... type) anyone know why ?

No overload matches this call.
  Overload 1 of 3, '(options?: IntegerDataTypeOptions): BigIntDataType', gave the following error.
    Type '25' has no properties in common with type 'IntegerDataTypeOptions'.
  Overload 2 of 3, '(options?: NumberDataTypeOptions): NumberDataType', gave the following error.
    Type '25' has no properties in common with type 'NumberDataTypeOptions'.ts(2769)
stuck dawn
tight island
#

does anyone have a plugin/anything that could assist me so i dont need a lengthy line
the thing i want to do is change 1 to 1st, 2 to 2nd, 3 to 3rd, etc. but i don't have a good way considering 11 = 11th and not 11st, 12 is also 12th but 21 is 21st so i can't do the ending i was going to do

neat ingot
#

@tight island

    function toOrdinal(i) {
        const j = i % 10, k = i % 100;
        if (j == 1 && k != 11) return i + "st";
        if (j == 2 && k != 12) return i + "nd";
        if (j == 3 && k != 13) return i + "rd";
        return i + "th";
    }
lyric mountain
#

tf

#

can't u just do ```js
function toOrdinal(i) {
switch (i.toString().slice(-1)) {
case "1": return ${i}st;
case "2": return ${i}nd;
case "3": return ${i}rd;
default: return ${i}th;
}
}

wheat mesa
#

Nope. Some have different rules than the others, because natural language sucks

#

That would give like 11st and 13rd

sudden geyser
#

1st
11th
21st
31st

neat ingot
#

you can also use the intl. class to do it if you need to consider other languages

quartz kindle
#

11, 12 and 13 are pretty much the only exceptions, no?

fallen holly
#

can someone help me with storing all my cmd and it info into a json file like this

sudden geyser
#

Define help.

#

How do you want it stored?

#

In what way?

#

What's a regular command?

fallen holly
#

non slash cmd

#

like prefix cmd

fallen holly
sudden geyser
#

But how do you expect it to get in that form.

#

I don't know where the commands will come from.

#

It would help for you to explain your main problem in more detail

civic scroll
#

to prevent unnecessary duplications

fallen holly
#

how ??

#

this is my 2nd time dealing with json storing

civic scroll
ancient nova
#

do i get anything for boosting? 😳

sudden geyser
#

blue-purple role

#

some chat

#

and that's it

ancient nova
#

damn was hoping I could move my bot up ranks or something

sudden geyser
#

damn he got it

#

lol no

ancient nova
sudden geyser
#

you'll need more than $10 for that

ancient nova
#

🗿

civic scroll
# fallen holly how ??

eg. if i do it it would be ```js
commandName => {
name: string,
description: string,
slash: boolean, // if executable via slash
message: boolean // if executable via messages
}

ancient nova
#

🗿 why can I not change my billing info on android

#

discord tweaking

fallen holly
#

lol

fallen holly
#

i will do the rest tmmr

lyric mountain
#

Else you might see yourself facing UB when executing said commamds

bright thorn
#

Without restarting can we make changes in the bot

#

Like change in interaction and message create files

wheat mesa
#

Depends, you’ll have to have some special code for reloading those things

bright thorn
#

Umm reload can happen only in commands i think

wheat mesa
#

No

bright thorn
#

Then

wheat mesa
#

You can change code and reload it dynamically as long as you’re not using ES6 style imports

pale oasis
bright thorn
#

Can we make changes in interaction create too without restarting the current instance

wheat mesa
#

Yes.

bright thorn
#

Any small example can anyone send

pale oasis
wheat mesa
#

You can change preeeetty much anything (to a certain extent) as long as you delete the file from the require cache and re-require it

bright thorn
wheat mesa
#

However if you’re using import you unfortunately won’t be able to do that

bright thorn
#

I am using require and const

#

😊

wheat mesa
#

Ok then you can definitely hot reload events and commands

pale oasis
#

But I believe you can use TS to allow both import and require(); statements.

bright thorn
#

Okay so I have to delete the old event from the client and register a new one right

wheat mesa
#

Unbind the listener, delete the require cache for the file you want to reload, re-require the file, and bind the listener back

#

That’s the basic overview

pale oasis
#

^

bright thorn
#

Umm 👍

wheat mesa
#

Somebody else will have to help you with the details though, I’m not very caught up with how deleting the require cache goes since I use ES6 style imports

pale oasis
wheat mesa
#

Because you can’t use both really

#

There’s two types of imports, one is a function, the other is a keyword

#

They do not do the same thing

bright thorn
#

Is this okay?

wheat mesa
pale oasis
wheat mesa
#

And it’s pretty much impossible to bust the ES6 import file cache

#

Trust me I’ve tried, there’s not an easy way around it

#

It’s the biggest complaint I have with ES6 style stuff, the rest is great

pale oasis
#

It's in a promise?

pale oasis
#

Do you need to wait for anything to happen here? It should be instantaneous.

wheat mesa
#

Oh and yeah, this is the warning on the “best” way to bust the es6 file cache:

#

Lol

pale oasis
wheat mesa
#

Huh

bright thorn
#

Can we change the default memory use of vps for nodejs

pale oasis
#

My way of saying crash your system

wheat mesa
#

Ah I see

pale oasis
#

I do it every time lol.

pale oasis
bright thorn
#

In my vps 15gb ram is available

#

But nodejs process stop at 3 gn ram

#

Use

pale oasis
#

I mean you can use --max-old-space-size..?

wheat mesa
#

Like it crashes at 3gb? How many servers are you in..?

bright thorn
wheat mesa
#

Ah okay

#

I was going to be concerned if it was a small amount but that makes sense

pale oasis
pale oasis
bright thorn
#

I didn't get it

pale oasis
#

const serversbotisin = idk_i_havent_progremmed_in_discordjs_in_30_years()

#

Trust me it's a good function

bright thorn
#

Yeah

radiant kraken
#

snake case ew

bright thorn
#

I am using const at many times

#

And storing the data and using it

pale oasis
#

I was thinking maybe you were storing big HEAPS amount of data in memory.

bright thorn
#

😑

pale vessel
wheat mesa
#

Is the process crashing at 3gb of ram?

pale oasis
#

Maybe a CPU problem, or a thrown error.

wheat mesa
#

Eh it could be a problem with memory, it depends

#

Sometimes v8 doesn’t like extremely large objects

#

Because garbage collecting them is painfully slow afaik

#

@earnest phoenix we need you in here big man

pale oasis
#

Who needs garbage collecting? You are the garbage collector.

wheat mesa
#

Average C developer mentality

pale oasis
#

On god

#

C is just a pain, though I love the idea of pointers.

wheat mesa
#

Pointers are in every language whether you see them or not

pale oasis
wheat mesa
#

Or just creating one in the first place

pale oasis
#

const o = {n:1};
function pointer(_o){
return _o.n+1;
}

wheat mesa
#

No sane language is going to be able to store dynamically allocated objects on cpu registers lol

pale oasis
#

Fk memory, we're using the CPU cache now.

wheat mesa
#

Friendship ended with heap, rax is my friend now

pale oasis
#

You think you could store an operating system in memory?

#

It's a good question I promise.

pale oasis
wheat mesa
#

Idk enough about OS dev to answer that question

pale oasis
#

I'm getting too deep into memory.

wheat mesa
#

I mean that’s kinda what VMs are

pale oasis
#

I think I need to free();

#

I have to stop with the memory puns

#

I'm not funny.

wheat mesa
#

lol

pale oasis
wheat mesa
#

Sure

pale oasis
#

I want to create an auto quest system.
Each item has a level, and the user needs to get an item one level higher than the user to complete each quest.

My question is how would I go around with this? Since each item has a different rarity.

radiant kraken
wheat mesa
#

I don’t think I quite understand what you mean here

pale oasis
#

For example: I don't want my quest system to create a quest to get more items than there is in existence of the game.

pale oasis
wheat mesa
#

So you want to like auto generate items..?

pale oasis
#

Seriously, scratch is better.

radiant kraken
#

i mean C is good when you want total control over everything

wheat mesa
#

Wait I misread that

radiant kraken
#

like multithreading

pale oasis
radiant kraken
#

which is hell in Rust

radiant kraken
pale oasis
wheat mesa
#

Multithreading in rust is fine, it’s sharing mutable state between threads that sucks

wheat mesa
#

Since it’s inherently unsafe from any language’s standpoint

pale oasis
radiant kraken
#

You should try it

wheat mesa
#

Rust is bliss

#

Pure bliss

#

And speed

#

Very speedy

radiant kraken
#

Rust is pog

#

Except for the multithreading part

wheat mesa
#

Blazingly fast 🚀🚀🚀🚀🚀🚀🚀

radiant kraken
#

That's hell

wheat mesa
#

The rc refcell carnage

#

Good thing I don’t do stuff with threads

radiant kraken
#

oh wait

#

Rust has async await, don't they

pale oasis
wheat mesa
radiant kraken
#

I should try tokio

wheat mesa
#

Many async await libs out there

#

Tokio being the most popular and probably the best supported

wheat mesa
radiant kraken
#

^

wheat mesa
#

Rust is a language that is very different from the rest

radiant kraken
#

Learn rust's borrowing and ownership system first

wheat mesa
#

So jumping right in would be very difficult

pale oasis
#

I'm watching this conversation of 2 nerds talking about languages I have never even heard of, and there's me, with React JavaScript, and python.

radiant kraken
#

It's a big obstacle but you'll be almost guaranteed an expert if you know it

wheat mesa
#

The borrow checker will fight you 24/7 and will win most of those battles if you don’t know how to work with it

radiant kraken
#

Rust's compiler error messages iara_uwu

wheat mesa
#

But once you figure it out, you don’t fight it a whole ton

#

And most of the time when you DO fight it, the compiler will just show you the solution

pale oasis
#

Rust has ownership and borrowing?

wheat mesa
#

Yes

radiant kraken
#

Yes

pale oasis
#

What does that mean? I've never understood what that means.

wheat mesa
#

It’s a difficult concept to wrap your head around at first

pale oasis
#

Like pointers?

#

Dear god.

radiant kraken
#

No, References

pale oasis
#

References and pointers are literally the same thing.

wheat mesa
#

Not quite

pale oasis
#

Check the compiled result in ASM.

#

Declare a reference, than a pointer.

wheat mesa
#

Pointers are much more unsafe

#

References are there because you’re guaranteed stuff about them

radiant kraken
#

References can be mutable and immutable

#

References can have an explicit lifetime annotation

wheat mesa
#

Rust has pointers, but very rarely will you work with them unless you’re doing low level stuff

pale oasis
wheat mesa
#

No garbage collecting is needed when you have the borrow checker

radiant kraken
#

Garbage collector is yikes

pale oasis
wheat mesa
#

That’s the point of it

radiant kraken
#

The reference is read only

wheat mesa
#

No garbage collector, no manual memory management, just semantics the language ensures you follow at compile time

radiant kraken
#

You can only read the value, not modify it

wheat mesa
#

There can be multiple immutable references at once, however only one mutable reference can exist at any given time

#

Because if data is unchanging, it’s safe to read from it

radiant kraken
#

Immutable reference can also be passed in multiple threads

wheat mesa
#

But if data is changing it’s not safe to read from different parts of the program at once

pale oasis
#

Wait for the data to change.

wheat mesa
#

That’s what async await sort of solves yes, in a way

#

However it’s not the ideal solution all the time

#

I rarely deal with threads so I’m not qualified to talk about that, would probably just be me guessing based on what I understand about the language from a single threaded standpoint

radiant kraken
#

Mutexes are pog

pale oasis
#

I never programmed in CPP, well, I did, but for a small 2 weeks.

wheat mesa
#

C++ is hell compared to rust

pale oasis
#

i really wanted to get a hand on the language, I mean, the performance is incredible with over 90 keywords!

wheat mesa
#

“Modern c++ is like rust without the quirks” - C++ user who has never used rust

radiant kraken
#

Most of them just looked at the lifetime syntax and raged quit

wheat mesa
#

Yeah lmao

#

Lifetimes are intimidating when you don’t understand them

#

But you’ll come to see their usefulness eventually

radiant kraken
#

Honestly i was one of them

wheat mesa
#

Same

radiant kraken
#

'a looks so cursed

pale oasis
#

heh.

#

Yes, lifetimes.

wheat mesa
#

Yeah the syntax is quite weird but I understand why it’s like that now

pale oasis
#

I know what those are. Give me like 2 minutes while I do a quick google search.

wheat mesa
#

When you have a cursed amount of lifetimes it’s nice to have proper names for them

radiant kraken
#

Don't look at the syntax

wheat mesa
#

Yeah it’ll freak you out

#

I promise they’re not that complex

#

Pretty simple when you get the hang of it

pale oasis
#

Why is the syntax so odd?

#

It looks like you're declaring a string...

wheat mesa
#

Idk, quirky compiler devs

radiant kraken
#

Why Bing

wheat mesa
#

Oh that’s just a use of lifetimes that the compiler normally infers for you

pale oasis
wheat mesa
#

You don’t have to write that yourself for that use case afaik

pale oasis
#

What does a lifetime do?

radiant kraken
#

Anyway 'a means that it's a lifetime annotation with the name a

wheat mesa
#

Lifetimes tell the compiler how long something lives for before it is dropped from memory

wheat mesa
#

Not really

#

Rust automatically destroys things from memory when they go out of scope

pale oasis
#

Rust looks very fun to program in

wheat mesa
#

However the problem with that is if you have something that holds a reference to that thing that is being dropped, you will now be referencing memory that you don’t know the contents of

pale oasis
#

So you get the duration on how long a variable lasts?

wheat mesa
#

So that’s where lifetimes come in

#

Lifetimes tell the compiler: “hey, I need this reference to live for as long as my struct does, don’t drop it from memory until my struct is dropped from memory”

wheat mesa
#
struct Something<'a> {
    name: &'a str // hey, don’t drop this from memory until lifetime a is dropped from memory!
}
pale oasis
wheat mesa
#

Otherwise you might access memory that doesn’t belong to you, potentially causing a segfault

#

It’s a more complex area of rust, don’t worry about it for now

radiant kraken
#

Multiple variables can have the same lifetime, which means that all of the variables will be dropped at least at the same time throughout the function

fn func<'a>(thing: &'a str, _unused2: &'a str) -> &'a str {
  // both of these strings are a str reference (like a char * in C/C++)
  // but since they are a reference, you don't know when one of them will be dropped (which would lead to a dangling pointer)
  // the EXPLICIT lifetime 'a here makes sure that they both will still exist throughout the entire function
  // return thing (return keyword is optional in the end of a function)
  thing
}
wheat mesa
#

I would’ve typed out a more detailed explanation like null did but I’m on mobile and that would be hell

radiant kraken
wheat mesa
#

Basically it’s to ensure you don’t accidentally have a reference to garbage memory

#

And the compiler will enforce it as a part of rust’s safety semantics

#

But pretty much any time you have a reference in a struct, you’ll need a lifetime annotation

pale oasis
#

Rust looks like an interesting language.

wheat mesa
#

It 100% is

pale oasis
#

Maybe I should become a rustacian

radiant kraken
#

Yes

wheat mesa
#

It also has no null type 😉

radiant kraken
#

But it has an Option type though

wheat mesa
#

One of the best decisions made by compiler developers to this day

pale oasis
#

I have to go now, It was really fun learning about lifetimes.

radiant kraken
#

Like ?String in JavaScript

pale oasis
#

Cya!

radiant kraken
#

Cya

wheat mesa
#

Bye 👋

wheat mesa
radiant kraken
#

True

wheat mesa
#

I see a lot of people in my CS classes (Java) that forget that all objects could potentially be null in some cases and don’t handle it

#

Then they get confused when they get an NPE

#

Whenever rust has a chance to return “null” it is always explicitly annotated and forces you to handle it

#

It’s the smallest things about rust that make you fall in love with it

radiant kraken
#

And also other things like traits, procedural macros, helpful community, and guaranteed memory safety

wheat mesa
#

God the community is actually great when you have a question with rust

#

I get responses in usually under 5-10 minutes and they’re always thoughtful and detailed, never once had an ounce of hostility in it

#

C++’s community on the other hand is a lot more passive aggressive with things about 75% of the time

radiant kraken
#

lmao true

wheat mesa
#

(In my experience, maybe I’m just asking stupid questions)

#

A lot of the time the question just gets buried

#

Rust’s community has been a huge help to learning everything I know about rust so far for sure

radiant kraken
#

It's hell to make a C++ program cross platform or even use third party libraries

#

I learned it the hard way when i wrote a compiler in C and i can't port it to macOS iara_why_sob

wheat mesa
#

Lmao

#

Library support in C++ is just really outdated and poorly organized

#

I think rust was the language the world needed in order for a more modern experience

#

Everything just feels updated and clean

#

FFI is still a bit sketchy when working with C/C++ libs tho, can’t be avoided

radiant kraken
#

true

#

but it's still not that painful

#

you can easily interoperate C/C++ libraries into Rust

wheat mesa
#

Yeah

#

I hate dealing with DLL linkage and shit like that, much better than dealing with setting include dirs and stuff with C++ tho

radiant kraken
wheat mesa
#

C++ users telling me to spend 2 hours to compile 40 different libraries after spending 3 hours just trying to get their include dirs set up

radiant kraken
#

Relatable

wheat mesa
#

Just for the linker to tell you “you done fucked up, your target type is wrong”

#

I like to think of the c++ linker as a really punchable hillbilly with a beer belly ngl

radiant kraken
#

i hate __impl_... symbols

uneven heath
#

Hmm, I don't really get Interaction and Collectors
Let's say in an Menu component for example. If I create a new menu and let user interact to it.
Isn't that I can still use interactionCreate event to modify the interaction message?

Then what would be the idea of using something like an interactionCollector. It sounds a bit redundant for me but I feel like it should have some meaningful idea behind

sharp geyser
#

think of a collector like a mini interactionCreate event

#

All they do is spawn the appropriate event, eg reactions would be reaction related events, messages would be message related events, interactions and components would be interactionCreate

#

and at the end of their life they get destroyed

#

All it is, just a temporary event that collects and returns the responses

uneven heath
#

So like a interaction event with timer?

sharp geyser
#

if you provide a timer yes

#

no timer makes em run indefinitely until stopped

#

also with collectors you can do filters so they only collect when a certain condition(s) are met

#

for example if you wanted say a button to only collect for the person who ran it, you'd make the appropriate filter

#

you could 100% do all this in the interactionCreate event mind you

#

the collectors are just easier as they can be used then and there

uneven heath
#

So it just make it easier?

sharp geyser
#

Yea

#

It has its benefits and drawbacks

#

A lot of people frown upon using collectors

uneven heath
#

How would a collector spawn itself then.
For example if I create a new component and I have a collector with a timeout. Would a new collector create at that moment or a collector already started during the initialization of the bot?

sharp geyser
#

Wdym?

#

You never want a collector to spawn itself without you calling the appropriate method

#

You'd call it when you need it

#

there is also awaitMessageComponentCollector

#

it is like this but it just spits out the collected without you catching the event yourself

uneven heath
#

Yeah, I see, that's enough information I am trying to investigate

earnest phoenix
# wheat mesa <@456226577798135808> we need you in here big man

I don't think their issue is related to memory in this case, their program might be causing a bottleneck through some imports that cause cyclic dependencies or something similar

Although it can be related to memory however if their program crashes with an OOM (Out-Of-Memory) error, which they haven't told us so there's also that

Also @bright thorn ^

bright thorn
#

🤐

earnest phoenix
# bright thorn 🤐

If an error is thrown when your program crashes, does it say something like JS Heap Out of Memory?

#

Or does it not thrown an error at all when the program crashes?

bright thorn
#

Yes

#

I will send you wait

bright thorn
# earnest phoenix If an error is thrown when your program crashes, does it say something like `JS ...
0|Real     |
0|Real     | <--- Last few GCs --->
0|Real     |
0|Real     | [26383:0x59ed7c0] 166458406 ms: Mark-sweep 1845.5 (2080.8) -> 1831.4 (2080.8) MB, 3522.5 / 9.2 ms  (average mu = 0.250, current mu = 0.203) task scavenge might not succeed
0|Real     | [26383:0x59ed7c0] 166462689 ms: Mark-sweep 1845.0 (2080.8) -> 1831.6 (2081.1) MB, 3434.7 / 0.1 ms  (average mu = 0.225, current mu = 0.198) task scavenge might not succeed
0|Real     | <--- JS stacktrace --->
0|Real     |
0|Real     | FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
0|Real     |  1: 0xb09980 node::Abort() [/root/.nvm/versions/node/v16.14.0/bin/node]
#

Even 12gb is Empty in my vps

earnest phoenix
# bright thorn ```js 0|Real | 0|Real | <--- Last few GCs ---> 0|Real | 0|Real |...

Before we get further into this, I recommend updating your Node.js version to the latest LTS release (v16.17.0 as of writing this, simply run nvm install --lts)

Now if you didn't know, the V8 JavaScript engine which the Node.js runtime runs on has a strict heap limit which is 512MB on 32-bit systems, and 1GB on 64-bit systems, if you need more memory you need to use the --max-old-space-size CLI option to increase it, you can set it to 4096 to allow V8 to allocate 4GB of memory

An example of running a program this way is:

$ node --max-old-space-size=4096 foo.js
bright thorn
#

On 64 bit

bright thorn
earnest phoenix
#

Should work

bright thorn
#

umm yeah am starting the new instance

#

with this

earnest phoenix
#

Although run it like this instead:

$ pm2 start src/index.js --node-args="--max-old-space-size=14336"
bright thorn
#

Yeah

#

?

slender wagon
#

i really love the download attribute on html 5, it makes things so much easier

solemn tulip
#

it's still the old logo on the api of top.gg

sick agate
#

yup

neon leaf
#

how would I make the button edit the message? I already know how to pass data using customId but message probably wont work with that

lyric mountain
#

Button has the reference to its own message, simply use interaction.message

bright thorn
#

how can we delete duplicate documents from schema

earnest phoenix
#

Does anyone know how to make something like this?

#

Any apps or sites ?

robust pecan
#

@earnest phoenixhttps://patorjk.com/software/taag/#p=display&h=0&v=3&f=Big%20Money-ne&t=Type%20Something%20

#

try look here

earnest phoenix
#

Ty so much

lyric mountain
bright thorn
#

in schema

#

but idk some guilds hav multiple schema

lyric mountain
#

well that's what happens when you try to use relational data on a non-relational database without proper structure

wooden ember
#

is there a way to stream the same audio to multiple vcs?

wooden ember
#

cant use createAudioStream twice on the same source apparently

#

also how do you get the "add to server" thing in the bot profile?

feral aspen
#

In an EJS file, what's the difference between <% %> and <%= %>.

neon leaf
#

does anyone know how to fetch data and edit messages from a button? this is my current non working code

neon leaf
#

I am using that, I dont know how to fetch and edit though, edit I dont know yet because I need fetch to work

lyric mountain
#

you're not, you're fetching the message

#

this makes zero sense

#

also, you'd need to await that

neon leaf
lyric mountain
#

simply use interaction.message

#

it's already a message by itself

neon leaf
#

is interaction.message the message content?

lyric mountain
#

it's the message, as in, the object

neon leaf
#

how can I get the embed content then? something like interaction.message.content?

lyric mountain
#

you first need to get the embed

#

message is a message (read, a message)

#

not embed, not tree, not dog, a message

neon leaf
#

well how would I get it?

lyric mountain
#

messages can have author, embeds, images, etc

lyric mountain
neon leaf
#

will that output the embed text (including description)?

lyric mountain
#

it'll output all embeds within the message

neon leaf
lyric mountain
#

for all embeds, yes

neon leaf
#

Can I somehow only extract the description?

lyric mountain
#

sure

earnest phoenix
#

Just get the embed you want and access it's description property

#

The embeds property is an array of embeds as messages can have multiple embeds, so if you only want to get the first embed, access the first index, embeds[0].description for the description

neon leaf
#

thanks, can I somehow make my buttons event not fail? it works but discord says it failed because I dont send a message or something with the button, I just edit a message

lyric mountain
#

you need to acknowledge the interaction within 3 seconds of it being fired

neon leaf
lyric mountain
#

yes, you didn't acknowledge

neon leaf
#

what do you mean with ackknowledge?

lyric mountain
neon leaf
#

so instead of interaction.message.edit I should use interaction.update?

lyric mountain
#

pretty much

#

IF you can guarantee your action will end within 3 seconds

neon leaf
#

while we are here, do you know why this returns NaN? its probably the array to string but i dunno how to fix that, I just want to search for the previous number in the embed

lyric mountain
#

because your regex didn't match anything

#

oh wait, that'll never return anything other than NaN

neon leaf
lyric mountain
#

embeds is plural (so it's a collection)

#

and you don't need to await something that's already there

lyric mountain
#

because mentions have numbers

neon leaf
#

Is there any way of turning the array / collection into a simple string at all? I logged it and it looks like this

lyric mountain
#

you need to get that element

#

do you know javascript at all or just doing it blindly?

neon leaf
#

I never did anything with Collections / Arrays before

lyric mountain
#

ok so that's a no

neon leaf
#

yes, basically

lyric mountain
green kestrel
#

hmm, project getting bigger

lyric mountain
#

making a bot in cpp? what a madlad

neon leaf
lyric mountain
#

yes

#

remember your regex is prone to exploiting

neon leaf
#

yes, its just for this mini counting game

lyric mountain
#

nono, you see, it wont work the way you expect it

#

for example, if you tested it with your name in it it'd return 0 always

#

because the first numeric match is 0 (0x4096)

green kestrel
#

nice, my new tweaks have cut memory usage

#

i thought they'd increase it, as its caching prepared statements now

#

and hmm, how do i have a third of my user base on one of 18 clusters

#

must be a chonky server or two somewhere

feral aspen
#

In an express post() method, is it possible to render a middle page before loading the final page?

#

Example, once the method is called, a page called loading.ejs would render then result.ejs would render.

quartz kindle
#

nope

#

the only way to do that is with either ajax or a redirect

feral aspen
quartz kindle
#

with ajax you would render page A, then page A uses js to make a fetch request to page B, wait for the result, then edit page A with the new result

#

with a redirect you would render page A with a timed redirect for example, that after X seconds automatically redirects to page B

#

its also possible to do long polling if page B takes a while to load

#

page A loads and immediately redirects to page B, then while your browser waits for page B to load, page A is still there stuck

rigid maple
#

How can I do multiple filtering? For example, there are 5 objects in the array and the objects have specific ids. I want to filter those objects whose ids are 2 and 3

#

Is there anything I can do instead of .filter().filter() ?

slender wagon
#

Woops

stuck dawn
#

how I can insert data in a map without overriding the data of an key (Typescript)

rustic nova
#

fetch
append
insert

#

so get the data in some temporary variable, add the data you want to add, then override the old data with the new one

stuck dawn
#

but i need to increase the data

lyric mountain
#

save data to variable -> increment variable -> save data to map

quartz kindle
#

show how you coded your map

rustic nova
#

depending how it is, you could also do for example ["data1"]["dataToIncrement"] = ["data1"]["dataToIncrement"]+1 ?

stuck dawn
#

you see that GetHashKey?

#

i want to increase that array

#

without overriding the old value

quartz kindle
#
const existing = hashList.get(category);
existing.push(GetHashKey(...))
stuck dawn
#

thank you i will try that..

lyric mountain
#

I...think I beat intellij analysis algo

quartz kindle
#

lmao

stuck dawn
#

it works thank you :)

boreal iron
#

/se(?:ason)?(?:.+)?6/gi

#

That will only fit the listed ones

#

Dunno how much different possibilities there are

#

You can test it yourself

low moat
#
    const chat = inter.options.getString('string');
    switch (chat) {
        case "hi": 
            await inter.reply({ embeds: [hi] })
    }```

so I have bee trying for a while now but I cant seem to figure out how to make an else statement like elif from python. So if someone doesnt say respond listed then it would send an embed called 'error' or something like that
wheat mesa
#

if(condition) {} else if(condition) {} else {} etc

low moat
boreal iron
#

Check if the content matches that pattern

pale oasis
pale oasis
#

You would use the string.prototype.match(); statement.

boreal iron
wheat mesa
#

If you fail to await a promise and it rejects, it will not be caught by try catch blocks

sharp geyser
#

yep

boreal iron
#

Also wrapping anything in try/catch blocks is just awful imo

#

Either add catch() as chain behind send() to catch errors or create an own send function or overwrite the prototype and add error catching in there

sharp geyser
#

or here me out, just make an error handler in your command handler

boreal iron
#

This would also allow you to check for a Message Instance or Interaction to respond accordingly

boreal iron
sharp geyser
#

something no one seems to take advantage of anymore

#

smh

boreal iron
#

True

#

sadly

#

But sometimes you gonna send messages also outside of command handlers

#

And people still forget to catch the promises

#

Also don’t have a top level error handler

#

why bot not working anymore

lyric mountain
#

Tbh, I hate the whole thing about promises, the concept is nice but them being contagious is annoying af

#

And I have to deal with this shit in flutter 😩

civic gorge
#

Hey all, i would need help with python package please.

wheat mesa
#

don't ask to ask, just ask

civic gorge
#

Ok so first, is the python package topggpy maintained?

#

I am getting

#
AttributeError: 'ClientSession' object has no attribute '_connector'```
#

From examples provided in package

dry imp
#

iirc i dont think topggpy package is maintained anymore or atleast there arent any active maintainers afaik

#

could be wrong tho

lyric mountain
#

You're not wrong

#

@civic gorge would be easier to simply use standard HTTP request on python, if you just want to post server count

#

Topgg api is not complex enough to warrant a specialized lib

#

Plus you keep external dependencies at minimum

civic gorge
#

Thanks

lament rock
#

Does anyone happen to know how to request with ipv6 using undici/global.fetch (node 18)

ancient nova
#

"websocked closed before connection was established" randomly

boreal iron
prisma nebula
#

What this mean

boreal iron
#

Log commandFile.data and you will eventually understand your own error

prisma nebula
#

?

boreal iron
#

Do it

prisma nebula
#

I cant log the problem in this server that i hodt in

#

Their are no shell

#

So i have to move to replit

#

Then move again to the sercer

#

Server*

boreal iron
#

Then keep it on the platform you took the screenshot by and console log what I mentioned

lament rock
#

for instance though, the requesting would be to get around YouTube's ip rate limiting

#

LavaLink already does this

#

just want to include it in my LavaLink remake

neon leaf
#

Did anyone ever do rock paper scissors with buttons? If yes, how did you store the choices

narrow warren
#

or two variables even

bright thorn
#

ephemeral: true is not working

#

for followUp

digital swan
stoic eagle
#

Man anybody got tts code in djs? It is nowhere to be found online or tutorials also doesn't exists for itsmile_frog

cinder patio
stoic eagle
#

Nvm I made it

#

But having this error

cinder patio
#

Everyone is thinking that because you provided no other information

#

maybe be more descriptive next time

eternal osprey
#

Hey guys, i have a question in c++

cinder patio
#

ok

rustic nova
#

me when question

earnest phoenix
#

How make function in JS no scam 2022 freee

boreal iron
#

idk switch to php

radiant kraken
#

@quartz kindle pls help why code no work ```c
int number = *((int *)0);
printf("%d\n", number);

earnest phoenix
quartz kindle
#

var_dump() :^)

boreal iron
#

var_dumb(…);

radiant kraken
#

@earnest phoenix can confirm

earnest phoenix
#

So true