#development

1 messages · Page 1993 of 1

neat ingot
#

ok so, it has to be developed on a live https capable server?

#

no localhosts?

quartz kindle
#

if you want to use InteractionServer, yes you need an https domain

neat ingot
#

i mean, makes sense tbf if its all webhook based

quartz kindle
#

you can still use the websocket for testing for example, before moving to https

neat ingot
#

but for a rest client and others it'd be fine to dev on local?

quartz kindle
#

ye

neat ingot
#

so lets say i wrote all my interactions and such with an interaction server.. thats not technically a bot is it? like, do i still need some kind of bot account type thing running somewhere for users to add to their guild etc?

quartz kindle
#

its an application

#

you can invite it like a regular bot

#

but if you dont give it the bot scope, it probably wont show in the member list, etc

#

but it will show in the guild's applications

neat ingot
#

ahhhh ok

quartz kindle
#

i believe they already fixed the online issue

#

even if you dont have the bot scope, it should still show online

neat ingot
#

I think I'm gonna have to make some time at the weekend to try out this lib

#

its just such a different way of writing a bot than im used to 😄

#

so the interaction server only receives interactions right? like, i know thats a dumb question. but im wondering about other events like guildCreate etc, how might those get handled?

#

or would you also run an 'internal sharder/rest client' alongside the interaction server to handle other events?

quartz kindle
#

although at that point you dont really need the interaction server anymore, just use the websocket for both

neat ingot
#

yea, I think I'm just gonna have to mess around with it and see how I get on 😄

solemn latch
#

speaking of the rest client, thanks @quartz kindle
Its so much easier and faster to figure out how everything works looking at your code.
had to redo a lot because of cloudflare workers, but still saved a ton of time.

quartz kindle
#

yw xd

green kestrel
#

sad times that I had to add this rule to my server 💩

#

nobody else experienced this issue on coding servers?

cinder patio
#

Isn't that a bit excessive

sudden geyser
#

used to just use a tag that would paste a message like that

wheat mesa
#

Automatic code snippet detection that deletes the user’s message and sends either a pastebin of it or a formatted code block

lyric mountain
#

that's...know what that aint a bad idea at all

#

just need to check what the user sent

#

if it's indeed code or unsolicited dikpik

wheat mesa
#

OCR

green kestrel
#

I'm hoping that even those who haven't bothered to read the rules will find a way to share their code that doesn't involve an image, if we take that function away from drive by spoon feed wannabes

sick agate
#

lol

lyric mountain
#

you can distinguish those who code and those who have no idea what they're doing by how they show their code

quartz kindle
lyric mountain
#

like those stock "hacker" images

quartz kindle
#

yup

sick agate
#

yup

split hazel
#

uwu

raw nest
#

I have this NextJS code here:

        const getLocalStorage = () => {
            if (typeof window !== 'undefined')
                return JSON.parse(localStorage.getItem('localStorage'))
        };

And the problem is, that in NextJS after loading the page, this function only works once because window isn't undefined anymore and otherwise I get the error window is not defined. How can I get localStorage data even after rendering in NextJS?

quartz kindle
#

wdym it only works once? window doesnt get undefined again

#

when does window become undefined again?

raw nest
#

I mean like when I render the site it gets the data and after that I can't get localStorage anymore...

lament rock
#

does anyone know how to modify the volume of an opus stream without the use of ffmpeg

wheat mesa
cinder patio
sharp saddle
#

lol

#

jk

#

jk

#

use next

#

is cool

cinder patio
#
useEffect(() => {
   // Code here...
}, []);
earnest phoenix
lament rock
#

Fml

raw nest
cinder patio
#

If you want that then just pass a callback to the button?

<button onClick={() => {
    // Access localStorage here
}}> 

</button>
#

and you can do whatever you want in useEffect\

lament rock
#

I found a lib that changes the audio of pcm, but the problem then becomes converting an unknown stream type to pcm and then transform and then convert to opus

earnest phoenix
#

Flashbacks of pain of working with opus streams

lament rock
#

by the time I do this, the computation cost might be more than just using FFMPEG

#

working on my lavalink rewrite trying to avoid usage of ffmpeg, but I guess there's no avoiding it

earnest phoenix
#

Perhaps

quartz kindle
#

there is always an alternative and everything is possible

#

just harder :^)

#

if you're gonna use ffmpeg in node anyway, you might wanna try using a native addon version, instead of the usual command line version

raw nest
cinder patio
#

yeah

#

Events always get fired client-side so

lament rock
quartz kindle
#

idk, never used them

#

stuff like beamcoder looks interesting tho

earnest phoenix
spark flint
#

why is discordjs.guide broken

wheat mesa
rustic nova
#

Tldr skill issue

wheat mesa
#

petition to add a trollface emoji to this server so us non-nitro users can use it

rustic nova
#

Denied

#

Get nitro or git gud

wheat mesa
fiery stream
#
spotify_result = next((activity for activity in user.activities if isinstance(activity, discord.Spotify)), None)```
fiery stream
#

why is that returning none even tho im listening to music

wheat mesa
#

python hurts me

fiery stream
#

but not that bad

spark flint
#
await interaction.guild.bans.create(user, { reason: `[${interaction.member.username}#${interaction.member.discriminator}] `+reason })```
sudden geyser
#

what be this

spark flint
#

making a ban command

#

[undefined#undefined]

cobalt junco
fiery stream
#

no py devs here 😦

dry imp
fiery stream
sudden geyser
spark flint
#

nah that embed isn't mine

#

its from another bot just logging the ban

#

i cba to load up audit logs iara_why_sob

sudden geyser
#

Ah, then it's probably what Debert said

spark flint
#

yep fixed it

#

its interaction.member.user.username and interaction.member.user.discriminator

eternal osprey
#
 Error: ENOENT: no such file or directory, open './databases/944252016685887579.json'```
#

So i am creating json files for each guild id, while my bot is deployed to heroku.

#

Is that why the json files are not actually being made?

#

as heroku blocks it?

wheat mesa
#

heroku doesn't allow you to create files like that iirc

eternal osprey
#

That's fucked up. Thanks tho waff

sudden geyser
#

They practically purge your file structure regularly.

#

So trying to host a database inside your project is not feasible.

#

Instead, you have to use Heroku's provided database(s) to do so.

#

Don't know how you'd set it up though since I don't use Heroku

wheat mesa
quartz kindle
#

and heroku in general

sudden geyser
#

json databases rock

quartz kindle
#

but not as much as rocksdb

eternal osprey
#

This project is not mine, it's a stupid school project so i really didn't give a fuck about using fancy databases and hosts

sudden geyser
#

we don't talk about rocksdb

quartz kindle
#

they literally have rock in their name, you cant outrock that

wheat mesa
#

also yet another stupid api wrapper question: how do I change the response I get from an api into an object of a class type? I normally just model the responses with interfaces, but that seems too raw since I have no methods and such

sudden geyser
#

oh yes I can

#

the rock would like a word with you dwayning

quartz kindle
#

the rock is not a database

quartz kindle
#

or only "type" it as a class?

wheat mesa
#

wrap it into a class

sudden geyser
#

the rock can be anything

wheat mesa
#

unless that's a stupid idea..?

quartz kindle
#

just create the class and assign the params

wheat mesa
#

Alright

#

I figured that was the way to do it but I didn't know if there was some magic that I was supposed to use instead

quartz kindle
#

well

#

in js you could do this

#
class A {
  constructor(obj) {
    Object.assign(this, obj);
  }
}
#

but idk if ts will allow that

#

ts wants to know everything statically, meaning you have to type the whole thing in

wheat mesa
#

surely there's an easier way

#

if I use interfaces then I sacrifice the luxury of methods and props wrapped into a single class

#

I could do something like ```ts
export class Perf {
games: number;
rating: number;
rd: number;
prog: number;
prov: boolean;
constructor(data: PerfData) {
this.games = data.games;
this.rating = data.rating;
this.rd = data.rd;
this.prog = data.prog;
this.prov = data.prov;
}
}

interface PerfData {
games: number;
rating: number;
rd: number;
prog: number;
prov: boolean;
}

quartz kindle
#

pretty sure you can do data: Perf

spark flint
#

my bots taking years to load when using my actual bot token

#

when i use my test bot token it loads in seconds

quartz kindle
#

guilds are big

#

they take time to be downloaded

spark flint
#

its only in 345 servers

quartz kindle
#

345 is more than 1

spark flint
#

true

#

i've left it to load with pm2 so

#

lets hope

quartz kindle
#

running locally or in a server?

spark flint
#

server

quartz kindle
#

how long is "years"?

spark flint
#

5+ mins compared to 10 seconds

quartz kindle
#

ok thats not normal

spark flint
#

yeah

quartz kindle
#

listen to the debug event

#

(assuming discord.js)

spark flint
#

yep

#

discord.js

#
client.on("debug", function(info){
    console.log(`debug -> ${info}`);
});```
#

that i'm guessing

quartz kindle
#

yeah

spark flint
#

it was an issue with presence intent

quartz kindle
#

👍

bright hornet
#
app.post("/dblwebhook", webhook.listener(vote=> {
const votesusers = vote.user
console.log(votesusers)
let channel = client.channels.cache.find(channel => channel.id === '949100386759893042')
const upvotes = new MessageEmbed()
  .setTitle('Upvote Status')
  .addField(`Log of Upvotes Status`, `${votesusers}`)
  .setColor('RANDOM')
  .setTimestamp()
  channel.send({embeds: [upvotes]})
}))``` why its not sending the embed? on this code line ```js
const webhook = new Topgg.Webhook(topgg)``` what webhook should i put? The webhook in discord or in the top.gg?
quartz kindle
#

the webhook url in your bot settings?

lyric mountain
bright hornet
#

i just wondering if what webhook should i put in the code

quartz kindle
quartz kindle
#

there is no where in the code to put any webhook

lyric mountain
#

A webhook is just a reverse api

#

Instead of you calling the service the service calls you

spark flint
bright hornet
#

im confused

lyric mountain
#

Yes, ignore me

#

Not that I care anymore

quartz kindle
#

:^)

spark flint
quartz kindle
#

thats the secret / password / auth / whatever that you get in your bot's top.gg edit page

bright hornet
quartz kindle
#

what did you put in your top.gg settings?

#

in the bot's edit page

#

in the webhook part

spark flint
#
import json
new = { }
with open("warningchannels.json", "r") as file:
    warningChannels = json.load(file)


for channel in warningChannels:
    print(channel)
    new[channel] = {"guild":channel, "channel":warningChannels[channel]}
with open("new.json", "w") as f:
    json.dump(new, f, indent=4)
print(new)```
#

how can i make it store like json { { "guild":"000000000000000", "channel":"000000000000000" } }

bright hornet
quartz kindle
#

in both url and auth

bright hornet
#

did i do wrong?

quartz kindle
#

yes its wrong

bright hornet
quartz kindle
#

where is your bot hosted?

bright hornet
quartz kindle
spark flint
quartz kindle
spark flint
#

mongo stores like that

bright hornet
spark flint
#

and I need to quickly move it to mongo Yikes

quartz kindle
quartz kindle
#

and you need to have a web dyno enabled

bright hornet
#

ohhhh

bright hornet
#

ah the workers?

quartz kindle
#

yes, it needs to be a web worker

#

otherwise you will get an error

proven lantern
#

do modal forms support autocomplete?

bright hornet
#

after pushing the webhook

#

i got this error

#
2022-03-04T02:29:38.565331+00:00 app[worker.1]: node:events:498

2022-03-04T02:29:38.565345+00:00 app[worker.1]:       throw er; // Unhandled 'error' event

2022-03-04T02:29:38.565346+00:00 app[worker.1]:       ^

2022-03-04T02:29:38.565346+00:00 app[worker.1]: 

2022-03-04T02:29:38.565346+00:00 app[worker.1]: Error: listen EACCES: permission denied 0.0.0.0:80```
quartz kindle
#

port 80 is locked

#

you need to use the port that heroku gives you

#

i believe its port 3000

bright hornet
#

the webhook?

lyric mountain
#

You need to out exactly like it's written in that picture

#

Heroku is the one assigning what port you'll use

bright hornet
#

oh

#

then i dont put any in .env?

lyric mountain
#

3000 in that example is for local tests

bright hornet
#

ok ok thanks

#

ill try

fiery stream
#

Is there a way to find out a specific shard’s ram usage

#

I saw this one bot do it on its dashboard

#

Don’t remember whats it called

bright hornet
#

or is it bec theres no new upvotes for my bot?

lyric mountain
#

Well, yeah you'll only receive events when they happen

bright hornet
#

ok ok thanks!

wheat mesa
#

Does anyone have any idea why this is sending the query parameters incorrectly? ```ts
async execute(): Promise<T> {
const res = await Axios.get<T>(this._endpoint, { headers: this.parseHeaders(), params: this.parseParams() });
console.log(res);
return res.data;
}

// ...

private parseHeaders() {
    let obj: Record<string, any> = {};
    for (const [key, value] of this._headers) {
        obj[key] = value;
    }
    return obj;
}

private parseParams() {
    let obj: Record<string, any> = {};
    for (const [key, value] of this._parameters) {
        obj[key] = value;
    }
    return obj;
}

``` For some reason the parameters are being sent like '/api/users/status?ids[]=jwaffled&withGameIds[]=false' when it should be sent as '/api/users/status?ids=jwaffled&withGameIds=false'

#

oh wait nevermind I know what's wrong

#

accidentally was making the map's value a string array instead of joining them with a comma

earnest phoenix
#

So I want some advice on how I should go about calculating the prices of items my rpg bot will have. The price should be affected by how rare it is, but I also had the idea of giving items a base price that people can sell for, or auctioning the items off/selling em for a price of their own

whole glen
#

how would i get this to send a random file from the folder? this is what i tried and it does not work var memes = ["mail1.jpeg", "1.jpeg", "4.png"]; var meme = Math.floor(Math.random() * memes.length); var colors = ["#0099ff", "", ""]; const embedmeme = new MessageEmbed(); embedmeme.setColor("#" + randomColor) embedmeme.setTitle(memes[meme]) embedmeme.setImage('./images/' + memes[meme]) await interaction.reply({ embeds: [ embedmeme ] });

earnest phoenix
#

I dont think you can set files as images with setImage

#

I think you gotta use attachments

#

Don't quote me on that tho but iirc that was a problem

earnest phoenix
# whole glen how would i get this to send a random file from the folder? this is what i tried...

You must attach the file using the files option of the <CommandInteraction>.reply() method and give it a name through the name option and the path to the attachment through the attachment option, and set the image to the embed using the <MessageEmbed>.setImage() method by providing the name to the attachment after attachment://, for example:

const embed = new MessageEmbed()
  .setImage('attachment://some-image.png');

await interaction.reply({
  files: [{
    name: 'some-image.png',
    attachment: './images/some-image.png'
  }],
  embeds: [embed]
});
royal herald
#

am rn on school bus atm so i cant send the code

earnest phoenix
royal herald
earnest phoenix
#

Hm

#

So if an item was listed as 1000 but it has a 20% drop rate it would be worth 5000 in the end?

#

Perhaps

#

How should I calculate probability tho

#

I plan on having crates people can find that gives em a random item

#

and the crates themselves will also have rarities :^)

#

You can kind of apply the same idea to it, with the magical Math.random() method

#

hm

wheat mesa
#

finally a usable format of creating rest requests ```ts
async getRealTimeStatus(withGameIds: boolean, ...userIds: string[]) {
let gameIds = 'false';
if (withGameIds) {
gameIds = 'true';
}

    return new RequestBuilder<ResponseTypes.RealTimeStatus>(
        this._accessToken,
        Endpoints.UserEndpoints.GET_REALTIME_STATUS,
    )
        .setParameterArr('ids', userIds)
        .setParameters('withGameIds', gameIds)
        .execute()
        .catch(err => this.handleError(err));
}
#

(don't judge the boolean thing)

wheat mesa
#

typescript is on crack or something, it didn't let me toString the boolean

earnest phoenix
#

since when could you ever toString a boolean

#

Damn ig you can

#

that dont makesense tho ngl

wheat mesa
#

it extends object technically

#

makes sense

earnest phoenix
#

nah

wheat mesa
#

I'll just do String(withGameIds)

earnest phoenix
#

why would you ever toStrting a bool

wheat mesa
#

just because it's not a very useful method explicitly doesn't mean it's there for no reason

#

a lot of things use it internally

whole glen
earnest phoenix
#

can't you read the file with fs and pass the buffer as attachment?

whole glen
#

this is what it does

earnest phoenix
#

pssss if it was detritus i might be able to help

dry imp
#

if it was in python im able to help

cobalt junco
cursive python
#

Hi

civic scroll
#

so i assigned two events to elements like this, but however

#

only mouseenter was captured

#

if i remove element.onmouseenter, then it starts picking up mouseleave

#

but if i set two events together, only mouseenter is fired

#

idk what is causing the issue, can you help?

atomic kindle
#

I tried the exact same thing, @civic scroll. However, I can not replicate this issue...

civic scroll
#

you free?

#

come to vc

atomic kindle
#

Sure.

#

One sec.

nova urchin
#

      const leaveEvent = () => {
        console.log("leave")
        element.removeEventListener("mouseleave", leaveEvent)
      }

      const enterEvent = () => {
        console.log("enter")
        element.addEventListener("mouseleave", leaveEvent)
      }

      element.addEventListener("mouseenter", enterEvent)```
bright hornet
#

or i should put in ctx.arc(x, y, Math.PI * 2, true);

#

confused

woeful pike
#

bro.. this isn't how you use angular

#

if you're using a js framework you never call querySelector, addEventListener, etc

#

except for some specific edge cases which I don't think is the case here

civic scroll
#

since those elements are dynamically created and appended in innerHTML

woeful pike
#

why

#

why are you using innerHTML in angular

civic scroll
#

the data get being fed to HoverService which get mouseenter, mouseleave, location

#

again, dynamically

#

created element

woeful pike
#

so?

#

that's literally the entire usecase of angular lol

civic scroll
#

i can't even pinpoint exact position

woeful pike
#

that's fine

civic scroll
#

since each text being fed in is different

woeful pike
#

that's why you have props

civic scroll
#

so i can't put the thing in HTML

woeful pike
#

sure you can

civic scroll
#

gimme a moment

woeful pike
#

are you only displaying one optional thing at a time?

civic scroll
#

no

#

it's a piece of interpolated text

#

with different tag locations at a time

woeful pike
#

mhm

#

but you only have one of it displayed at a time or?

civic scroll
#

all

woeful pike
#

is it a dynamic amount

civic scroll
#

look at interpolate methods and you will get what i mean

woeful pike
#

oh man...

civic scroll
#

i legit couldn't use component for this case

woeful pike
civic scroll
#

then the tags can't be put between the text

#

and i can't pick up events if i don't specify listeners, which brings me back to original problem

#

imagine if it's something like

"Attack Interval <@ba.vdown>increases</>, ATK <@ba.vup>+{atk:0%}</>, attacks deal <@ba.vup>Arts damage</> to at most <@ba.vup>{attack@max_target}</> enemies and have <@ba.vup>{attack@buff_prob:0%}</> chance to <$ba.stun>Stun</> the hit targets for <@ba.vup>{attack@stun}</> seconds\n<@ba.rem>Liskarm is <$ba.stun>Stunned</> for {stun} seconds after the skill duration</>"
woeful pike
#

so you have a list of things like

[regular text here] [special text @listeners] [more regular text] [some other special thing]
?

civic scroll
#

yes

#

vanilla api is enough

#

i just can't get it to fire the event

#

anything but mouseleave fires

woeful pike
#

so you might need something a little bit more sophisticated. You can have an array like

type Field = TextField | InterpolatedField

const fields: Field[] = [{
  type: "text",
  text: "Attack Interval"
}, {
  type: "interpolated",
  onClick: someFunction,
  text: "increases"
}, {
  // ...
}]

and you render them in a for loop + ngIf

civic scroll
#

might be an issue for nested tags

woeful pike
#

maybe you're removing the element before mouseleave can fire?

civic scroll
#

no

#

the element is there

#

when i let only mouseleave it fires normally

#

but not when i added in other events

woeful pike
#

btw you don't need const refThis = this; if you just use arrow functions

civic scroll
woeful pike
#

yes because function() {} creates its own this context, () => {} doesn't

civic scroll
#

and refThis so i can use services in the class

civic scroll
woeful pike
#

oh you need the this context of the event listener too

#

lmfao

civic scroll
#

for its coordinates and dimensions

woeful pike
#

I would cry if I had to maintain a codebase like this though you're really shooting yourself in the foot here

civic scroll
#

it was simple me like
if mouse enter, get location, display on that location
if mouse leaves, hide the popup

#

that... all it is

#

i just couldn't get that one event to fire for some reasons

bright hornet
woeful pike
#

try replacing mouseleave with mouseout maybe

civic scroll
civic scroll
#

which did nothing

woeful pike
#

fair, doesn't really fix anything in this situation

civic scroll
#

i don't know what is blocking it from firing

woeful pike
#

dude idk like you've really resorted to black magic here

bright hornet
civic scroll
#

ye

woeful pike
#

it's probably an issue with you trying to jam non-angular inside an angular codebase and the events not working as expected

#

tho idk enough about angular to know why it'd be like that

civic scroll
#

vanilla case

#

it doesn't collide with anything though

bright hornet
civic scroll
#
ctx.drawImage(pfp, x, y)
ctx.beginPath();
ctx.arc(x, y, Math.PI * 2, true);
ctx.closePath();
ctx.clip();
bright hornet
#

styll

#

still

civic scroll
#

hmmmmmmmmmmmmm

#

i don't remember

bright hornet
#

:((

civic scroll
#

i will try

sacred aurora
#

Can i do query1 || query2 in a single query with mongodb?

#

nvm there's or operator

eternal osprey
#
  .addField('Team 1 - TOP', 'x',  true) // TOP
  .addField('Team 1 - JGL', 'x', false) //JGL
  .addField('Team 1 - MID', 'x', false) //MID
  .addField('Team 1 - ADC', 'x', false) // ADC
  .addField('Team 1 - SUP', 'x', false) // SUP
  .addField('Team 2 - TOP', 'x', true)
  .addField('Team 2 - JGL', 'x' , false)
  .addField('Team 2 - MID', 'x', false)
  .addField('Team 2 - ADC', 'x', false)
  .addField('Team 2 - SUP', 'x', false)```
why is my bot not making both TOP fields next to each other and the rest of the fields under the TOP fields?
#

So i would have something like: TOP 1 Top2
The rest The rest

modest maple
#

probably because you go inline: true once and then every elese false for the most part

boreal iron
#

Discord doesn’t support tables as you would like to display it

eternal osprey
modest maple
#

markdown table time 😉

boreal iron
#

Only reliable thing is to work with code block

#

But that however will be fucked on mobile

eternal osprey
#

In that case, is there any way to tab out an addField?

#
addField()
space
addField()
neat ingot
#

you can use a zero width space as a blank character

boreal iron
#

Sure with line breaks in your value using unicode chars

eternal osprey
boreal iron
neat ingot
boreal iron
#

See my linked message

#

This guy wanted to do nearly the same like you

#

Just see what I wrote

#

For example one top list on the left (in code blocks) one right

boreal iron
#

Probably because of the horrible scaling on mobile

#

_time to sleep _

woeful monolith
civic scroll
#

that's a single text block 🤨

woeful pike
# civic scroll actually i will use a tree instead

yeah it's the same concept. you're essentially creating an html tree but instead of rendering the html into a string you're only storing the tree data structure and then serializing into the html with angular's templating

civic scroll
#

it's harder to do with tree rather than array

#

recursive needed

woeful pike
#

should be exactly the same concept

civic scroll
#

if we do it then the html becomes really complex

#

for tree

woeful pike
#

nah

#

components render their children

#

that's really all there is to it

civic scroll
#

so pass the children data into component and let it parse by itself

#

good idea

woeful pike
#

yep

civic scroll
#

i will try it out later

woeful pike
#

this is where data structures comes in handy in the frontend

#

it's not all just css 😛

civic scroll
#

for a reason 💀

#

but still if the event listener works then that would be more straightforward

woeful pike
#

it's not straightforward lol it's just more convenient considering you already started working on it

#

it's sunk cost

#

or at least feels that way to you

civic scroll
#

that part is maintainable since there is no collision and they are unique

woeful pike
#

maintainable Monkas

civic scroll
#

it is

#

smon trust me for once cry2

#

i might cringe at my decision 2 years later

#

but for now it's feasible

woeful pike
#

it's just so elegant to solve it the correct way

civic scroll
#

but

#

but

#

alright i will try come up with a struct and ask you later

#

but still idk why the mouse event

eternal osprey
#
  <a class="navbar-brand" href="index.html"><img src="img/pws.png" alt="logo" style="top: 5px; left: -6px"/></a>```I tried this before
lyric mountain
eternal osprey
#

didn't really do anything at all

woeful pike
#

oh no

#

don't use absolute position

#
<nav style="display: flex; justify-content: space-between; align-items: center">
  <img />
  <your-buttons-component />
</nav>
woeful pike
#

because that's not what absolute positioning is for

#

css is like building legos

#

you put legos on top of each other pretty much

#

I recommend learning about the box model, flexbox and grid

eternal osprey
#

ah okay, thank you! Will have a better look at css

woeful pike
#

layouts in css are just rectangles inside other rectangles

old cliff
#

Does snyone know how can I setup a github workflow to upload compiled ts code to a different branch after an edit has been made in the main branch?

lyric mountain
#

was supposed to mention margins

lyric mountain
#

how? no idea, but it's kinda like docker or something

old cliff
#

yes I'm asking about setting up an action for that

old cliff
woeful pike
#

why do you want compiled code in version control?

lyric mountain
#

maybe to be able to just clone without compiling or whatever, idk

woeful pike
#

poor man's non-cross-platform container

tribal crow
#

is it possible to get message id's?

#

like via code?

#

message.id?

lyric mountain
#

for sure

#

almost* anything you can do manually can be done through code

  • except client-side stuff like interactions
lyric mountain
#

it would too

#

what I mean is that you can't interact with interactions through code

#

like using slash commands or clicking buttons

tribal crow
#

ah, yes

#

i understand

tribal crow
lyric mountain
tribal crow
#

cause i tried to log interaction.id in the button event

lyric mountain
tribal crow
#

ah

lyric mountain
tribal crow
#

oooh

#

understand

coral sigil
#

Can you make a slash command with many string options, but out of those options, you have to provide one? Not a particular one, just one

dry imp
#

you mean like optionchoice?

coral sigil
#

no i don't mean choices, I mean string options that the user can provide a string for

lyric mountain
#

you mean variable signatures, no that's a thing I wish they added

coral sigil
#

but its not the same and would be a lot better with options natively supporting that

quartz kindle
#

yeah you have to make do with subcommands

lyric mountain
#

we can only dream of proper mutable signatures

quartz kindle
#

and datepicker and array options

lyric mountain
#

damn I forgot about those

tribal crow
lyric mountain
#

well, message is undefined then

#

you need to check for that too

tribal crow
#

may it be because i call it before sending the message?

lyric mountain
#

definitely

#

a message only receives an id after it's sent

lucid prawn
#

my bot keep going offline because it keeps running this command npm ci and it's getting annoying

tribal crow
# lyric mountain a message only receives an id after it's sent
TypeError: Cannot read properties of undefined (reading 'id')
    at Object.execute (/home/runner/Disbank-API/commands/blackjack.js:101:52)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Client.<anonymous> (/home/runner/Disbank-API/index.js:43:13)
/home/runner/Disbank-API/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:90
    if (this.deferred || this.replied) throw new Error('INTERACTION_ALREADY_REPLIED');
#

line 101 is: messageID: interaction.message.id

quartz kindle
#

what do you want to do with the message id?

tribal crow
#

save it

rocky hearth
#

can smbdy tell me, how to find following in js
(3 ** 4 ** 5) % (1e9 + 7)

pale vessel
wheat mesa
#

Use smaller numbers duh

pale vessel
#

you sure you don't want ((3 ** 4) ** 5) % (1e9 + 7)?

earnest phoenix
#

wth is **

wheat mesa
#

Power

pale vessel
#

exponential

earnest phoenix
#

oh

wheat mesa
rocky hearth
#

without parenthesis, 4 ** 5 is evaluated first

wheat mesa
#

Odd

#

Didn’t know much about the way exponents were evaluated

pale vessel
#

BODMAS

#

PEMDAS

#

fuck, w/e

rocky hearth
#

where's Tim

wheat mesa
# pale vessel PEMDAS

I know PEMDAS I just didn’t know that exponents were evaluated right to left instead of left to right when chained together

rocky hearth
#

a to power b to power c, so its makes sense to find b ** c first.

lyric mountain
#

so it's not really right to left, but top to down

rocky hearth
#

hmm, correct

quaint rampart
#

anyone know of a js module that will let u run a web server without any extra routes or anything? like a normal web server

lyric mountain
#

like express?

quaint rampart
#

yeah but without any extra routes or anything just like a normal web server that lets u view it’s directories and reads .htaccess let’s u view all the images, json files in that directory etc

#

idk if that’s even possible

lyric mountain
#

no it's not

#

a webserver without routes isn't a webserver

#

you can do what u want with nginx or any webserver really

quaint rampart
#

hmm alright, i was really hoping to be able to run a website on pterodactyl that’s why i was wondering

lyric mountain
#

idk what pterodactyl is, but simply setup a webserver for the site

#

it's not the hardest thing

quaint rampart
#

alrighty thanks

old cliff
#

@quaint rampart you can try making one yourself

#

It is easy and requires little skill

#

Can be done via express

quaint rampart
#

you right

#

i’d just have to make it read the directory

#

and

#

make a route

lyric mountain
#

that's...that's what i just said

quaint rampart
#

yeah ik i started working on it cuz of what u said

quartz kindle
#

powers are slow af in js

#

avoid them

#

if you can

lyric mountain
quartz kindle
#

idk

#

ask them

old cliff
#

Use * for the route and scan dir each time for the required path

old cliff
quartz kindle
#

both

old cliff
#

Mhmm

quartz kindle
#

exponentiation is an expensive operation in general

#

even in other langs

#

for example python:

#

depending on the situation, it will be much faster to use a multiply loop instead of powers

old cliff
#

Lemme test

#

Br

#

B

lyric mountain
#

this includes groovy startup time, compilation, execution and return

#

without startup time

#

now lemme do it 100k times

#

idk what to say

#

it gets lower every time I run again

quartz kindle
#

yea v8 is a beast

austere surge
#

nice eval command

lyric mountain
quartz kindle
#

it highly depends on the situation, since some things are optimizable others are less optimizable, if youre just gonna run the same numbers in a loop, it will probably be compiled to give the end result directly and skip the entire computation

austere surge
#

im not entirely sure how to return something in mine lmao

quartz kindle
#

but in some of my projects i got a significant performance boost from removing them

austere surge
#

and i cant use async or i dont get an output :(

lyric mountain
#

ye, for pre-defined values it barely computes anything

old cliff
#

What lang?

boreal iron
#

meths again?

lyric mountain
#

I imagine if the value is well defined before the loop it just consider the first value for everything else

lyric mountain
old cliff
#

Js or what?

lyric mountain
#

GROOVY

old cliff
#

Ok

austere surge
#

lol

old cliff
#

Nvm I'm dumb

lyric mountain
old cliff
boreal iron
#

is topgg completelly fucked up today?

austere surge
lyric mountain
#

guess I should mark the time after instantiating the compiler

#

not before

austere surge
#

mayb

old cliff
#

Better results

#

Does the +=0.000.....1 also take some time?

lyric mountain
#

ye

#

floating point calculations are always slower

old cliff
#

If I take something bigger it will be Infinity

lyric mountain
#

easier way to go to infinity is just any ** 10 ** 100

#

or any / 0 (depending on lang)

fiery stream
#

why doesnt this work even tho im listening to music

#

is the api broken or something ?

#

it prints this

lyric mountain
#

do u have the presence intent?

fiery stream
lyric mountain
#

enable it on both sides then

fiery stream
#

whats that.. im making a bot after like 2 years

#

n in different lang

#

by different i meant i used to code in js first

lyric mountain
#

a couple years ago discord added privileged intents

fiery stream
#

how do i enable em ?

#

i have all that enabled

#

is there anything i need to do with code ?

lyric mountain
#

now enable in the code

#

also, make sure your lib is updated

#

otherwise it wont have them

fiery stream
#

its latest i think

fiery stream
lyric mountain
#

no

#

read the docs

#

it's one of the first examples there

fiery stream
lyric mountain
#

oh, py

#

yeah it's like that ig

#

just note d.py was abandoned

fiery stream
fiery stream
lyric mountain
fiery stream
#

bot = commands.AutoShardedBot(PrefixGetter(config.get('core').get('prefix')), intents=discord.Intents(messages=True, guilds=True, presences=True)) ion this this works i still dont get anything back

lyric mountain
#

idk then

fiery stream
#

rippp

#

so should i just not make my bot anymore if d.py is abandoned ?

lyric mountain
#

there are forks of it probably

cinder patio
#

or just use another language

fiery stream
#

i was finally started to like python 😦

cinder patio
#

meh

fiery stream
#

which other library is good out of these ?

#

disnake gets updated regularly

sudden geyser
#

Pycord and next cord are the two most popular

solemn latch
#

I've heard of pycord, none of the rest.
when choosing a library I like to check the source code and if its still maintained.

sudden geyser
#

To my knowledge

spark flint
#

disnake is good

#

good for slash commands

fiery stream
#

pycord seems to be most starred out of all of em

whole glen
#

does this mean file is too big? ```Uncaught DiscordAPIError: Request entity too large
No debugger available, can not send 'variables'
Process exited with code 1

solemn latch
#

how big is it? limit is 8MB

sudden geyser
#

Unfortunately no library wants to admit what they're not good at

#

So it's hard to pick

fiery stream
sudden geyser
#

Don't know

#

Many of them are forks so they share a lot of the same things

quartz kindle
#

you have to test them, stuff like how much memory they use at login, etc

compact pier
#

nvm

#

found out

sudden geyser
#

It's hard to do that on your own since you practically need to learn all five and choose

whole glen
fiery stream
quartz kindle
fiery stream
#

is rest cord a good idea ?

#

plus isnt it easier to make dashboard using restcord cuz php is like a web client ish im not sure

cinder patio
#

it doesn't really matter

sudden geyser
proven lantern
fiery stream
quartz kindle
quartz kindle
#

but still, the dev needs to test their particular use case and make their own decision in the end

sudden geyser
#

Yeah I don't disagree that a dev should still make their own decisions

#

I just think that library devs should do more to express what their library is good and not good for, which can be highlighted through methods like you just said.

lament rock
#

Everyone should move to modular libs because discord.js is a memory leak

earnest phoenix
#

discord.js memory usage is a vizualised skill issue

sudden geyser
#

Discord.JS is more of a convenience/abstraction library

#

It is modular, but not enough for most people

cinder patio
#

Modular, not modular, doesn't really matter for memory usage

sudden geyser
#

For the average bot in 1-500 servers, memory usage is not very important.

#

Especially with intents, people favor the convenience over the memory usage cost

delicate zephyr
#

hell you can get modular cache by either allowing no caching, internal or external

#

but thats too advanced for people making libs to get popular tbh

cinder patio
#

a non-modular lib can still have a configurable cache

quartz kindle
#

the thing is not exactly being modular or not, its more how much dependent on each other the modules or components are

#

djs is super dependent on a lot of stuff both internally and across the little modularity it has

sick agate
woeful pike
#

I hate digitalocean from the bottom of my heart like so

#

so sincerely

sick agate
#

idk

delicate zephyr
woeful pike
#

dude they just

#

removed our floating ips

sudden geyser
delicate zephyr
woeful pike
#

POOF GONE

sudden geyser
#

What's a floating ip

woeful pike
#

and so we were like oh that's strange and added it back

#

but DO didn't change our default gateway after it was added

sick agate
woeful pike
#

so we spent like 1.5 hours trying to figure out wtf the issue could be because it didn't occur to me that DO's feature just straight up wouldn't work

delicate zephyr
woeful pike
#

so I ended up fixing it by manually querying the gateway and changing it for each node

#

I hate my life

#

fuck DO

delicate zephyr
#

why not switch

spark flint
#

^

sick agate
spark flint
#

also @woeful pike is that the top.gg ip being indexed on google? its a do one so

delicate zephyr
#

just go to it

#

lol

spark flint
#

yeah it loads top.gg, not sure if it should be getting indexed

delicate zephyr
#

its known iirc

woeful pike
#

it's just the load balancer

spark flint
#

ah

woeful pike
#

not a server ip

#

super strange that google picks it up though

spark flint
#

ok good kek

#

theres a ss if you want to reproduce it or look into it etc

#

idk

lyric mountain
#

shameless scrapping KEKW

#

wait

#

they're all the same thing tf

spark flint
#

yteah

#

yeah

#

also wouldn't someone accessing the site from the ip bypass cf ddos protection

lyric mountain
#

ig you could simply block if the origin isn't cloudflare

spark flint
#

yeah thats not the best

delicate zephyr
#

surprised they dont just filter all cloudflares ip

spark flint
#

bearing in mind top.gg gets ddossed every so often

#

How do I do a reload command in djs

lament rock
#

delete require.cache[require.resolve(filepath)];
setImmediate(() => require(filepath));

#

You have to destroy ticking timers and remove events from event emitters and remove external references if you're gonna do that. I wrote a module called heatsync which does the brute of the work

#

some weird quirks is if you want to make things hot reloadable is you need to export an Object and then on file change, delete all old props and then assign new props from updated reference to the old Object

split hazel
#

thanks bro

#

BRO

#

i was gonna watch that

solemn latch
#

how does rate limits work for editing interaction responses?

#

ie, is it the same as normal message editing, or does it remove the limit like responding to an interaction?

wheat mesa
#

afaik it’s normal message editing

#

But I could be wrong

#

Might be worth just testing it

tribal crow
#

Hey! Whenever i reply to an interaction and i want to get the interaction.message.id, i get this error:

TypeError: Cannot read properties of undefined (reading 'id')

wheat mesa
#

Then you don’t have the message object attached to the interaction

tribal crow
#

...

wheat mesa
#

Or interaction isn’t what you think it is

#

I don’t know how djs works internally for this, but you may have to fetch the message

tribal crow
#

like i reply to an interaction, in the same code i try to save the message id after sending it.

wheat mesa
#

Oh wait, interaction.message isn’t even a thing

tribal crow
wheat mesa
boreal iron
#

See this:

tribal crow
#

i figured another way to do it :)

#

got the interaction id instead

boreal iron
#

Aha… I mean that’s not the ID of the reply but okay

tribal crow
#

ik, didnt need it for anything else than matching it with another id

boreal iron
#

🤷

surreal sage
#

(0.47246).toString()
Works or nah?

wheat mesa
#

Why would it not?

surreal sage
#

Wanted to confirm

wheat mesa
#

Also you can easily test this yourself if you really wanted to know :p

surreal sage
#

Cause got it in my mind but never got the time to test

#

but y?

wheat mesa
surreal sage
#

Thanks bud

solemn latch
wheat mesa
#

That too

solemn latch
#

I do it a few times a day just to double check what I'm doing lmao

split hazel
#

chavs start a node instance in the terminal to test

boreal iron
wheat mesa
#

Chads build their own nodejs interpreter to test

split hazel
#

superior beings build their own OS just to test something

earnest phoenix
#

Gigachads make their own universe from scratch to test something

spark flint
#

big bun uses preexisting libs for features that are dogshit!

earnest phoenix
#

Lets see if I will get in trouble for taking over the world and making null the supreme leader

split hazel
#

(development debate time) serious talk the sanctions from companies such as "facebook is banned in russia" is stupid because it don't affect the people in charge at all only the residents

earnest phoenix
#

I mean, people in charge do use social media as well

#

so in a way it does affect them

#

but it does also largely affect the people who don't even want to be part of the war

#

Same thing is happening with their economy

#

The people are suffering cause of what their leader is doing.

wheat mesa
#

Banning social media ironically makes it harder for the truth to get out about the war as opposed to Russian sponsored propaganda

delicate zephyr
#

well

#

russia did

#

facebook banned all russia media outlets

earnest phoenix
#

I know google banned some of their services in russia iirc

#

especially their ad services

split hazel
#

yeah the economy is fucked

#

people lining up at banks

sudden geyser
#

sanctions are always felt most by the people than the targets

delicate zephyr
#

@split hazel it affects their economy, also its not just facebook

Spotify blocked all news sources
Shell and BP started pulling billion$ investments
Ford suspended all operations in russia
General Motors halting all exports to russia
Boeing said Tuesday that it would suspend support for Russian airlines
Apple has stopped selling its products in Russia
Facebook block access to Russian news outlets RT and Sputunk across europe
Twitter has similarly announced plans to "reduce the visibility and amplification" of Russian state media content.
Netflix refusing to air Russian state TV channels in the russia (required by russian law starting this week)
Spotify has closed its office in Russia "indefinitely" and restricted shows "owned and operated by Russian state-affiliated media."
Roku (streaming service) blocked russian news outlet RT
YouTube, which is owned by Google, said over the weekend it had blocked Russian state media within Ukraine, including RT

  • Will also be limiting recommendations of these channels
    Airbnb's suspend all operations in Russia and Belarus
    Intel has stopped all shipments of its products to Russia and Belarus
    Microsoft is suspending all new sales of its products and services in Russia
    BP said Sunday it was planning to exit its 19.75% stake in Russia's biggest oil company, Rosneft, and their joint ventures
    Equinor will also begin to exit its joint ventures in Russia
    Exxon planned to leave its last remaining oil-and-gas project in Russia and not to invest in new developments
    Shell is also getting out of Russia and ditching its joint ventures with Gazprom, including its involvement with the moribund Nord Stream 2 natural gas pipeline.
    Mastercard has blocked multiple russian financial institutions
    DirecTV is cutting ties with RT, the Russia-backed television network
    Disney is also suspending the release of its theatrical films in Russia
    H&M paused all sales in Russia
    Ikea the world's largest furniture company, is closing its 17 stores in Russia
austere surge
#

jeez

delicate zephyr
#

forgot 1

#

McDonalds closed all stores in russia

sudden geyser
#

basically every western company you can name has limited or stopped doing business in russia in fear of violating sanctions

#

except coke maybe

boreal iron
bright hornet
#

Why my upvote api still not working :/

#
const Topgg = require('@top-gg/sdk')
const express = require('express')
const app = express()
const webhook = new Topgg.Webhook(webs)

app.post("/dblwebhook", webhook.listener(vote => {
const votesusers = vote.user
let channel = client.channels.cache.find(channel => channel.id === '949100386759893042')
const upvotes = new MessageEmbed()
  .setTitle('Upvote Status')
  .addField(`Log of Upvotes Status`, `${votesusers}`)
  .setColor('RANDOM')
  .setTimestamp()
  channel.send({embeds: [upvotes]})
  console.log(votesusers)
}))

app.listen(process.env.PORT || 3000)```
#

not sending on channel even in console.log

boreal iron
#

Do you even receive votes?
Is your topgg token accurate?

bright hornet
#

and yes

wheat mesa
#

Btw, you don’t need to use .find, you can just .get() with the id of the channel

boreal iron
#

and vote.user actually provides the user ID?

#

Make sure your channel ID is right then

#

Maybe log your var channel

stiff dust
#

Hi Guys i want to know which one would you rather ? a Big Schema for each guild that saves all data of that guild in one schema or different schema for each thing for example 1 schema for prefix 1 schema for each system and 1 schema for each log ?

earnest phoenix
#

A single schema would be better instead of multiple, since having a lot of schemas can lead to inflation of the database and a lot of memory being used as there will be more data to deal with

stiff dust
#

srry for bad english

earnest phoenix
stiff dust
#

so you suggest me to use 1 schema for all of them

#

also have you work with mongoose cause i have few question

earnest phoenix
#

I mostly use the official MongoDB driver called mongodb which is used in Mongoose, but I know much about it, go ahead

sudden geyser
# stiff dust Hi Guys i want to know which one would you rather ? a Big Schema for each guild ...

I'd argue that it depends on what you want to do. Having multiple entries and drawing relationships between them is popular with SQL and relational databases, but since you're using MongoDB, that isn't as easy to pull off nor as beneficial. Since all you're really storing are constants that make sense on that specific guild, it's fine to use one large schema, but would suggest you at least use collections for duplicate keys like this:

#

Like, you could easily abstract all the XChannelID: String into their own separate documents and store it under your schema.

stiff dust
# earnest phoenix I mostly use the official MongoDB driver called `mongodb` which is used in Mongo...

now i have multi schema and in channel delete event if someone delete a channel that saved in my data base i will remove that data cause it doesnt exist anymore but now if i try to use 1 schema for that i cant delete the data so i need to update it but what should i do for that update it to what ??

for example in my schema i have KickLogChannelID so if someone delete one channel that has same id with KickLogChannelID i should update GuildSchema but update it to what ?

#

null ?

earnest phoenix
#

Just delete it, query the channel with that ID and delete it from the schema since it no longer exists

earnest phoenix
#

The data for that channel saved in that schema since that channel no longer existed as you said that you listen to the channel delete event to delete it, there's no need to update it when the actual channel no longer exists

#
<MongooseSchema>.deleteOne({ id: <Channel ID> });
stiff dust
#

maybe a server have for example kicklog and banlog

#

if they delete kick log channel

#

and i delete the data

#

the banlog will disable too

#

im talking about this style

earnest phoenix
#

Oh that's what you mean, for that you can just update the data, not delete the document, and it'll be just fine

#

You update it to a default value, such as null

stiff dust
#

i cant do this

austere surge
#

jesus

stiff dust
#

this should become false cause data.kicklog is null ?

if (data && data.kicklog) {
// log
}
#

or i need to check it in some other way

earnest phoenix
#

That check should work

stiff dust
#

and my last question
for example if in my schema i define it like this:

KicksChannelID: { type: String, default: null },

which one should i use for update ?

let newData = await GuildModel.findOneAndUpdate({ KicksChannelID: null })
let newData = await GuildModel.findOneAndUpdate({ KicksChannelID: default })

newData.save()
earnest phoenix
#

default is a keyword, you can pass that in like that, you need to know what the default value is and pass that in

stiff dust
#

well can i just use the null one?

earnest phoenix
#

Yes

stiff dust
#

tnx alot <3

spark flint
#

how can i set button url

#

discord.js

#
            const row = new MessageActionRow()
            .addComponents(
                new MessageButton()
                    .setCustomId('primary')
                    .setLabel('View Documentation')
                    .setStyle('LINK')
                    .setUrl("https://docs.blacklister.xyz"),
            );```
#

doesn't work

#
2|index | TypeError: (intermediate value).setCustomId(...).setLabel(...).setStyle(...).setUrl is not a function
2|index |     at Object.execute (/root/bots/blacklister/slashcommands/apikey.js:27:25)
2|index |     at processTicksAndRejections (node:internal/process/task_queues:96:5)
2|index |     at async Client.<anonymous> (/root/bots/blacklister/bot.js:146:9)```
earnest phoenix
spark flint
#

ah

stiff dust
boreal iron
#

Wouldn’t make sense anyways as it doesn’t trigger an event

stiff dust
earnest phoenix
#

Default as null is good option in this case

stiff dust
#

tnx

#

oh god i need to change everywhere 😢

sudden geyser
#

that's a party

stiff dust
sudden geyser
#

synonym for "that sounds painful"

stiff dust
#

oh yeah 😅

#

ig i need to debug for 1 week...

#

and there is a harder way after do the code stuff...

#

i need to change the data base manually and import channels from different schemas to main schema for each server

#

i find smoething !!

the else part is fine but in first if statement (data && data.TotalVotes) ig i do a little wrong i want to change the data but now i see that i just findOneAndUpdate it and maybe the finded one is different with data so how can i update the data ?

i want when someone vote
if they voted before (there is a data) made data.TotalVotes +1 and if tehre isnt create one

pearl trail
#

findoneandupdate({GuildID: yes}, {$inc:{TotalVotes: 1}})

pearl trail
#

increment

#

aka +

bright hornet
#

this is how i do the topgg api vote log right?

const Topgg = require('@top-gg/sdk')
const express = require('express')

const app = express()
const webhook = new Topgg.Webhook(webs)

app.post("/dblwebhook", webhook.listener(vote => {
    try {
    const votesusers = vote.user
    let channel = client.channels.cache.get(channel => channel.id === '949100386759893042')
    const upvotes = new MessageEmbed()
      .setTitle('Upvote Status')
      .addField(`Log of Upvotes Status`, `${votesusers}`)
      .setColor('RANDOM')
      .setTimestamp()
      channel.send({embeds: [upvotes]})
      console.log(votesusers)
    } catch (err) {
      console.log(err)      
    }
}))``` 

in my config
```js
{
  "webs" : "http://project.herokuapp.com/dblwebhook"
}``` am i missing something?
wheat mesa
wheat mesa
#

That feels like a not specific domain at all

bright hornet
boreal iron
bright hornet
#

oh wait

#

i got error

#
at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=project.herokuapp.com request_id=882d2826-d567-45a6-8206-4a00483627de fwd="203.177.43.166" dyno= connect= service= status=503 bytes= protocol=http```
#
at=error code=H14 desc="No web processes running" method=GET path="/dblwebhook" host=project.herokuapp.com request_id=da7429f2-8f2e-48bc-b037-cbc3cfbe71f5 fwd="203.177.43.166" dyno= connect= service= status=503 bytes= protocol=http```
wheat mesa
#

Like I said :p

bright hornet
#

i dont have any idea

bright hornet
solemn latch
#

yeah, the web dyno needs to be on to receive a webhook.

bright hornet
solemn latch
#

the worker can also be on, but youll probably need to modify your code to use both.

bright hornet
#

lmao

solemn latch
#

documents for what? how dynos work?

earnest phoenix
#
This page isn’t working

domain.xyz redirected you too many times.
#

smh how do i fix it

solemn latch
earnest phoenix
#

it used to work for a while, just started getting this error

simple stump
#

I'm learning how to use modules, but when passing a parameter for require I get the error that require(...) isn't a function.

["loadEvents", "functions"].forEach(Boolean).forEach(h => {
  require(`./handlers/${h}.js`)(client)
});
require(`./handlers/${h}.js`)(client)
                                     ^

TypeError: require(...) is not a function
solemn latch
earnest phoenix
#

I don't know why this is so sudden.

#

I also don't know how to fix it

solemn latch
solemn latch
simple stump
#
module.exports = client => {
  // smth w/ client
};
#

waiit nvm. one of the files doesnt have module.exports

#

yep it works now. whoops

hasty mulch
#

Anyone know what language this is in?

"title" : "{{Title}}",
"author" : {
"name" : "{{Author}}"},
"description" : "{{Content}}"}
] }```
#

I want to add color and a footer

wheat mesa
#

...?

#

That’s just a JSON object from the looks of it

austere surge
#

yes

hasty mulch
#

Alright, any documentation for the embed?

solemn latch
#

For discord embeds?

hasty mulch
#

With JSON, yes

solemn latch
#

Yeah discord only accepts embeds in json afaik

austere surge
solemn latch
#

^ embed docs

austere surge
#

djs has an embed builder but that converts to json anyway i think

solemn latch
#

Yeah it does

hasty mulch
austere surge
#

do you have the djs package

hasty mulch
#

Neg, only Python

austere surge
#

oh

#

not sure how to use with python if possible

solemn latch
#

It's probably easier to just use json anyway

hasty mulch
#

I can download the Js stuff needed

austere surge
hasty mulch
solemn latch
#

Like the order(json doesnt care about order, only structure)? Or like, in what way?

#

The discord docs cover it pretty well, I linked to them earlier.

wheat mesa
#

I apologize for the formatting, I’m on mobile

hasty mulch
#

It's ok

hasty mulch
wheat mesa
#

What? Why?

#

It’s really well explained

solemn latch
#

It's pretty uncommon for docs to do that.

Typically only beginner libraries do that

wheat mesa
#

I’d say it’s really clear

austere surge
wheat mesa
#

It’s just showing the json structure, you don’t really need a visual representation

solemn latch
#

If you are confused on how json works I can find a source.

hasty mulch
#

Nvm, I found some more examples of what I'm looking for

austere surge
#

which do you all prefer
"variable": "value"
variable: "value"

solemn latch
#

"Variable":"value" is more correct iirc.

austere surge
#

i like the 2nd

#

i always forget the quotes

#

im used to doing '/" when making strings so it throws me off :/

wheat mesa
#

First one is proper json structure, 2nd one is usually used for props in an interface or something like that

lyric mountain
#

First one also has the advantage of being able to be anything that's representable with a string

austere surge
#

ye

simple stump
#

If I have a variable in a JS file and I want to change it, get the variable, etc. Would this woork?

file1.js

// Define the variable.
var someArray = [];
// Export the variable.
module.exports.arrayReference = someArray;

file2.js

const file1 = require("file1.js");

// some variable idk
let myString = "sup";
for (var i = 0; i < file1.arrayReference.length; i++) {
  // do smth with the array
  file1.arrayReference.push(myString);
}

// log it or whatever
console.log(file1.arrayReference[0]);
lyric mountain
#

Use let

simple stump
#

mb. it was just an example haha. but yea i got u

lyric mountain
#

Abt the variable thing, u can just export it

#

That's how u make global value files

simple stump
#

ah i see. yea thats my goal

#

so if i were to update the variable in the file, it would update globally?

lyric mountain
#

Ye

#

As long as the variable isn't instance-specific