#development

1 messages · Page 1811 of 1

latent heron
#

🤢

eternal elbow
#
channel.setName('not_general')
  .then(newChannel => console.log(`Channel's new name is ${newChannel.name}`))
  .catch(console.error);
``` Why is "catch" not working here?
proven lantern
#
const guildToJoin = await client.guilds.fetch(guild.id);
guildToJoin.channels.cache.get(0);

will guildToJoin.channels.cache.get(0); always return a channel that i can send an invite to?

pale vessel
#

You may be looking for collection.first()

#

But it's not guaranteed that the client can send message to it

proven lantern
pale vessel
#

Sending an invite would require the send messages permission, no?

proven lantern
#

looks good though

runic depot
#

send the link after uploading :)

proven lantern
latent heron
#

because it's honestly a really good informative video

#

PHP is an extremely tricky programming language to learn as I've slowly found out over time and it's worth addressing a lot of its problems

runic depot
#

i don't know which should i choose for professional backend coding...

pale vessel
proven lantern
#

all of them?

pale vessel
#

Yeah

runic depot
earnest phoenix
#

how to grow a discord server ?

latent heron
#

so here's my advice

proven lantern
#

dang

runic depot
pale vessel
latent heron
#

Don't do NodeJS or Express for backend

#

I really strongly advise against it because they [JavaScript] never were truly designed for it in the first place

runic depot
latent heron
#

if you want backend, learn Java or PHP

earnest phoenix
#

did everything

#

but still cant grow it

runic depot
earnest phoenix
#

; )

latent heron
#

i've been coding in PHP for over 11 years

#

i promise you, you're gonna lose your shit

#

i'm still learning new stuff in it every day

runic depot
#

So... ok

latent heron
#

i still don't understand a lot about it

runic depot
#

XD

latent heron
#

but if you want a backend for specifically websites

#

go with PHP.

#

otherwise, stick to smth like Java or C# as a general backend route

runic depot
latent heron
#

as in bots?

runic depot
#

it has a client side and backend

runic depot
latent heron
#

huh

#

Discord uses a bunch of langs for backend

#

Discord is a stack

#

JS, Elixir, Rust, Python and C++

runic depot
#

i mean like discord, a backend that clients can communicate with it

latent heron
#

as in an API?

runic depot
#

yes

#

not like ejs or django template or ...

#

just api

latent heron
#

honestly you can write an API in just about any modern programming language

#

look into erlang

runic depot
latent heron
#

so

#

erlang

#

also most modern languages are super fast now

#

there are very few rare exceptions to it

runic depot
#

I haven't heard that before.

latent heron
#

because the development industry has adopted new standards for high performing languages

#

also, hardware has just become so advanced that it's not really a concern anymore

#

CPUs are so advanced at handling huge amounts of processing time that you have ~1MB. file differences of script file sizes deviating by a few nanoseconds

runic depot
latent heron
#

because Python and nodeJS are vastly different

runic depot
#

yes they are

#

i want a good lang for backend

#

just this :/

#

because of that i got stuck between php and nodejs

latent heron
#

it depends on what you're trying to make a backend for

runic depot
#

api

latent heron
#

is it for a website API? or a general API

runic depot
latent heron
#

it really does depend

#

don't use either then

#

both things you're suggesting are mainly used for web APIs

#

use C++, C# or Java

#

or you could try using erlang as suggested

runic depot
#

ok thanks for your time ;)

latent heron
#

cheers

prime mist
latent heron
#

personally not a huge fan of elixir

#

but it definitely exists as an option too yeah

#

that's quite surprising for performance

#

webman is a thing?

#

I've heard of workerman before, which is an incredibly fucking good async PHP framework https://github.com/walkor/workerman

GitHub

An asynchronous event driven PHP socket framework. Supports HTTP, Websocket, SSL and other custom protocols. PHP>=5.3. - walkor/Workerman

#

it's impressive for what it can do

prime mist
#

Yeah PHP is full of surprises lol

tired panther
#

How can I make this in CSS? that the Button has something like a 'log' field

cinder patio
#

huh

tired panther
#

the Buttons are animated (thats way they look weird)

near stratus
cinder patio
#

Ah so you want to put that red button there, something like a notification?

tired panther
tired panther
tired panther
cinder patio
#

As long as the notification button is a parent of the bigger button then the animation doesn't matter. Can you show us the CSS style for the big buttons

tired panther
#
.shard-button{
    font-family: Tahoma, Verdana, sans-serif;
    margin-left: 7px;
    margin-right: 7px;
    margin-top: 2px;
    margin-bottom: 2px;
    
    border-style: solid;
    border-width: 4px;
    border-radius: 7px;
    padding: 2px 2px 2px 2px;
    text-align: left;
    font-size: 1em;
}

.shard-button.animated{
    animation: beat 1.5s ease 0s infinite;
}


.shard-button.animated::before, .shard-button.animated::after {
    content: "";
    position: absolute;
    
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    
    background-color: inherit;
    opacity: 0.4;
    border-radius: inherit;
  }

  .shard-button.animated::before {
    z-index: -2;
    animation: beat-before 1.5s ease 100ms infinite;
  }
  
  .shard-button.animated::after {
    z-index: -1;
    animation: beat-after 1.5s ease 200ms infinite;
  }
/*Colors & key Frames*/
cinder patio
#

try float, but you could also make the shard-button a flexbox

tired panther
cinder patio
#

ye, just give the inner button float: right

#

or, put the inner button in a div and give the div float: right

runic depot
#

float is bad

#

use display

tired panther
#
 <p class="shard-button animated green"><b>Shard 1 | Online</b></p>

I used the p, using a div than a p causes a bigger Button

cinder patio
#

I mean, the p only has that look because of all the margin you've added

#

You should use flexbox to position and size your elements

runic depot
#

this is needed

#

for a button

#

you can do with a tag

#

and add padding to it

boreal iron
#

Or just for this class p.shard-button

tired panther
#

looks uggly blobseenoevil

cinder patio
#

it's the green

#

with the white background

tired panther
#

changed to this Style, having Problems when adding Icons, they never show up Shiba_Cry

slender thistle
#

Received

tired panther
tulip ledge
#

Does anyone know why my bot is stuck on this for sometimes like 30 minutes+?

webhook = await channel.createWebhook(name, {
      avatar: avatar
    });
small tangle
tired panther
#

could you log out webhook

tulip ledge
#

no lol

#

its awaited

#

it's stuck on await

#

So I can't log webhook lol

earnest phoenix
#

@tulip ledge creating webhooks uses http
i wonder why the server didnt time out

tulip ledge
#

true

#

but like rn I tried it

#

it worked for a bit

#

and now it's stuck again

#
      try {
        webhook = await channel.createWebhook(name, {
          avatar: avatar
        });
        this.webhooks[channel.id] = webhook;
      } catch (e) {
        console.log(e)
      }
#

it's also not giving an error

#

so it's literally stuck there

eternal elbow
#

How do I handle the rate limit when changing the channel name?

tired panther
tired panther
#

then we can see if your Bot has any ratelimits

tulip ledge
#

429 hit on route /channels/734541084314828840/webhooks

tired panther
tulip ledge
#

any idea how I would fix it?

#

and do you know the numbers?

#

and is it channel specific or just all around?

tired panther
# eternal elbow I do not fully understand

if(client.cooldown.has(channel.id)) return;

channel.edit...
client.cooldown.set(channel.id, true)
setTimeout(()=>{
client.cooldown.delete(channel.id)
}, cooldownexpiretime)
tired panther
tulip ledge
#

ok

#

Is there a way to check how many more requests I can make?

tired panther
eternal elbow
#

Is client.cooldown something inside discord.js?

tulip ledge
# tired panther you can read the ratelimit info on `client.on('ratelimit')`

I have this but it didn't return anything when it got ratelimited

const path = require("path");
const Event = require(path.join(process.cwd(), "util", "Event.js"));
const chalk = require("chalk");

module.exports = class ReadyEvent extends Event {
    constructor(client) {
      super(client, {
        name: "rateLimit"
      })
    }
  
    async run(info) {
      console.log(`Rate limit hit ${info.timeDifference ? info.timeDifference : info.timeout ? info.timeout : "Unknown timeout"}`)
    }
  }
tired panther
#

you have to create a map client.cooldown = new Map();

eternal elbow
eternal elbow
tired panther
eternal elbow
tired panther
spare badger
#

I just accidentally almost disabled and deleted a VPS of a client KEKW

willow mirage
#

how I can do this?

const objA = {
a: 10,
b: 10
}
const objB = {
a: 5,
b: 5
}

And I want to get those a, b from both object using the { a, b } but the problem is they will have same variable name.

const {a, b} = objA;
const {a, b} = objB;

How I can do something like

const {a as a2, b as b2} = objA;

?

pale vessel
#

const {a: a2, b: b2} = objA; TsukasaSmug

willow mirage
pale vessel
#

Your solution

willow mirage
#

im stuped

#

fuck

pale vessel
#

Exdee

earnest phoenix
#

flazepe being helpful

#

📸

#

gotta document

willow mirage
#

too much syntaxes from esXX

earnest phoenix
willow mirage
#

import export

#

:<

pure lily
mild agate
#

eh? you don't know how to use setInterval?

fiery edge
#

Yep

#

Like setTimeout

mild agate
#

its

setInterval(function, time);

At each time interval (in milliseconds) the function will get executed

pure lily
earnest phoenix
#

But it doesn't execute until after the time is up

#

then from there it will execute every x time

mild agate
#

example

const myInterval = setInterval(() => {
    console.log("This will get logged each 3 seconds")
}, 3000)
#

This will run until clearInterval on that interval object is called
i.e.

clearInterval(myInterval);
willow mirage
earnest phoenix
#

How do you use setInterval

#

That is a good question

willow mirage
#

exdee

twilit geode
#

anyone have experience with docker

#

wondering if its safe to leave bot token in container when putting it on dockerhub

#

from what I can tell you cant see the code; but I have no experience

prime glacier
#

[ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './types' is not defined by "exports" in C:\Users\name\Documents\GitHub\demonandbadboy\node_modules\dotenv\package.json

can someone help?

inner fulcrum
#

@hidden coral #support message
well do u know tampermonkey?
its a script injector which can even use to expose things which u are not supposed to see in a website soooooo

slender thistle
#

What does that have to do with anything

inner fulcrum
slender thistle
#

He did literally say the hackers had access to his account, soooo...

earnest phoenix
#

Its safe if you arent dumb

slender thistle
#

I don't see your point

earnest phoenix
#

Dont use an easy to guess password or share your password and you should be straight

#

not to mention doesn't repl have 2fa

#

just enable that

slender thistle
#

I don't think it does

earnest phoenix
#

I am not shocked

slender thistle
#

Then again, I'm signed in via my GitHub account

earnest phoenix
#

repl sucks

slender thistle
#

Around 2 years of using repl, haven't had my shit stolen

earnest phoenix
#

I haven't either cause I dont use it

slender thistle
#

kekw

#

Replit moved from .env files to environment variables, interestingly

prime glacier
#

[ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './types' is not defined by "exports" in C:\Users\name\Documents\GitHub\demonandbadboy\node_modules\dotenv\package.json

can someone help?

lusty quest
#

ahh yes Github Co Pilot makes your code a Minefield, like it uses Open source code, and can copy/paste it into your code (possible licensing issues)
also your code gets send to Github and stored.

lusty quest
#

no

prime glacier
#

ok

long crow
#

For those with color blind, is the button readable? I have doubt on it

earnest phoenix
#

@long crow just make it black

#

the green blends with the white

long crow
#

the secondary type I guess

pale vessel
#

Custom emoji mmLol

stray seal
#

How do i get latency Code and Voting Perk Code?

#

:>]

pale vessel
#

Voting perk code?

earnest phoenix
#

Wut

#

Its called DIY

pale vessel
#

I guess you have to use the Top.gg API for that

earnest phoenix
#

Do it yourself

stray seal
#

Can someone DM me to get acess to the code and help?

earnest phoenix
#

no

#

Do

#

it

#

yourself

#

We will help if you have any issues

stray seal
#

@earnest phoenix

earnest phoenix
#

but we wont code it for you

stray seal
#

A mod said for someone to get me help

#

with the code.

vivid fulcrum
#

help with code != giving you the code

earnest phoenix
#

Yea, help with code you've already written

#

We wont write it for you or give you the code

vivid fulcrum
#

if you want to get premade code, pay someone here to do it

stray seal
#

Like make it

earnest phoenix
#

If you want me to make it give me money other then that ask for help

#

We won't write code for you, if you have a specific problem we will try and help you solve it

long crow
#

Look much better

earnest phoenix
#

Not a bad idea using buttons and select menus

#

How does the select menu work exactly tho

#

Do you just list all the songs displayed and have them select one and then it uses it to search for that song?

long crow
#

Yea, I max the selection to only 1

earnest phoenix
#

Mmmm

#

Would be cool if you could select multiple

#

Tho it might be useless

long crow
#

when it got selected, song played

#

For playing song, not so, but other thing might be useful

earnest phoenix
#

Mmm well

#

What if you wanna play multiple songs by the same artist

#

you could do something like -play Artist and it lists all the songs found from youtube or whatever with that artist

long crow
#

You can select on other song after 1 selected

#

I can even repeat select 1 song, as long I do .editReply

#

since the selection will reset again

prime glacier
#

[ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './types' is not defined by "exports" in C:\Users\name\Documents\GitHub\demonandbadboy\node_modules\dotenv\package.json

can someone help?

tulip ledge
#
HTTPError [AbortError]: The user aborted a request.
0|Topaz RPG  |     at RequestHandler.execute (/root/TopazRPG/node_modules/discord.js/src/rest/RequestHandler.js:107:21)
0|Topaz RPG  |     at processTicksAndRejections (internal/process/task_queues.js:95:5) {
0|Topaz RPG  |   code: 500,
0|Topaz RPG  |   method: 'put',
0|Topaz RPG  |   path: '/channels/864227199921946644/messages/864525935785410562/reactions/%E2%9C%85/@me'
0|Topaz RPG  | }
#

Anyone knows how to fix?

long crow
#

Yeah, with the buttons, I can pretty much eliminate the music commands for other commands

crude egret
#

Anyone have any idea why I'm getting these errors? The code runs just fine.

#

More specifically. How fix good yes?

#

xD

vivid fulcrum
#

using json as a database

crude egret
#

I know. I have a database somewhere else, but I simply don't know how to use it

#

I have never used databases

#

Just curious @vivid fulcrum . What should I do with my database endpoint?

vivid fulcrum
#

endpoint?

#

is this an api?

crude egret
#

Idk man

#

Oh, no. Not the thing in the top xD

vivid fulcrum
#

oh

crude egret
#

I use plox.host

#

Pretty neat service tbh

#

3.25$ for 3 months of hosting + 2 database slots

#

So I'm not really in a hurry to get the database working xD

#

So. Any ideas on either the errors or the database? xD

small tangle
#

can i fix these timeout errors, since they are level INFO i guess they are not severe, but i'd like to fix them, but for me it seems like its not happening on my side FeelsSmartMan

#

i mean a couple seconds later they connect successfully again and everything works, but this happens from time to time

solemn latch
#

im guessing its remote mongodb?

#

you could increase the timeout value to something a bit more stable

tranquil drum
#

has anyone seen binary payloads that start with

d9 d9 f7 a3
vivid fulcrum
#

payloads where

#

that also isn't binary

earnest phoenix
#

that is a buffer is it not?

tranquil drum
#

was sent as HTTP body with content-type of application/json

earnest phoenix
#

Probably some kind of buffer

vivid fulcrum
#

that can be anything

#

need more context on what you're doing

tranquil drum
#

no worries ty anyway

quartz kindle
#

thats ÙÙ÷£ in utf8

small tangle
earnest phoenix
#

Omg its tim

earnest phoenix
quartz kindle
#

owo?

boreal iron
#

at least not devided by zero

summer torrent
#

I'm in weird situation. VScode and tsc says there is no such (Interaction, MessageButton etc) class in Discord.js. But when I look at node_modules, I can see that class

earnest phoenix
#

download djs types

#

wtf

summer torrent
#

it is typescript file

summer torrent
earnest phoenix
#

downloading @types/discord.js can fix it

#

npm i -D @types/discord.js

#

then add the types to tsconfig.json

summer torrent
#

wait discord.js doesn't do that?

earnest phoenix
#

Djs stinky

prime glacier
#
Uncaught Exception: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './types' is not defined by "exports" in C:\Users\gamin\Downloads\demonandbadboy-main\demonandbadboy-main\node_modules\dotenv\package.json```can someone help me
earnest phoenix
#

Quick before erwin comes: detritus stinky too

summer torrent
lusty quest
#

nah he is lurking around on the detritus discord

#

and his first message today was frick

earnest phoenix
#

frickroll

lament rock
prime glacier
#

Cannot find module 'dotenv/types'

lament rock
#

restart ts server is preferable

lament rock
earnest phoenix
#

@summer torrent according to djs package.json they already include typings in v12 (the typings repo is archived and the latest version there is v11)
are you sure you're not on djs v11?

summer torrent
#

i restarted my pc too

earnest phoenix
#

inspect its package.json

#

see if there's a types field

summer torrent
#
  "types": "./typings/index.d.ts",```
#

im installing discord.js@dev

earnest phoenix
#

huh

#

looks sus

pale vessel
#

Well if you have problems with Discord.js maybe it's time to move to another library wesmart /s

sudden geyser
#

discljord

pale vessel
#

How do you pronounce that? I'm curious

#

I saw it somewhere

sudden geyser
#

"DISK-le-yord"

earnest phoenix
#

is that a lib for clojure (def didn't look that up)

sudden geyser
#

yes

deft kestrel
#

Asynchronous JS code makes a performance difference and other fun jokes you can tell yourself

sudden geyser
#

How about this

#

Promises aren't much better than callbacks

lament rock
#

Promises spawn a micro thread to perform the task, so they are better than callbacks as callbacks impose single threaded

earnest phoenix
#

is discord's api compatible with scratch the child's development tool

#

asking for uh.. afriend

solemn latch
earnest phoenix
#

wait fr..

#

ok thanks lol

solemn latch
#

yeah

lament rock
#

Trying to find the src for runMicrotasks one sec

earnest phoenix
#

is it possible to not match the red square

sudden geyser
#

You could append a ? after the *

earnest phoenix
#

thx,makes sense

lament rock
# quartz kindle source for this?

Can't seem to find the exact source where it actually spawns a thread, but the logic behind it is that the thread doesn't get paused to run async functions like a sync fs call would, so it has to spawn it in a micro thread to run in an async context

quartz kindle
#

it isnt a thread

#

after nextTick and before timers

lament rock
#

JS has a super weird implementation of Promises then

#

I still can't find where I saw this

sudden geyser
#

JS is wack in general yet we all love it

quartz kindle
#

js doesnt have threading at all, every single part of it is single threaded

#

the only way to thread is to explicitly spawn a separate instance of v8, in a separate process or separate c++ thread/js context

lament rock
#

worker_threads

quartz kindle
#

yes thats what worker threads do

#

its a separate instance of v8

lament rock
#

oh my god

quartz kindle
#

there is no memory sharing either

#

you have to use ipc with worker threads

lament rock
#

what is SharedArrayBuffer then

quartz kindle
#

thats the only shared memory option

#

but its a pure buffer

#

you cant share js objects between worker threads without ipc

#

or serialization

lament rock
#

I guess I should have figured since the docs state that the messages you send between children and the parent port has to be cloneable

quartz kindle
#

some objects can be "transfered"

#

which makes them cease to exist in the original worker

#

but its pretty limited, mostly arraybuffers and stuff

lament rock
#

wish that wasn't the case

quartz kindle
#

yeah well, what can we do

lament rock
#

Idk. Fork node I guess

quartz kindle
#

highly doubt its that simple

#

i dont know anything about how v8 is built, but im pretty sure its not made to be thread safe

#

trying to thread it will likely introduce a shit ton of memory violations

lament rock
#

perhaps on the end user's side. Promises could fuck with a lot of stuff

quartz kindle
#

from v8 devs:

#

There are two options: (1) use different isolates on each thread (then the scripts can run in parallel) and (2) use one isolate and use v8::Locker to lock the isolate before you use it (then only one thread at a time can execute scripts)

lament rock
#

having only 1 thread execute at a time defeats the purpose of threading

earnest phoenix
#

I am trying to match nested stuff ik that is possible with while loops but i still want to try

#

if add \w as alternative I get another results

tired panther
#

How do I make css button fill my whole div? I use width:100%, but the Problem is, when schrinking the Browser, the style gets weird

lament rock
#

If you want to match any character except for some, then you can do [^characters]

quartz kindle
#

text makes button overflow to the right?

tired panther
earnest phoenix
#

Mmm

#

I dont like how that looks

#

something about it is just off

boreal iron
#

whitespace: nowrap

earnest phoenix
#

Could be my monitor tho

lament rock
#

Reconsider using red text

tired panther
#

it should look like this

boreal iron
#

oof... missing the -

quartz kindle
#

if you're giving width:100% to the text itself, that wont work because the text is inline

boreal iron
#

white-space: nowrap;

quartz kindle
#

use nowrap like fake said

tired panther
boreal iron
#

Doesn't match the overall light style

quartz kindle
#

whey

boreal iron
#

Use decent backgrounds if you're using a light style

tired panther
boreal iron
#

Errr... well that has nothing to do with the color selection

lament rock
#

Red text isn't something to use lightly as using red is a design principal to capture user attention as danger

tired panther
quartz kindle
#

but heartbeats are dangerous

#

:^)

boreal iron
#

Dark text color on a light background and vise versa

tired panther
lament rock
#

heart beats are very dangerous. Stop your heart from beating

boreal iron
#

yes, whitespace for right element

#

120bpm is good I heard

cinder patio
#

Change the background color

#

white is just not good

quartz kindle
#

light theme hater

boreal iron
#

shhh it is

cinder patio
#

for what you have going on

pale vessel
quartz kindle
#

btw dude came here for css help, not for design help xD

cinder patio
#

I just can't help myself

boreal iron
#

lol

quartz kindle
#

xD

tired panther
quartz kindle
#

someone send google a pic of discord light theme

cinder patio
#

Also that blue line at the top is ???, unless other elements outside of that ss has that blue shade, change it to the green or red like the button colors

boreal iron
#

Looks like bootstrap

cinder patio
#

true

earnest phoenix
cinder patio
#

is it?

tired panther
#

Needed something to start lol

quartz kindle
#

start from scratch :^)

tired panther
#

yes, btw back to my problem. How can I solve it white-space: nowrap; doesnt seem to work

cinder patio
#

If it is then why aren't you using more of the css classes it provide 😭😭

boreal iron
#

huh... it does work being applied on the right selector

earnest phoenix
tired panther
tired panther
boreal iron
#

It may be overwritten by bootstrap

#

Add an !important behind

earnest phoenix
boreal iron
#

It also requires a full reload aka. CTRL + F5 to clear the cache

tired panther
boreal iron
#

meh without seeing the code I can't really help tho

#

and the element it's being applied on

lyric mountain
#

that way it'll match all square brackets inside square brackets

#

is that what you wanted?

tired panther
# boreal iron meh without seeing the code I can't really help tho
.shard-button{
    font-family: Tahoma, Verdana, sans-serif;
    margin-left: 7px;
    margin-right: 7px;
    margin-top: 2px;
    margin-bottom: 2px;
    border-style: solid;
    border-width: 4px;
    border-radius: 7px;
    padding: 2px 2px 2px 2px;
    text-align: left;
    font-size: 1em;
    background-color: #36393f;
    border-color: #36393f;
    display: flex;
}
.shard-button.log{
    color: #ED4245;
    background-color:#202225;
    border-color: #202225; 
    border-width: 10px;
    border-top-width: 1px;
    border-bottom-width: 1px;
    margin: 0px 3px 0px 3px;
    padding: 0px;
    float: right;
    white-space: nowrap;
    width: 100%;
  }
``` DO you need the html part?
lyric mountain
#

(?<=\[.*)(\[.+\])(?=.*\]) here's an alternative version

earnest phoenix
#

not really ,but thx for the help,I will use while loop for now 😄

boreal iron
#

Oh wow you're making things more complex then needed

lyric mountain
#

the previous one

#

note the capture group in this case

earnest phoenix
#

I want to match nested groups ,so [ab[ab[ab]]] [ab],should match as group

boreal iron
lyric mountain
#

either way, my first solution will work for that

#

since capture groups will get all matches

#

if you want to include the parent group, just use \[.+\]

earnest phoenix
#

n group

tired panther
lyric mountain
#

\[.+\] = will match all square bracket groups WITH content inside
\[.*(\[.+\]).*\] = will match all square bracket groups INSIDE square brackets
(?<=\[.*)(\[.+\])(?=.*\]) = will match all square bracket groups INSIDE square brackets (non-capturing version)

#

all 3 can be used to grab all matches, even if inside other matches

earnest phoenix
#

thx 🤗

tired panther
boreal iron
#

one sec please

#
<style>
    .inner
    {
        display: table;
    }
    .row
    {
        background-color: lightgrey;
        -webkit-border-radius: 3px;
        -moz-border-radius: 3px;
        margin-bottom: 5px;
        padding: 5px;
    }
    .row:last-child
    {
        margin-bottom: 0;
    }
    .row > div
    {
        border-radius: 3px;
        display: table-cell;
        vertical-align: middle;
    }
    .shard
    {
        background-color: rgba(0, 0, 0, 0.5);
        padding: 5px;
        white-space: nowrap;
        color: #ffffff;
    }
    .status
    {
        padding: 0 10px;
    }
</style>

<div class="wrapper">
    <div class="inner">
        <div class="row">
            <div class="shard">Shard 0</div>
            <div class="status">Heart died due 120bpm heartbeat</div>
        </div>
        <div class="row">
            <div class="shard">Shard 1</div>
            <div class="status">Heart died due 120bpm heartbeat</div>
        </div>
        <div class="row">
            <div class="shard">Shard 2</div>
            <div class="status">Heart died due 120bpm heartbeat</div>
        </div>
    </div>
</div>
#

as example

pale vessel
#

Python binding to the Networking and Cryptography (NaCl) library

#

NaCl (pronounced "salt") is a new easy-to-use high-speed software library for network communication, encryption, decryption, signatures, etc. NaCl's goal is to provide all of the core operations needed to build higher-level cryptographic tools.

lyric mountain
#

that moment when you want to pun so hard that you find NaCl in "Networking and Cryptography"

boreal iron
#

Colorization is optional of course

#

Add with: 100%; if the table should be 100% of its parent

#

(to .inner)

lyric mountain
#

if you use flex you don't really need to use 100%

boreal iron
#

Ewww go on with your flex shit

lyric mountain
#

how do you know my shit is flexible?

boreal iron
#

lmao

#

We still wanna support IE6!!

#

As there might be one of a billion clients still using it

lyric mountain
#

so...basically banks and millenium-old enterprises?

boreal iron
#

Younger people can not understand why oldEyes

lyric mountain
#

I'm not as young as you might think

boreal iron
#

Where’s grandpa Tim if I need him

lyric mountain
#

it's just that...no one use IE anymore

boreal iron
#

Err still a small percentage

lyric mountain
#

only people who are really afraid of changes

boreal iron
#

At least using my tools

#

And the user agent history shows they’re somehow refusing any browser updates

tired panther
#

is there a away how I can stop this?

#

weird, bc it minimizes the button, but does not scale down the font

#

ah, its because of white-space: nowrap 💡

boreal iron
#

I meant to use it on the shard number only

#

As a website can scale the text to the right should still be able to transform

#

As written in my example above your basic structure is way more complex than needed

#

But I’m driving now means I can’t really get into your code anymore

tired panther
#

okay, thx

cinder patio
#

wait wtf

cinder patio
#
<div class="wrapper">
    <div class="inner container">
        <div class="row">
            <div class="col-4">
            <div class="shard">Shard 0</div>
            </div>
            <div class="col">
             <div class="status">Heart died due 120bpm heartbeat</div>
            </div>
        </div>
    </div>
</div>
#

ur using bootstrap right

boreal iron
#

As written in my example I’m working with dieplay not flex

cinder patio
#

oh

boreal iron
#

Sure why not auto correct my word to dieplay

#

Whatever that means

#

Fucking mobile

cinder patio
#

I didn't see the css

boreal iron
#

Wut?

#

Oh I got it now lol

cinder patio
#

I just saw row and thought bootstrap

boreal iron
#

Anyways it doesn’t really matter in that case
Using flex works as well with an div acting as row, applying the background and radius to it

#

It’s always up to the coder to decide which way he goes

#

I still prefer to use CSS2.0 for much more compatibility but in this case the result is 100% the same

#

not to start with the endless discussion again

tulip ledge
#
npm WARN deprecated cheerio-select-tmp@0.1.1: Use cheerio-select instead
npm ERR! code 1
npm ERR! path D:\OneDrive\Bureaublad\Heimerdinger-master\node_modules\sqlite3
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@14.16.0 | win32 | x64
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: C:\Users\Yarne\AppData\Local\Programs\Python\Python39\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack   File "<string>", line 1
npm ERR! gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack                       ^
npm ERR! gyp ERR! stack SyntaxError: invalid syntax
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (child_process.js:308:12)
npm ERR! gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
npm ERR! gyp ERR! stack     at maybeClose (internal/child_process.js:1048:16)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\OneDrive\\Bureaublad\\Heimerdinger-master\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"    
npm ERR! gyp ERR! cwd D:\OneDrive\Bureaublad\Heimerdinger-master\node_modules\sqlite3
npm ERR! gyp ERR! node -v v14.16.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok

help pls

cinder patio
#

Use cheerio-select instead

earnest phoenix
#

This isn't discord.js server

fair axle
#

Sorry

earnest phoenix
#

all good

#

Just thought id let you know

harsh blade
#

This is supposed to block the command from being used when someone has the blacklisted role, but it doesnt work and no errors?

#

Any ideas or suggestions

pale vessel
#

Why are you instantiating a new client?

royal portal
#

is this right cryangeryBOYE (express)

app.enable('trust proxy');
app.set('trust proxy', 1);
pale vessel
#

Use client inside your execute method

#

Don't create a new client/message listener

harsh blade
#

Cuz im negative iq, my devs are offline and i really need this

pale vessel
#
async execute(...) {
    if (message.member.roles.cache.has(id)) return;
   ...
}```
lyric mountain
#

I wonder why no lang has implemented something akin to @SingleInstance where it errors during compilation if it is instantiated more than once

harsh blade
#

Al okay, ill try

#

Thanks

woeful pike
#

it would be trivial to implement that in code why do you need compiler support for something like that

lyric mountain
#

idk, it was an example

sudden geyser
#

It sounds like something to implement for those who want their code to be "correct", even though it's pretty trivial

woeful pike
#

singletons don't sound very correct to me

harsh blade
woeful pike
#

if you're passing along objects to functions that need them it doesn't really matter if you create an extra object

pale vessel
#

You can use the client parameter that you have in your execute method (alternatively message.client, if you didn't have that)

harsh blade
#

Something like this? Sorry if im being annoying haha

pale vessel
#

Looks good

harsh blade
#

Im pretty sure i got the wrong id

pale vessel
#

The ID you used would only work for a specific server though

#

Since IDs are unique in general

harsh blade
#

Yeah thats for my discord im developing atm.

#

for the muted role

#

it is the correct id

#

but it doesnt do anything 😭

#

Should i add member to the excecute?

modest maple
#

@quartz kindle Because I know you like performance Poggers:

Buffered I/O: Random Read (uniform) size span of 1.67 GB, for 20.026606515s, 3280 IOPS
Direct I/O: Random Read (uniform) size span of 1.67 GB, for 20.004066132s, 23676 IOPS

7x the IO operations with direct IO :P

boreal iron
#

If you wanna log the event then return after your message being sent

quartz kindle
#

like using what vs what code

harsh blade
slender thistle
#

@rustic nova

rustic nova
#

Discord pls

#

Fucking discord

#

@Erent-six#2119

#

Fuck you mobile

slender thistle
#

They left

#

Oh banged

#

Banned

zinc wharf
#

Aurel be having a hard time 😔

paper isle
#

Not sure if this is the correct place, but does anyone knows how to set a static image for when the server gif icon isn't playing?

#

It has a perfectly looping gif but a static image too

modest maple
# quartz kindle wdym direct io

Direct IO basically means you bypass the OS page cache and instead manually manage the memory for disk io etc... So every time you call for a disk read etc... To the os, its always a actually disk task rather than the os's internal pool

slender thistle
#

It's just the first frame that's a static image and the rest is the gif

modest maple
#

Generally can remoce alot of overhead, especially in a random access point of view whete traditionally the os would fetch more than it needs treating it as a sequential task

quartz kindle
#

not js i assume?

modest maple
#

Le rust

quartz kindle
#

ah yes

modest maple
#

But you can do it i. JS

#

Would recommend using io uring setup though to make it actually performant

#

And also carries with it some memory alignment stuff you need to make sure ya dont oof

quartz kindle
#

i found this

#

but their benchmarks dont look good

modest maple
#

You kinda need io uring to make it generally performant to atleadt on par or better than os buffered

#

Becuase its the async and parallel side to it that give it the extra performance because you're able to designate more memory that would otherwide have been taken uo by the page cache

quartz kindle
#

well, that wont work in js then

modest maple
#

Js no like uring?

#

Or is it becUse of Js's massive perfprmance penalty when using native extensions cuz jit ™️

sudden geyser
#

is your keyboard having issues

modest maple
#

Mobile

quartz kindle
#

you can do it in native, so basically not js

modest maple
#

I mean you can expose it to js

#

I would imagine node will eventually add some support for it no? Then again probably not

quartz kindle
modest maple
#

Oof

quartz kindle
#

looks like its pending on libuv

harsh blade
#

const Logger = require('leekslazylogger');
const log = new Logger();
const { MessageEmbed } = require('discord.js');
const fs = require('fs');
const { join } = require('path');
const Discord = require('discord.js');
const client = new Discord.Client;


module.exports = {
    name: 'new',
    description: 'Create a new support ticket',
    usage: '[brief description]',
    aliases: ['ticket', 'open'],
    example: 'new my server won\'t start',
    args: false,
    async execute(client, message, args, {config, Ticket}) { //Right Here!
  if (message.member.roles.cache.has("864612793352585226")) return;
        console.log("\x1b[32m", "Successfully blocked a ticket (user is blacklisted) from:", message.member.displayName)
    message.reply("Debug plz ignore")

        const guild = client.guilds.cache.get(config.guild);

        const supportRole = guild.roles.cache.get(config.staff_role);
        if (!supportRole)
            return message.channel.send(
                new MessageEmbed()
                    .setColor(config.err_colour)
                    .setTitle(':x: **Error**')
                    .setDescription(`${config.name} has not been set up correctly. Could not find a 'support team' role with the id \`${config.staff_role}\``)
                    .setFooter(guild.name, guild.iconURL())
            );


        let tickets = await Ticket.findAndCountAll({
            where: {
                creator: message.author.id,
                open: true
            },
            limit: config.tickets.max
        });

        if (tickets.count >= config.tickets.max) {
            let ticketList = [];
            for (let t in tickets.rows) {
                let desc = tickets.rows[t].topic.substring(0, 30);
                ticketList
                    .push(`<#${tickets.rows[t].channel}>: \`${desc}${desc.length > 30 ? '...' : ''}\``);
            }

            let m = await message.channel.send(
                new MessageEmbed()
                    .setColor(config.err_colour)
                    .setAuthor(message.author.username, message.author.displayAvatarURL())
                    .setTitle(`:x: **You already have ${tickets.count} or more open tickets**`)
                    .setDescription(`Use \`${config.prefix}close\` to close unneeded tickets.\n\n${ticketList.join(',\n')}`)
                    .setFooter(guild.name + ' | This message will be deleted in 15 seconds', guild.iconURL())
            );

            return setTimeout(async () => {
                await message.delete();
                await m.delete();
            }, 15000);
        }


        let topic = args.join(' ');
        if (topic.length > 256)
            return message.channel.send(
                new MessageEmbed()
                    .setColor(config.err_colour)
                    .setAuthor(message.author.username, message.author.displayAvatarURL())
                    .setTitle(':x: **Description too long**')
                    .setDescription('Please limit your ticket topic to less than 256 characters. A short sentence will do.')
                    .setFooter(guild.name, guild.iconURL())
            );
        else if (topic.length < 1) topic = 'No topic given';

Can anyone help me out?
At line 14 is the thing im trying to do, basically have a "ticket mute" role which will just dump the command if you got the role.

No errors in console and it doesnt work, am i missing anything?
Cheers!

lyric mountain
#

errr...line 14?

#

aint gonna count lines, please put a comment near it

spice finch
#

How do you add a button with node.js to tickets and stuff?

harsh blade
sudden geyser
#

performance

harsh blade
#

omg sorry ping, its a habit now 😭

quartz kindle
#

half of those requires are not even being used lol

#

unless thats not the full code

#

if you dont see "Successfully blocked a ticket (user is blacklisted) from:" in your console, then either the user has that role, or your problem is not in that file

harsh blade
#

Hm

harsh blade
#

Ill keep digging for more errors

#

Cant find anything sadly

#

would there be a way of canceling the command from being run without actually modifying the command file?

errant flax
#

if i put setTimeout() on a loop callback or something
it would wait for the time to end right bonk

sudden geyser
#

setTimeout doesn't block, so it wouldn't wait.

#

Of course, you could make it block by converting it to a promise and resolving it.

lyric mountain
#

You could also use setInterval or crontab if you're going to do repeating tasks

fiery stream
#

What does -f do in curl

#

?

lyric mountain
#

Check curl -h or something

fiery stream
#

I’m on phone

lyric mountain
#

Still

#

Or just throw in google

fiery stream
#

Cant find it anywhere

#

You on ios ?

lyric mountain
#

Google -> curl "-f" with quotes

fiery stream
#

Ahh got it

errant flax
#

how do i make a hint like a string is: "AbCD"
then
it will result: "A_C_" bonk
im kinda stuck at like showing the entire string

lyric mountain
#

Make 2 strings, one being the full answer and the other being only "_____", then replace a random index with the corresponding letter from the answer

errant flax
#
Math.floor(Math.random()*code.length)

this would start at 0 right

lyric mountain
#

Ye

#

Between 0.000...1 and 0.999...9

#

Then multiply by length

#

Which will get u between 0 and length - 1 after floored

earnest phoenix
#

string.split("").map(x => {
let rand = Math.random() // no floor
rand > 0.5 ? "_" : x;
}).join("");

#

if you want to make it harder just make 0.5 smaller

#

@errant flax test this out

lyric mountain
#

Tbf, it's best if you do random based on revealed char count

#

Since there's a very very little chance that all characters might hit below the threshold and be revealed

earnest phoenix
#

Split the string, choose random indexes and call it a day

lyric mountain
#

Ye

#

Like 30% of the total count or whatever

#

If word has 10 chars reveal 3 random indexes

earnest phoenix
#

@lyric mountain or split the string, map it to objects storing the index and the char, sort randomly, replace first percentage of chars with _ then join the array

lament rock
#

Sounds too complicated for a simple task

earnest phoenix
#

@lament rock the method KuuHaKu said was more complicated
first you'll have to pick random indexes based on the percentage
then there's a chance you'll pick the same index twice

lament rock
#

You can do it procedurally you know..

earnest phoenix
#

here's my method:

// little trick to trigger devs:
var
str = "code913";

function obfuscate(string, percentage = 30) {
let arr = string.split("")
.map((char, index) => { return { char, index }})
.sort(_ => Math.random > 5 ? 1 : -1);

return arr.map(obj => Math.floor(percentage / 100 * arr.length) >= obj.index ? "_" : obj.char);
}

obfuscate(str);
#

@lament rock i hope this works

lament rock
#

You'd still end up with possibly all chars being revealed

#

I'd increment a reveal amount and try to spread out the reveals as much as possible

raw spruce
#

Vote tracker site not working pls fix it

deft kestrel
#

Do node workers work inside other workers

lyric mountain
#

Also don't use var

earnest phoenix
#

var gud

brazen epoch
#

Is there currently any issue with the site? Its not sending me http requests when someone votes

lyric mountain
#

Check pins

lament rock
brazen epoch
lyric mountain
brazen epoch
#

Ohh

#

So by neutral neutral does this mean its being working on or the issue isnt that much anymore or what does it mean lmao

deft kestrel
lament rock
deft kestrel
#

//rewriting my bot from the group up because it was very bad at scaling

lament rock
#

Idk how to scale a Discord bot efficiently unless you have threads running the commands or have a separate thread to process incoming gateway messages and parsing to JSON to post to parent port. For commands, things would have to be pretty low level since high level libs are mostly class based and their data would not be cloneable to send over ipc. Having a separate thread to handle gateway messages is easy to do.

There are some cool low level libs like CloudStorm and SnowTransfer to write more performant bots. (the official ones are still on API v6, but I've forked them and updated them to v9 wink wink nudge nudge nah jk)

errant flax
#

how do i link a font from google and how do i use the font noobthonk

lament rock
#

check w3schools for custom fonts I guess

#

google fonts should provide a cdn link you can ref in your css

cinder patio
#

wait use it where?

pale vessel
#

Paste the link tag that Google gave inside your head tag

#

Also don't use CSS imports

#

IIRC they didn't support parallel so it'll load slow

lament rock
errant flax
#

i dont understand a single thing

pure lily
#

I host my bot on a vps but when I close putty it doesn't respond how do I fix this

earnest phoenix
#

You might want to use a terminal multiplexer like screen/tmux or process manager like pm2

errant flax
#

how do i do a backpsace in html/css bonk

earnest phoenix
#

wat

errant flax
#

like \n?

earnest phoenix
# pure lily why does this happen tho

I don't know the details, it's just the way it is. When you logout from your SSH session, it sends SIGHUP to running jobs. You can overcome this with nohup and daeomonizing the process, or disown. I haven't really tried them though. With terminal multiplexers, you can detach the shell process and re-attach it later.

fading wave
#

would be better to use a process manager

#

like systemd

earnest phoenix
#

That might be an option too

errant flax
pale vessel
#

<br>

#

🇧🇷

wheat mesa
errant flax
#

also is there a way to customize the padding for <br> tag

pale vessel
#

Try line-height

#

I think that's for text, never mind

#

Does changing the padding via CSS not work?

errant flax
#

havent tried it lmaoCry

#

nope it doesn't

pale vessel
#

Change line-height for p

nimble kiln
#

Some googling brought this up:

   display: block;
   margin: 10px 0;
}```
errant flax
#

that works thx! pd_pepethumbsup

nimble kiln
cinder patio
#

<br><br><br>

boreal iron
#

I wonder why you margin 10px up and down as the default element height is 19px/20px already oldEyes

feral aspen
#
(node:33) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.fields[1].value: This field is required
embeds[0].fields[1].value: This field is required
#

I'm so confused.

#

I literally made 20 checks on everything.. if there is no value.. I add an alternative value.. and it's still erroring that.

#
const profile = new MessageEmbed()
.setThumbnail(bot.users.cache.get(user.id).displayAvatarURL({ dynamic: true, size: 4096, format: 'png' }))
.setTitle(`${bot.users.cache.get(user.id).username}'s Profile`)
.addField("**:notepad_spiral: - Bio:**", social.bio)
.addField("**Attitude Badges:**", `${ifStaff ? staff : ""} ${moderator ? certifiedmoderator : ""} ${bugBuster ? bugbuster : bugHunter ? bughunter : ""} ${premium ? supporter : ""} ${earlySupporter ? earlySupporterBadge : ""}` || "None")

return await message.channel.send(profile);
boreal iron
#

Just log the target field right before sending it

feral aspen
boreal iron
#

Technically it’s the second field without a value but make sure social.bio isn’t empty, too

feral aspen
boreal iron
#

It doesn’t as the value before “” is defined and not null

earnest phoenix
#

Giving fields an empty string makes them invalid

#

Does it not?

feral aspen
#

It does, for sure, my bad.. but I'm checking for 5 different things.. I can't put them all as None or else there will be 5 Nones.

boreal iron
#

“” || “None”
Will be “” since “” is an empty string and not null

earnest phoenix
#

Yea but empty strings have no value and discord can’t use that

feral aspen
visual goblet
#

but isn't None better than empty?

boreal iron
#

Try to set a value of null instead of “”

feral aspen
boreal iron
#

Not sure if that works but try it

feral aspen
visual goblet
#

hey man this is a learning experience for me I was just trying to get involved

feral aspen
#

If premium is true and the others are false, it will become None None None <badge> None

feral aspen
boreal iron
#

Try that

#

Keep “None”

visual goblet
#

hey while this channel has some javascript users

#

how hard is it to set up a more sorted out command handler?

cinder patio
#
(`${ifStaff ? staff : " "}${moderator ? certifiedmoderator : " "}${bugBuster ? bugbuster : bugHunter ? bughunter : " "}${premium ? supporter : " "}${earlySupporter ? earlySupporterBadge : " "}`) || "None"
visual goblet
#

for example economy file moderation file utilities file etc

boreal iron
cinder patio
#

huh?

#

oh wait

#

yeah no

#

that won't work

boreal iron
#

That’s why I suggested to replace “ “ by null

#

Not as string of course

#

Not sure how JS handles that inside ` `

#

Oh

#

Can’t spell that damn name…

cinder patio
#

null will get stringified

#

so it'll become null null :badge: null for example

boreal iron
#

Template iter… something something

cinder patio
#

template strings

boreal iron
#

Ah nvm then

small tangle
#

template strings

boreal iron
#

Then check the values before adding them to the field

#

Put the values into an array and use join inside the field set

#

If the array is empty display none

cinder patio
#
(`${ifStaff ? staff : ""}${moderator ? certifiedmoderator : ""}${bugBuster ? bugbuster : bugHunter ? bughunter : ""}${premium ? supporter : ""}${earlySupporter ? earlySupporterBadge : ""}`) || "None"
#

that should work, you don't really need empty spaces if the badges are emojis

boreal iron
#

But the result of the template string should be “”

cinder patio
#

if it's "" then it's going to be replaced by "None"

boreal iron
#

Does “” || “None” check if the string is empty, too?

cinder patio
#

|| checks if the first value is falsey, and an empty string is falsey

boreal iron
#

Thought it just checks if the var is defined and not null

#

Oh an empty check, too

#

Learned something new I guess oldEyes

cinder patio
#

Other and probably better way is to just use if statements

#
let badges = "";
if (badgeCheck) badges += "badge";
// More checks
.addField("Badges", badges || "None");

more readable and all that

boreal iron
#

Or just using val ?? “”

#

Assuming the var can’t be an empty string

cinder patio
#

nope
ifStaff ? staff : ""

boreal iron
cinder patio
#

that can't be translated to val ?? ""

earnest phoenix
#

"" isn;t a null value

#

so it will always be val

boreal iron
#

Of course it can

earnest phoenix
#

What

#

and empty string is still true

#

is it not?

cinder patio
#

depends

#

?? - yes

#

|| - no

boreal iron
#

If( isset( val ) ) val else “”

#

val ?? “”

#

isset checks if val exists and is not null

#

Should be similar on JS

#

If defined and not null

#

I guess oldEyes

#

If not JS is even more trash… but we know the answer already

errant flax
#

how do i make a specific part of the text to red like:
I am red

i want to color the "red" text to color red but how do i do that without overwriting the other text?

#

in html bunnynod

earnest phoenix
#

Well

feral aspen
#

I'm back..

earnest phoenix
#

You could wrap it in another tag and give it a class

boreal iron
#

<span style=“color: red;”>red</span>

earnest phoenix
#

Well

boreal iron
#

As inline element

earnest phoenix
#

for example an h1 tag

#

or use a span

#

yea

errant flax
#

span is basically like a paragraph tag right pd_pepethumbsup

eternal osprey
#

hey!

#

Is ytdl-core really still broken?

#

I am getting tired of this freaking package

#

it's been almost 2 months now since that it broke

boreal iron
#

Does nothing if you don’t assign any format to it

feral aspen
cinder patio
#

well what happened

earnest phoenix
feral aspen
#
.addField("**Attitude Badges:**", (`${ifStaff ? staff : ""} ${moderator ? certifiedmoderator : ""} ${bugBuster ? bugbuster : bugHunter ? bughunter : ""} ${premium ? supporter : ""} ${earlySupporter ? earlySupporterBadge : ""}`) || "None")
eternal osprey
boreal iron
#

You’re still adding unnecessary spaces

earnest phoenix
#

@feral aspen your code is wet
keep it DRY (Dont Repeat Yourself)

boreal iron
#

Which will end up being interpreted into not being empty

cinder patio
#

yeah but what was the output

boreal iron
#

“ “ || “none”

feral aspen
feral aspen
boreal iron
#

Will be “ “

feral aspen
cinder patio
#

wait whut

#

what did your discord bot send

feral aspen
#

Nothing.

#

It errored.

(node:33) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.fields[1].value: This field is required
embeds[0].fields[1].value: This field is required
boreal iron
#

${} ${} the spaces between

feral aspen
#

Yes.

cinder patio
#

there are still spaces ye

#

remove em

earnest phoenix
#

discord ignores spaces sometimes

cinder patio
#
${ifStaff ? staff : ""}${moderator ? certifiedmoderator : ""}${bugBuster ? bugbuster : bugHunter ? bughunter : ""}${premium ? supporter : ""}${earlySupporter ? earlySupporterBadge : ""}
boreal iron
#

As googlefeud wrote before, remove them

feral aspen
boreal iron
#

There we go

boreal iron
earnest phoenix
feral aspen
boreal iron
#

Correct

#

More like as NOT EMPTY

earnest phoenix
#

bruh

boreal iron
#

Defined, not empty, not false, not null

feral aspen
#

Well.. I learned something today, and it worked. 🎉

boreal iron
#

👍

earnest phoenix
#

also the way you're putting the badges in the template string is very bad

errant flax
#

how do i make my page "long" like u can scroll all the way down if u know what i mean bonk

cinder patio
boreal iron
#

GoogleFeud: success… now let’s send over our bill

#

(aka. invoice)

errant flax
wary flame
#

overflow: shown;

#

On parent element (most likely body)

#

Default is overflow: auto which enables scrollbar when content overflows

errant flax
#

oh if my body content is like a bunch of stuff it will automatically add it noobthonk

boreal iron
#

Magically 🪄

errant flax
#

oh ye it does :KEKA:

earnest phoenix
#

@errant flax Did you know you can customize the scrollbar? (tho it only works in chromium based browser iirc)

errant flax
#

wuz tht

#

also how do i resize an image without overwriting the resolution if u know what i mean pd_pepethumbsup

#

nvm fixed my issue

earnest phoenix
#

How can I serve images statically with express

frozen mesa
#

they have docs, maybe in there

earnest phoenix
#

I tried using

app.use('/images', express.static(join(__dirname, './images')))

and then do

app.get('/', (req, res) => {
  res.status(200).sendFile('urcute.jpg')
})
#

and I just get an error

#

do I have to actually do localhost:port/images/urcute.jpg

#

when sending the file?

frozen mesa
#

I think yes

#

Or make a index file where it shows what images u can get if ur just on the images section yk

earnest phoenix
#

I wanna serve an image on the root tho

#

so ican just send blah.is-a-qt.tech and it sends the image

frozen mesa
#

But wait I think you need to make the app.get("/images")

#

Oh

wary flame
#

Response.sendFile sends a file from disk

cinder patio
#

you have to provide the full path

wary flame
#

Use Response.redirect

#

With full path

earnest phoenix
wary flame
#

No you're not

#

Full path is images/urcute.jpg

earnest phoenix
#

I just tried providing the full path and it yelled at me for not proviidng the full path

earnest phoenix
#
TypeError: path must be absolute or specify root to res.sendFile
    at ServerResponse.sendFile (C:\Users\dyeaa\Documents\Github\tyrian\node_modules\express\lib\response.js:425:11)
    at C:\Users\dyeaa\Documents\Github\tyrian\index.js:8:21
    at Layer.handle [as handle_request] (C:\Users\dyeaa\Documents\Github\tyrian\node_modules\express\lib\router\layer.js:95:5)
    at next (C:\Users\dyeaa\Documents\Github\tyrian\node_modules\express\lib\router\route.js:137:13)
    at Route.dispatch (C:\Users\dyeaa\Documents\Github\tyrian\node_modules\express\lib\router\route.js:112:3)
    at Layer.handle [as handle_request] (C:\Users\dyeaa\Documents\Github\tyrian\node_modules\express\lib\router\layer.js:95:5)
    at C:\Users\dyeaa\Documents\Github\tyrian\node_modules\express\lib\router\index.js:281:22
    at Function.process_params (C:\Users\dyeaa\Documents\Github\tyrian\node_modules\express\lib\router\index.js:335:12)
    at next (C:\Users\dyeaa\Documents\Github\tyrian\node_modules\express\lib\router\index.js:275:10)
    at SendStream.error (C:\Users\dyeaa\Documents\Github\tyrian\node_modules\serve-static\index.js:121:7)
frozen mesa
#

process.cwd() + "path"

earnest phoenix
#

I just get this

earnest phoenix
frozen mesa
#

oh

earnest phoenix
#

still get this same error

wary flame
#

Absolute path

#

res.sendFile(require('path').resolve(path))

#

path.resolve converts relative to absolute path

#

Eg. ~ resolves to /home/user

#

On *nix systems

cinder patio
#

Or use __dirname, can you tell us your file structure? Where is the file which starts the express server, where is the image located?

wary flame
#

Although statically serving images at /images and redirecting to /images/image from root requests should work too

earnest phoenix
#

If I use sendFile will it embed in discord?

wary flame
#

No

#

Don't think so

#

It might

earnest phoenix
#

I want it to embed in discord so that might be an issue

frozen mesa
cinder patio
#

I think it would

wary flame
#

Embedding images doesn't require opengraph

earnest phoenix
#

Love how it tells me cannot get /

#

404

#

I am serving something on /

frozen mesa
#

App.get("/") ...

earnest phoenix
#

I am doing that

#

Which is the problem

frozen mesa
#

Um

#

Lol

earnest phoenix
#
0|index    | Require stack:
0|index    | - /home/misty/Voltrex/index.js
0|index    |     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
0|index    |     at Module.Hook._require.Module.require (/home/misty/.nvm/versions/node/v15.11.0/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:61:29)
0|index    |     at require (internal/modules/cjs/helpers.js:88:18)
0|index    |     at Object.<anonymous> (/home/misty/Voltrex/index.js:1:17)
0|index    |     at Module._compile (internal/modules/cjs/loader.js:1063:30)
0|index    |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
0|index    |     at Module.load (internal/modules/cjs/loader.js:928:32)
0|index    |     at Function.Module._load (internal/modules/cjs/loader.js:769:14)
0|index    |     at Object.<anonymous> (/home/misty/.nvm/versions/node/v15.11.0/lib/node_modules/pm2/lib/ProcessContainerFork.js:33:23)
0|index    |     at Module._compile (internal/modules/cjs/loader.js:1063:30) {
0|index    |   code: 'MODULE_NOT_FOUND',
0|index    |   requireStack: [ '/home/misty/Voltrex/index.js' ]
0|index    | }

I do not understand what I am doing wrong.

#

I assume it is having trouble finding the image once its on the server and being hosted.

#

But I don't get why

frozen mesa
#

did you put the right filepath?

earnest phoenix
#

I am pretty sure yea

#

it works when its on my pc

#

but once I move it up to the server it has issues

willow mirage
#

anyone has used Docker be4?

#

im fucking stuck

small tangle
#

what are you doing stepdocker

pale vessel
#

OML

willow mirage
lusty quest
willow mirage
#

thanks you :))

lusty quest
#

if you learn docker more you will love it

willow mirage
#

already love it

#

at the firs t ytry

earnest phoenix
#

I tried using socket

#

Docker*

#

But it doesn’t work on windows without WSL iirc

#

And I don’t wanna setup WSL

modest maple
#

it doesnt work on windows without hyper virtualisation enabled in bios

#

Docker can run on either the legacy Hyper-V backend

#

or the WSL backend

earnest phoenix
#

I have hyper v enabled iirc

lusty quest
#

did you have windows 10 Pro?

#

bcs this is one of the consumer versions that give you hyper-V access

boreal iron
#

well just a few edits in the registry and you're on pro pandasad

nimble kiln
#

Has anyone experience with discord webhooks with discord.js? They seem to backlog when you send too many messages to it, which is fine, but when it starts to send out the backlogged stuff it's out of order. They get sent randomly

pale vessel
#

Err, did you await your requests?

crimson vapor
#

are you hitting ratelimits?

nimble kiln
flat copper
#

My bot is replying after so many time

nimble kiln
#

It's a livechat, I just keep sending it new messages

#

Even when it gets ratelimited/gets backlogged

crimson vapor
#

could be part of the issue

pale vessel
#

Await them

nimble kiln
#

That's worth a try

#

Tbh I should just send more embeds in one webhook message