#development
1 messages · Page 2077 of 1
do you know how to embed images into the long description?
for example, u mention this but gives no examples
nah just saying thats probably why it doesnt get many invites
people click and get blinded
anyone could say "never seen commands" but what commands?
@ancient nova
You can achieve this using Markdown or HTML in your bot's description. You can ask in #development for help or use this HTML and Markdown cheatsheet for more resources.
oh and remember the first rule of advertising: the first 20 words are the ones that'll define whether you'll grab the viewer's attention or not
Also not going to hate on the name, but "Anonymous Hater" gives off a weird vibe imo
Uncaught DiscordAPIError DiscordAPIError: Invalid Form Body
data.components[0].components[5]: The specified component exceeds the maximum width
data.components[0].components[6]: The specified component exceeds the maximum width
data.components[0].components[7]: The specified component exceeds the maximum width```?
character limit
new MessageButton()
.setCustomId('0week')
.setLabel('Warn')
.setStyle('PRIMARY'),
new MessageButton()
.setCustomId('1day')
.setLabel('1 Tag')
.setStyle('PRIMARY'),
new MessageButton()
.setCustomId('2day')
.setLabel('2 Tage')
.setStyle('PRIMARY'),
new MessageButton()
.setCustomId('3day')
.setLabel('3 Tage')
.setStyle('PRIMARY'),
new MessageButton()
.setCustomId('4day')
.setLabel('4 Tage')
.setStyle('PRIMARY'),
new MessageButton()
.setCustomId('5day')
.setLabel('5 Tage')
.setStyle('PRIMARY'),
new MessageButton()
.setCustomId('6day')
.setLabel('6 Tage')
.setStyle('PRIMARY'),
new MessageButton()
.setCustomId('1week')
.setLabel('1 Woche')
.setStyle('PRIMARY')```
Doesn't look like i meet the limit right?
I couldn't decide on a better name
MAX 5 components per ROW
oowh bruhf
max 5 action rows
if I'm gonna change I need to do it right now cause my bot is a couple servers away from verification
Finding a name is hard. You could go for a name that matches a theme.
Like Mimu goes for a "cute" theme
i didn't make the rules lol
I know this may sound stupid but could anyone grab the screenshots for me?
I have a CSS script extension and it will look quite sketchy
Can't i create 2 rows then and add them to the embed?
i guess not right
how would i add mutliple rows? i suppose it needs to be on a different embed each time right
Would't a select make more sense when it comes to selecting days?
this is what i've done
In web dev you always say if there is more than 3 buttons, use a select
you simply add another row to the component
const row1 = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('0week')
.setLabel('verwarnung')
.setStyle('PRIMARY'),
new MessageButton()
.setCustomId('1day')
.setLabel('1 Tag')
.setStyle('PRIMARY'),
new MessageButton()
.setCustomId('2day')
.setLabel('2 Tage')
.setStyle('PRIMARY'),
new MessageButton()
.setCustomId('3day')
.setLabel('3 Tage')
.setStyle('PRIMARY'),
new MessageButton()
.setCustomId('4day')
.setLabel('4 Tage')
.setStyle('PRIMARY'),
new MessageButton()
.setCustomId('5day')
.setLabel('5 Tage')
.setStyle('PRIMARY'),
);
const row2 = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('6day')
.setLabel('6 Tage')
.setStyle('PRIMARY'),
new MessageButton()
.setCustomId('1week')
.setLabel('1 Woche')
.setStyle('PRIMARY'))
const embed1 = new MessageEmbed()
.setColor('GREEN')
.setTitle('Verwarnung- 1 woche options')
.setDescription(`Wähle mit wievielen Wochen der User bestraft werden soll!`)
.setTimestamp()
.setFooter({ text: 'Arcadia Henker | Strike'});
interaction.reply({ embeds: [embed1], components: [row1, row2] })```Like this lmao?
srry for the code bomb lol
dude for real
yeah?\
the first row has 6 buttons
oowh lmao
But yes it works like this
yes
You simply add those rows to the array of your components
But with the correct amount of buttons per row
I've updated, does it look better now?
Does anyone have an opinion on what I did?
Makes sense to make multiple rows like:
1d, 2d, 3d, 4d, 5
1w, 2w, 3w, 4w
And maybe a first row with common timeouts
5m, 15m, 30m, 1h, 12h
also 6h
eyes rolling
eyebrows waving

is that better then?
maybe ditch the scroll reveal effect
and have the effect appear on the page load
ok
that is the goal
really don't know what to add more
I'm totally out of ideas
another thing id suggest is when entering the URL to play the music, maybe give the use feedback that it's loading in, i.e. disabling the input and adding a loading indicator like a spinner
the spinner has for PC version
ah
I just put the URL because I was not able to put the name
the bot probably didn't find the song or something
I just made a change you asked for:
https://github.com/OnBeat-Project/OnBeat-Bot/commit/4e15781e58513446c5561a6701c958f6440dfdc1

hi, why is this happening? it worked just fine and now it throws this error
are you using v14?
https://discord.js.org/#/docs/discord.js/main/general/welcome v14 doc @mint rock
aaa is it worth switching to v14?
That’s up to you
Not much of a difference between 13.9 and 14.0 now
I’m terms of features and api support
even though they were both released on the same day
Once you don’t plan to rewrite your entire code and put a lot of time into it anyways it’s not really worth atm
lmao
I'm too lazy to change to v14, there are many things
But expanding the code just to edit way more code later if you update it might also not be considered great
i sent message to djs server by accident and now they are crying
It actually up to you how
And how familiar youre already with djs, it’s syntax and changes
read up 
I mean, the earliest, the better
you'll eventually have to, better do it so you don't need to rush later on
Hi guys, there is a way to make the bot to send a message when someone votes on top.gg? without webhook
no
Yes
i saw there it is
But not just in time
doesn t matter
Only then when you send a request to the API
I mean, if ur ok with having a considerably huge delay between voting and notifying...
ur users wont be happy probably
I won’t be happy to get random messages anyways
xD
give them 50 virtual bucks for voting 😎
user votes
1 hour later
"thanks for voting"
user: "Wtf?"
either do what kuuhaku suggested, querying the API periodically or have the user execute a command to confirm their vote
other than that, there's nothing else but using webhooks
At least to for example redeem some cookie or other benefit
But that’s still not really comfortable
it didn t fking work
What’s the issue then?
const express = require('express')
const app = express();
app.get('/', (req, res) => res.send('E on'));
const port = 65476
app.listen(port, () =>
console.log(`it s on`));
app.get("/bot-data", async function (req, res) {
res.send({users: client.guilds.cache.reduce((a, b) => a + b.memberCount, 0), servers: client.guilds.cache.size})
})
const Topgg = require('@top-gg/sdk')
const fetch = require('node-fetch')
const webhook = new Topgg.Webhook("maybe no?")
app.post("/dblwebhook", webhook.listener(vote => {
console.log("User with id - " + vote.user + " Voted!")
let value = JSON.stringify({
embeds: [
{
description: `<@${vote.user}> (${vote.user}) [voted](https://top.gg/bot/993041677243654144/vote) for **shard**`,
color: "#000dff"
}
]
})
fetch("https://discord.com/api/webhooks/some-id-lol/hehe", {
method: 'POST',
headers: {
'Content-type': 'application/json',
},
body: value
}).catch(e => console.log('Error occured while posting webhook : ' + e))
}))
that s my express
where s the issue?
if you're wondering about if i'm that dumb and forgot to set in top.gg
let me show
Where’s is that code running? At home or on a server?
server
try acces it
it s on
I’m on mobile
you can enter it
How tf would I manage to send a post request lol
or let me ss it
The code will react on post requests
Aka webhooks
for site
your vps is probably blocking it
but for website works
He has a password
Requiring an authorization
fair
Can you actually receive and log a vote?
Well is see your initiated client var in the code above
Just fetch the server and channel and send the message
Using the log data, we probably just the user Id
Fetching what?
server and channel and send the message
client.guilds~~.cache~~.fetch(…)
then <guild>.channels.fetch(…)
OR get() as both are cached by default
In order to not let @earnest phoenix cry about it again
BUT since I don’t know about the caching behavior of the guy I’m helping I always take the safe way aka fetch Mr. Voltrex
Is the webserver part of your bot code?
I can’t see shit on mobile
log the fetch response body
(not real)
Using the rest api to send a webhook
Damn
Code blocks suck hard on mobile
Not my fault

bruh
:))
It does dingus
Oh lol
which is just a fancier map
😉 dingus
bingus dingus
lol
can we just appreciate rust for one moment ```rs
fn find_number(&self, num: f64) -> Option<usize> {
self.constants.iter().position(|c| {
if let Constant::Number(num2) = c {
(num - num2).abs() < f64::EPSILON
} else {
false
}
})
}
god it's amazing
not ugly syntax!
what about it is ugly!
I don't like the lack of parenthesis that much but I can deal with it for the benefits of the language
} else {
false
}
EXCUSE ME?
Looking for tree to end this mess, don’t wanna watch rust code
what abt if let?
Searches for an element in an iterator, returning its index.
position() takes a closure that returns true or false. It applies this closure to each element of the iterator, and if one of them returns true, then position() returns [Some(index)]. If all of them return false, it returns None.
position() is short-circuiting; in other words, it will stop processing as soon as it finds a true.
In this case if c is an instance of Constant::Number, it will pass the if statement, else it will go to the else block
more beautiful rust ```rs
pub fn write_constant_string(&mut self, string: String) -> usize {
if let Some(id) = self.find_string(&string) {
id
} else {
self.write_constant(Constant::String(string))
}
}
oh my jesus christ that just made me feel worse
Represents how i see rust
my god
let lock = false;
app.post(
'/dblwebhook',
webhook.listener((vote) => {
if (!lock) {
lock = true;
console.log(vote.user);
bot.emit('vote', vote, bot, app);
lock = false;
}
})
);
Is this how you properly create a mutex? For some reason I tried to attempt making one and this piece of code sometimes execute twice. Sometimes it will run fine and execute once, then some other times it will run twice, however it doesn't execute three times. Any help will be appreciated!
spamming your question every 5 minutes isn't going to get you an answer :p
I think your underlying problem isn't about mutexes, you need to figure out why you're getting two webhook events
wait hold on you can do a command for users to vote for your bot?
No you cant, however you can listen to events from top.gg api on who voted for your bot
Nope
why not? you can make it so only the people who are connected to the top.gg auth app can vote
perhaps that would be hard to do?
That feature is not available as it could be easily abused
how for example?
People using user bots to send vote messages on timed intervals
that's what I meant by people who are connected to the top.gg auth app, meaning real people that are registered on the website
not bots
"user bots"
mutex in js doesnt really exist, its useless to do that
even so that's pretty much what you'd do with the normal websites, just harder and more of a pain to do to watch an ad
the only thing in js that is remotely similar is sharedArrayBuffer atomics
It doesn't work on js?
meaning people will just not vote unless they have a reason to
¯_(ツ)_/¯
:/
What solution do you think would work in my case instead of using mutex?
if you are receiving the same event twice, its top.gg's fault, not yours
I think a possible reason why my code could be executing twice is because the webhook is retrying itself
I would rather have that for the sake of convinience
But I don’t see a reason why a webhook would need to retry itself however as the first one that was sent is successful
not in a sync code
But doesn't it use pseudo threads for events? (aka promises)
nop
It’s probably Top.gg's fault, but I don’t imagine this is fixable or preventable on my side somehow
its impossible for two events to be executed at the same time
Yes but, if an event gets deadlocked wouldn't it prevent further events from happening?
maybe save the previous event data and compare to the new one, if it's identical break the script
however it is possible for a second event to enter execution before the code in the first event finishes, if the code is async, and i mean truly async, it does i/o stuff or uses timers, just slapping the async keyword on it doesnt make it async
if you put a while(true) {} inside the event, yes, a second event will never fire
Damn
or anything else in your entire code
I knew js was mono thread, but I though events were handled like promises
they are just tools that allow you to use async
them by themselves do not make any code async
It is possible that since i’m sending embeds to a channel logging votes, I could fetch a total of 4 messages since the embed duplicates seem to be next to each other or after a unique message. I could check if the embeds are duplicates possibly
since a user can only vote once every 12 hours on top.gg you can simply create an object and add the user's id to that object
if it already exists, ignore
then delete the user from the object after 12 hours
Is the second event being fired before you can respond to the first one?
I think I’ve seen multiple webhooks being sent, too even after responding as expected
So… most likely an API issue
I'd say create a promise to handle the processing and return an status asap
Maybe their code fails on parsing the response data
Sending the request again
For whatever reason
To debug that I'd bombard the handler with requests to see if something fails
Like, simulate 5 or so votes per second
Guess nobody will ever debug the API
Nono, I mean his handler, not topgg api
Also doubt anyone actually actively working on an improved version of it
Oh yeah of course
But I still assume like it’s an issue on topgg
Since we’ve seen that issue for multiple people
Not all of them are using sdk
Chances are low something goes wrong on the client side on many different environments
But haven’t really tried to debug that at all
Not so important
so I timed out a person for 30 seconds using member.timeout() and after that passed they dmed me that they we're still muted? I had to manually time them out again for that to be fixed
discord bug?
indeed, and from looking at the top.gg-sdk code, they dont return a response until your callback finishes
which imo is a bad design
so essentially as said above, your vote event function is likely too slow to the point that top.gg is retrying the request
assuming that it's my client
// Variables
const bot = new discord.Client({intents: [discord.GatewayIntentBits.GUILDS, discord.GatewayIntentBits.GUILD_MESSAGES, discord.GatewayIntentBits.GUILD_MEMBERS, discord.GatewayIntentBits.GUILD_MESSAGE_REACTIONS, discord.GatewayIntentBits.GUILD_PRESENCES]})
whats wrong with it
i updated to v14
Its pascal case
so Guilds, GuildMessages etc
Also if you want the message content in the message object, you should define the MessageContent intent. Just in case you didn't know.
is that new?
Well that's what v10 api requires (what v14 uses)
Could I use res.sendStatus() before I execute my code with a 204 status?
I would be unsure how I would integrate those params within my listener
app.post(
'/dblwebhook',
webhook.listener((vote) => {
console.log(vote.user);
return bot.emit(vote, bot, app);
})
);
yes
Idk how express works, but u could always simply ```js
new Promise(() => {
// code
})
return // whatever u need to return in express
Literally all of their enums moved to PascalCase
I figured it out
app.post(
'/dblwebhook',
async (req, res) => webhook.listener((vote) => {
res.sendStatus(204);
console.log(vote.user);
return bot.emit(vote, bot, app);
})
);
I think this should send the response to top.gg
So the webhook doesn't retry
I was actually close to ask if you already figured out to send a legitimate response to the request
But thought no, you would have been through this already

Haha, I just love debugging code for hours (me trying to figure out basic js ive done a million times already)
That's not a lot tbh
yes
i haven't tried out v14 yet, how is it? what new changes are there (been sticking with the python discord api wrappers lately so haven't even been doing much js)
Changes = once again, adding a new word to property chain
inb4 djs devs complaining about changing 3 lines of code because of a major version change
2022-07-18T04:24:08.245962+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=POST path="/dblwebhook" host=den-utilities.herokuapp.com request_id=e61d0b4a-93a3-4131-b3e4-880737d00e75 fwd="159.203.105.187" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https
I get this request timeout, I'm not sure what this means.
Djs support itself was flooded with that 🤣
I am going to go with it timed out
Took too long to try and form the request
How would I resolve this issue?
app.post(
'/dblwebhook',
async (req, res) => webhook.listener((vote) => {
res.sendStatus(204);
console.log(vote.user);
return bot.emit(vote, bot, app);
})
);
this is all my code for the app.post
Why are you returning an event emit?
Not all functions need to return something. Just emit the event and move on
Perhaps try using the actual example from the node SDK’s readme: ```js
const express = require('express')
const Topgg = require('@top-gg/sdk')
const app = express() // Your express app
const webhook = new Topgg.Webhook('topggauth123') // add your Top.gg webhook authorization (not bot token)
app.post('/dblwebhook', webhook.listener(vote => {
// vote is your vote object
console.log(vote.user) // 221221226561929217
})) // attach the middleware
app.listen(3000) // your port
I am using that tho, I can remove the return statement tho, but i don’t see why me adding extra onto it would cause an issue
You’re not. You have a different second parameter
So I should remove the req and res params?
Try it exactly as the example shows
Crawl released v14 today
now I see 14.0.1
Yeah it was cause of a bug
With builders and installation
You make one yourself
no
Did they not mean the auth?
You copy it from bot webhook page
api token
Ahh, that’s what they meant
My mistake
🤔 umm there are no webhooks there
You need a verified bot for that
🥺 u mean i need to get my bot verified for getting it voted from top gg?
you have to get your bot verified from top.gg
ohh i have submitted it
it will take 1-2 weeks
now wait
hmm thanks
Back at my days it used to take 8 weeks
what the ... seriously
oo
v14
wait that exists? wow never knew
That's what I said with v12
v14 released?
@round cove ok so prisma is kinda nice ig 
I am liking it so far
At this point all I gotta think about is design
prisma handles everything else for me
model Profile {
id Int @id @default(autoincrement())
race String
currentWeapon String @default("Rusty Sword")
user User @relation(fields: [userId], references: [id])
userId String @unique
balance Int @default(1000)
level Int @default(0)
xp Int @default(0)
}
model User {
id String @unique @db.VarChar(22)
iventory Item[]
profile Profile?
@@index([id])
}
So I have these two prisma models and I am starting to think I don't even need the two of em. I could just combine the data they store into one no? That would make sense to me, but I am horrible at database design so idk if there is any benefit to doing it this way
yay this simple thing didn't work!
A button not being an URL requires a custom ID
Try something Like
const HelpSelectRow: ActionRowBuilder<SelectMenuBuilder> = new ActionRowBuilder();
that doesn't matter
yeah, i was just doing that for testing purpose, so not complete, but yeah the row type thingy
forcing it to have that type isn't a fix.
💀
For buttons const HelpButtonRow: ActionRowBuilder<ButtonBuilder> = new ActionRowBuilder()
You haven't seen any discord.js typescript fixes
have been since beginning of time
yes because djs codebase is a shit show
ah this thing helped me, thanks for helping me here #824411059443204127 message
They should just start from scratch imo
instead of trying to add typings themselves
They don't have the balls to do it
Discord api is huge
It isn't that hard
I could do it myself if I had more knowledge in ts
I just am not ready yet
Just push an object of components to your response as the API expects it
That will fix all your issues 
Instead of using the builders
Also this will prevent you from updating your code over and over again on each djs relrease
at this rate making my own builder sounds better
well for some reason, i use builders but i collect all of them in 1 file lmao from now on
It’s easier to complain about things than changing your life dingus
Like you have a choice?
We all complain about discord but none of us have actually left it
you do have a choice
same with djs
people just choose not to do anything

Eris?
Thay take years to update
cause its better to complain then do anything like fake said
nah just grow some balls and go libless
I stopped complaining long ago
learn the discord api yourself and make your application 10x more performant in the process
tried
Imagine nobody would complain anymore. What a sad world if anybody just smilies 24/7
Discord api is fucking huge
meh
I am planning on getting a group together to make a better package.
Lets see if that ends up happening
Get a job and you'll be used to it
pretty sure fake has a job
although sometimes i am not certain
with the amount of time he is on discord
plot twist: he works at discord
Let’s be honest for the most projects the lib is totally okay
Using this instead of developing your own entire wrapper is much easier and less time consuming
Also you usually only run into issues like this if you’re getting deeper into using a library issuing internal inconsistencies
The common user copy and pasting his code together who literally has no clue about what he does is okay with this
Anyways
How do I rotate a text box in css?
lol
your account will be suspended soon
*smirk, I'm in danger
While all this is factual, there are hardly libs out there that gives full control to the user
more experienced devs are left with the lack luster performance the other libs provide
They get barely any control on how things like caching is done
That’s what I said
The deeper you’re getting into this the more issues and inconsistencies you experience
But that won’t even happen for the most users I guess
well discord.js provider raw option
You can do anything with it
with Eslint screaming Can't import private
I'd rather use something that has only the bare basics and give more control to the user
yes djs is perfect for newer users
True but let’s be honest it’s actually nicely documented and regarding its popularity it provides tons of examples and support anywhere
but once you start developing a bot that relies on performance djs just doesn't cut it
Tim made a lib like that
indeed tim's lib is amazing as well
noone uses it tho
Not that anyone knows
I use it from time to time
Can’t complain
Maybe this will start getting an issue after 10000s of guilds
And it is very hard to make a user friendly performant lib
Including sharding etc
But I plan on building a lib on top of that
Would be better than startinf from scratch
I prefer starting from scratch
In an ideal world, we could make a user friendly and performant lib
though that balance is hard to achieve
The only thing I tried raw is oauth2
And normal stuff like webhooks, users, guilds
first thing I ever did with the discord api itself was oauth
Now its second nature to me
talking of oauth2 I spent hours trying to fix an error
Turns out when generating token from code they accept url param instead of json
yes
After of developing community panels managing servers, players and backends of gaming communities which was made to be idiot-save it turns out it wasn’t
When I was thinking I created something easy to use and understandable it turns out people around the world had issues using it
So I got feedback and started to design things differently and had to readjust many things over and over again to make them more user-friendly even if they were already
Just because of a few plebs around the world
nah don't work
That was the error
ah ic
end users are dum
Yes, but when people focus too much on the user friendly aspect they typicallyy leave out performance as it is just easier to focus on one than the other
Building something really user-friendly and accessible but also following development principles is damn complicated
I'd love to get people together and make a lib that can be a better alternative when looking for performance
It’s always a mix of driving in between all of them
I've found the hardest challenge when programming is finding a team
hardly anyone has the motivation to actually do the goal
That’s the reason I did anything myself
Even if that ended up getting projects stretched like close to 2 years
I'm sure you'll get a good job in the future
pfft
no seriously
Im not working for some corporate company
They don't care about the people who use their products
noney
all they care about is the money they generate
You need money to care about users
I'd sooner just quit the career than work for a company like that
You will work in my mine to collect sulfur with your bare hands
But you will be payed with bread and water
I will pay you back with a foot in the ass
I remember that from Indonesia
nah but seriously
Seriously running your own business is hard and much more work than just being an employee
While that is true
I don't really care about the hardships
Anything to achieve my goals
Being a employee ensures safe income
Yes but then to me that just brings lack of value to life
Almost all the time
No hate to people who want a safe life
but I feel if you aren't taking risks are you truly living?
I don't wanna die with regrets
Nothing is save these days, companies tend to throw out people quicker than you think
take risk in stock market
Sometimes even companies running in a good state
lol
Why do you think I'm going to med college?
Meh this is just my babbling pay no mind to it
Because you’re addicted to help people once a beautiful day you’re finished
Which is good
I-
-|
I feel a lot of people take programming the wrong way
A lot don't understand how valuable it can be
Trust me, There are more programmers than teachers in our country
While that may be true
Like everyone knows how to code
Welcome to south asia
there are also a lot who take advantage of programming and use it for bad
rather than what it should really be used for
that's russia
most of that comes from there
Asia, Europe, Australia, US
there are also a lot of it in asia as well
Like most scam call centers are in India
Hackers in Russia
Karens in US
US as well
Not really most of it comes from the US and Korea
^
But we don’t read about that every day
which korea
I tought south was good
how naive
😔
Since Russian propaganda is easier to bring under people then telling them their entire country and world is being spied and controlled by the US
That convo just now Akio made me extremely sad
World largest amount of hackers are working for the US intelligence agencies
See
The news is just a political tool
Public news are only meant to keep people stupid and control their fears
While there’s some interesting well researched article sometimes 99% is just the same propaganda
I dunno what to think anymore
A lot of people understand that over time
Later in their life
Unfortunately not enough people tho
How they’re getting controlled and manipulated 24/7
Imaa stop watching new at this rate
The news used to not be so bad
Like the US people think healthcare is something bad and socialism regarding this will destroy their entire country
Just to@mention one example
but it slowly became a political tool for the politicians in the US
But yeah… that’s moving into a political discussion
At the end there are only two sorts of people, those who understand and those who don’t understand or wanna believe what’s going on
Trusting what they see and read everyday
Blindly falling to any propaganda
💀
lmfao what
idk man i am confused
"published 2 hours ago" "no longer supported" wot man wot
the discord.js devs trippin
there is no select menu component in discordjs? its showing me in the docs tho
why are you importing component?
Your vsc broken
yea its in the docs but not in the autocomplete
in v14 i think SelectMenuBuilder()
or something like that
no i was just searching all the components
13
@pine novahttps://discord.js.org/#/docs/discord.js/main/class/SelectMenuComponent
doesn’t work on vs, it only gives suggestions for previously written code
yea as i said its in the docs but autcomplete is not showing it
annoying af
no it shows all the classes, properties and shit that are available in the discord package tho
that shit haven’t worked for me in ages
Restart vsc something must have goone wrong
see
If only this were true
nop not working
¯_(ツ)_/¯
I'm getting 1000 options
any special plugins or something? cus that’s never displayed for me either
its built in
just press ctrl+space
I know how to do it bruh 💀
💀
it’s just that it only displays what I’ve previously written
discord.js 2.0
instead of all available options
I wish djs was deprecated as a whole
imagine then using eris
Wrong file
Is this once again the right moment to tell you not to use the builders at all?
@winged temple @pine nova
cant view that on a phone
me using slashcommandbuilder: 💀
It's me showing the 1000 component options
bruh
not giving me any options except those 3
tried using import syntax too
fr
You sure that's vsc?
what version of discord.js?
is it not available in that version?
idfk honestly
Take a look into the docs
L
yes there is
it is MessageSelectMenu v13
no
the select menu yes
it’s literally just renamed
sorry thishttps://discord.js.org/#/docs/discord.js/13.8.1/class/MessageSelectMenu
o wait
what r you even tryna do
^
wait wait so selectmenucomponent and messageselectmenu are same just renamed?
Isn’t it select menu field?
yes
that would be text
I believe
he wants that drop down stuff
Omg i was on modals
but inside a model
Sry
yes
I don't think changing the top.gg page helped at all with the problem of no one adding the bot
is that even possible?
idk
afaik it doesn't
should be tho
it just supports short and paragraph
not sure if SelectMenuBuilder or SelectMenuComponent but yes
just these 2?
yep, afaik
yeah I was like why this dude tryna use select menus in a model
:copium:
it is SelectMenuBuilder, SelectMenuComponent is just a SelectMenuBuilder without a functions and read-only data 😩
display all channels of guild and select one of them
yes
do a command that will give you the select menu stuff
and then from there
i wanted to use modals tho
read the information from that chabbel
it’s just a few extra steps
wait a few more months
well too bad
buld a raytracer with js
o no i dont mean just discord bots
💀
doing that in js just sounds painful
@woeful pike aren't you making a raytracer?
yet someone did that because they were too bored
A simple ray tracer written in javascript with WebWorker support. - GitHub - ercang/raytracer-js: A simple ray tracer written in javascript with WebWorker support.
poor dude
why does this package has selectmenu in modals https://www.npmjs.com/package/discord-modals
Discord-Modals is a package that allows your discord.js v13 and v14 bot to create, and interact with Modals, a new Discord feature.. Latest version: 1.3.7, last published: a month ago. Start using discord-modals in your project by running npm i discord-modals. There are 9 other projects in the npm registry using discord-modals.

man had no life
fr
Cause you can use select menus in modals
LOOL
wait seriously?
YA ALL SAID U CANT USE
It has been a thing for a decent bit
bruh
with discord.js
i have something to work on now
I didn't know either
I don't think djs supports it yet
i figured like why the f wouldnt there be select menus in modals
but you 100% can
are you sure?
u mean inside the modals right?
mhm
i see i see
yeah i did most of what I wanted to do with it though
Those aren’t fully supported yet
try it 🤷♂️
yes but it is still possible
it is still highly experimental
What did you make it in? Rust?
and will be available only to a small percentage of discord users
ye
nice nice
if (settings.antiSpam === "true" && permlevel(message) === 0 && !message.member.permissions.has("MANAGE_MESSAGES")) {
``` is there any way to optimise this? It's in the messageCreate event
I know it's bad that's why I'm asking if there is a better way to do this
=== "true" I may need to bleach my eyes
Lmfao
OK RELAX
it's just the way I wrote my settings sytem
settings.antispam returns a string
And why is that?
then make it return a bool dingus
becausse that's the way I wrote my settings system
eval(settings.antispam) === true
really
just use bools for the love of god
That's not the point, why does it have to be a string in your case?
why did you even think of using strings
because I made my saving system save them as strings as accident and to edit that I would have to rewrite 3 scripts where each of them I have to recast it to bool before saving ALSO I would have to rewrite 2312434 commands to remove the string from them
Then do it, simple
when you add " in sql
it will take me ages
You came here to optimize the code anyway
do you want optimized code or not?
Trust me, it wouldn't; rewriting documents across the whole database to a different value won't take much time
You have to work smarter, not harder
wait voltrex it'll show you how I made that
I turned my bot off for 4 weeks and even tho I got 48 new servers instead of losing any
ppl are dumb
Lmao
// this is the value that will be settings.someSetting
const joinedValue = value.join(" ");
// Update the setting
settings.set(message.guild.id, joinedValue, key);

I have no idea what that is
this is basically what I do, now before you say anything, I would have to delete my entire db because people already saved joinedValue as a string before PLUS rewriting those couple commands, events and handlers
would you really bother with that
settings is a enmap
value is just args
key is the setting
sqlite >>>>>> enmap
You have done something dumb, now take action upon it and sanitize the values and what gets saved
can't you create another backup db > copy all values with Bool > delete orginal
Pp
And you don't have to delete the entire database, you just have to edit the documents with the certain values to a different value
Altering tables are way too much risk without backup
Yeah, backing up the database is a good idea
that works too
wipe db start over

Create a new bot instead
might as well
I am scared to look at his bot's source code
you'd probably find regex everywhere
I only used regex where it was necessary
eww regex
doubt
also the bot is quite decently responsive actually
You look at the source and it looks like a parser with regex
it uses around 80-90mb of ram and 4% cpu even under load
lmao
I's sure those string bools cause half of it
no
djs eats hella
man doesn't use djs
I'll take a screenshot for u
aint no way he doesn't use djs he was asking for help with djs earlier
I think they meant they're not using discord.js if it doesn't consume way too much RAM
well it's a little bit higher now, because I added a lot of new stuff yesterday
but it's still adequently low
How many guilds does your bot even operate on?
...............................................
do you use djs?
bruh
yeah
ok boutt to say
would of made me very confused why you'd ask for help with djs and not use it
nah djs descent with low servers
what are you trying to say?
djs is bad
Fax
noone comparing to your lib that one op
chill
someone uses 70gb of ram for 700k servers with djs
I'm aware, but I already started so not gonna edit the entire bot into a different language now
cap
Nobody said different language
Different lib
700k servers 70gb ram
no way it uses 70gb ram lmfao
thats not half bad tbh, ive seen 40gb for 150k servers
Yea they take memory
yea
good riddance
Bro it is 100% factual
Google Chrome is drooling
Is this only your node process usage?
I’ve got like
That's probably an entire digitalocean cluster
wtf
yea...
Cake’s notsobot is in 734k servers and uses ~120gb of ram give or take, but it has a LOT cached
It uses detritus
jeez
I mean it's not really surprising, 16 million servers is way too much
idk why nobody uses lmdb for caching
5TB ram wtf?
Is that overall though? I’m assuming they had load balancing to some extent
okay but 5TB????
okay so it was less than 70 but it is getting close
is there even any mb that can handle that much ram?
lmfao probably not
its likely not a single machine
90M cached members tf
5TB is nothing for that many servers, I'm sure Rythm doesn't use a single machine
Yeah
its probably a clustered database
they cache every member and channel
man that's insane
Well if they need to
for a bot of that kind they have to
If you want a successful bot use good coding practices
Don’t need to optimize them yet
no one is going to use a shit bot excluding mee6
I feel like a lot of bot devs have high mem usage because they’re lazy and don’t optimize their caches
from 120MB how low do you guys think it'll go after removing all the string comparision checks?
Literally nothing will change lol
or they dont know how
a few kb > mb
cause it is dumb to store bools as strings
RAM is not the only thing you have to worry about
^
Comparing strings instead of bools is a LOT slower
It has to compare character by character
a lot of bot devs were never expecting their success so now they race against time trying to figure out how to improve it
if it's only dumb and doesn't cause that much of a performance difference what's the point
Whereas bools only need to compare 1 bit
yeah fine
I'll rewrite it we'll see how much faster it is
speed is another factor to take into account
Which is extremely fast and probably optimized into bitwise operations which are incredibly fast
ferpormance
You probably won’t notice a difference, but it’s still a good practice to not sacrifice speed where you don’t need to
it def won't be noticeable for how little severs your bot is in
also gm
Gm
hey can someone help me with this? i am getting this error in modals
DiscordAPIError: Invalid Form Body
data.components[0]: Value of field "type" must be one of (1,).
at RequestHandler.execute (C:\Users\hp\Documents\GitHub\Utility-Bot\node_modules\discord.js\src\rest\RequestHandler.js:350:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (C:\Users\hp\Documents\GitHub\Utility-Bot\node_modules\discord.js\src\rest\RequestHandler.js:51:14)
at async CommandInteraction.showModal (C:\Users\hp\Documents\GitHub\Utility-Bot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:240:5)
at async Object.execute (C:\Users\hp\Documents\GitHub\Utility-Bot\commands\announce.js:27:9)
at async Client.<anonymous> (C:\Users\hp\Documents\GitHub\Utility-Bot\index.js:58:9) {
method: 'post',
path: '/interactions/:someid/asasasasa/callback',
code: 50035,
httpStatus: 400,
requestData: { json: { type: 9, data: [Object] }, files: [] }
}
this is my code
const announcementModal = new Modal()
.setCustomId('announcement-modal')
.setTitle("Make an Announcement")
.addComponents([
new MessageSelectMenu()
.setCustomId('announcement-channel')
.addOptions(
{
label: "Channel1",
value: "Channel1",
}
)
])
await interaction.showModal(announcementModal)
It’s not fully supported by the API yet
the select menu component?
told you not supported
it is still experimental
My gosh it’s not officially released or finished yet
component
you guys are getting me to want to rewrite it and then not want to rewrite it at the same time
"big performance difference" but "won't be noticeable"
I got it to work with detritus but I was unable to get the response from the user
It will when running benchmark
My man you used strings out of laziness, you shouldn’t be sacrificing speed even if it’s not noticeable



