#development

1 messages · Page 1915 of 1

hybrid roost
#

this message

earnest phoenix
#

translate it

hybrid roost
#

interaction error

boreal iron
#

Interactions will always fail if you don't respond to the webhooks

#

If you don't respond to the button in your code, it will always fail

hybrid roost
#

how can i respond it?

#

and don't send message

#

or edit it

boreal iron
#

Technically by responding with a 2xx status code

#

But I guess you ask for a djs solution... ?

hybrid roost
#

yep..

hybrid roost
boreal iron
#

Hmm actually a good question how to respond via djs

#

Probably need to use the client.api directly

hybrid roost
#

what if you create a stub that will respond to everything with code 200, and the handler will remain in djs

#

I create..

boreal iron
#

The webhook's coming from Discord to djs, it just needs a response you would usually return by replying to the interaction

quartz kindle
#

you can simply respond with a message update that doesnt change anything lol

#

i mean, usually people want to see an acknowlegment

boreal iron
#

Oh that works?

quartz kindle
#

so at least edit the message with something like an OK

boreal iron
#

Thought djs would may throw an emtpy message update error

quartz kindle
#

you need to send content, yes, but the content doesnt need to be different from the original

boreal iron
#

But the message will show (edited) right?

#

Can't you just ack the webhook without sending/updating the message?

hybrid roost
#

interaction.message.edit(interraction.message)?

#

or

#

hm

boreal iron
#

You should be able to add the whole message payload, yeah

hybrid roost
#

interraction.message.edit({embeds:[interraction.message.embeds], components:[interraction.message.components]})

boreal iron
#

I think you can provide the whole message payload, too

hybrid roost
#

I used

interraction.message.edit('123') 
boreal iron
#

interaction.message.edit(interraction.message)?

hybrid roost
boreal iron
#

Ok well then it doesn't

hybrid roost
#

text is "interaction error"

boreal iron
#

Then you will have to define each option yourself

#

interraction.message.edit({embeds:[interraction.message.embeds], components:[interraction.message.components]})

#

But

#

interraction.message.embeds

#

should already be an array

#

No need to wrap another array around it

#

Same goes for components

#

It's already an array

hybrid roost
#

still interaction error

boreal iron
#

Just on mobile?

#

Shouldn't happen if you successfully respond

#

Probably just a Discord issue then, I remember got interaction errors, too especially on mobile even if the response worked

hybrid roost
#

solution is...

#

interraction.deferUpdate();

#

just call this and "interaction error" vanish

boreal iron
#

Shouldn't be needed in this case

#

Since you respond (within 3s)

hybrid roost
#

idk. it is sloves my problem

shadow frigate
#

you we're correct, thank you lmao

distant garden
#

or just provide the url

shell crystal
#

Why do I get mistakes like that?

lyric mountain
#

tf is that

lyric mountain
jolly notch
#

Not worth it

earnest phoenix
#

can i post code for feedback
i wanna see if its shit

jolly notch
#

but sure

earnest phoenix
#

its just help command, feels shit idk

boreal iron
#

Why would you read the same file multiple times?

#

Read it once, then split the created vars content or check if it starts with xxx

woeful pike
#

they are reading it once though

jolly notch
boreal iron
#

Enlighten me, I see two

jolly notch
#
const about = fs.readFileSync(`./commands/${file}`, "utf-8").split(';')[1];

    const isAdmin = fs.readFileSync(`./commands/${file}`, "utf-8").startsWith("//s");
#

He means that

quartz kindle
#

lol

boreal iron
#

Since he doesn’t specify the length he’s reading the whole file

woeful pike
#

smoothbraingang exporting an object with a property that defines permissions of that command
ASbigBrain parsing comments in a js file to determine permissions of the command

boreal iron
#

Yeah I’m aware but still 2 file reads

quartz kindle
#

wait what

boreal iron
#

Imma reading the file once then work with my vars

quartz kindle
#

reading the file as text to parse that stuff? lmaoo

boreal iron
#

Dunno why you would do that oldEyes

#

(in that case)

rustic nova
#

tl;dr people scream at your shitty code

#

eh?

woeful pike
#

code review is actually really good

#

I'm willing to bet money that it's 10x less toxic than stack overflow

boreal iron
#

Anything in the net gets toxic, it just takes its time

woeful pike
#

people who are pretentious and annoying don't tend to put themselves in a vulnerable position by sharing their code and asking for feedback

#

voluntary code review tends to be pretty positive in my experience

jolly notch
rustic nova
#

is it actually useful?

jolly notch
jolly notch
# rustic nova is it actually useful?

So I write some code for school, I want it to be of the best standards and etc. I could learn all the documentation for a language and be able to understand do I use camel case or snake case. Or I could just go post my code on there and have a response of what's wrong with it and how it could be made better

#

When I was a beginner at Python I was using nested if statements and etc yk the bad methods. Someone rewrote my code to go use a dictionary and reduced the amount of lines it consumed by like 60

cinder patio
#

smaller doesn't always mean better

jolly notch
#
 @job.command()
  async def apply(self,ctx,*,selection:str):
    a = banned(ctx.author.id,self.bot.blacklisted)
    if a is True:
      return await ctx.send("You are blacklisted from using this command.")
    db = client.bot
    posts = db.user
    for x in posts.find({"guildid":f"{ctx.guild.id}","id":f"{ctx.author.id}"},{ "_id": 0,"job":1,"level":1}):
      level = int(x["level"])
    if selection.lower() == "garbage collector" and level >= 0:
      posts.update_one({"id":f"{ctx.author.id}","guildid":f"{ctx.guild.id}"}, {"$set": { "job": "Garbage Collector","income":50}})#save
    elif selection.lower() == "cleaner" and level >= 7:
      posts.update_one({"id":f"{ctx.author.id}","guildid":f"{ctx.guild.id}"}, {"$set": { "job": "Cleaner","income":70}})#save
    elif selection.lower() == "car washer" and level >= 16:
      posts.update_one({"id":f"{ctx.author.id}","guildid":f"{ctx.guild.id}"}, {"$set": { "job": "Car Washer","income":105}})#save
    elif selection.lower() == "maid" and level >= 27:
      posts.update_one({"id":f"{ctx.author.id}","guildid":f"{ctx.guild.id}"}, {"$set": { "job": "Maid","income":145}})#save
    elif selection.lower() == "receptionist" and level >= 36:
      posts.update_one({"id":f"{ctx.author.id}","guildid":f"{ctx.guild.id}"}, {"$set": { "job": "Receptionist","income":185}})#save
    else:
      return await ctx.send(f"You are currently {level}, please go to school using ?learn")
    await ctx.send(f"You are now working as a {selection.lower()}")
#

I wrote this code in 2019

#

As you see I have that massive if statemnt

#
 @job.command()
  async def apply(self,ctx,*,selection:str):
    a = banned(ctx.author.id,self.bot.blacklisted)
    if a is True:
      return await ctx.send("You are blacklisted from using this command.")
    db = client.bot
    posts = db.user
    for job_name, level_min, income in (
   ('Garbage Collector',  0,  50),
   (          'Cleaner',  7,  70),
   (       'Car Washer', 16, 105),
   (             'Maid', 27, 145),
   (     'Receptionist', 36, 185)
):
    if selection.lower() == job_name.lower() and level >= level_min:
        data = {
           "id": f"{ctx.author.id}",
           "guildid": f"{ctx.guild.id}"
        }
        set_stuff = {
          "$set": {
              "job": job_name,
              "income": income
          }
        }
        posts.update_one(data, set_stuff)
        break
else:
    return await ctx.send(f"You are currently {level}, please go to school using ?learn")
    await ctx.send(f"You are now working as a {selection.lower()}")
#

As you see you would rather prefer the second one as it's much more cleaner and less messy. You could actually read it

#

I rather go bully someone on stackoverflow because of things like bad answers

#

But on code review there isn't such a thing as a bad answer as you are just giving your opinion

#

Unless you write

This code is shit, my grandma can run faster than this

#

@rustic nova there ya go

rustic nova
#

knew it

jolly notch
wheat mesa
#

bot.user is null

proven lantern
#

has anyone used catalyst? it looks it's trying to destroy js so it's bad like java

lyric mountain
jolly notch
lyric mountain
#

but doesn't js already have express?

proven lantern
#

they just want to use the legacy java paradigm in js

split hazel
quartz kindle
#

a cyclist is a substance that moves via a chain reaction that produces mechanical energy

split hazel
#

tim hop into my friend list right now

#

we could be great friends

quartz kindle
#

donezo

spark flint
#

why am i suddenly getting this

#

my api worked fine the other day

#

wait shit

#

i think i see the error

#

yep fixed, i did ,, at one point

split hazel
#

oh dear

spark flint
#

yeah...

jolly notch
#

@rustic nova the issue with 30% of people that post on stackoverflow

sterile lantern
#

So for a slash cmd (discord.js) how would I made a input that searches for a user in the server, and after that, what would I use to get the user ID of the mentioned user?

spark flint
hybrid cargo
#

dead it's async, not await

spark flint
#

OH

#

YEAH

#

SHIT

spark flint
#

pls help

#

can't code

#

i'm sending API requests in Node.js but its returning nothing

#

will grab code

#

api its grabbing data from is returning the data in json format

#
app.get('/api', async (req, res) => {
  const userid = req.query.userid;
  const apikey = req.query.apikey;
  await axios.get('http://api.blacklister.xyz/check/' + userid, {
    headers: {
      'Authorization': apikey
    }})
  .then(function (response) {
    res.send(response);
  })
})``` but express doesn't return anything
pale vessel
#

why are you sending the whole response object

spark flint
#

idk

pale vessel
#

send the data response.data

grim aspen
#

Was about to ask that

spark flint
#

that works

#

now how do i make it only work if both userid and apikey are passed

pale vessel
#

Use an if statement with the logical AND operator

spark flint
#

alr

#
if( userid && apikey) {
//api shit
}
else {
  //error shit
}```
spark flint
pale vessel
#

A boolean isn't a string

#

Remove that and use !==

delicate zephyr
#

@quartz kindle just got confirmation from a few friends that hetzner works with voice again

#

They just never announced it~

delicate zephyr
#

I few friends who have voice features did and yea, got it working on a test bot running on my hetzner dedi

#

so have a feeling they sorted it and kept it on the dl

quartz kindle
#

well, not all of their ips were affected

delicate zephyr
#

considering the last announcement was 2018

quartz kindle
#

its very possible your friend got lucky

#

im pretty sure someone yesterday tested it and it was not working

delicate zephyr
#

Idk but it seems a lot of people don't have issues from what I can tell

boreal iron
#

I’m gonna test it tomorrow as well on 3 different system and IP ranges and will report back.

#

A voice connection is just enough?

quartz kindle
#

ye, join voice

#

also depends on the voice region

#

only some regions are affected as well

boreal iron
#

Yee testing the EU dedis and the US cloud

quartz kindle
#

i mean the voice server region

#

on discord's side

boreal iron
#

Oh yeah ok

#

Depending on the guild?

quartz kindle
#

you can set voice region per channel

zenith terrace
#

@quartz kindle omg new pfp?

boreal iron
#

Ah didn’t know that, never dealt with voice

#

Anyway… gonna get 1 h of sleep hashflushed

quartz kindle
#

good night

boreal iron
#

hour

royal pawn
#

How to make bot respond to itself?
My code:

@bot.command()
async def addrole(ctx, member : discord.Member, role : discord.Role):
    await member.add_roles(role)
    embed = discord.Embed(description= f"✅ Added {member.mention} **{role} Role**", color=discord.Color.green())
    await ctx.channel.send(embed=embed)```
It only respond to discord users but it doesn't respond to itself when I use `.say !addrole @Swan Htet Kyaw#0001 Role`. 😅 I want to make bot reply to itself
hybrid cargo
#

It depends on how you coded your message event. Just gotta remove the line where you return if the message author is the bot. But why do you even want to do this? This feature can easily be abused and can get your bot ratelimited

simple stump
#

If I have the ID's of channels (ignore the scuffed names lol):

var channel1ID = message.guild.channels.cache.find(c => c.name === "Game " + game + " Team 1").id;
var channel2ID = message.guild.channels.cache.find(c => c.name === "Game " + game + " Team 2").id;

How would I delete the channels? I know I can delete the current voice channel the user is in, but I want to delete channels based on their ID.
interaction.member.voice.channel.delete();

#

nvm im stupid idk why i was using .id

royal pawn
#

How to make selection Role dropdown menus in discord.py?
Current code:

@bot.command()
async def roles(ctx):
    await ctx.send(
        "Select Roles",
        components = [
            Select(
                placeholder = "Select something!",
                options = [
                    SelectOption(label = "Member Role", value = "Member"),
                    SelectOption(label = "Pokemon Master", value = "Pokemon Master")
                ]
            )
        ]
    )
    interaction = await bot.wait_for("select_option", timeout=None)
    member = interaction.author
    role = discord.utils.get(member.guild.roles, name=f'{interaction.values[0]}')
    await member.add_roles(role)
    await interaction.send(f"Member role has been added!")

Is there other way to do that?

#

I just started with select menus and buttons

earnest phoenix
#

html question:
are <nav> elements only supposed to be used inside <header>?

quartz kindle
#

no

earnest phoenix
#

what is the proper semantic use

quartz kindle
#

pretty much this

royal pawn
#

How to make selection Role dropdown menus in discord.py?
Current code:

@bot.command()
async def roles(ctx):
    await ctx.send(
        "Select Roles",
        components = [
            Select(
                placeholder = "Select something!",
                options = [
                    SelectOption(label = "Member Role", value = "Member"),
                    SelectOption(label = "Pokemon Master", value = "Pokemon Master")
                ]
            )
        ]
    )
    interaction = await bot.wait_for("select_option", timeout=None)
    member = interaction.author
    role = discord.utils.get(member.guild.roles, name=f'{interaction.values[0]}')
    await member.add_roles(role)
    await interaction.send(f"Member role has been added!")

Code help? I want to make selection menus for role selection

#

Example:

lament rock
#

5-6 hours of work Smile

#

plenty more work to do

boreal iron
vocal elk
#
from discord.ext import commands
import music

cogs = [music] 

client = commands.Bot(command_prefix='~', intents = discord.Intents.all())  

for i in range(len(cogs)):
    cogs[i].setup(client```
#

idk what the error is

sly sierra
#

alright

amber lantern
#

Where am i gonna start coding?

#

my bot are offline

sly sierra
#

You first have to start by picking a programming language

#

then learning the programming language first

#

then go on learning the librarys

amber lantern
#

but where?

sly sierra
#

documents

amber lantern
#

oh thank you

#

which one?

#

both?

sly sierra
#

I'd recommend pythoin

amber lantern
#

okay

#

where do i find progamming languages

#

i found it

boreal iron
#

The words python and recommend in one sentence should be a banable offense

#

Damn you got me KEKW

#

_sentence is offline due technical difficulties _

glacial vapor
#

i love this extension

#

going through a repo much nicer with it

small tangle
#

omg you leaked your env variables !1! peepoGiggles

earnest phoenix
delicate zephyr
#

you probably can

woeful pike
#

that's what they did

delicate zephyr
#

wait

#

Oh

#

lmfao

#

there has to be a better way

#

like yea exporting an object

#

but like of parsing comments

cinder patio
#

but y tho that's not what comments are for

delicate zephyr
#

I mean, true

#

but like why not, for shits and giggles

woeful pike
#

use NLP to figure out if the file claims to have an admin only command in its comments

delicate zephyr
earnest phoenix
#

But it works :pensiveclown:

spark flint
earnest phoenix
#

Cant use emoji on phone or what

#

:KEK:

glacial vapor
clear marlin
small tangle
#

I want to optimize the execution times of my methods and so far they take 600ms, of which 480ms are due to calling a method of a coworker dogkek

woeful pike
#

hahah

small tangle
#

you mean markdown?

boreal iron
#

(only available in embeds)

small tangle
#

yeah

boreal iron
#

Which is, guess in an embed

#

Also fields don’t have a description, just a name and value freerealestate

earnest phoenix
earnest phoenix
#

I got 2.5k error as this

#

@earnest phoenix your token is leaked

#

Not

#

reset it and don't start the bot

#

I regenerated

#

And still error is going

earnest phoenix
earnest phoenix
#

13.3.1

#

the error looks similar like node-fetch ones,but i have noidea how you can resolve it,maybe you can ask at djs support server

#

maybe you can try switching to detritus

earnest phoenix
earnest phoenix
#

I hope you are joking

#

not that

#

typical discord.js user behavior

#

@earnest phoenix

#

Dont have time to change all codes

earnest phoenix
#

It happened after i updated to djs v13.3.1

hybrid cargo
#

Use inline fields

#

Oh wait, u want it to be displayed like dank memer?

#

Use description

earnest phoenix
#
.setTitle(`${user.username}'s balance`)
.setDescription (`**Wallet**: ${wallet}`)
hybrid cargo
#

It does

quartz kindle
#

its coming from a webhook, check if the parameters are correct when you create the webhook

earnest phoenix
#

how to make slash command embeds

short parcel
spark flint
#

@dense flame

dense flame
#

thanks

spark flint
#

Ah it’s gone

#

Good

earnest phoenix
#

It fixed when i reset token a few times

#

But cant be sure because it happened by itself

earnest phoenix
#

Damn its being again

surreal sage
#

How can you remove a specific element gotten from array.find

#

ex: ```js
var item = array.find(your shit here)
item.(what here???)

#

I found a solution

small tangle
#

but filter returns a new array, it doesnt manipulate the array its getting called on

#

fair enough

woeful pike
#

in case you need to use the item you're filtering before you remove it from the array, array.find is "referentially stable" meaning you can do comparisons between 2 objects

const array = [{}, {}, {}]
const thing = array.find(somePredicate)
const newArray = array.filter(elem => elem !== thing)

and it'll remove that object you found

small tangle
#

its so dumb LULW i ran the VS Performance Profiler and the left column is the execution time of my program (in ms) with a coworkers method and the right column is without

earnest phoenix
#

Imagine discord.gay

frozen sundial
#

how are we supposed to know if it's valid-

earnest phoenix
#

I regenerated token copied pasted to token env in replit envs and i runned to bot and it worked and after some while it started to erroring

#

So itsnt about token string or command

#

Djs node fetch is shit

#

Thats all

#

Or djs 13 cant run with node 17

#

But they only wasting my time instead of helping

#

Thats why i am out of rage

quartz kindle
#

well, as he said, the token is not valid

#

check if the token you see in the error is the same token you have in your env

quartz kindle
slow terrace
#

My deleteguild event sends that the bot left a undefined why that?

slow terrace
#

I added
if(!guild) {
return;
}

slow terrace
boreal iron
#

!guild.available

#

In combination with yours

slow terrace
boreal iron
#

!guild || !guild.available

slow terrace
#

yea worked ty bro

earnest phoenix
#

If my token is invalid HOW THİS FUCKİN BOT IS WORKİNG

quartz kindle
#

did you check what i said?

earnest phoenix
#

Yes

quartz kindle
#

and?

earnest phoenix
#

And i dont think my ctrl + c and ctrl + v is broken

quartz kindle
#

thats not what im saying

earnest phoenix
#

It is same

#

Its same

quartz kindle
#

are you sure the token that your error is showing is exactly the same as your token?

#

because your code could somehow be breaking the token

#

making it not valid

earnest phoenix
#

Oh

#

This is my webhook token

#

Yes its webhook token

quartz kindle
#

the the code where you create your webhooks

earnest phoenix
#

Line 37

quartz kindle
#

where did you get the webhook token from?

earnest phoenix
#

From my secret zone channel's integrations

quartz kindle
#

you copied the webhook url right?

earnest phoenix
#

Yes

#

And pasted it google

#

And get token from page

quartz kindle
#

what page

earnest phoenix
#

When you googled url you get a page

quartz kindle
#

??

quartz kindle
#

that has nothing to do with google lol

#

but anyway, you can simply take the token from the url itself, its the same thing

slender wagon
#

so guysss my site is acting kinda weird, sometimes it hits me with this

quartz kindle
#

https://discord.com/api/webhooks/906212400607412224/VUTm6OVd8l6SXO0OAKOFwEFW6S6TIeAFmRNmgdzd4KKsvEmSy4kKCczRreFINNZ2RY_V
^ this is the token

slender wagon
#

it's localhost

earnest phoenix
#

Yes i know

earnest phoenix
#

This way comes more easy

quartz kindle
#

anyway

#

check your env file or whatever

#

and make sure the webhook token there is correct

earnest phoenix
#

Checked

#

Recreated webhook

slender wagon
quartz kindle
#

and that it DOES NOT HAVE HIDDEN SPACE AT THE END

#

in your ENV

lyric mountain
#

tim changed pfp again

#

damn

earnest phoenix
#

Yes there isnt

#

I am sure

#

Look there isnt

#

hidden space at the end in my env

quartz kindle
#

what about hidden newline

earnest phoenix
#

Whats it

lyric mountain
#
-b-
K1wtj0X9vS0nGLi
\n
slender wagon
#

ubuntu 18 or 20

#

which one should i use for my new server

lyric mountain
#

20

slender wagon
#

oki

boreal iron
#

Err isn’t 21 stable yet?

#

I think it is

quartz kindle
#

instead of this

#

make sure there is no empty line

earnest phoenix
#

Yes

#

I'm just laughing

#

Nice random

earnest phoenix
glacial vapor
#

Rate my yandere dev skills

earnest phoenix
#

uhh isn't the user level card supposed to show the user pfp too?
so how can you just send an imgur link

opaque acorn
#
 throw new TypeError('CLIENT_MISSING_INTENTS');
            ^
TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.
#

?

#
const Discord = require('discord.js')
const { Client, Intents } = require('discord.js');

const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
lament rock
#

The FLAGS are ints and I'm pretty sure ClientOptions.intents only accepts an int or an Array of strings. Not an Array of ints. But that may be incorrect.

rustic nova
glacial vapor
#

it checks rank and level from esportal
Max level is 20 there

opaque acorn
lament rock
#

or is it you need to pass an instance of the Intents class

lament rock
#

Discord.js is weird

boreal iron
#

Probably just passing them to the wrong client?"

glacial vapor
opaque acorn
#

im trying to upgrade to v13

glacial vapor
#

uses api to check those stats and have some image stuff

opaque acorn
#

is hard

lament rock
#

v13 is hard

coarse topaz
#

Hi, how can I make it so that it's NOT case sensitive?

if (message.author.id === "ID") {
    for(var i = 0; i < message.embeds.length; i++) {
        if(message.embeds[i].title.includes(`trigger text`)) {
            message.delete();
            }
        }
    }``` Currently, the bot reads the embed, but only deletes the message if the title hasn't been written with caps. I'd like to make it delete the message if the title includes the trigger text, whether it's been written with caps or not
quartz kindle
earnest phoenix
opaque acorn
quartz kindle
#

show full error

lament rock
#

okay

coarse topaz
#

Will try again though

quartz kindle
#

show what you tried

coarse topaz
#

if(message.embeds[i].title.toLoweCase().includes(`trigger text`)) {

quartz kindle
#

toLowe?

opaque acorn
# quartz kindle show full error
 throw new TypeError('CLIENT_MISSING_INTENTS');
            ^
TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.
    at Client._validateOptions (/app/node_modules/discord.js/src/client/Client.js:544:13)
    at new Client (/app/node_modules/discord.js/src/client/Client.js:73:10)
    at Object.<anonymous> (/app/events/guild/message.js:2:16)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
at load_dir (/app/handlers/event_handler.js:10:21) {
  [Symbol(code)]: 'CLIENT_MISSING_INTENTS'
}
coarse topaz
#

new function

earnest phoenix
quartz kindle
#

and why are you creating a client there

coarse topaz
#

weird that it didn't display any error in the console

earnest phoenix
#

maybe the error was catched and never logged

boreal iron
#

Probably just passing them to the wrong client?"

quartz kindle
#

b

opaque acorn
#

xd

lament rock
quartz kindle
#

weeb

opaque acorn
wheat mesa
#

But... why....

boreal iron
quartz kindle
#

dont ever require index.js

#

it creates circular dependencies

opaque acorn
quartz kindle
#

the files will never finish loading because they are all waiting for the other to load in a circle

wheat mesa
#

Wdym I love circular dependencies

#

They go in a merry go round and have a lot of fun doggowave

quartz kindle
#

heretic

lament rock
#

You should require a module that multiple modules require and export an Object from that file and then Object.assign necessary properties to that file

wheat mesa
#

I’m just looking out for my files’ rights 🤬

opaque acorn
#

ok

#

finished

wheat mesa
#

They need to be happy files

opaque acorn
#

thanks

boreal iron
quartz kindle
# opaque acorn thanks

if you need to access client you can easily do it through every single discord.js object, for example message.client

wheat mesa
#

The more circular dependencies, the happier your files will be :)

quartz kindle
#

you dont ever need to export client

lament rock
#

I export it anyways because I need references outside of events

earnest phoenix
#

hello, how do i find out my bot's token on top.gg

#

<@&304313580025544704>

boreal iron
#

you better ping @everyone

#

Edit your bot, left menu, Webhooks

earnest phoenix
earnest phoenix
# boreal iron The site has moved to https://docs.top.gg/

but i am using top.gg vote mandatory command this error

UnhandledPromiseRejectionWarning: Error: 401 Unauthorized
at IncomingMessage.<anonymous> (C:\Users\MSI\Desktop\sekunda my bot\node_modules\dblapi.js\src\index.js:118:25)
at IncomingMessage.emit (events.js:412:35)
at endReadableNT (internal/streams/readable.js:1317:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
(node:10180) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:10180) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:10180) UnhandledPromiseRejectionWarning:

boreal iron
#

Well the question was:

how do i find out my bot's token on top.gg

#

You need to provide your token in the header of your request

#

Explained on the first page

#

also

#

dblapi.js is deprecated

earnest phoenix
#

I asked for the token because that command wanted it.

boreal iron
#

Don't use that anylonger

#

That's the current library

#

Use this one

earnest phoenix
#

nice thank

boreal iron
#

👍

earnest phoenix
#

@boreal iron

boreal iron
earnest phoenix
boreal iron
#

You send a request to the topgg API then, saving all voters in your database or setup webhooks, receiving "live" if somebody votes which you need to store in your database as well.

#

If somebody runs your command, then access your database to check if he has voted.

#

And consider caching the voters after fetch your database.

boreal iron
#

Your taken can be found here as I mentioned before

#

Edit your bot, left menu, Webhooks

#

Visit topgg, login, edit your bot, left menu, Webhooks -> Token

earnest phoenix
#

ok

boreal iron
earnest phoenix
boreal iron
earnest phoenix
glacial vapor
earnest phoenix
#

bruhhh

#

all things are ok but a user is having trouble with his profile

#

and maybe another user but i don't kniow

#

his profile doesn't refresh

#

with quick.db

#

any other quick.db-like dbs? i'm having problems

woeful pike
#

why not just sqlite

#

if you want an ORM you can use prisma, it's great

earnest phoenix
#

ok

livid lichen
#
[].push({
  arg.name: gotArg.value
)};
```Hey, the thing above doesn't work for some reason. I've tried everything I could but I cannot find a solution. Anyone got any ideas?
cinder patio
#

You are missing a )

#

No actually you've swapped the places of the ) and }

#

it should be })

#

Also why not just

[{ arg.name: gotArg.value }]
livid lichen
feral aspen
quartz kindle
#

wdym doesnt work lol

#

also, if you want a dynamic keyname, do this

quartz kindle
livid lichen
#

Uh oh

cinder patio
#

My connection is not private, cool

livid lichen
#

Gotta get a new certificate :(

cinder patio
#

just send the image here

quartz kindle
#

certificate invalid lul

livid lichen
#

alr

livid lichen
quartz kindle
#

anyway i told you how to fix it

#

dynamic property names

livid lichen
#

I'll try. Thanks.

feral aspen
#

TIM, that's you? 😂

cinder patio
#

Oh lmao I completely glossed over the property name

livid lichen
#

Holy shit it worked!

feral aspen
#

I didn't even know. lmao

livid lichen
#

Thanks!!

quartz kindle
#

its always been me lol

feral aspen
quartz kindle
#

ye, but the old one was also me

#

lel

feral aspen
#

I finally finished learning Regular Expressions.

#

Now, soon, debugging. 👏

quartz kindle
#

regex is not something you "finish"

#

lmao

feral aspen
quartz kindle
#

you never finish learning regex

feral aspen
quartz kindle
#

:^)

feral aspen
#

I learnt what I had to learn in regexes.

wheat mesa
#

When will someone make a readable regex

feral aspen
#

31 lessons of Regexes, damn.

wheat mesa
#

On the bright side, you now know 0.00056% of regex mmLol

cinder patio
#

Hmmm that's actually not a bad idea, I could make a typescript transformer which makes regex more readable somehow

#

So you would get the exact same performance from regex

quartz kindle
#

make a lang that compiles to regex

wheat mesa
#

Actually not a bad idea

boreal iron
#

Or regex to human readable code

#

That would help anyone who doesn’t understand regex

#

(vise versa)

quartz kindle
#

that already exists

#

there are a few websites that break down regex step by step with explanations of each block

boreal iron
#

Nah that’s absolutely not what I mean

quartz kindle
#

regex to lolcode?

boreal iron
#

I will explain what I mean tomorrow when I’m back at PC

wheat mesa
#

regex to brainfuck

#

I wouldn’t notice the difference

feral aspen
#
let string = 'h a m o o d i h a j j i r i';
let removeSpaces = /\S+/g;

const result = string.match(removeSpaces);

let name = "";
result.map(x => name += x);

let capitaliseH = /[h]/g;

name = name.replace(capitaliseH, 'H')
console.log(name); // HamoodiHajjiri
#

Look at this, bruh.

wheat mesa
#

Regex is outdated, needs a proper replacement

#

Imo

split hazel
boreal iron
#
var regex = RegexBuilder()
.addCaptureGrouo()
.contains("[a-zA-Z]")
.minLength(4)
.maxLength(8)
.isGlobal(true)
```@quartz kindle
#

Converting to an actual regex

wheat mesa
#

Still close to regex but that’s much more readable

boreal iron
#

Would require tons of available methods

#

But human readable

split hazel
#

regex builder is actually great only if there was an online version that straight up gives you the resulting regex

boreal iron
#

Imagine that class with its tons of methods covering as much as possible

#

Might actually be a good idea for a library

#

_can smell all the donations already _

#

Tim you wanna team up?
You code it and I’m doing the marketing.
You will get 10% of all donations.

<html><small><small><small><verysmall>if they ever reach 10000/month

split hazel
#

give me a 5% cut and I'll plan the optimal architecture

boreal iron
#

Get off my profit! You can get 5% of Tims

slow terrace
#
const fetchedLogs = await member.guild.fetchAuditLogs({
            limit: 1,
            type: 'MEMBER_KICK',
           });
        // Since there's only 1 audit log entry in this collection, grab the first one
        const kickLog = fetchedLogs.entries.first();
        const { executor, target } = kickLog;

        let RemoveEmbed;
        if (kickLog && target.id == member.id) {
<kickembed>
        } else {
<leaveembed>
        }
earnest phoenix
slow terrace
slow terrace
# earnest phoenix Can u show the code
const fetchedLogs = await member.guild.fetchAuditLogs({
            limit: 1,
            type: 'MEMBER_KICK',
           });
        // Since there's only 1 audit log entry in this collection, grab the first one
        const kickLog = fetchedLogs.entries.first();
        const { executor, target } = kickLog;

        let RemoveEmbed;
        if (kickLog && target.id == member.id) {
<kickembed>
        } else {
<leaveembed>
        }
earnest phoenix
#

U wanna maki antikick with mongoose?

slow terrace
#

Antikick?

wheat mesa
#

I don’t understand what you’re trying to do here

#

What’s the problem

slow terrace
#

This code is for when member leaves check if it kicked and sends the kick embed and it’s not send it as leave embed

earnest phoenix
slow terrace
# wheat mesa What’s the problem
C:\Users\WolfWolfy\Downloads\Wolfy-master\Wolfy-master\events\GuildMemberRemove.js:37
        const { executor, target } = kickLog;
                ^

TypeError: Cannot destructure property 'executor' of 'kickLog' as it is undefined.
    at Object.execute (C:\Users\WolfWolfy\Downloads\Wolfy-master\Wolfy-master\events\GuildMemberRemove.js:37:17)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
earnest phoenix
#

kick log is undefined

#

line 37

slow terrace
#

I know, the error is saying this 😂

earnest phoenix
# slow terrace What was the problem?

U can use this


client.on('guildMemberRemove', async member => {
    const fetchedLogs = await member.guild.fetchAuditLogs({
        limit: 1,
        type: 'MEMBER_KICK',
    });
    // Since we only have 1 audit log entry in this collection, we can simply grab the first one
    const kickLog = fetchedLogs.entries.first();

    // Let's perform a sanity check here and make sure we got *something*
    if (!kickLog) return console.log(`${member.user.tag} left the guild, most likely of their own will.`);

    // We now grab the user object of the person who kicked our member
    // Let us also grab the target of this action to double check things
    const { executor, target } = kickLog;

    // And now we can update our output with a bit more information
    // We will also run a check to make sure the log we got was for the same kicked member
    if (target.id === member.id) {
        console.log(`${member.user.tag} left the guild`);
    } else {
        console.log(`${member.user.tag} left the guild, audit log fetch was inconclusive.`);
    }
});
slow terrace
#

But I don’t know the reason it’s sometimes working

earnest phoenix
#

Use this its working

earnest phoenix
# slow terrace Oh okay ty

If u wann aknow who kick u can use this


client.on('guildMemberRemove', async member => {
    const fetchedLogs = await member.guild.fetchAuditLogs({
        limit: 1,
        type: 'MEMBER_KICK',
    });
    // Since we only have 1 audit log entry in this collection, we can simply grab the first one
    const kickLog = fetchedLogs.entries.first();

    // Let's perform a sanity check here and make sure we got *something*
    if (!kickLog) return console.log(`${member.user.tag} left the guild, most likely of their own will.`);

    // We now grab the user object of the person who kicked our member
    // Let us also grab the target of this action to double check things
    const { executor, target } = kickLog;

    if (kickLog.createdAt < member.joinedAt) { 
        return console.log(`${member.user.tag} left the guild, most likely of their own will.`);
    }

    // And now we can update our output with a bit more information
    // We will also run a check to make sure the log we got was for the same kicked member
    if (target.id === member.id) {
        console.log(`${member.user.tag} left the guild; kicked by ${executor.tag}?`);
    } else {
        console.log(`${member.user.tag} left the guild, audit log fetch was inconclusive.`);
    }
});

#

can anyone explain me the discord intents? my bot got 75+ servers so i'm making the form but at last it says to pick intents. I set my bot's presence and there i use the server size and user size and i read that other things like getting ID is not necessary for intents

#

i want to be sure that server & user size use intent?

drifting wedge
#

hi

#

so i have ngninx set up

#

i had a friend do it for me

#

and idk how i can add another instance

#

i made the sites enabled thing and reloaded it but its still not workiung

#

any ideas?

boreal iron
#

You messed up the config then

drifting wedge
#

umm

#

the other ones work?

#

like i completely copied the file

#

and just edited the domains and localhost port

boreal iron
#

Does the domain even has your webservers IP as target?

drifting wedge
#

yeah

boreal iron
#

Changed when?

drifting wedge
#

today

#

lol

#

i just bought it

#

oh

#

i have an idea

boreal iron
#

Check the dns records

drifting wedge
#

but like this happened for many domains ive tried

#

yeah

#

like even old ones

#

already pointed to webserver

boreal iron
#

Hmm unfortunately I’m not fluent with the NGINX syntax if that’s really an issue of the webserver

drifting wedge
#

hmm

#

lik

#

like

#

the domains my friend set up work

#

like if i edit THAT one for that specific domain

#

it works

#

but not for new ones

#

@boreal iron

wheat mesa
#

Anyone know how to get VSC to stop using ~ for auto imports and use relative pathing instead? Not sure why it suddenly changed to this whole ~ thing, but it breaks and it's annoying to replace that line every time

boreal iron
drifting wedge
#

adding new files

#

like of different domains

#

if i do stuff with the 2 domains its configured with (my friend did) it works

#

but if i add any new one

#

that one just doesnt work

#

wait

#

@boreal iron it gives a too many redirections error

#

wait

#

wrong one

#

oops

#
    listen 80;
    listen [::]:80;
    server_name mydomain.com www.mydomain.com;
    return 302 https://$server_name$request_uri;
}



server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    ssl_certificate         /etc/ssl/cert.pem;
    ssl_certificate_key     /etc/ssl/key.pem;

    server_name mydomain.com www.mydomain.com;
    add_header X-XSS-Protection "1; mode=block";

    location / {
        include proxy_params;
        proxy_pass http://localhost:3401;
    }
}```
#

here

#

@boreal iron

#

in the actual file it is my real domain btw

boreal iron
#

Why do you proxy the domain to another webserver?

drifting wedge
#

i use quart

#

flask basically

#

its a py web backend thing

boreal iron
#

Oh not another NGINX server

#

An app then

drifting wedge
#

yeah

boreal iron
#

Ok got it

drifting wedge
#

i might have an idea why its not workiong

boreal iron
#

Tbh even if I’m not into NGINX too well the config looks about fine

#

Guess it’s your app

drifting wedge
#

hmm

#

i mean yeah

#

i think its the app too

#

but then why doesnt it work when i try it with other things?

boreal iron
#

I wonder there’s no reverse proxy config

drifting wedge
#

like with simple apps?

#

ok so

#

i fixed the app

#

but its still not working

boreal iron
#

If you don’t use a proxy instead just assign a documentroot even without files in there, then there shouldn’t be any redirection error anymore

#

Which would prove it’s your app

drifting wedge
#

aight

#

how do i do that lol

#

im not too good with nginx

#

like not at all lol

boreal iron
#

Neither I freerealestate

drifting wedge
#

lmao

#

wait so what do i need to do?

boreal iron
#

Lemme take a look

drifting wedge
#

i dont need to add the config for nginx anywhere else right?

boreal iron
#
    server_name testsite.com;

    root /var/www/testsite.com;

    location / {
        try_files $uri /index.html;
    }

drifting wedge
#

i can try making the app like extremely simple

boreal iron
#

Adjust the paths

drifting wedge
#

alright

#

dont i need server { ?

boreal iron
#

Check if that causes a redirection error

drifting wedge
#

or listen?

boreal iron
#

Yeah it’s inside

drifting wedge
#

inside the first one? or second?

#

2nd right?

boreal iron
#

No inside your SSL one

drifting wedge
#

yeye ok

boreal iron
#

The first one only redirects http to https

#

Replace the proxy config with the lines I wrote except server name

#

You have that already of course

drifting wedge
#

in root i put the file path?

boreal iron
#

Yeah some path including an index html/php whatever

#

Just to test

#

Oh I see it’s far more easier

#
server {
        listen 80 default_server;
        listen [::]:80 default_server;
        root /var/www/example.com;
        index index.html;
        server_name example.com;
}```
#

Just copy the two lines root and index to test the redirection replacing your proxy config

woeful pike
#

if you're just serving static files you might as well go with something like netlify or cloudflare pages

woeful pike
#

are you putting nginx in front of the app webserver just for static files?

drifting wedge
#

uhh

#

no

#

im doing backend logic too

woeful pike
#

I mean serving specifically static files from nginx is actually a good idea

#

but usually if you have something like a node webserver you'd simply proxy_pass the connection through to your app instead

drifting wedge
#

i dont know nginx at all

woeful pike
#

what's your backend

drifting wedge
#

quart

#

flask but async

woeful pike
#

you got gunicorn in front of that?

drifting wedge
#

hypercorn

#

yeah

woeful pike
#

ok yeah so just proxy_pass the connection to it

drifting wedge
#

uhh

#

i have no idea how to do any of this lmao

#

i just reuse the template my friend made

woeful pike
#

you're binding hypercorn to a unix socket right

drifting wedge
#

uhhh

#

idfk

#

lmao

woeful pike
#

how are you running your app?

drifting wedge
#

hypercorn

woeful pike
#

ok but like how are you getting it to run, what's the command?

drifting wedge
#

hypercorn --workers 3 --bind localhost:3401 -m 007 asgi:app

woeful pike
#

oh over a port ok

drifting wedge
#

so

#

what do i do lol

woeful pike
#

basically you just do

upstream quart {
  server http://localhost:3401;
}

server {
  server_name yourname.com;
  # stuff here
  location / {
    proxy_pass http://quart;
  }
}

to send incoming connections that match your domain into your app

#

you might also want to add some headers before you send the connection to your backend

drifting wedge
#

uh aight

woeful pike
#

I hope that https redirect is autogenerated by certbot

drifting wedge
#

uh

#

what

woeful pike
#

don't worry about the top stuff

drifting wedge
#

yeye

#

is that correct tho?

#

its nginx: [warn] conflicting server name "nerded.io" on 0.0.0.0:80, ignored

#

sorry for being dumb lol

woeful pike
#

you can delete the first server declaration. If you haven't even set up your server you shouldn't be dealing with https redirects

drifting wedge
#

im literally like stupid af when it comes to linux lo

drifting wedge
#

like the app

#

i just need to RUN it

woeful pike
#

wdym? you can curl http://localhost:3401 on your host machine when you have hypercorn running, no?

distant cobalt
#

how do i check the discordjs version?

woeful pike
#

the nginx part is just to expose the local server to the world

drifting wedge
#

yes

#

thats the issue

woeful pike
#

to be honest you probably don't even need nginx for this

boreal iron
#

Oh I see you found somebody dealing with NGINX

woeful pike
#

but it just makes things easier to work with

drifting wedge
#

i mean

#

i just need to like RUN the thing lol

#

like i mean id rather it be nginx

woeful pike
#

you can't run your app with hypercorn?

drifting wedge
#

but idm

#

i can

#

yes

#

but how do i expose it

woeful pike
#

so why are you saying the issue is urnning it xd

#

ok yeah well we're getting there

boreal iron
#

The issue was in your app, right?

drifting wedge
#

not anymore

#

the app is fine

woeful pike
#

you just need one server declaration with server_name and a proxy_pass directive that points to hypercorn

boreal iron
#

Yeah but like I assumed the config wasn’t the issue it was ok

woeful pike
#

you can set up https on top of that once you get that working

#

or just use cloudflare and forget about it

distant cobalt
#

how do i check the discordjs version?

woeful pike
#

I literally showed you

drifting wedge
#

i think i might now

#

know

#

yeah

#

yeah yeah

#

i just rememberd

#

hold on]

#
  server_name domain.com;
  # stuff here
  location / {
    proxy_pass http://localhost:3401;
  }
}``` this should work?
woeful pike
#

if nginx -t checks out and you've run nginx reload yes

drifting wedge
#

it gives this

#

nginx: [warn] conflicting server name "nerded.io" on 0.0.0.0:80, ignored

#

its fine right?

woeful pike
#

you have 2 servers with the same name

drifting wedge
#

i dont

#

oh

#

might be on top?

#

the https stuff?

#

there

#

commented it out

#

LETS GO

#

IT WORKS

#

I LOVE YOu

eternal osprey
#
{
    let m = "./cards"
    for (const key in m){
      console.log(m[key])
    }
  }
```tried getting the images instead of colors...
drifting wedge
#

ALLL

eternal osprey
#

yeah any fix lmao

woeful pike
#

ay nice

boreal iron
#

He already has other SSL setups

woeful pike
#

or just turn on the cloudflare orange cloud

eternal osprey
woeful pike
#

oh does he? ok

boreal iron
#

And it included the SSL host and redirection

#

Somebody did it for him

woeful pike
#

I wouldn't do SSL with anything other than certbot

#

I'm not touching certificates

boreal iron
#

Yeah nothing to say against that

#

I do as well

#

What I meant was if somebody set it up for him certbot may is already configured

#

But that redirection error he had can’t be caused by a missing SSL cert, if so NGINX should have logged something I guess

#

At least Apache would do

#

I’m not really into NGINX unfortunately

#

And I’m also driving freerealestate

#

Like always

quartz kindle
#

because they had ECDH certs before certbot got them

woeful pike
#

oh 👀

quartz kindle
#

actually not sure if certbot even supports them yet

#

also, acme.sh doesnt use letsencrypt by default

#

they use zerossl

#

not sure whats the reasoning or which one is better than the other tho

boreal iron
#

certbot has got actually really good, also supporting Windows now and it works well
Also the fact you can configure like anything yourself, set pre hooks and after, passing the environment vars to your code etc. is nice

#

No plugins ever needed

#

If you like to do things on ur own

quartz kindle
#

ye

#

pretty sure acme also does all that

#

also, the entire acme.sh is a single 7.5k line sh file with zero dependencies

#

pretty crazy

simple stump
#

I have an embed, but want to add a mention in the Embed title. However, the mention is displayed as a string. How would I fix this?

const pendingEmbed = new Discord.MessageEmbed()
                .setColor('#10D365')
                .setTitle(`<@` + message.author.id + `> ` + '\'s Party: ')
                .setDescription('• ' + parties[i][1])
                .setTimestamp()
            message.channel.send({ ephemeral: true, embeds: [pendingEmbed] });
spark flint
quartz kindle
#

pretty sure title doesnt support mention

spark flint
#

or do js .setTitle(message.author.name + '\'s Party: ')

modest maple
woeful pike
#

I still don't know what the point of paying for TLS anymore is

modest maple
#

I mean cloudflare is adding support to use other authorities outside of just themselves which is neet

#

Although If i remember the tests were just either them or LE

simple stump
#

aight thx

quartz kindle
#

whats the difference between LE and other authorities anyway?

#

arent they all pretty much the same?

#

other than some of them being valid for 1 year

boreal iron
#

Well LE is most likely accepted anywhere

quartz kindle
#

most of them are

boreal iron
#

Most yeah but not all

quartz kindle
#

i mean, whatever the authority is, all the browser needs to do is contact the authority servers, whatever they may be, no?

boreal iron
#

Some apps even require to import LE root cert to accept it manually

quartz kindle
#

apparently zerossl has better compatibility than LE

boreal iron
#

Jokes on me, never heard of zerossl

quartz kindle
#

they also require you to have their CAA in your DNS

boreal iron
#

Hmm I’m too old to switch systems

quartz kindle
boreal iron
#

Huh signed by another authority Wut

quartz kindle
#

What then, is cross-signing? Cross-signing is simply when multiple valid paths exist between a root certificate and a node certificate. This can be advantageous for a number of reasons. Sometimes, a certificate in the chain expires. While it would be nice if every piece of software was frequently updated and shipped an up-to-date copy of the root CA store, this is not the case in the real world. Many devices, for a number of reasons, are not subject to regular updates. Strategically cross-signing intermediate certificates from an older (therefore more likely to be present on the larger subset of devices in the wild) root certificate, “buys some time”. Hopefully by the time the older-still root certificate expires, the device will have been replaced. We can dream, right? Cross-signature is also useful when CAs need to perform maintenance. When vulnerabilities in the SHA-1 hashing algorithm were found, CAs issued new intermediate certificates which were able to cross-sign for yet more intermediates lower down in the chain. This allows, at least in theory, trust to continue seamlessly. In reality, this switcharoo working in practice is highly dependent on both software implementation and administrator configuration.

#

The main determining factor for whether a platform can validate Let’s Encrypt certificates is whether that platform trusts ISRG’s “ISRG Root X1” certificate. Prior to September 2021, some platforms could validate our certificates even though they don’t include ISRG Root X1, because they trusted IdenTrust’s “DST Root CA X3” certificate. From October 2021 onwards, only those platforms that trust ISRG Root X1 will validate Let’s Encrypt certificates (with the exception of Android).

boreal iron
#

Yeah looks amazing on mobile especially if you’re driving

quartz kindle
#

xD

boreal iron
#

Longer texts please

quartz kindle
#

from what i understand, cross signing means the cert can be validated by multiple root certs

boreal iron
#

Didn’t know that exists tho

quartz kindle
#

zerossl uses UserTrust RSA and AAA root certs
letsencrypt uses ISRG root cert

#

until october 2021 they also used DST root CA x3

#

but now they no longer do, its ISRG only

boreal iron
#

Yeah since ISRG is LE basically

quartz kindle
#

yeah

#

they are basically self contained now, and for this reason a bit less compatible with older systems

boreal iron
#

Yeah true

quartz kindle
#

zerossl maintains strong compatibility with older systems by using these other well established root certs

#

ISRG Root X2 (new ECDSA root) - coming soon

#

they still dont have ECDSA support

#

.>

boreal iron
#

Good to know that’s a thing

#

Not working with older systems anymore but you never know

quartz kindle
#

ye

#

honestly it doesnt even matter

#

lots of other shit will break before they even try using your websites on those systems

#

ECDSA is hot tho

boreal iron
#

Some of my software doesn’t support that anyways

quartz kindle
#

rip

boreal iron
#

I remember when Hetzner launched their new DNS console and people couldn’t add TXT records anymore using AES2048 bit keys or more due their length

quartz kindle
#

lel

boreal iron
#

At least they finally got a DNS API

#

Oh they also got a robot and cloud server API if you didn’t know that

#

Pretty good for getting the status or automating failover etc

#

If you even need that

#

If it’s a promise then it needs to be awaited

quartz kindle
#

but im not gonna go into that rn anyway

#

i've never had any issues whatsoever with any of my vps's

spark flint
#

thats not good is it KEKW

quartz kindle
#

so its a pretty far fetched worry

quartz kindle
boreal iron
#

Hmm if you don’t wanna pay for it but need a bit redundancy I can actually add an record if you need to

woeful pike
quartz kindle
#

nah i dont even have the infrastucture to do it

boreal iron
#

My system is online for so many years

spark flint
#

ah i fixed it

quartz kindle
#

@boreal ironever user hetzner's load balancer? how does it work?

spark flint
#

it was on a check firewall option on Krystal Hosting panel KEKW

quartz kindle
#

do they like give you a root IP and some rules to proxy to multiple addresses?

boreal iron
#

Nah don’t got that many requests

#

Simply click on it and configure it without clicking order

#

Should be self explaining I think

quartz kindle
#

not sure i'd want to date someone who spends 24 hours on the road

boreal iron
quartz kindle
#

the A record, that directs the domain to the ip

boreal iron
#

Brb need to restart discord

quartz kindle
#

i know you can do that with SRV records, but not with A records afaik

boreal iron
#

Chats fucked up

quartz kindle
#

.>

#

it wasnt that bad of a burn as the other one tho

#

most of it was still in good shape

boreal iron
#

If you choose round robin

boreal iron
#

The load balancer may recognize the status code and will in case of a timeout automatically send requests to your 2nd target

#

But I haven’t tested this yet

#

That’s a good question for the forum

#

damn it’s getting cold outside

#

fucking global warming

quartz kindle
#

meanwhile world leaders use 400 private jets to attend climate change conference

boreal iron
#

Yeah

#

But it’s been used in a good manner

#

You can’t compare that with your evil manner to fly into a different country once in your life

quartz kindle
#

yes, we are only consumers

#

we are the reason the world is dying

boreal iron
#

Finally you got it

quartz kindle
#

not them, they are the ones trying their best to save it

#

:^)

boreal iron
#

Anyways maybe I can test the load balancer at the weekend

#

Shutting down one DNS server

#

If I got some time

#

You better don’t use a JSON database in the first place

#

People don’t actually like to support that "bad practice "

quartz kindle
#

is the file being written multiple times at once?

#

are you running that code multiple times in a short time?

#

file writes are not atomic, multiple writers will interfere with each other

boreal iron
quartz kindle
#

there are two ways to make the writes work atomically:

  • use writeFileSync instead of writeFile (only works if you're using a single process)
  • write to a temporary file with a random name, then rename the file
#

depends on your needs

#

i use sqlite (better-sqlite3)

#

sqlite will do

#

the only thing sqlite would not be good for is if you need hundreds of writes per second from multiple processes at once

boreal iron
quartz kindle
#

i know the feel

boreal iron
#

Stop watching YouTube and 9gag

#

A timeout wouldn’t change much

#

Calling the function 3 times for example would result in 3 timeouts ending at the same time

#

If a write process ever takes a little longer your whole system is fucked up

earnest phoenix
#

Hello, does anyone know of any good API's to get images from.

boreal iron
#

Well only thing I can think of other than Tims statement is a queue

#

Which contain your file actions as promises and will continue if one promise has finished

#

Until it’s empty