#development
1 messages · Page 27 of 1
They are not static files
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
then convert them to some compress format like rar or zip
it should
that doesnt ya know, help much
That tells you exactly what to do… fetch the user with client.users.fetch() and then access the property that contains that information
yeah, the client.users.fetch() is what i was missing
inb4 cannot read property of undefined error
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
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
oh wow thats news to me
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
console.js line 18 col 24
that would be const LineOfCode = ms(inter.options.getString('Code'));
is it the capital?
yeah lol thanks for that by the way i didnt know about that
ms gets mad when you don’t give it something
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
This is likely caused by an ill-formatted response, or not sending a response at all.
defo an an ill-formatted response because i had no clue of what i was doing
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
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.
yes it does i use it for everything else
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.
You aren't even sending a response back
lol thats the part im stuck on
dumb it down for me like ur explaining it to a 7 year old
inter.reply({ embeds: [embed] }); right?
Yes
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.
ooo that looks good
i will give it a go
That doesn't change anything 
Just makes it prettier. Won't change functionality lol
Also interaction.options isn't a string, so be mindful of that
yeah but atm i have it laid out in a very long, disgusting way
interaction.options?
inter.options in your case
it's a nullable
tip: error message is the most helpful friend you can have during debugs
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'})
interaction.options is basically
https://discord.js.org/#/docs/discord.js/main/class/CommandInteractionOptionResolver
Although. Ternary operations are ... personal preference
const embed = new EmbedBuilder({
color: '#5679EF',
title: "💻 Console",
author: {
name: client.user.username,
iconURL: client.user.displayAvatarURL({ size: 1024, dynamic: true })
},
description: `the test ${inter.options == 'test' ? 'worked' : 'failed'}`
});
for my case
Didn't know you could do that. I hate functional programming so yeah I'd do that too 😛
Well there's no reason to use the embed builder if you're just manually defining those embed properties
ima pass function inside classes method arguments just to make you mad
Because it ends up being the same thing regardless of the embed builder
:triggered:
i was meant to use MessageEmbed
it's for something to add later on
The MessageEmbed class was renamed to EmbedBuilder
I'm about to post C# code and make you mad 
like later on i wanna add something to the thing i can just call embed.setWhatever
Who needs libraries when you got HttpClient 😛 https://pastie.io/hfzhog.cs
this has defo helped a lot
the object init just makes the code cleaner and reduce number of function calls
that's my taste
what i was just formatting the code 💀
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'
Well yes but that's not what I meant, I mean like instead of passing the embed data that you've set manually to an embed builder is unsafe and non-traditional, which can cause unexpected issues
the unexpected is that we will play uno on xbox 

one small issue with this is that its just saying failed over and over again
reason is
As I said, inter.options is not a string
inter.options was not 'test'
ohh i see
It's an object containing helper properties and methods to work with the options you've received with the interaction
^
i'm just losing my sanity rn
only issue with that site is that i dont speak developer language and understand 0% of what its saying
What options have you set to your console command? By options I'm talking about the arguments
/console code: test for example, code being an option
arguments as in 'random thing' ? 'worked' : 'failed'}?
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
What are you even trying to compare against the random thing string?
I honestly have no idea what you're doing
nor do i
i am new to all of this
i just copied it from what the other person said lmao
Also dynamic is no longer an option in discord.js v14, it's automatically applied
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
oh alright i will get rid of it
v14 is a pain in my ass
Then why do you have an option called code?
i dont know tbh i just put it there as a placeholder completely ignore the names of things i just do it to remember what i was doing previously i am very dodgy like that
ignore the names of things or if it helps i can temporarily rename everything lmao
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
getting the value of the argument is currently what im failing at im fairly sure either that or i just cant wrap my brain around v14
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
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?
Yes
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
uhh am i doing something wrong here
This one is plain js
i am using electron
is that in the main js file?
Yeah, it must've been in the render file
as it's the 'frontend'
electron is so strange but satisfying at the same time
document only exists inside the render process, not in the main process
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?
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
you can try using win.webContents.executeJavaScript()
win.webContents.executeJavaScript(`
document.getElementById("code1").innerHTML = ${code1}
`)
Owh i will try!
I though that i could make the main send data over to the render.js
using win.webContents.send
afaik thats basically the same thing, but it already runs/evals it for you
And this should be in the main file>?
yes
this is why i like nwjs more than electron
nwjs has node built into the window, there is no separate process
That would be pretty good yeah
might have a look at nwjs
This actually worked lol
poggers
thanks daddy tim
Amyone have official discord mod server?
nvm it didn't work
I was looking at some pre-set values lol
This doesn't change any data
me when
Owh wauw it does
😭
but it only can send 1 content per request
please
just think
it sent but one content
why
look at the code, think before asking questions
no
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
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
boolean means true or false
i thought that was off lmao
idk why they said that
maybe they didnt understand?
you're probably looking for choices
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
To save everyone's eyes, can you use js in your code block.
i have no idea how to do that
actually i lied i might
oh yeah i do oops
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?
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
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.
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)
Actually I can make the body relative and the nav absolute
🤔 is your nav not in the body?
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
Well, the entire body is relative. but the nav is absolute
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
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.
for example: https://i.woo.pics/f88a91ecba.mp4
Ignore the fact the sites super ugly thats just because I'm not a designer not because the method
looks good
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?
Well, you will get that in the interactionCreate event
once an choice is chosen it will be sent along the interactionCreate event iirc
wee is my favorite page my site
Ambulance goes wooweewoowee
cute
(✿◡‿◡)
let sleep = null```
SyntaxError: Unexpected token in JSON at position 0
Why is this
In node module
Anyone can help me
Instantly
Show error
Wait
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
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)
please read
because its coming where i didn't change anything in code
What's petitio?
i don't know even this package also not installed
It is, else it wouldn't appear there
Some lib ur using depends on it
Show the rest of the error
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)
see
Is that all of it?
yes
You have some sort of special unicode character or something in your JSON that isn't valid JSON format
Do you use any kind of library that uses json?
Like any api wrapper (except d.js or topgg) or gasp file-based database?
Erela
Erela.js
Ok so, when I read "lavalink client" the very first question that comes to mind is:
Are you playing youtube/spotify music?
Yes
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
Ok so I have to change ip?
Well, first you need to make sure that's the issue
Also you don't simply "change ip", at least not for free
me when json issue
One of the reasons why I dropped the music module entirely
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
Getting invalid token at index 0 on petitio, he's using erela.js
for discord client?
so music player inside discord client
Worthy to note last erela update was an year ago
that json issue
Judging by the time he took, he didn't change ip at all
ip has nothing to do with this
Bugd eodm
we didn't even know what string caused json error
Internal stuff btw, happens inside node modules
it's possible that
it made http request
and tryna parse the response
it expected json
Yes, that's why I said ip issue
Both youtube and spotify have non-json error pages
but we don't know what the response looks like
moment
but he still didn't get it
i cried
Well, they could go inside the module and add a breakpoint there
i said
And hope for it to happen quickly
In potito
Indexjs
Potito
add a project-wide breakpoint
But yes, specifically petitio/dist/index.js, line 30
literally tick this box
Sayu, #development message
the thing is
It happens async, don't think breakpoints will catch that
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
also i kinda guess that was the result call from fetch api
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
okay now i did
but thing is that Test bot is working but main bot not working
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
},
],
What exactly is your issue
{
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
this is the problem 👆
{
name: "warn",
description: "to set warn",
type: ApplicationCommandOptionType.String,
required: true,
==> // i want to add owner and staff as a option after choose warn
},
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
hey guys
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
because there are no bots with slashes allowed
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?
the error is by using of erela.js
and the erela.js in outdated
as everyone is facing same error which i got earlier
well yes, I said yesterday it was last updated 1 year ago
so now what i can do?
for temporary fix
shoukaku is their but i need time to migrate
why is your image so painfully small
but any temporary solution?
there's no thing like "temporary solution", it doesn't work like that
uf
I used sharex sorryu
but well, no, it doesn't update automatically
u need to update it inside an on-click event
how can i make this make a row when has no more space?
grid or flow layout
i am using flex
doesn't matter
now u need to adjust flex alignment
But how am i going to maintain the same embed then
could i define the embed by messageId?
yes?
and then do embeds: [embed]?
also make sure not to update immediately
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?
no
fuck
embeds are final once sent, u either update the message entirely or u don't update at all
thank you i used align-content: flex-start;
If i update a message, will the id change?
get the message, get the message's embeds, push new embed to embeds collection, make it an array, and put again in embed: []
also I repeat, make sure you don't update the message instantly
unless you enjoy having your bot spam the ratelimit
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
make a self-replacing queue system, and only propagate the new values once the timer ends
tf ur trying to do?
its not giving error on without pm2 start
Somewhat putting two pfp on a image with jimp
can't u use canvas?
when i am going to start its by pm2 its giving errors
I think you should use @napi-rs/canvas, discord has it in their guide
I don't know mongoose
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?
Yeah i will give it a go
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
Yes you should
use gimp/paint/photoshop/whatever to make your scaffolding, then check the coordinates for each thing
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
Yeah thanks then i am using canvas
it's the exact same error u showed yesterday
are u still using erala?
yes
but this error not came when i start bot in screen
well I don't use pm2 so...
Are you sure that you are updating the files?
And using pm2 restart correctly?
yes
Try to reset your json and use pm2 restart
Try starting the bot with the node cmd
try it out again
pm2 has nothing to do with that json file.
Only thing that could be is that he hasn't restarted his running client correctly
Ig
I restarted 3 times
have you reset your json files before doing so?
Check the json
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
Yes we can do that
note the json file isn't a file
Hey how do i actually fetch the message by id in djs v13?
it's a response from some api (petitio lib)
get the channel, fetch the message from it
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
the channel is interaction.channel
then fetch the message from it
Yeah but my question is... how do i fetch the message
interaction.channel.fetch()?
check the docs
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
To fetch a message/messages from a channel, you must use the <TextBasedChannel>.messages.fetch() method
You can either pass the message's ID, or pass other options to fetch messages depending on said options
yes
am not starting pm2 from json file
well you obviously wasn't
Check your lib versions and see if the match
It might be a broken version that your pm2 is running
petitio lib
Wait a second, why are you even using Petitio instead of the traditional HTTP clients/libraries?
Ugh, ErelaJS had to use something inconsistent and non-traditional didn't it
Lol
guys how do i disable line wrap in nvim
thanks
some typing magix for you guys
why
Lmao
rushing to port all the legacy code to slash commands
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
In canvas you have to give dimensions if you are using an image as wallpaper ?
(background)
see docs
also keep in mind that doing any kind of resizing will effectively destroy the image quality unless u tweak the interpolations settings
when I used it it didn't really destroy the image quality...
what's the version of discord.js and discor-player you are using?
17.7.2
that's node
oh wait
"discord.js": "^13.1.0",
"discord-player": "^5.1.0-dev.1636095464.54bb4b0",
hmmm
oh
it maybe possible is that discord player tryna use discord v14 intent contructor
so do i upgrade my discord.js to v14 ?
ye
in discord v13 it's Intents
version 14 renamed it to IntentBitFields
how can I filter an array of objects by a state and remove that object when I find it?
In what programming language?
typescript
But what do you mean by "state"? Can you elaborate on that?
i think i know how to do it thank you anyway
I need the content intent for other stuff so I'll keep the content commands
I will, however maybe try adding some slash commands
maybe
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
my only argument: i'm biased towards clis 
well I still prefer content commands for my own server and if others don't like it I'm saying I could add slash
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)
use those functions
context.beginPath
context.arc
context.endPath
context.clip
closePath()*
Exactly where?
After declaring context?
i forgor 💀
After the first arrow right?
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()
Essentially the same as cannot read property x of undefined
discord-buttons is also deprecated. Don't use it lmao
ok
also the first part means you're using unsafe libraries.
2 of them being critically unsafe(potentially giving remote access to your process/server)
you need to fetch the owner
const owner = await guild.fetchOwner()
same thing
yes, since you're using await
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: ` Info`, value: `Detailed help for an order: \`${PREFIX}help [commands]\` \nFor more help, visit our` },
{ name: ` 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: ``
},
{
label: `Info`,
value: `info`,
description: `See info commands`,
emoji: ``
}
])
),
];
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
is there a way to change/ set the connection bit rate to a discord vc using d.js?
VoiceChannel#edit(GuildChannelEditOptions). GuildChannelEditOptions is an object and can include the bitrate property which is a number.
Documentation is available here: https://discord.js.org/#/docs/discord.js/main/class/VoiceChannel?scrollTo=edit
looks as if the reply was auto-generated
how could i access the data argument from inside the ejs tag? currently it just says data is undefined
Try to create the component collector for the message itself not the message.channel and log the interaction.values property inside
ah nice thx
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
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
like the client disconnect event?
I think it would still work because it would be considered one shard.
true
Only one way to know 🤷♂️ Try it!
will do
so shardDisconnect doesnt work however shardError does start spewing out errors
shardReconnect just fires alot of times
So disconnect only fires after reconnecting fails.
oh ok
I'm not sure how many attempts discord does
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)
You seem to have a lot of internet reliability issues
also what is the "apiRequest" event for? liek what request fires at the start and then at random points in the day
Have you tried using a host with more reliable uptime instead of coming up with solutions with reconnecting?
Probably for any requests sent to the REST portion of the DAPI
yes i live in the middle of nowhere and am 1 of two subscribers on an adsl phone line
You should probably look into a proper host, free or not
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
it fires when your bot sends a request to discord.
ie fetching a user.
responding to interactions doesnt count afaik
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
There's certain disconnect opcodes that are deemed as unrecoverable, which requires an entirely new session as opposed to continuing the previous one
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
shardDisconnect likely provides more information about the shard itself rather than the normal disconnect event
You can just do client.once('eventName') because that just binds it, then once it gets fired, it’s unbound again
but im using an event handler
It does the exact same thing as .on, just only gets fired once
or do i just do client.once("fileName.js")
No
lol
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
but how would i incorparate that though?
atm i jsut have bot.on(eventName, event.bind(null, bot)); and thats it for each file
it’s the exact same thing
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
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
bruh thats why i said i was using an event handler
is there a way to unbind the old events?
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
I dont see why not
how does client.off work?
will that remove the listeners that where set for the event handler?
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
are you activly sending requests to the keep alive endpoint?
repl free plan problem
ah fair enough
hmm it used to work fine before
also not even uptimerobot dosent work on repl
@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
it's an interaction
Alrighty thanks!
Thank you!
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
use the existing code, send the message in targeted channels of each server
staff or everyone, which ever worked
A while back this scope should have been auto assigned by Discord on every server - I don’t know exactly if this has been a thing for verified bots only or for any bot.
But I’m sure you can figure that out.
thanks
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)
read the type error
Did you upgrade to V14 without changing the intents stuff... The import is not intents anymore, its GatewayIntentBits
same question for this, why are we stringifying everything
because you are sending shit over internet
you see, there is only ONE type of data you can use when exchanging data: bytes
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
There’s only one kind of data technically, bytes 😉
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
What would be the best db for a leveling system, would need a quick and fast db
mango
free
mango
mongo*
mango 😂
Okayy
Yeha lmao
i cant remember off the top of my shmol noggin
lemme look
5000?
MongoDB is fine for simple operations and stuff, but if you're looking for scalibility, you should go for PostgreSQL
ooo
Postgres is great, can confirm
Definitely has more of a learning curve than mongo though
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)
how can i install in cmd ?
Since you seem to be using Linux, I would recommend installing a Node.js version manager such as nvm and use it to keep your Node.js version up-to-date
Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm/README.md at master · nvm-sh/nvm
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```
Make sure to run npm ls @sveltejs/adapter-auto, if it's actually installed it'll list the versions of it, if not then be sure to reinstall; additionally it's better to show us the import error directly
Probably includes some hints as to what causes the issue
and there is a version of it.. so it is installed
Can you show us your package.json file?
Easily share your source code with other developers.
lol
just do this for me at this point
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
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?
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;
What does sveltekit() return in your case? Try logging it
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
from where
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 :)
thanks
i learnt js from that
I have a quick question, what's the difference between express.js and node.js.
I haven't really understood the real difference.
express.js is a library
did you learnd hole 21 ?
node.js is a runtime
hole 21?
content
???
Is it like react.js or?
yeah it is
what do you think express.js runs on?
browser?
ExpressJS needs Node.js to run, basically; or a decent implementation of it
How about react.js? You don't need node or do you?
you need browser
and react compiled esm code
but for most options react is rendered on the server
so nodejs again
I'm honestly confused on whether I should use express.js or react.js.
Basically everything on https://npmjs.com/ that uses Node.js-specific APIs and such requires Node.js
sorry for noob question i am about to ask
but how would i do that? because it wouldn't be just as simple as doing a console.log(), right?
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
Express is a back-end framework for web-servers and such, React is a library for making UIs as it comes with lots of UI components and many others
Sweet. 👍
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
Fast, unopinionated, minimalist web framework. Latest version: 4.18.1, last published: 4 months ago. Start using express in your project by running npm i express. There are 63964 other projects in the npm registry using express.
sayuri 💀
there are also berry and dylan
berry knows react really well
dylan knows both react and angular
I JUST SPILLED COFFEE ON MYSELF FOR THE 3RD TIME THIS WEEK
anyways
time to recode website because ig svelte got update
thats why errors
Put on your React gloves
me?
time to learn react and make a website with it when the website is supposed to be done today
:glasses:
since if you use react, you will also integrate it with animations
which makes it even more bloated
yes, because you will hold me at gunpoint if i dont
so not mobile-performance friendly
since react does virtual dom
at this point do angular

or none
just html lol
or wix lol
but they want it as cheap as possible and already pay for a wix site
Ben Awad when you mention Angular:
nvm my fav website planned its next UI version to use react
💀
which is more lightweight
react
angular is a whole framework
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
- Astro Launch Blog https://astro.build/blo...
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?
wym
you mean as in intro animations?
to react
ah\
idk
💀
@earnest phoenix https://www.youtube.com/watch?v=TNhaISOUy6Q
https://www.youtube.com/watch?v=b0IZo2Aho9Y
https://www.youtube.com/watch?v=Tn6-PIqc4UM
https://www.youtube.com/watch?v=pgAvVxowaYU
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...
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...
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...
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...
i forgor my earbuds
can a socketio server and an expressjs api server be in the same node app or must be in different apps?
i mean as long as the variable and constant names dont conflict i dont see why not
and the ports
actually, can two unique protocols use the same port?
No right? 🤔
I've never tried
or thought about it
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
I just realized to make a ws connection it uses http for the handshake anyway
yeah
i thought that was odd but eh its a well known protocoll so idk kinda makes sence
also, socketio can attach using express.
https://socket.io/docs/v4/server-api/#serverattachhttpserver-options
so they could share ports.
Server
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
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]);
so i have to make another app for a websocket server?
Provide the same function you used for the event as the second parameter
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
too late
i use private node shit everywhere
youre removing client events from bot?
He’s trying to unbind all of his listeners and then rebind them for a dynamic event reload command afaik
yeah but are the listeners the same reference in both bot and client?
@earnest phoenix i fixed the issue
i forgot an s in "preprocess"
I would suggest just use the lib I made, but 
inhales
you HEADASS
you better use typescript
not for this ismple of a project
I just need to copy over the code
and then
do
typescript.
I DONT WANNA CONVERT IT
too much work and I only have 30 mins left til im out of work

Javascript users when they completely fuck up every bit of syntax possible and it still compiles :troll:
js is awesome but I don’t like how loose it is which is why I use typescript instead
(me who uses strictly typed js without ts) :^)
Lol
in case you're wondering, this is how it looks like
its basically ts but in comments, so no need to compile
Ooooh
I needa learn thia
this*
I mean
I'll just use ts instead lmao
Ik ts basics
Interfaces, vars etc...
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
Lol
But you needa use a cmd to compile it and you can't run it directly like node index.js
Thanks!
Just have an npm start command
with ts, you can compile to min.js
I've really been enjoying using this.
nala
Hi
do you have any idea when my bot will be approved dude?
hi <3
@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
Do I press the top or the bottom one?
The top one
anyone know of any good oauth2 tutorials?
And then there's me rewriting this to TS
https://github.com/VoltrexMaster/protonug
An installer and updater for the GE (GloriousEggroll) custom Steam Proton builds. - GitHub - VoltrexMaster/protonug: An installer and updater for the GE (GloriousEggroll) custom Steam Proton builds.
JSDocs can be pretty frustrating as they take way longer to write and debug
I've been using it too for code completion, AND ITS AWESOME
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
Why can’t I vote
ECMAScript proposal for type syntax that is erased - Stage 1 - GitHub - tc39/proposal-type-annotations: ECMAScript proposal for type syntax that is erased - Stage 1
there is no democracy
Did GitHub disable their image generation for their metadata embeds or something

yes
Damn
that's a user
Main Page. Contribute to Hopefuls/Hopefuls development by creating an account on GitHub.
ye
that's a repository
That is supposed to generate the image embed
Yeah
does anyone ever use this
I've been putting it off for too long tbh, gonna finally finish my anti raid system
just a couple things left to do
Some do, I do as well
https://github.com/VoltrexMaster/opteric
Looks pretty cool on metadata embeds
@earnest phoenix would you be up for stress testing my anti raid once finished?
A single person for anti-raid testing? That wouldn't really work
Unless you lower the threshold in some way
I'm probably going to create some settings system for detetcion (eg. 2 channels deleted in 3 seconds)
so we could adjust that
Alright
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
Lmao no
do channelCreate and channelDelete events get emitted in DMs?
how exactly would that work?
just making sure
You just... add them
You mean hyperlinks?
yes
@earnest phoenix how exactly do I check the size of a collection?
[Text goes here](URL goes here)
also how do i add make different text sizes
You can use HTML and use p tags with the font-size style to change the size of the text
so you literally add <p style='font-size:somesize;'>text</p>?
Yes
and you add <br> to put line breaks?
Yes
It should
does script tags work in topgg description?
no
😔 sed
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?
messageComponentCollector
which one is it?
https://discord.js.org/#/docs/discord.js/main/search?query=messageComponentCollector
soooo this one?
https://discord.js.org/#/docs/discord.js/main/class/Message?scrollTo=createMessageComponentCollector
yeah




