#development
1 messages · Page 1936 of 1
damn woo
ye, running multiple clients in a single code will put a hell more strain than using multiple codes
But it's possible ?
possible? yes
recommended? no
how do i do that?
you should run them separately

get a file path?
Like D:\Dev\bot\file.png
?
"recognize"?
the path you mean
python right?
@bot.command(pass_context=True)
async def rules(ctx):
await ctx.send(file=discord.File('paste.png'))
yes
like this ^
how I could do so that all 5 number it add +1 to the value "number"
let number = 0;
let count = 0;
for(const i of users) {
count++
}
what 5 numbers?
tf
like when the for is executed 5 times
also big brain for pinging in dms 
asking for help in dms
isn't that what you already did there?
no i want to add 1 to the value number
yo are free mongo db servers any godo
saying they can pay even though one google search would be enough to fix their problem
each five number
for bots
yeah thanks
please forget the idea of making multi-bot code
basically can u run a discord bot using a free mongo db server effectively
effectively? sure, why not
just wondering
cause when i was creating it
it said it was like experimental or a sandbox but idk
just remember it'll always have a drawback for using free version of paid services
you can always just install the database on your vps
which will be cheaper and without limitations
wait how :0
ive been using sql and db files for my bot
and wanted to switch to something better
so i was looking at mongodb
you have to do in the same directory
who told you mongo is better than sql?
they are different tools for different jobs
idk howwwww
im new to scripting kinda
really?
really
mysql is me
in mongo everything is thrown where it lands
(scratch mysql there, put any other sql database)
when you don't care about relationships
mysql will never work
dam
if u want mysql use maria
pretty sure most databases have cloud options available
even sqlite apparently
should i just use regular db files then
basically unorganized json blobs
using like sqllite
cuz postgres doesn't have a db file
nosql's motto is "if it fits it sits" 
I think this article does a good job detailing the issues with MongoDB's model http://www.sarahmei.com/blog/2013/11/11/why-you-should-never-use-mongodb/
depends on your needs
No, there are NoSQL databases that do have relationships (e.g. Datomic). SQL is not specific to that.
that's kinda ironic
sqlite trades functionality for speed
it's very basic regarding data types and barely allows any user management (if any)
but it's fast
boi it's very fast
if you'll only use basic types (and no parallel writes) sqlite might be worth it
what non-basic type would you need anyway
wats parallel writes
like writes at the same time?
ye
no multi threaded writing
sqlite allows only 1 write at a time
so in the example of leveling

it'll be almost instant anyway
Most of the time
and most sql libs will queue for u
one write to each table or one write to the entire db at a time

yes
that's probably due to file nature of sqlite
like, many threads changing the same file simultaneously can't result in anything good
that's why many json dbs die
but don't underestimate sqlite
it's extremely hard to get two writes to happen at once willingly
json db 
all my homies love json databases
when you look at the json db, json db looks at you
haha
and say: [object Object]
What can go wrong with jason
pov you make fun of americans
american't use metric system
because when it's 70 degrees we aren't burning alive

when would u use the connect event instead of the ready event
If you need to do something before the application is ready?!
basically what is ready for access when connected
like can i call anything from discord when its connected but not ready yet
Nope
connect = before
ready = after
Any important information will be delivered within the ready event
basically no reason other than debugging, extra logging or if you're modifying the library
it's redundant cuz you can always pre-init stuff in the index file
but yea, for debugging it might help
pov you use jest
why it always shows the embed?
i used many ways
if(!args[0] || args[0].toLowerCase() !== "trophies" || args[0].toLowerCase() !== "gold" || !chk){
let embed = new Discord.MessageEmbed()
.setTitle('Leaderboard?')
.setDescription('I have many leaderboards, you can pick\n one from below and check it with\n `cc.lb <category>`')
.addField('🎲 Categories of Leaderboard',":troph: `Trophies` - Trophies leaderboard.\n:gold: `Gold` - Gold leaderboard.")
.addField(':diamond_shape_with_a_dot_inside: Easy Access',"To set a leaderboard by default, you\n can just do `cc.lb default <category>` and \nthe next time you will only need to put \n`cc.lb`.")
.setFooter('More categories coming soon...')
.setThumbnail(client.user.avatarURL())
.setColor("RANDOM")
message.channel.send(embed)
} else if(args[0].toLowerCase() === "default"){
return message.channel.send('Default what? Put a category! `cc.lb default <category>`')
} else if(args.join(' ').toLocaleLowerCase().includes("default gold")) {
message.channel.send('Yep! Done setting your default leaderboard category to `Gold`!')
db.set(`default_${message.author.id}`, "gold")
} else if(args.join(' ').toLocaleLowerCase().includes("default trophies")) {
message.channel.send('Yep! Done setting your default leaderboard category to `Trophies`!')
db.set(`default_${message.author.id}`, "trophies")
} else {
jest is made by facebook lol (?)
how
hello so i am adding a spin wheel on one of my pages and the spin is all done through clientside js, do u guys think the users can manipulate clientside js?
Think about it like this, if you have a condition of “if user input does NOT equal “hi” OR if user input does NOT equal “bye”
Then you’re always going to have it evaluate to true
Because if the user inputs “bye” then then user input is NOT “hi”
So it’ll evaluate to true
And if the user inputs “hi” then the user input is NOT “bye” therefore it evaluates to true
so i remove the "args[0].toLowerCase() !== "trophies" || args[0].toLowerCase() !== "gold" "?
which of these is outdated form v12?
Im trying to figure out but maybe yall will find it first
Why not just pull up the symbols in the docs
or hover over them and hope your IDE tells you if it's deprecated
are you fetch the server owner
use await message.guild.fetchOwner()
oh..
you're right its the issue with the owner
I did some things and it returned undefined
returns nothing, and when I add .name it does undefined..
fetchOwner probably does work
but was used incorrectly (e.g. accessing .name on the promise rather than the value)
oh
Means the value: ... is "", which is invalid since they're not allowed to be empty.
yea..
You could imperatively check if the string isn't blank and call .addField
But shouldnt || "undefined" replace it?
Yes, but that assumes the first value is null/undefined
That value could itself be a blank string.
false
wait nvm I was wrong
d.js moment
yea....
fetchOwner returns a GuildMember object
(await message.guild.fetchOwner()).user.username
yo, anyone else getting 429ed by discord rn? or in general any one-off issues with their bot today?
cause this is super unusual for my bot to start getting 429ed out of nowhere
429 is a ratelimit
ik
its just completely out the blue this happened. like the first time this ever happened in prod
and a couple other bots went had issues around the same time i did apparently
so im just gathering info
you're spamming something
Oh that's because I own a server which has lots of bots joining in with common name as welcome, alerts, notifications, etc scamming the people
i dont think its on purpose tho. cpu usage for my bot hiked up for whatever reason (still trying to profile) and i believe it crashed my bot/hung up requests. when the bot had the chance to re-establish a connection to the gateway, rate limits were probably screwed
that’s my initial prognosis cause i was at work and trying to debug the issue at the same time
but i also heard from a buddy of mine that others bots went out at the same time mind did, so i was entertaining the idea of it being a coincidence
purpose or not, it's certain something is spamming the api
yeah ik that part
is it js?
yeah
do you have any heavy number crunching code?
you know any good cpu profiling software for nodejs? i’ve been using dynatrace trials and it’s helped solve major issues for me in the past. but it comes with a full package that’s overkill
thats what im trying to figure out
it's quite easy to see where the issue might be
what is you most complex code?
or the one where you use loops the most
whats wrong with chrome's dev tools?
im bad at this stuff lol
cmon, you gotta have at least one code you're suspicious of
that’s why i took the easy route and used dynatrace cpu profiling. but i need to learn/utilize proper
so i actually had an old loop i found through cpu profiling with dynatrace. i removed it and unexpected restarts were a lot less frequent. but now that you mention it, i probs need to survey my code for more loops and start there
true. lemme take a gander
just look at the biggest code you find
so only loops i have only loop through a couple items or looping through stuff like member roles
New Question x3
How come this doesn't lock the channel for a the
role.idbut only the@everyonerole?
let role = interaction.guild.roles.cache.find(x => x.name === "Members");
if(role) return; interaction.channel.send(`No \`@Members\` role found, skipping. `)
interaction.channel.permissionOverwrites.create(
interaction.guild.roles.everyone,
{
VIEW_CHANNEL: true,
SEND_MESSAGES: false
},
{
id: role.id,
SEND_MESSAGES: false
})
const embed = new MessageEmbed()
.setAuthor(interaction.guild.name, 'https://64.media.tumblr.com/239ad7e946a65c9e1cbc6ed508e12269/tumblr_nwbyqyd8RJ1s9ab4to1_500.gifv')
.setDescription(`<#${interaction.channel.id}> **-** Has been locked..`)
interaction.channel.send({ embeds:[embed] })```
Djs v13 ^
You'd have to do it separately:```js
interaction.channel.permissionOverwrites.create(
interaction.guild.roles.everyone,
{ VIEW_CHANNEL: true, SEND_MESSAGES: false }
);
interaction.channel.permissionOverwrites.create(
role.id,
{ SEND_MESSAGES: false }
);```
{
id: role.id,
SEND_MESSAGES: false
}```doesn't make sense, does it?
It still doesn't lock it for "role"
I did this one
Didn't work.
That's not the problem, Discord.js resolves role objects to IDs
You could explicitly specify that the ID is a role by adding { type: "role" } as the third parameter or change role.id to just role
why does my project double in size when i have node-fetch in my dependencies? it should only be 99.7 kB
my project grows from 1.6mb to 3.0mb
and with axios it grows to 1.7mb
Bro does it matter that much though
What's better, TailWindCSS or Bootstrap?
Better in terms of what?
Easiness, use of each?
You can't really compare them both?
Is there a difference to use A in something and use B in something else?
Tailwind is more of an ease of access framework, with utilities and classes that have no design they force you to have, unlike Bootstrap
I'd rather use Tailwind and design my own components than to use Bootstrap and make my website look generic (you could still override the styles, but it'd be very jank IMO)
Is bootstrap hard to use their designs?
bootstrap is hard to customize imo
tailwind makes it relatively easy with its extending and shit
but flaze is right
Oh, I see. Although, why? I see many websites look professional when it comes to using Bootstrap?
In my past experiences with bootstrap you are very limited
use chakra ui
it's accessible
chakra is a component library no?
accessibility > everything
yep
with emotion for styling which makes it a bit slow to render
can you use component libraries without using something like react or angular
you can use chakra ui vur
vue
well yea
but i mean
also who tf uses vanilla js
plain html it will be rather hard
me
at school
cause
no node
:c
then use tailwind
no node
cdn
ah right forgot tailwind has a cdn
react and vue also have cdn
sadly no angular
fake sob
angular would probably be a pain if it was cdn no?
mf huge
angular is already a pain
I use angular
because it requires typescript
I mean
it doesn't require it
you are too powerful
you can easily use js with it
it just isn't recommended
cause ew js
ew browser
does webassembly work in safari
No idea
damn
i could've used rust for frontend
Anyways, it looks like TailWindCSS is better based on what I'm trying to achieve, thanks.
what are you trying to achieve
CSS Frameworks colorized
Easy: Bulma
Simple: TailWindCSS
Flexible: Chakra UI
Bad: Bootstrap
I hate bulma now
it fucked my css up
and im blaming bulma and not my shitty css skills
so
i clearly said easy
not good
lol
bootstrap is so old
its trying to be good
feels like learning programming again
except there are no indian guys on YouTube to help me
sob
bro
I watched a vid on angular
by fireship?
and I found this guy with the worst mic and indian accent
indian accent is not bad accent
n oits not
angry sob
but pair it with a dollar store mic
i don't even have a mic
nerd
i don't talk in vc
just go there to stalk
owo #general
I talked for the first time in ages in the vc this morning
flaze was there
Bootstrap 4 🤮
New site is good though
colorscheme looks good
even on light mode
if I ever make a website
its dark theme
no option for light

I forced dark mode on link's website
lol
he changed it to allow any light mode
I will add light mode
cringe
but it will be extremely hard to activate
I will make you work for it
just make it display a floating div that covers the entire screen
and the div has a full white background
Bootstrap is plain
It's not necessarily bad imo
php is also pretty good
Just not something that could make your website stand out
I personally hate PHP's syntax but it's ✨ preferences ✨
Hey complex is simple and simple is good
lmfao
I personally hate python but it's ✨ preferences ✨
hi xetera
python aint bad
light theme default is linked with lower bounce rates for users fyi
wdym
how
familiarity most likely
For some users, light mode is better for accessibility
i can't read an ebook on light theme without crying my eyes frok the brightness
Darkmode with light elements is better imo
increase your phone brightness???
also every meme is in light mode
xet should i learn rust for backend
nodejs slow
Im still not gonna add light mode to my site but it's good to know
rust is so boring
python is so terrible
I couldnt sit and use it without not knowing what to do with it
sure, rust is probably my favorite language currently
it's literally everyone's favourite language for 6 years straight
the typesystem alone is totally worth it
but is it better than node
it depends on your usecase
I like rust's error system
web server
I feel like if node had rusts error system
js is stupidly easy but painful to refactor once you start building something up
node would be a lot more enjoyable
rust has a big learning curve and tedious to get set up with but refactoring and expanding your project is so easy
the word thread main paniced makes me panic so no
lol
what low level language is easy
I use go currently when im not doing the hackathon
esbuild is written in go right?
uh, it depends on your definition of low level and easy but C is certainly very simple
forgets to free memory in a loop
ram explosion
C has a couple core concepts and that's it. But making a program without bugs or memory leaks is not simple so it's hard to say what easy really means
I hate to say this but py is easy
my philosophy for programming is that the compiler should be doing as much of the work as possible, so C is out of the picture
so is go and javascript, python etc
what is the C compiler written in
C
gcc? pretty sure it's bootstrapped for decades now
the first iterations were written in assembly
i mean software abstractions were built on top of hardware
if you look at things like the Enigma machine for example
that thing that encrypts messages
the one that decrypts
jsx
TSX*
I personally hate you but it's ✨ preferences ✨
❤️
did u just get offended cause someone said they don't like the only programming language u know?

Shiv be having new identity
I'm identityless, I do not identify as anything 😎
You identify as cool
I have this event handler:
const { readdirSync } = require("fs");
const colors = require('colors');
module.exports = async bot => {
const load = dirs => {
const events = readdirSync(`./src/events/${dirs}/`).filter(d => d.endsWith('.js'));
for (let file of events) {
const evt = require(`../events/${dirs}/${file}`);
let eName = file.split(".")[0];
bot.on(eName, evt.bind(null, bot));
}
}
["client", "guild"].forEach(x => load(x));
};
.. and I have an example interactionCreate event:
module.exports = async (bot, interaction) => {
// Interesting code.. I know right?
};
How can I pass colors and use it like in bot, interaction, colors.
either bind it, but then the order will be: bot, colors, interaction
or you can include it when you run the actual function
you can also just attach it to your bot object
I don't mind if so like that, since some events have two parameters instead of one.
This seems to be an issue I seem to know why.
I got it managed. 👍
damn i missed the talk about rust 😢
What language
In python I would do splitword = <variablename>.split() then do splitword[0]
same
what if he uses lua
Idk then lol
splitword[1]
What can cause a high cpu?
intense work
Which IDE/Editor should you use for Node development and what are the most benefits of them?
- IntelliJ IDEA
or - Visual Studio Code
Currently use vscode , but felt over IntelliJ and thinking about if it is worth using it.
Text Editors colorized
NodeJS/TypeScript or Python: Visual Studio Code
HTML, CSS, JS: JSFiddle or CodePen
Anything: Sublime Text
IDEs colorized
.NET: Visual Studio (unfortunate naming)
Java: Eclipse
notepad++
Damn I was about to say it
Caveman: Notepad
Gigachad: Notepad++
Terachad: vim
Petachad: Punchcard
write on a piece of paper, in cursive, and use ocr AI
in cursive
yes, in cursive
I tried changing it to just role, still no luck :/ but its alr
Imagine suggesting a piece of paper in 2021…
Shame on you Tim
even my school agrees with that
ay
tf is this
11.12 09:11:20 [Bot] internal/modules/cjs/loader.js:960
11.12 09:11:20 [Bot] throw err;
11.12 09:11:20 [Bot] ^
11.12 09:11:20 [Bot] Error: Cannot find module 'node:events'
11.12 09:11:20 [Bot] Require stack:
11.12 09:11:20 [Bot] - /node_modules/discord.js/src/client/BaseClient.js
11.12 09:11:20 [Bot] - /node_modules/discord.js/src/index.js
11.12 09:11:20 [Bot] - /index.js```
its not a package...
[ full error ]
My bot is logging Command raised an exception: Forbidden: 403 Forbidden (error code: 50001): Missing Access even though it has permissions to join and speak in the voice channel
anything interesting presented?
I'm trying to make a ban command, how can I send a message without being banned from the user dm?
Try to send the message before banning the user.
There's a chance the ban could fail, however, so the message sent would be useless.
You could try to check if banning the user would work beforehand (permissions)
@rustic nova !!!
damn banned
uh
i need an opinion on something
data.sort((a, b) => b - a)
// or
data.sort((resultA, resultB) => resultB - resultA)
or do you think it really matters
they're just parameters
so you can give them whatever name you want
b is a value from data
e.g. an array of objects would set b to some object in that array
i know what they are lol
One message removed from a suspended account.
One message removed from a suspended account.
i'm just asking which would you personally prefer, a single letter for a parameter like that or a bigger name
One message removed from a suspended account.
oh i know it doesn't matter
In this case I'd go with letters because it's obvious what they are
but I'd prefer single letters for small expressions
It's actually not resultA or B but instead it is arrayElementA or itemA etc.
and actual names for larger ones
just have people saying that "single letter variables are meaningless" or something along those lines idek
kinda dumb
lmao
data.sort((previousElementFromSourceArray, nextElementFromSourceArray) => nextElementFromSourceArray - nextElementFromSourceArray)
in certain contexts they are
Not in that case...

I think they can be even longer...
Please teach me
Can you understand what this does?
function count(c) {
return c.length;
}
Probably yes.

they're meaningless sometimes but not all the time
i always kinda prefer them over longer ones for iterable values in short functions
like users.map(u => u.name)
but anyway
i don't think it really matters
how to setup it?
can you set permission like (BAN_MEMBERS) for slash commands (discord.js) ?
You can't do it statically
Aka have Discord check it on the client side
But you can check it at runtime
Since they do tell you the permissions the user has
With the benefit that the permissions have been computed for you
yeah, In their doc it tells they only have it for specific role or ids
am have a folder in ubuntu but no one can do anything inside it
i want them to be able to write stuff
how would i do that?!?!1
chmod?
are you still using FTP?
yes 
SFTP*
am trying to make SFTP
can't you set perms with sftp
using chmod 755
so when i use
sudo chown root:root /var/sftp
i can read the folder
but when i use
sudo chown guest:guest /var/sftp
i can modify stuff but cant read
guest:guest means it'll belong to user guest and group guest
you probably want to also use -r to make it recursive
so files within it are also assigned to the user
same for chmod
just BE CAREFUL with chmod
still doesnt work
what is your user?
chown sftp to guest group too
guest:guest
then login to guest
you're logged into root currently
cant see the files
u sure the files are there?
cuz lack of read permission would prevent u from acessing the folder not from seeing the files
is the password right?
yes its right
how would i enable write?!?!1
+w
how does 1 get an api key?
what command would i use 
for top.gg?
yes sir
you need to be approved first
you'll receive a notification from @gilded plank and a green name if you do
how do you get approved? do you guys need me to provide anything etc?
ahh okay, yeah iv done that already
then wait
need to chown guest:guest
still no work 
welp, I'm out of ideas then
you could create a group for guest then
tried that already
no
~
is it possible to have a slash command option that only has a key and no value? ie:
/command regularkey:value -unvaluedkey
Wdym
like, a slash command string option that expects no additional information
Like /command option:value novalue?
yea
I dont think you can do that
rip
Or maybe make it not required or as a subcommand?
i wanted to add a -private option to some of my commands. atm im using an optional boolean, but the 'false' option is completely pointless so was hoping to be able to just have something like -private
No you cant make option without value i think
How to make subcommands /subcommand group?
lib: discord_slash, discord.py
ye no worries, ill just keep the unrequired boolean option with true as the initial choice 🙂
You can make a generic option where you're required to put in a value and it defers info from that
or if you want flags, just have a param labelled flags
yea thats a fair approach, but its only the one flag i want 😄
is there some sort of tool that tells you the full size of a dependency including all sub dependencies in node?
npm just gives info on the package. fetch is actually 1.4mb but it says Unpacked Size = 99.7 kB
https://www.npmjs.com/package/node-fetch
this is a bit better. still about 5x off
There's also bundlephobia but that breaks often
probably since discord is deciding to signal that every role's permission has changed to the hierarchy
but I'm not sure myself
How do I make sure a user has ADMINISTRATOR permissions before using a Slash Command? v13
if (member.permissions.has(Permissions.FLAGS.ADMINISTRATOR)) {?
Yes
isn't there a bool value to check if they have administrator as well?
It returns
if (interaction.user.permissions.has(Permissions.FLAGS.ADMINISTRATOR)) { interaction.reply({content: `You may **not** use this Command.`, ephemeral:true})
Can not read property "has" of undefined, I tried adding "cache"
or did djs remove that
users have no permissions
Ahh
Member
only members do
right
Tyty
I keep forgetting.
It still says it even tho I have perms
if (interaction.member.permissions.has(Permissions.FLAGS.ADMINISTRATOR)) return interaction.reply({content: `You may **not** use this Command.`, ephemeral:true})
That's for checking for normal permission + administrator (since you could have administrator but not the other) but they want to check for administrator explicitly
Sorry for ping, Discord mobile doesn't even show the reply option so I couldn't disable it
You can ping me idm
and ah alright makes sense
So confused on why it still says it even tho I have perms.
does your role have an administrator permission?
I own the server.
but yes, I do also have a role that has admin
oh
since it returns true it will always return the message
you wanna check if it is false
Yeah lol
so you wanna use !
Makes sense
if(!blah) return blah
Also, one more thing.
const filter = (interaction) => {
if(interaction.user.id === interaction.member.id) return true;
return interaction.reply({ content: "You can't use this button" })
}
const collector = interaction.channel.createMessageComponentCollector({ filter, time: 15000 });
const wait = require('util').promisify(setTimeout);
collector.on('collect', async i => {
Anyone can click that button...
Do you understand discord permissions?
I have always misunderstood them
but I have a filter on the button^
no need to return true
that check is already basically doing that
I dontt even think you need that if statement there
iirc I used to just interaction.user.id === interaction.member.id
Also would that check even work 🤔 I might just be tired but for some reason that looks a bit off
hm?
Idk I might just be me
but I never return anything in my filters so idk if returning in the filter causes any problems
Ah got it, tyty
at least I don't think you'd wanna return anything if the user id = the user id
since it will just return true
is it possible to send an ephemeral message before the initial message is returned using the discord api?
i only see it in follow up message and i dont think you can send a follow up message before the initial message
https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
yes you can
oh nice, maybe it's not working for me since i defer the response first
that would cause it to not work
dang
thanks, i guess i can still make it work. i'll just wait to send that message
If you want to do that then the result must be ephemeral no matter what content it is
You have to respond as soon as possible
So you can't have normal messages and ephemeral error messages if you defer
It's one or the other
Wait what?
So you can't send a public embed with buttons and then respond with an ephemeral message if someone who isn't supposed to press those buttons?
You can add flags while deferring
You can
Ah okay
i send an ephemeral message the first time someone hosts a lobby, but i also send a generic message saying there is a new lobby. i just need to send the ephemeral message second
Buttons clicks are whole new interactions
why does the rest of the code is in gray?
obv its going to be that fcolor
string literals or whatever its called doesn't work in ""
yes it is
the correct word is "threw"
thrown
would be threw in this context
It depends on the context.
"He threw" is correct.
"He had thrown" is correct
this is development not English class
lmao
This is true, but gotta help the homies
any idea why theres a red highlight?
can you show more of your code
at reward? It may just be syntax highlighting
a lot of themes do for example:
orange.blue.white
maybe not that exact color scheme, but
It's not necessary to escape it
Probably the code editor has funky syntax highlighting logic
its just something you have to deal with
What editor is that even
im hosting it in a pterodactyl host
could it be that there needs to be a , after the first string
🤔
already did that after i sent the msg

I'd probably recommend coding on vscode online and then transfer over to your host
hello i'm using discord py and i have an interaction in my message when i use that interaction it works but a message is displayed "this interaction failed"
how can i fix this
You need to reply to the interaction
how
any example
i want to edit that message
like we do in await m.edit(embed = embed)
Are you using buttons?
Use interaction.respond() - https://devkiki7000.gitbook.io/discord-components/api-reference/interaction
The type should be 7 (refer image)
This is weird though
Is it outdated? I have no idea
Yeah try type 7
ty
Hey so, when I removed return true
It doesn't let me use the buttons.
const filter = (interaction) => {
if(interaction.user.id === interaction.member.id)
return interaction.reply({ content: "You can't use this button", ephemeral:true })
}
const collector = interaction.channel.createMessageComponentCollector({ filter, time: 15000 });
const wait = require('util').promisify(setTimeout);
collector.on('collect', async i => {
you'll have to create an webhook
How do i
then intergrate that webhook
oh
intergromate.com provides free webhook service
watch yt
there's a tutorial
watch
send link
Why do my buttons work for other people? I put return true on it and I can't use it either.
const filter = (interaction) => {
if(interaction.user.id === interaction.member.id) return true;
return interaction.reply({ content: "You can't use this button" })
}```
When I have that, I cant use it.
when I remove return true anyone can use it.
should I change user.id to member.id? or something
how can i use buttons along side drop down menus discord py
looks like the C++ lib space is just all DPP now...
https://media.discordapp.net/attachments/825407339254644779/919452441651609630/SPOILER_unknown.png
sleepy discord has stopped development
just don't use .NET
detritus better
I have applied for privileged intents. when I clicked the submit, the standard JS alert() window "tour submission resigned" came out to me. however, the bot's page still has the same "apply" window. This is how it should be or I made a mistake somewhere
is there a way to make a button that passes a value when clicked?
https://discord.com/developers/docs/interactions/message-components#component-object
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
i want to use the same custom_id, but pass different values
something like this?
const values = {
"someId": "someValue"
....
}
.....
const value = values[custom_id]
I have a button like this js { type: 1, components: [ { type: 2, style: 1, label: isFull ? "Join queue for full lobby" : "Join the lobby", custom_id: isFull ? "join_lobby_queue_button" : "join_lobby_button", value: lobbyCode, } ] }
I want to pass the lobbyCode to along with the call
every button will have a different lobby code, but the same custom_id
i might have to do something like that
but parameters are nice things to have
So i would have to do something like this js { type: 1, components: [ { type: 2, style: 1, label: isFull ? "Join queue for full lobby" : "Join the lobby", custom_id: isFull ? `join_lobby_queue_button.${lobbyCode}` : `join_lobby_button.${lobbyCode}` } ] }
oof
yeah but it doesn't seems to be available rn
sad times
🤔
How can I have my bot generate a timezone stamp
Like I have it now Ends in: 15s
but I want it to show the markdown time stamp.
How can a bot generate one of those?
`<t:${Math.floor(timestamp / 1000)}>`
:R
?
Needs to be relative time
like this?
`<t:${Math.floor(timestamp / 1000)}:R>`
Yeah
hacks
Hi I have a question I bought the gun pass I had it but then it was taking away from me
Taken
???
Wrong server
What server do I have to go to
What bot do you need help with?
I'm not about my account got hacked and it got changed to numbers
Uh
I'm trying to have you ever heard of Connecticut state will play
No
Ok
Well I'm trying to do training for Connecticut state role play
Is that the invitations expired
I'll find their server
@indigo flint You're listed as an owner of the Connecticut State RP server, just letting you know that the invite for the server is expired ^^
slash commands are not showing up
any idea
why
idts there is any problem with code
global commands take 1 hour to show up
you should use guild commands for testing stuff
oh okay
wasnt it 20 mins earlier
No
anyone know how to install node 16? cuz i just installed debian and want to update all my junk thats on my old server
however when i install node it just installs node 12
and i cant update it either
or alturnetly how to install d.js v12 so that i atleast can get all my crap back online in the mean time
nvm worked it out
How would I auto-close a tab in js that has been opened if I am making a chrome extension?
i never put an invite out for that server they must be talking about a different one
i never put it there
Oh I see what you are talking about
that is old
im not in that server
and i never owned it
One message removed from a suspended account.
One message removed from a suspended account.
sadge
I didn't think extensions had access to closing tabs ngl
Nvm
Took two seconds on the docs to find it
Is try { ... } catch { false }; the same as try { ... } catch { {} };?

both of them are useless
if you want to catch and do nothing, just catch {}
or if you want to be semantically correct, and not have eslint complain about empty blocks, do this
try {
...
} catch {
/* no-op */
}
Oh okay
People catch for false.. some catch like .catch(() => {})
void 0 
if you want to return false in case of error, that another thing
with try catch, you have to either return it, or assign it to a variable
catch { return false }
.catch(() => false)
This is same with {}
its not the same
{} would be undefined, no?
one returns false, the other returns undefined
Ahh.. although.. same result?
No?
Alright.
Err, undefined and false is different if that's what you're asking
it does not affect what happens to the error, it affects what you have AFTER the error
what do you want to have after the error happens?
false or undefined?
or do nothing?
Do nothing.. but not error.
then it doesnt matter
catch {}
.catch(() => {})
👌🏼
if you want to do nothing, you dont need the false for anything
if you get eslint complaining about empty blocks, do what i said before
put a comment inside
catch { /* no-op */ }
I didnt understand this.. though. What do you mean, by it?
do you know what eslint is?
anyone know why nodejs isnt working in anyway?
it always trys to install v12 saying its the latetest
it will not update
npm was broken the one time it did update
reinstalled everything
node is back to v12
discordjs v12 is giving me errors
cant import moduals sometimes with errors like
SyntaxError: Cannot use import statement outside a module
or
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module:
nothing runs without errors at all
at this point im just gonna go back to using centos 7 and never update anything ever again cuz if its gonna be like this every time i might considder moving to alaska and live in a shack with no power cuz this is pissing me off
all i want is to install nodev16
and discordjs v13
that is literally it
dont install node using apt
why not
use this
node.js is a fast moving project, it updates much faster than linux operating systems like ubuntu and debian
ah i see
for the sake of system stability, linux systems are not allowed to update individual packages when they come out
they only update them when the time comes for a full system upgrade, and only update the packages that are properly tested
its explained in the readme
or do i have to build it from source
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
are you sure there's no malicious stuff in that script
i mean its on the official nvm github thing
and my server is basically a fresh install of debian
nevermind
mmm
if anything were to happen to it, hundreds of people would notice
looks at log4j
Unfortunately, not.
looks at vm
doesnt use java anywhere, doesnt care
javascript
OwO
lmao
indeed
also what does this mean and how do i fix it? i guessing this is somthing to do with upgrading from node 12
chalk is using esm
what is that?
maybe they did the same thing node-fetch did
is this good or bad
// commonjs
const chalk = require("chalk");
// ES2015 modules
// esm
import chalk from "chalk";
you can't import esm from cjs or vice versa
chalk has enormous brain to use esm on npm
see i changed it to that befor and it gave me some other error
one sec
this is it
you have to rename your js file to .mjs
i don't recommend using esm



