#development

1 messages · Page 27 of 1

ancient nova
#

upload whatever you want people to download to some cdn, then call that whenever user presses the button

eternal osprey
#

files basically get generated on the electron app

#

And these generated filed are inside a folder called lists

#

I tried using an anonfile package, and it worked.

#

but it only could upload 1 file at the time

#

and returned me 5 different download links

ancient nova
#

then convert them to some compress format like rar or zip

eternal osprey
#

hmm

#

That might work lol

ancient nova
#

it shouldweirdsip

neon leaf
#

that doesnt ya know, help much

eternal osprey
#

owh wow that worked

#

bae i love you

wheat mesa
neon leaf
#

yeah, the client.users.fetch() is what i was missing

wheat mesa
#

inb4 cannot read property of undefined error

low moat
#

u donut i cant paste it here

#

lemme give it to u in ur dms

#

its just a long repetitive list of all the other slash commands i have in the bot

#

actually there u go

#

it cut lots of it off but there u go lol

wheat mesa
#

You probably have a slash command with either a space, special characters, or capital letter in the name

#

There it is

#

Slash commands cannot contain capital letters in their name

low moat
#

okay let me try execute my command

#
        throw new Error(message);
              ^

Error: Value is not a string or number.. value=null
    at ms (C:\Users\Finn\mbot1\node_modules\ms\dist\index.cjs:24:15)
    at Object.execute (C:\Users\Finn\mbot1\commands\other\console.js:18:24)
    at module.exports (C:\Users\Finn\mbot1\events\interactionCreate.js:15:17)
    at Client.emit (node:events:513:28)
    at InteractionCreateAction.handle (C:\Users\Finn\mbot1\node_modules\discord.js\src\client\actions\InteractionCreate.js:81:12)
    at module.exports [as INTERACTION_CREATE] (C:\Users\Finn\mbot1\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (C:\Users\Finn\mbot1\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)
    at WebSocketShard.onPacket (C:\Users\Finn\mbot1\node_modules\discord.js\src\client\websocket\WebSocketShard.js:481:22)
    at WebSocketShard.onMessage (C:\Users\Finn\mbot1\node_modules\discord.js\src\client\websocket\WebSocketShard.js:321:10)
    at WebSocket.onMessage (C:\Users\Finn\mbot1\node_modules\ws\lib\event-target.js:199:18)

Node.js v18.7.0```

okay i knew an error was gonna happen but wasnt sure where
wheat mesa
#

console.js line 18 col 24

low moat
#

that would be const LineOfCode = ms(inter.options.getString('Code'));

#

is it the capital?

wheat mesa
#

You see the problem now?

#

Capital letter

low moat
#

yeah lol thanks for that by the way i didnt know about that

wheat mesa
#

ms gets mad when you don’t give it something

low moat
#

it seems to be executing just fine but it isnt giving me any results so i must of done something wrong with the way it responds to certain strings

#

i got no error in console so im just assuming

willow aspen
low moat
#
    const LineOfCode = ms(inter.options.getString('code'));

    if ((inter.options) == 'test') {
    const embed = new EmbedBuilder()
    .setColor('#5679EF')
    .setAuthor({ name: client.user.username, iconURL: client.user.displayAvatarURL({ size: 1024, dynamic: true }) })
    .setTitle("💻 Console")
    .setDescription(`the test worked`)
    }

    else {
    const failembed = new EmbedBuilder()
     .setColor('#5679EF')
     .setAuthor({ name: client.user.username, iconURL: client.user.displayAvatarURL({ size: 1024, dynamic: true }) })
     .setTitle("💻 Console")
     .setDescription(`the test failed`)
    }
},
};```

I did something very wrong here and i can feel it but i really dont know how to finish this off lmao i searched everywhere
#

i have no error message, no underlined red text etc.

#

got to love discord.js v14

willow aspen
#

I'm not familiar with DisocrdJS. Does it support putting in a hex value like that? Discord API does not accept a Hex value.

#

For the setColor that is.

low moat
willow aspen
#

Okay, then nothings stands out to me. See if you can somehow extract the json object sent using discord js. I interact with the API directly so I could help you with that.

earnest phoenix
low moat
low moat
low moat
earnest phoenix
#

Yes

willow aspen
#

Additionally. ```js
let embed = new EmbedBuilder()
.setColor('#5679EF')
.setTitle("💻 Console")
.setAuthor({ name: client.user.username, iconURL: client.user.displayAvatarURL({ size: 1024, dynamic: true }) })
if ((inter.options) == 'test') {
embed.setDescription(the test worked)
} else {
embed.setDescription(the test failed)
}

#

I mean. You have king Voltrex here themselve so I'll just shutup now.

low moat
#

i will give it a go

willow aspen
#

That doesn't change anything sus

#

Just makes it prettier. Won't change functionality lol

earnest phoenix
#

Also interaction.options isn't a string, so be mindful of that

low moat
earnest phoenix
#

inter.options in your case

civic scroll
#

it's a nullable

#

tip: error message is the most helpful friend you can have during debugs

willow aspen
#

Personally would have ```js
let embed = new EmbedBuilder()
.setColor('#5679EF')
.setTitle("💻 Console")
.setAuthor({ name: client.user.username, iconURL: client.user.displayAvatarURL({ size: 1024, dynamic: true }) })
.setDescription(the test ${inter.options == 'test' ? 'worked' : 'failed'})

earnest phoenix
willow aspen
#

Although. Ternary operations are ... personal preference

civic scroll
willow aspen
#

Didn't know you could do that. I hate functional programming so yeah I'd do that too 😛

earnest phoenix
#

Well there's no reason to use the embed builder if you're just manually defining those embed properties

civic scroll
earnest phoenix
#

Because it ends up being the same thing regardless of the embed builder

civic scroll
civic scroll
earnest phoenix
#

The MessageEmbed class was renamed to EmbedBuilder

willow aspen
#

I'm about to post C# code and make you mad KEKW

civic scroll
#

nah

#

i'm immune to it

low moat
#

holy mother of god

#

it says it failed lmao but i will work with it

civic scroll
willow aspen
civic scroll
#

the object init just makes the code cleaner and reduce number of function calls

#

that's my taste

civic scroll
low moat
#

the only issue i have is that if i said 'coke' it would say 'omg its coke' or something like that and also if i was to say 'ping' it would say 'pong'

earnest phoenix
civic scroll
earnest phoenix
low moat
civic scroll
#

reason is

earnest phoenix
civic scroll
#

inter.options was not 'test'

low moat
earnest phoenix
#

It's an object containing helper properties and methods to work with the options you've received with the interaction

civic scroll
#

i'm just losing my sanity rn

low moat
# earnest phoenix ^

only issue with that site is that i dont speak developer language and understand 0% of what its saying

civic scroll
#

how tf

#

is 300 not a valid font weight value

earnest phoenix
#

/console code: test for example, code being an option

low moat
#

also what im trying to do may look dumb as hell but its very hard to explain what im trying to achieve here lmao

#

im not trying to use eval or anything

earnest phoenix
#

What are you even trying to compare against the random thing string?

#

I honestly have no idea what you're doing

low moat
#

i am new to all of this

low moat
earnest phoenix
#

Also dynamic is no longer an option in discord.js v14, it's automatically applied

low moat
#

if i was to say '/console hi' it would respond with 'hello' or something like, i basically want there to be multiple responses to multiple different strings

low moat
#

v14 is a pain in my ass

earnest phoenix
low moat
#

ignore the names of things or if it helps i can temporarily rename everything lmao

earnest phoenix
#

You basically just have to get the value of the argument AKA the option, and use it to compare against whatever you want, and respond with multiple different things

low moat
earnest phoenix
#

For example

const text = interaction.options.getString('text');

switch (text) {
  case 'foo':
    await interaction.reply({ content: 'bar' });
    break;
  case 'baz':
    await interaction.reply({ content: 'biz' });
}
#

With this example, if I do /console text: foo, it'll respond back with bar

#

However if I do /console text: baz, it'll respond back with biz

#

That's an example of how you can get the arguments AKA options, and respond back to them

low moat
#

i see and where it says switch (text) { in the 'text' part i would put 'code' since it is the name of the option right?

earnest phoenix
#

Yes

low moat
#

lovely thank you i will keep trying to sort out all of these errors and if i get stuck i will come back here

#

but thanks a lot

eternal osprey
#

uhh am i doing something wrong here

eternal osprey
#

i am using electron

quartz kindle
eternal osprey
#

Yeah, it must've been in the render file

#

as it's the 'frontend'

#

electron is so strange but satisfying at the same time

quartz kindle
#

document only exists inside the render process, not in the main process

eternal osprey
#

Yup!

#
const { code1, code2, code3, code4, code5, code6 } = require('./main.js')```would this be a solid way to import variabled from my main to my render?
quartz kindle
#

idk how electron works, but if the processes are separate, that will not work

#

as main.js would be required as if it were a new file in a new process

#

no variables would be defined

eternal osprey
#

Owh fuck

#

I must use the ipc functions then

quartz kindle
#

you can try using win.webContents.executeJavaScript()

#
win.webContents.executeJavaScript(`
    document.getElementById("code1").innerHTML = ${code1}
`)
eternal osprey
#

I though that i could make the main send data over to the render.js

#

using win.webContents.send

quartz kindle
#

afaik thats basically the same thing, but it already runs/evals it for you

eternal osprey
quartz kindle
#

yes

#

this is why i like nwjs more than electron

#

nwjs has node built into the window, there is no separate process

eternal osprey
#

might have a look at nwjs

eternal osprey
#

poggers

#

thanks daddy tim

prisma nebula
#

Amyone have official discord mod server?

eternal osprey
#

I was looking at some pre-set values lol

eternal osprey
civic scroll
#

me when

eternal osprey
#

Owh wauw it does

civic scroll
#

😭

eternal osprey
#

but it only can send 1 content per request

civic scroll
#

please

#

just think

#

it sent but one content

#

why

#

look at the code, think before asking questions

eternal osprey
#

Sayuri

#

I think by typing

civic scroll
#

no

civic scroll
#

type in your editor then

#

use 20% brain for once

eternal osprey
#

me when using sayuri's suggestion to think while typing in my editor:

civic scroll
#

fr though, just try to think about it

#

asking should be the last resort

oblique sky
#

to train your question quality: Ask something on stackoverflow. if your question got more than three votes, you just learnt that how to ask a meaningful question in the correct way

low moat
#
const { EmbedBuilder } = require('discord.js');
const { ApplicationCommandType, ApplicationCommandOptionType } = require('discord.js');

module.exports = {
    name: 'guide',
    description: 'A guide of everything you need to know!',
    voiceChannel: false,
    options: [
    {
        name: 'guide',
        description: 'Select a guide to continue',
        type: ApplicationCommandOptionType.Boolean,
        required: true,
    }
    ],

async execute({ inter }) {

const DataGuide = new EmbedBuilder()
.setColor('#5679EF')
.setAuthor({ name: client.user.username, iconURL: client.user.displayAvatarURL({ size: 1024, dynamic: true }) })
.setTitle('📰 Guide')
.setDescription("How we use your data and how to prevent us from using your data")
.setFooter({ text: 'Powered by Nonay', iconURL: inter.member.avatarURL({ dynamic: true })});

const code = new EmbedBuilder()
.setColor('#5679EF')
.setAuthor({ name: client.user.username, iconURL: client.user.displayAvatarURL({ size: 1024, dynamic: true }) })
.setTitle('📰 Guide')
.setDescription("This is a placeholder")
.setFooter({ text: 'Powered by Nonay', iconURL: inter.member.avatarURL({ dynamic: true })});

    const prompt = inter.options.getString('guide');

    switch (prompt) {
    case "data":
    await inter.reply({ embeds: [DataGuide] })
    break;
    case 'code':
    await inter.reply({ embeds: [code] })
}

},
};```

So I have checked out multiple different sources but none seem to be working, how would i go about making a multiple choice slash command
#

i have been told to set type: ApplicationCommandOptionType to type: ApplicationCommandOptionType.Boolean,

#

but nothing other than that

quartz kindle
#

boolean means true or false

low moat
#

idk why they said that

#

maybe they didnt understand?

quartz kindle
#

you're probably looking for choices

low moat
#

i am also wait a sec i may of found the answer

#

i may of accidentally answered my own question

#
        name: 'guide',
        description: 'Select a guide to continue',
        type: ApplicationCommandOptionType.Boolean,
        required: true,
        choices: [
            {
                name: "data",
                value: "guide_data"
            },
            {
                name: "code",
                value: "code_bean"
            }
        ]
    }
    ],

async execute({ inter }) {

const DataGuide = new EmbedBuilder()
.setColor('#5679EF')
.setAuthor({ name: client.user.username, iconURL: client.user.displayAvatarURL({ size: 1024, dynamic: true }) })
.setTitle('📰 Guide')
.setDescription("How we use your data and how to prevent us from using your data")
.setFooter({ text: 'Powered by Nonay', iconURL: inter.member.avatarURL({ dynamic: true })});

const CodeBean = new EmbedBuilder()
.setColor('#5679EF')
.setAuthor({ name: client.user.username, iconURL: client.user.displayAvatarURL({ size: 1024, dynamic: true }) })
.setTitle('📰 Guide')
.setDescription("How we use your data and how to prevent us from using your data")
.setFooter({ text: 'Powered by Nonay', iconURL: inter.member.avatarURL({ dynamic: true })});

    const prompt = inter.options.getString('guide');

    switch (prompt) {
    case "guide_data":
    await inter.reply({ embeds: [DataGuide] })
    break;
    case 'code_bean':
    await inter.reply({ embeds: [CodeBean] })
}

},
};```

okay I think I did it right, however, I dont think I got the responses right
#

yep can confirm i didnt get the responses right

willow aspen
#

To save everyone's eyes, can you use js in your code block.

low moat
#

actually i lied i might

#

oh yeah i do oops

eternal osprey
#

Hey guys i've recently built an electron app

#

i have a problem tho

#

It created an exe file

#

but next to the exe file it still needs all json files etc to be in the folder

#

how can i make these items hidden for the user?

solemn latch
#

thats something you would deal with in the install process I would think.

#

ie setting the location of your support files

#

for example on windows if you go to %appdata%\discord in your file explorer discord's supporting files exist there

#

some of them also exist in C:\Users\YOURUSERNAME\AppData\Local\Discord

sharp geyser
#

Okay so I have two separate containers, one for the nav and one for the main content of the page. Issue is, that the main content is way too close to where the nav is. If possible I'd like to make it so the nav has a clear boundary and if the nav is opened it will overlap the main body without pushing it out of the way.

solemn latch
#

sounds like two separate issues.

one is padding around the nav to give it more space.

then the nav menu(the menu that opens) should have the position fixed(so it can sit on other content)

sharp geyser
#

Actually I can make the body relative and the nav absolute

solemn latch
#

🤔 is your nav not in the body?

proven escarp
#

that would work but it's useless

#

no need for absolute

#

unless you want it sticked to top then use fixed

#

like when you scroll it doesn't move

sharp geyser
#

so it will end up sitting on top of everything else

#

unless I change the position of those other elements in the body or at least this is my understanding

solemn latch
#

my typical setup is

<div> as a flexbox
   <nav> <whatevergoesinthenav> </nav>
   <main> </main>
</div>
#

gives something like this

#

I like this setup because it can be easily transitioned to other looks for other devices.

#

Ignore the fact the sites super ugly thats just because I'm not a designer not because the method

low moat
#
        name: 'guide',
        description: 'Select a guide to continue',
        type: ApplicationCommandOptionType.Boolean,
        required: true,
        choices: [
            {
                name: "data",
                value: "guide_data"
            },
            {
                name: "code",
                value: "code_bean"
            }
        ]
    }
    ],```

how would i go about responding to an option being selected?
sharp geyser
#

Well, you will get that in the interactionCreate event

#

once an choice is chosen it will be sent along the interactionCreate event iirc

spark flint
#

woo vs wee

solemn latch
lyric mountain
#

Ambulance goes wooweewoowee

sharp geyser
lyric mountain
#

(✿◡‿◡)

earnest phoenix
#
let sleep = null```
bright thorn
#

SyntaxError: Unexpected token in JSON at position 0

#

Why is this

#

In node module

#

Anyone can help me

#

Instantly

lyric mountain
#

Show error

bright thorn
#

Wait

earnest phoenix
#

It means exactly what it says. There is something that is not supposed to be there at the line the error is coming back on.

Make sure that your syntax is correct

bright thorn
#

please read

#

because its coming where i didn't change anything in code

lyric mountain
#

What's petitio?

bright thorn
#

i don't know even this package also not installed

lyric mountain
#

It is, else it wouldn't appear there

#

Some lib ur using depends on it

#

Show the rest of the error

bright thorn
#
0|main     | SyntaxError: Unexpected token  in JSON at position 0
0|main     |     at JSON.parse (<anonymous>)
0|main     |     at Y.json (/home/ubuntu/bot/node_modules/petitio/dist/index.js:30:574)
0|main     |     at ke.json (/home/ubuntu/bot/node_modules/petitio/dist/index.js:30:2499)
0|main     |     at runMicrotasks (<anonymous>)
0|main     |     at processTicksAndRejections (node:internal/process/task_queues:96:5)
bright thorn
lyric mountain
#

Is that all of it?

bright thorn
#

yes

wheat mesa
#

You have some sort of special unicode character or something in your JSON that isn't valid JSON format

lyric mountain
#

Do you use any kind of library that uses json?

#

Like any api wrapper (except d.js or topgg) or gasp file-based database?

bright thorn
#

no

#

i will send you the packagejson

#

wait

lyric mountain
#

Sigh

#

Any of these libs?

bright thorn
lyric mountain
#

Which erela?

#

Like, 50% of that list has "erela" in its name

bright thorn
lyric mountain
#

Ok so, when I read "lavalink client" the very first question that comes to mind is:

#

Are you playing youtube/spotify music?

bright thorn
lyric mountain
#

Did you check if your IP wasn't banned from those services?

#

Afaik both are strictly against third party clients

#

My bet is that you're receiving a non-json response (like empty response or html error page) which wasn't considered by erela devs

#

Which prevents the music from being played at all

bright thorn
lyric mountain
#

Well, first you need to make sure that's the issue

#

Also you don't simply "change ip", at least not for free

civic scroll
#

me when json issue

lyric mountain
#

One of the reasons why I dropped the music module entirely

civic scroll
#

just run the project in debug mode
and attach breakpoint on unhandled exceptions

#

you will know what caused that

#

plus what is he tryna do anyway

#

kuu

lyric mountain
#

Getting invalid token at index 0 on petitio, he's using erela.js

civic scroll
#

for discord client?

lyric mountain
#

I believe so

#

He's playing from youtube/spotify

civic scroll
#

so music player inside discord client

bright thorn
#

This is not ip issue

#

I changed

lyric mountain
#

Worthy to note last erela update was an year ago

civic scroll
#

that json issue

civic scroll
#

vscode?

#

just run it in debug mode

lyric mountain
#

Judging by the time he took, he didn't change ip at all

civic scroll
#

ip has nothing to do with this

earnest phoenix
#

Bugd eodm

civic scroll
#

we didn't even know what string caused json error

lyric mountain
#

Internal stuff btw, happens inside node modules

civic scroll
#

it's possible that

#

it made http request

#

and tryna parse the response

#

it expected json

lyric mountain
#

Yes, that's why I said ip issue

#

Both youtube and spotify have non-json error pages

civic scroll
#

but we don't know what the response looks like

#

moment

#

but he still didn't get it

#

i cried

bright thorn
#

Yes

#

😓

lyric mountain
#

Well, they could go inside the module and add a breakpoint there

civic scroll
#

i said

lyric mountain
#

And hope for it to happen quickly

civic scroll
#

run it in debug mode

#

hit F5 on your main file

#

fss

bright thorn
#

I will try

#

Wait

lyric mountain
#

Potito

civic scroll
#

add a project-wide breakpoint

lyric mountain
#

But yes, specifically petitio/dist/index.js, line 30

civic scroll
#

literally tick this box

lyric mountain
civic scroll
#

the thing is

lyric mountain
#

It happens async, don't think breakpoints will catch that

civic scroll
#

with that enabled, it will jump straight to the problematic file

#

it can

#

it throws when that got thrown

#

it allows you to look back

#

plus

#

we only need the string which caused the problem

civic scroll
lament rock
#

I've created my own rudimentary http router for an upcoming api I'll be working on, but does anyone have any reference to one that may be a bit more mature and optimized? I think how I handle route keys could be better

bright thorn
#

but thing is that Test bot is working but main bot not working

white hornet
#

hello i want to add slash command for my bot but i have problem with options for the command is there any website for generate options?

#

and if someone can help me with code i want to make it work like this

      options: [
        {
          name: "on",
          description: "to make it on",
          type: ApplicationCommandOptionType.String,
          required: true,
        },
        {
          name: "off",
          description: "to make it off",
          type: ApplicationCommandOptionType.String,
          required: true,
        },
        {
          name: "lmite",
          description: "to set a lmite",
          type: ApplicationCommandOptionType.Integer,
          required: true,
        },
        {
          name: "warn",
          description: "to set warn",
          type: ApplicationCommandOptionType.String,
          required: true,
          // i want to add owner and staff as a option after choose warn 
        },
      ],
sharp geyser
#

What exactly is your issue

white hornet
#
        {
          name: "warn",
          description: "to set warn",
          type: ApplicationCommandOptionType.String,
          required: true,
          ==> // i want to add owner and staff as a option after choose warn 
        },
#

i want to add owner and staff as a option after choose warn

white hornet
earnest phoenix
#

{
name: "warn",
description: "to set warn",
type: ApplicationCommandOptionType.String,
required: true,
==> // i want to add owner and staff as a option after choose warn
},

tribal harness
# white hornet this is the problem 👆

You want to set the owner and staff as an option for a warning? Could you explain more? Are you wanting only the staff and owner to be able to warn? Or am I having a brain fart

eternal osprey
#

hey guys

near ether
#

how come in some servers when i go to server settings -> integrations -> my bot, it has no slash commands?

#

in other servers they show up but in some they dont

lyric mountain
#

because there are no bots with slashes allowed

eternal osprey
#

hey guys

#

How would i update the button with the amount of entries?

#

This is my current code:

#

 const row =  new MessageActionRow()
                      .addComponents(
                          new MessageButton()
                          .setCustomId(`${ids}`)
                              .setLabel(`${configuration["starter"].embedemoji}-${count}`)
                              .setStyle('SUCCESS'),
                      );
            ```
#

Or does it automatically update?

#

And if i update the button, is there any way to not override the embeds, but only the buttons?

bright thorn
#

and the erela.js in outdated

#

as everyone is facing same error which i got earlier

lyric mountain
bright thorn
#

for temporary fix

lyric mountain
#

not use erela

#

find something else

bright thorn
#

shoukaku is their but i need time to migrate

lyric mountain
bright thorn
#

but any temporary solution?

lyric mountain
#

there's no thing like "temporary solution", it doesn't work like that

bright thorn
#

uf

eternal osprey
lyric mountain
#

but well, no, it doesn't update automatically

#

u need to update it inside an on-click event

stuck dawn
#

how can i make this make a row when has no more space?

lyric mountain
#

grid or flow layout

stuck dawn
#

i am using flex

lyric mountain
#

doesn't matter

stuck dawn
lyric mountain
stuck dawn
#

let me try

#

it worked but my other app got in the middle

lyric mountain
#

now u need to adjust flex alignment

eternal osprey
#

could i define the embed by messageId?

lyric mountain
#

yes?

eternal osprey
#

and then do embeds: [embed]?

lyric mountain
#

also make sure not to update immediately

eternal osprey
#

Because if i edit the message I am also editing the embed right? I really don't want an embed override. Is there a way to disable that?

lyric mountain
#

no

eternal osprey
#

fuck

lyric mountain
#

embeds are final once sent, u either update the message entirely or u don't update at all

stuck dawn
eternal osprey
lyric mountain
#

no

#

that'd make no sense at all

pearl trail
#

get the message, get the message's embeds, push new embed to embeds collection, make it an array, and put again in embed: []

lyric mountain
#

also I repeat, make sure you don't update the message instantly

#

unless you enjoy having your bot spam the ratelimit

fervent moss
#

Someone good at jimp?

 let img = await Jimp.read(
      'https://cdn.discordapp.com/attachments/785156938627153992/910541044792311899/slap.png'
    );
    let avatar_jimp = await Jimp.read(user.avatar_url);
    avatar_jimp.resize(200, 200);
    img.composite(avatar_jimp, 350, 70);
    let avatar2_jimp = await Jimp.read(user2.avatar_url);
    avatar2_jimp.resize(220, 220);
    img.composite(avatar2_jimp, 580, 260);

    let buffer = await img.getBufferAsync(jimp.MIME_PNG);

As this doesn't work

lyric mountain
#

make a self-replacing queue system, and only propagate the new values once the timer ends

bright thorn
#

its not giving error on without pm2 start

fervent moss
lyric mountain
#

can't u use canvas?

bright thorn
#

when i am going to start its by pm2 its giving errors

iron crescent
lyric mountain
fervent moss
# lyric mountain can't u use canvas?

Uh...i can but i am bad at finding the correct places to set the pfp so actually soemone has found the correct pfp places for jimp.

But ig the places wouldn't matter in jimp or canvas. Is t it?

fervent moss
bright thorn
# lyric mountain I don't know mongoose
0|main     | SyntaxError: Unexpected token  in JSON at position 0
0|main     |     at JSON.parse (<anonymous>)
0|main     |     at Y.json (/home/ubuntu/bot/node_modules/petitio/dist/index.js:30:574)
0|main     |     at ke.json (/home/ubuntu/bot/node_modules/petitio/dist/index.js:30:2499)
0|main     |     at runMicrotasks (<anonymous>)
0|main     |     at processTicksAndRejections (node:internal/process/task_queues:96:5)

This error showing when i start bot by pm2

iron crescent
bright thorn
#

without pm2 no error

#

its playing music as it is

lyric mountain
#

and yes, it wouldn't matter what u use to draw, pixel coordinates are absolute regardless of lib

#

(0,0) is always topmost left corner

fervent moss
#

Yeah thanks then i am using canvas

lyric mountain
#

are u still using erala?

bright thorn
#

but this error not came when i start bot in screen

lyric mountain
#

well I don't use pm2 so...

eternal osprey
#

And using pm2 restart correctly?

eternal osprey
iron crescent
eternal osprey
#

try it out again

eternal osprey
#

Only thing that could be is that he hasn't restarted his running client correctly

iron crescent
#

Ig

eternal osprey
#

have you reset your json files before doing so?

iron crescent
#

Check the json

eternal osprey
#

Send us the JSON file here, that's running on your ubuntu vps if it isn't big.

#

We can validate it and check it out

iron crescent
#

Yes we can do that

lyric mountain
#

note the json file isn't a file

eternal osprey
lyric mountain
#

it's a response from some api (petitio lib)

lyric mountain
eternal osprey
#

i think that he is installing 2 different lib versions. He might have installed an older/newer version than on his own pc. That maybe could have broken json files or something

eternal osprey
uneven tartan
#

then fetch the message from it

eternal osprey
#

Yeah but my question is... how do i fetch the message

#

interaction.channel.fetch()?

lyric mountain
#

check the docs

eternal osprey
#

I honestly don't understand how these docs work

#

I went to the message property and found fetch

#

but how the fuck do i use it then

lyric mountain
#

it's a promise

#

u use it like any other fetch

earnest phoenix
#

You can either pass the message's ID, or pass other options to fetch messages depending on said options

bright thorn
#

am not starting pm2 from json file

lyric mountain
#

well you obviously wasn't

eternal osprey
#

It might be a broken version that your pm2 is running

#

petitio lib

earnest phoenix
#

Wait a second, why are you even using Petitio instead of the traditional HTTP clients/libraries?

lyric mountain
#

erala.js

#

or some other outdated petitio lib

earnest phoenix
#

Ugh, ErelaJS had to use something inconsistent and non-traditional didn't it

iron crescent
#

Lol

civic scroll
#

guys how do i disable line wrap in nvim

sudden geyser
#

There's an option called nowrap

#

@civic scroll

civic scroll
quartz kindle
#

some typing magix for you guys

civic scroll
iron crescent
#

Lmao

quartz kindle
#

because i waited until the last second as usual

#

12 days left for content intent

#

no time to rework now, im trying to adapt/port all my old crap

#

and then rework incrementally

#

lmao

civic scroll
#

tim when the port

fervent moss
#

In canvas you have to give dimensions if you are using an image as wallpaper ?

#

(background)

lyric mountain
#

see docs

#

also keep in mind that doing any kind of resizing will effectively destroy the image quality unless u tweak the interpolations settings

iron crescent
#

when I used it it didn't really destroy the image quality...

civic scroll
#

it's canvas

#

depends on canvas size and render quality options

celest gate
civic scroll
#

what's the version of discord.js and discor-player you are using?

celest gate
#

17.7.2

civic scroll
#

that's node

celest gate
#

oh wait

#

"discord.js": "^13.1.0",

#

"discord-player": "^5.1.0-dev.1636095464.54bb4b0",

civic scroll
#

hmmm

#

oh

#

it maybe possible is that discord player tryna use discord v14 intent contructor

celest gate
#

so do i upgrade my discord.js to v14 ?

civic scroll
#

in discord v13 it's Intents

#

version 14 renamed it to IntentBitFields

stuck dawn
#

how can I filter an array of objects by a state and remove that object when I find it?

earnest phoenix
stuck dawn
#

typescript

earnest phoenix
stuck dawn
ancient nova
#

I will, however maybe try adding some slash commands

#

maybe

earnest phoenix
#

You should honestly just switch to slash-commands entirely

#

Not only do they make the developer's life easier by providing a lot of useful features, but they also handle a ton of things for you

#

And it's also more convenient to the users

civic scroll
ancient nova
fervent moss
#
const canvas = Canvas.createCanvas(1000, 500);
        const context = canvas.getContext('2d');

    const background = await Canvas.loadImage('https://cdn.discordapp.com/attachments/785156938627153992/910541044792311899/slap.png');
    context.drawImage(background, 0, 0, canvas.width, canvas.height);

    const { body } = await request(message.author.displayAvatarURL({ extension: 'jpg' }));
    const avatar = await Canvas.loadImage(await body.arrayBuffer());
    context.drawImage(avatar, 350, 70, 200, 200);
    
    const avatar1 = await Canvas.loadImage.(message.mentions.users.first().displayAvatarURL({ extension: 'jpg' }));
    
context.drawImage(avatar1, 580, 260, 220, 220);

Here how do I make avatar and avtar1 with round corners
(sorry i can't understand docs it written use .cut but where i don't understand)

civic scroll
earnest phoenix
#

closePath()*

fervent moss
#

Exactly where?
After declaring context?

civic scroll
#

after rendering the image

#

call that

civic scroll
fervent moss
#

After the first arrow right?

earnest phoenix
#

After drawing the background

#

Once you begin the path, draw an arc, and close the path; be sure to call context.save() to save the current state, clip into the arc by calling context.clip(), draw the avatar, and finally restore back the saved state by calling context.restore()

hidden gorge
#

what does this mean?

lament rock
#

Essentially the same as cannot read property x of undefined

#

discord-buttons is also deprecated. Don't use it lmao

hidden gorge
#

ok

solemn latch
#

also the first part means you're using unsafe libraries.

#

2 of them being critically unsafe(potentially giving remote access to your process/server)

quartz kindle
#

you need to fetch the owner

#

const owner = await guild.fetchOwner()

#

same thing

#

yes, since you're using await

sour oar
#
const home = new EmbedBuilder()
                .setAuthor({ name: `Welcome to the help panel.`, iconURL: client.user.displayAvatarURL({ dynamic: true, size: 512 }) })
                .setColor(COLORS)
                .setDescription(`You can start streaming music straight away without any setup, just run the \`${PREFIX}play\` command, give it something to search for and you're good to go! \n\nUnlock exclusive benefits by purchasing a premium membership: `)
                .setFooter({ text: `© MihaiT`, iconURL: message.author.displayAvatarURL() });
    
            const info = new EmbedBuilder()
                .setColor(COLORS)
                .setAuthor({ name: `Eli's Commands`, iconURL: client.user.displayAvatarURL({ dynamic: true, size: 512 }) })
                .addFields(
                    { name: `![Eli_Bot](https://cdn.discordapp.com/emojis/972786663078105128.webp?size=128 "Eli_Bot") Info`, value: `Detailed help for an order: \`${PREFIX}help [commands]\` \nFor more help, visit our` },
                    { name: `![Eli_ADD](https://cdn.discordapp.com/emojis/972784975172751380.webp?size=128 "Eli_ADD") Comandos`, value: `\`${PREFIX}about\`: Stats and bots details. \n\`${PREFIX}help\`: Help commands. \n\`${PREFIX}invite\`: You receive a link so you can invite me to any server you manage. \n\`${PREFIX}vote\`: Vote for Nakano on Top.gg \n\`${PREFIX}support\`: To join communities.` },
                )
                .setFooter({ text: `© MihaiT`, iconURL: message.author.displayAvatarURL() });
    
    
            const components = (state) => [
                new ActionRowBuilder().addComponents(
                    new SelectMenuBuilder()
                        .setCustomId("help-menu")
                        .setPlaceholder("Please Select a Category")
                        .setDisabled(state)
                        .addOptions([
                            {
                                label: `Home`,
                                value: `home`,
                                description: `Go home`,
                                emoji: `![EliOfficial](https://cdn.discordapp.com/emojis/972798080393052191.webp?size=128 "EliOfficial")`
                            },
                            {
                                label: `Info`,
                                value: `info`,
                                description: `See info commands`,
                                emoji: `![Eli_Bot](https://cdn.discordapp.com/emojis/972786663078105128.webp?size=128 "Eli_Bot")`
                            }
                        ])
                ),
            ];
    
            message.reply({ embeds: [home], allowedMentions: {repliedUser: false}, components: components(false) });
    
            const filter = (interaction) => interaction.user.id === message.author.id;
    
            const collector = message.channel.createMessageComponentCollector(
                {
                    filter,
                    componentType: "SELECT_MENU",
                    time: 200000,
                    max: 10
                }
            );
    
            collector.on('collect', (interaction) => {
                if (interaction.values[0] === "home") {
                    interaction.reply({ embeds: [home], ephemeral: true });
                } else if (interaction.values[0] === "info") {
                    interaction.reply({ embeds: [info], ephemeral: true });
                } 
            });

it doesn't work for me and it doesn't give me an error either

wooden ember
#

is there a way to change/ set the connection bit rate to a discord vc using d.js?

proven escarp
sudden geyser
#

looks as if the reply was auto-generated

low orbit
#

how could i access the data argument from inside the ejs tag? currently it just says data is undefined

boreal iron
wooden ember
#

will this work "on the fly" so i can change it whilst the bot is streaming audio?

#

oh bruh this is for changing channel bitrate, not the bots streaming capabilities

wooden ember
#

also, why does the disconnect event and reconnect event not fire?

#

like my bot disconnects and reconnects all the time but the listeners never fire

#

literally unplugged my server ethernet and nothing happend

solemn latch
#

like the client disconnect event?

wooden ember
#

yeah

#

but im not using sharding

proven escarp
wooden ember
#

true

proven escarp
#

Only one way to know 🤷‍♂️ Try it!

wooden ember
#

will do

wooden ember
#

so shardDisconnect doesnt work however shardError does start spewing out errors

#

shardReconnect just fires alot of times

solemn latch
#

So disconnect only fires after reconnecting fails.

wooden ember
#

oh ok

solemn latch
#

I'm not sure how many attempts discord does

wooden ember
#

i reconnected the ethernet before it failed

#

i mean as far as i know its infinite

#

lost internet for a week once and i left my server up

#

all reconnected automatically

#

whether it changed it reconnection methods after a while (i.e only sends out a request every 5 minuites instead of every other second like when internet is just lost)

wheat mesa
#

You seem to have a lot of internet reliability issues

wooden ember
#

also what is the "apiRequest" event for? liek what request fires at the start and then at random points in the day

wheat mesa
#

Have you tried using a host with more reliable uptime instead of coming up with solutions with reconnecting?

wheat mesa
wooden ember
#

yes i live in the middle of nowhere and am 1 of two subscribers on an adsl phone line

wheat mesa
#

You should probably look into a proper host, free or not

wooden ember
#

its cheeper for them to just basically give us internet for free than to fix it

#

there was a company that dug up the country road by our house not to long ago and install fibre but we have to install a conduit to the house befor they will install it and we havent gotten round to thqt yet

#

i mean for every day use its enough and with the workaround ive built into my bots its not really in issue but just an annoyance

solemn latch
#

responding to interactions doesnt count afaik

wooden ember
#

oh I see

#

is ther any data you can get from the event liek the data its requesting?

solemn latch
wooden ember
#

oh damn there are quite a few paramiters for that one

#

what happens when the client session becomes invalidated?

#

whats the difernece between that and just being disconnected

#

as i assume you just get booted

wheat mesa
#

There's certain disconnect opcodes that are deemed as unrecoverable, which requires an entirely new session as opposed to continuing the previous one

wooden ember
#

fair enough, also i discovered that event fires when I restart the client so yeah they must have just migrated from disconect to shardDisconnect at som point

#

makes sence though

#

why have two of the same events

#

its the same for reconnect ,error and resume

#

also i desovered why my reload command was causing my bot to multiply, it was the fact that i was rebindinf the event withough unbinding it

#

idk how to unbind it though lol

wheat mesa
#

shardDisconnect likely provides more information about the shard itself rather than the normal disconnect event

wooden ember
#

there is no disconnect event anymore

#

its not in the docs

wheat mesa
wooden ember
#

but im using an event handler

wheat mesa
#

It does the exact same thing as .on, just only gets fired once

wooden ember
#

or do i just do client.once("fileName.js")

wheat mesa
#

No

wooden ember
#

lol

wheat mesa
#

It’s the exact same thing as .on

#

Just a two letter difference

#

Everything else about it is the same except for the way it gets handled internally

wooden ember
#

but how would i incorparate that though?

#

atm i jsut have bot.on(eventName, event.bind(null, bot)); and thats it for each file

wheat mesa
#

it’s the exact same thing

wooden ember
#

wait

#

im actually dumb

#

nvm

#

ok so now my reload events command is bricked

#

once i reload them i cant run commands anymore

#

asuming the event it nolonger fireing

wheat mesa
#

well that's not what I thought you were trying to do, don't use once for events you need to fire more than once

wooden ember
#

bruh thats why i said i was using an event handler

#

is there a way to unbind the old events?

cursive musk
#
var http = require('http');

http.createServer(function (req, res) {
  res.write("I'm alive");
  res.end();
}).listen(8080);
#

Would a script like this work for a bot?

#

A keep alive script

solemn latch
#

I dont see why not

wooden ember
#

how does client.off work?

#

will that remove the listeners that where set for the event handler?

cursive musk
#

tried it

wooden ember
#

why do you need a keepalive thoough? or are you using some free host that needs constant activty or somthing

#

idk how any of that stuff works but just curious

solemn latch
wooden ember
#

ah fair enough

cursive musk
#

also not even uptimerobot dosent work on repl

wooden ember
#

probably they fixed that work around then

#

also oof ima sleep its 2am

#

gn

proven escarp
#

@wheat mesa Is there a modal submit event or is it only considered an interaction?

#

Can't seem to find anything about it in the documentation of discord.js

wheat mesa
#

it's an interaction

proven escarp
#

Alrighty thanks!

wheat mesa
proven escarp
#

Thank you!

brittle shore
#

Hello, I am basically redoing my bots code fully to be full on only slash, Its in 60+ servers and was wondering if anyone had an idea on how I can alert the other servers its in on they will need to reinvite the bot with the slash scope invite link to make the bot work. once I release the new update.

Thanks in advance

#

That doesnt violate discord tos and top.gg tos

civic scroll
#

staff or everyone, which ever worked

boreal iron
boreal iron
#

Also you should be quick to switch over your stuff

#

The message content won’t be available anymore in September

#

(as long as your message doesn’t include a bot mention)

celest gate
drifting cairn
#

read the type error

iron crescent
#

Did you upgrade to V14 without changing the intents stuff... The import is not intents anymore, its GatewayIntentBits

last tapir
civic scroll
lyric mountain
#

you need to, somehow, convert ur data to bytes before sending

#

now, you could technically convert the object to bytes directly and send that, but the receiver will only be able to reverse to object if they have the exact same version as you, and even then it's iffy

#

strings are a sequence of characters (read: 2 bytes per character), and can be easily encoded and decoded regardless of software version or even if they are the same program

#

you could use xml, csv, toml, yaml, html, whatever, JSON is just the standard way of transferring serialized data

wheat mesa
#

Computers do operations with binary numbers with an electrical signal of either on (1) or off (0), so everything eventually has to be represented as bits and therefore bytes at some level

iron crescent
#

What would be the best db for a leveling system, would need a quick and fast db

iron crescent
#

mango

earnest phoenix
#

simple

#

mongo****

iron crescent
earnest phoenix
#

mango 😂

iron crescent
iron crescent
earnest phoenix
#

yea its simple, free, quick

#

perfect for beginners/easy projects

iron crescent
#

What's the rate limit?

#

For queries

earnest phoenix
#

i cant remember off the top of my shmol noggin

iron crescent
#

oh lol

#

I'll just google it

earnest phoenix
#

lemme look

iron crescent
#

5000?

earnest phoenix
#

MongoDB is fine for simple operations and stuff, but if you're looking for scalibility, you should go for PostgreSQL

iron crescent
#

ooo

wheat mesa
#

Postgres is great, can confirm

#

Definitely has more of a learning curve than mongo though

iron crescent
#

Oh

#

I'm already using firestore rn

celest gate
earnest phoenix
# celest gate

The newer versions of discord.js require a higher version of Node.js, update your Node.js version

#

Better to update it to the latest LTS (currently v16.17.0)

earnest phoenix
#

Once you install nvm, run nvm install --lts to install the latest LTS release of Node.js

#

Hey there!

So I am making a website in Svelte and for some reason, the script tags come up highlighted in red saying that it could not find the @sveltejs/adapter-auto package imported from the config file..

I have the latest version of node and npm and tried to install the package, and I still have the error...

this has never happened before

#

any help is appreciated! and thanks in advance

#

Also, this shows when I run the website:

Not found: /
Error: Not found: /
    at resolve (file:///C:/Users/me/Desktop/code/rock-the-dock/.svelte-kit/runtime/server/index.js:3513:14)
    at async respond (file:///C:/Users/me/Desktop/code/rock-the-dock/.svelte-kit/runtime/server/index.js:3392:20)
    at async file:///C:/Users/me/Desktop/code/rock-the-dock/node_modules/@sveltejs/kit/dist/vite.js:1560:22```
earnest phoenix
#

Probably includes some hints as to what causes the issue

#

and there is a version of it.. so it is installed

earnest phoenix
earnest phoenix
civic scroll
#

just install react

spark flint
#

lol

earnest phoenix
#

just do this for me at this point

earnest phoenix
# earnest phoenix https://srcshare.io/62ffa93fa832bd7f21f435f3

Weird, some other people have also encountered this issue caused by some obscure reason, try closing the project in whatever IDE you're using, open a terminal and go to the project directory, and run npm ci, and finally reopen the project in said IDE

earnest phoenix
# earnest phoenix Weird, some other people have also encountered this issue caused by some obscure...

Okay so I just did that, and it got rid of the error in the IDE

But now the following is displayed on the website:

Not found: /
Error: Not found: /
    at resolve (file:///C:/Users/devin/Desktop/code/rock-the-dock/.svelte-kit/runtime/server/index.js:3513:14)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async respond (file:///C:/Users/devin/Desktop/code/rock-the-dock/.svelte-kit/runtime/server/index.js:3392:20)
    at async file:///C:/Users/devin/Desktop/code/rock-the-dock/node_modules/@sveltejs/kit/dist/vite.js:1560:22
#

seems like a vite issue?

civic scroll
#

viet issue

#

vite

#

so maybe vite config?

earnest phoenix
#

doesn't look like there is anything wrong:

import { sveltekit } from '@sveltejs/kit/vite';

/** @type {import('vite').UserConfig} */
const config = {
    plugins: [sveltekit()]
};

export default config;
earnest phoenix
celest gate
earnest phoenix
# celest gate

To destruct properties and methods from something in JavaScript, you must use {}, not ()

#

I would recommend learning JavaScript fundamentals before making a Discord bot with it

earnest phoenix
#

There are a lot of videos and I think even a "bootcamp" on youtube

#

Or, you can pay for courses, but there are a plethora of free alternatives to doing that :)

civic scroll
celest gate
#

thanks

civic scroll
#

i learnt js from that

feral aspen
#

I have a quick question, what's the difference between express.js and node.js.

#

I haven't really understood the real difference.

celest gate
civic scroll
#

node.js is a runtime

civic scroll
celest gate
#

content

civic scroll
#

???

feral aspen
civic scroll
#

what do you think express.js runs on?

#

browser?

earnest phoenix
#

ExpressJS needs Node.js to run, basically; or a decent implementation of it

feral aspen
#

How about react.js? You don't need node or do you?

civic scroll
#

you need browser

#

and react compiled esm code

#

but for most options react is rendered on the server

#

so nodejs again

feral aspen
#

I'm honestly confused on whether I should use express.js or react.js.

earnest phoenix
#

Basically everything on https://npmjs.com/ that uses Node.js-specific APIs and such requires Node.js

earnest phoenix
#

cause i tried an nothing came back

#

Yes you just need to log it with console.log(), but since you didn't get anything in the console that means that file isn't even executed

#

Which can mean that's not what the error is caused by

earnest phoenix
feral aspen
#

Sweet. 👍

earnest phoenix
#

i need to learn react at this point

#

You can get the exact difference just by going to https://npmjs.com/package/express and https://npmjs.com/package/react

civic scroll
#

oh

#

someone said react

earnest phoenix
#

sayuri 💀

civic scroll
#

there are also berry and dylan

#

berry knows react really well

#

dylan knows both react and angular

earnest phoenix
#

I JUST SPILLED COFFEE ON MYSELF FOR THE 3RD TIME THIS WEEK

civic scroll
#

💀

earnest phoenix
#

anyways

civic scroll
#

i'm like dylan but worse

earnest phoenix
#

time to recode website because ig svelte got update

#

thats why errors

#

Put on your React gloves

#

me?

civic scroll
#

blub

#

think carefully

earnest phoenix
#

time to learn react and make a website with it when the website is supposed to be done today

civic scroll
#

since

#

nah

#

react

#

is bloated

#

in a sense

earnest phoenix
#

:glasses:

civic scroll
#

since if you use react, you will also integrate it with animations

#

which makes it even more bloated

earnest phoenix
#

yes, because you will hold me at gunpoint if i dont

civic scroll
#

so not mobile-performance friendly

#

since react does virtual dom

#

at this point do angular

earnest phoenix
#

google

#

google = angular made

sick agate
#

or none

earnest phoenix
#

just html lol

#

or wix lol

#

but they want it as cheap as possible and already pay for a wix site

civic scroll
#

actually

#

blub

earnest phoenix
#

Ben Awad when you mention Angular:

civic scroll
#

for lightweight

#

do svelte

#

or vue

earnest phoenix
#

might just switch back to vue tbh

#

idk

civic scroll
#

nvm my fav website planned its next UI version to use react

earnest phoenix
#

💀

civic scroll
#

@earnest phoenix your pick

#

i can help on react / angular

earnest phoenix
#

which is more lightweight

civic scroll
#

react

earnest phoenix
#

then react

#

and

civic scroll
#

angular is a whole framework

earnest phoenix
#

Or just use the yet another web framework (this is a joke)
https://www.youtube.com/watch?v=gxBkghlglTg

Astro version 1.0 just launched giving developers a way to build server-rendered websites with any JavaScript framework. It uses the islands architecture and partial hydration to deliver fast apps with frameworks like React, Vue, Svelte, and more.

#programming #javascript #TheCodeReport

🔗 Resources

▶ Play video
civic scroll
#

also

#

i can ask voltrex

#

how to abuse v8

#

for more performance gain

earnest phoenix
#

only issue is

#

im at work

#

so

#

if we vc

#

i apologize about horrible mic

#

or is there a website or something that I can go to that is a good intro?

civic scroll
#

you mean as in intro animations?

earnest phoenix
#

to react

civic scroll
#

idk

#

💀

#

React hooks provide a highly-efficient was to tap into framework features and organize reactive logic. Learn how use every built-in React hook https://fireship.io/courses/react-next-firebase/

00:00 Why React Hooks?
02:20 useState
03:50 useEffect
05:55 useContext
06:58 useRef
07:58 useReducer
09:27 useMemo
10:12 useCallback
10:40 useImperativeHa...

▶ Play video

React is a minimal on the surface, but it’s actually a highly complex JavaScript UI library with many potential pitfalls. In this tutorial, we look at 10 antipatterns in React, along with tips and tricks to improve our code. https://fireship.io/courses/react

#react #js #CodeThisNotThat

🔥 Use this discount code to get 33% off Fireship PRO:

hh...

▶ Play video

React is a little JavaScript library with a big influence over the webdev world. Learn the basics of React in 100 Seconds https://fireship.io/tags/react/

How I make these Videos https://youtu.be/N6-Q2dgodLs

#react #webdev #100SecondsOfCode

Install the quiz app 🤓

iOS https://itunes.apple.com/us/app/fireship/id1462592372?mt=8
Android https://p...

▶ Play video

Learn React.js from scratch and use one of the most popular frontend libraries to build amazing web apps!
Join the full React.js course: https://acad.link/reactjs

Check out all our other courses: https://academind.com/learn/our-courses


• Go to https://www.academind.com and subscribe to our newsletter to stay updated and to get excl...

▶ Play video
earnest phoenix
#

i forgor my earbuds

pine nova
#

can a socketio server and an expressjs api server be in the same node app or must be in different apps?

wooden ember
#

i mean as long as the variable and constant names dont conflict i dont see why not

solemn latch
#

and the ports

wooden ember
#

oh yeha

#

that too

solemn latch
#

actually, can two unique protocols use the same port?
No right? 🤔

#

I've never tried

#

or thought about it

wooden ember
#

they can send data down the same port aslong as its not locked i think but it will cause all manner of issues most likely

#

but then it depends how the difernt thing manage packets that they dont recognise shoudl just be ignored but i know most things steer clear of resusing ports so theres probably a reason behind that

#

also bruh tryed to use the d.js event handler from the docs since that works difernetly from mine so i can fix my issues but now its more broken

#

reeeeee

solemn latch
#

I just realized to make a ws connection it uses http for the handshake anyway

wooden ember
#

yeah

#

i thought that was odd but eh its a well known protocoll so idk kinda makes sence

solemn latch
wooden ember
#

oh damn so you can do that

#

pretty neat

#

anyone know an alturnitive to using event.bind in an event handler?

#

that works fine but means i cant reload the event files

#

unless ther is a way to "unbind" it

#

ooo might be able to use client.removeAlListeners(); to unload them

#

will try that

#

yup works now hellyeah

#

now to get aliases to work

wooden ember
#

bruh so i wanted to only delete the listeners i created but when i do that it just says the listener argument must be a function but idk how to do that and there is almost no info on it other than to format it something like: ```js
bot.removeListener("message", client._events.message[0]);

pine nova
pale vessel
wheat mesa
#

Also pretty much never ever ever use variables that start with _, those are private variables and should not be touched by external code

#

As per encapsulation rules

quartz kindle
#

i use private node shit everywhere

wheat mesa
#

You’re a wizard though

#

That’s different

quartz kindle
wheat mesa
#

He’s trying to unbind all of his listeners and then rebind them for a dynamic event reload command afaik

quartz kindle
#

yeah but are the listeners the same reference in both bot and client?

earnest phoenix
#

@earnest phoenix i fixed the issue

i forgot an s in "preprocess"

lament rock
civic scroll
#

you better use typescript

earnest phoenix
#

not for this ismple of a project

#

I just need to copy over the code

#

and then

#

do

civic scroll
#

typescript.

earnest phoenix
#

I DONT WANNA CONVERT IT

#

too much work and I only have 30 mins left til im out of work

wheat mesa
#

Javascript users when they completely fuck up every bit of syntax possible and it still compiles :troll:

iron crescent
#

literally

#

js is awesome

wheat mesa
#

js is awesome but I don’t like how loose it is which is why I use typescript instead

iron crescent
#

yeah

#

Well I still like use vanilla js

#

Although the type system is pretty useful

quartz kindle
#

(me who uses strictly typed js without ts) :^)

iron crescent
#

Lol

quartz kindle
#

in case you're wondering, this is how it looks like

#

its basically ts but in comments, so no need to compile

iron crescent
#

Ooooh

#

I needa learn thia

#

this*

#

I mean

#

I'll just use ts instead lmao

#

Ik ts basics

#

Interfaces, vars etc...

quartz kindle
#

the thing i dont like about ts is the compilation

#

which makes the code you write different from the code you actually run

#

so then you need a bunch of extra tooling like sourcemaps and shit to debug

iron crescent
#

SAME

#

That's why I needa learn this lmao

wheat mesa
#

Ts is JAVAscript

#

😉

iron crescent
#

Lol

#

But you needa use a cmd to compile it and you can't run it directly like node index.js

wheat mesa
#

Just have an npm start command

iron crescent
#

Ig that works too

#

Another excuse: file size /s

lament rock
#

with ts, you can compile to min.js

iron crescent
#

damn that excuse failed too

#

Gotta look for more

solemn latch
rare fern
#

nala

solemn latch
#

Hi

rare fern
#

do you have any idea when my bot will be approved dude?

rare fern
gilded plankBOT
#

@rare fern

The average up-to-date approval times are stated [here](#support message).

This does not mean it will take the same amount of time someone else's bot took to be reviewed and does not mean your bot is guaranteed to be reviewed within that time frame.

There is no exact time for how long bot approval will take.

There is a queue and you're not first, nor are you last.

Read more about our reviewal process here

rare fern
#

Do I press the top or the bottom one?

solemn latch
#

The top one

ancient nova
#

anyone know of any good oauth2 tutorials?

earnest phoenix
#

JSDocs can be pretty frustrating as they take way longer to write and debug

iron crescent
earnest phoenix
#

Although we're still looking forward to the erasible type annotation proposal by Microsoft, it has a lot of edge cases and the issue of destroying backwards compatibility in a way

#

I just hope that nothing goes too wrong with the implementation

viral wasp
#

Why can’t I vote

earnest phoenix
sudden geyser
#

there is no democracy

earnest phoenix
#

Did GitHub disable their image generation for their metadata embeds or something

sudden geyser
#

yes

rustic nova
sudden geyser
#

that's a user

rustic nova
#

ye

iron crescent
#

that's a repository

rustic nova
#

That is supposed to generate the image embed

iron crescent
#

Yeah

sudden geyser
#

does anyone ever use this

ancient nova
#

I've been putting it off for too long tbh, gonna finally finish my anti raid system

#

just a couple things left to do

earnest phoenix
#

Looks pretty cool on metadata embeds

ancient nova
#

@earnest phoenix would you be up for stress testing my anti raid once finished?

earnest phoenix
#

Unless you lower the threshold in some way

ancient nova
#

so we could adjust that

earnest phoenix
#

Alright

ancient nova
#

I'm also probably going to try and integrate selection menus to my config command

#

since I'm going to have a whole lot of modules

iron crescent
ancient nova
#

do channelCreate and channelDelete events get emitted in DMs?

lyric mountain
#

how exactly would that work?

ancient nova
inland maple
#

how do you add links into a top.gg description

earnest phoenix
inland maple
#

how

#

like the clickable links

earnest phoenix
#

You mean hyperlinks?

inland maple
#

yes

ancient nova
#

@earnest phoenix how exactly do I check the size of a collection?

earnest phoenix
#

[Text goes here](URL goes here)

earnest phoenix
inland maple
#

also how do i add make different text sizes

earnest phoenix
inland maple
#

so you literally add <p style='font-size:somesize;'>text</p>?

earnest phoenix
#

Yes

inland maple
#

and you add <br> to put line breaks?

earnest phoenix
#

Yes

inland maple
#

interesting...

#

does it create a button if i add <button>?

earnest phoenix
#

It should

pine nova
#

does script tags work in topgg description?

lyric mountain
#

no

pine nova
#

😔 sed

ancient nova
#

okay the channels are done

#

it actually works quite well not gonna lie

#

next up will be the roles

#

may be a little bit harder since I'm going to have to store all of the permissions somewhere...

#

is there a collector for the action row?

quartz kindle
#

messageComponentCollector

ancient nova
quartz kindle
#

theres only one lol

#

all of those are the same thing but on different contexts

ancient nova