#development
1 messages ¡ Page 1950 of 1
It's saying "Unknown application command"
After I edited one of the commands and re-ran it.
Yeah because registering an already registered command will cause unexpected trouble
By building a proper command handler which fetches the commands on a startup from Discord, compares it to your loaded commands from your files and either registers a missing one, updates commands which have changes or deletes registered ones which do not exist locally anymore
.
Doesn't djs handle that đ
No
now what
Oh fun
Not that I know
that's more confusing than how my granny makes cookies
So in simple terms
its impossible or is a lot of work?
Also not that this would be much work
Cause I have no idea how to do anything of what you just said
I mean fetching and looping through your loaded commands are just a few lines of code
no, heartbeats are not logins, they are normal
Sounds like a lot more work than hitting the endpoint that accepts a list of commands and handles that for you
And it basically only costs you what you create (https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands)
Commands that do not already exist will count toward daily application command create limits.
Integrate your service with Discord â whether it's a bot or a game or whatever your wildest imagination can come up with.
aka that .set stuff you were seeing
I'm reading the docs and nothing explains that -
You donât overwrite existing commands if thatâs not required
So what would I do to fix this:
client.once('ready', () => {
console.log('Ready!');
const CLIENT_ID = client.user.id;
const rest = new REST({
version: '9'
}).setToken(CLIENT_TOKEN);
(async () => {
try {
if (true) {
await rest.put(
Routes.applicationCommands(CLIENT_ID), {
body: commands
},
);
console.log('Successfully registered application commands globally');
} else {
await rest.put(
Routes.applicationGuildCommands(CLIENT_ID, MAIN_SERVER_ID), {
body: commands
},
);
console.log('Successfully registered application commands for development guild');
}
} catch (error) {
if (error) console.error(error);
}
})();```?
That loop thing? but I have no idea how to do that. đ¤Ł
That endpoint (yes set()) has a different purpose than what you do compare to my command handler
Right here, this is what I'm using.
Are you building traditional commands (message intent) for that not to apply?
o-o I'm using what is directly in there đ¤Ł
referring to fake :p
this is it right here.
oh lol, my bad
Wut? Took a shower real quick
I lost the context
I was going to ask that too
No I was actually writing while taking a shower
lmao
But using soap and a phone is getting too complicated 
Ya ya⌠I know coders usually never take a shower or use soap
But once in a month, you know

Shh
No! Not anymore, traitor
gibe mi mĂ´ney pleasi

i report iu
Not if I report you first, ha! How does that taste, Sir
mordekaiser es numero 1
HUEHEUHEUEHUEHUEHEUHEUEHUEHUEHEUHEUEH
EHUEHUEHEUHEUEHUEHUEHEUHEUEHUEHEUE
Okay.
So now I've swapped to this, but it doesn't "register" new commands, it reloads them.
client.once('ready', () => {
console.log('Ready!');
const clientId = '708198760408416256';
const rest = new REST({ version: '9' }).setToken(CLIENT_TOKEN);
(async () => {
try {
console.log('Started refreshing application (/) commands.');
await rest.put(
Routes.applicationGuildCommands(clientId),
{ body: commands },
);
console.log('Successfully reloaded application (/) commands.');
} catch (error) {
console.error(error);
}
})();
})```
so, this loop thing fake, I'd assume it involves that in a way^?
applicationGuildCommands needs a guild id
then applicationCommands is what you want
I dont think that goes in the ready event either đ
Or simply use the inbuilt methods like I mentioned a million times already
Well it works đ¤Ł
I've already said a million and 2 times, I have no idea how to do that
client.application.commands.create(âŚ);
uh what
so just smack that in there and call it good? Cause idk what to put in replace of the ...
....
That guide makes no sense
It's alr made
I'm using rest
So it has a description in it.
That isn't helpful --
I got that but always copying random stuff because you dont wanna study the docs will always lead to the issues you currently have
đ isnt it weird the guide suggests a weird round about way when djs itself has its own methods
I get that, but the guides don't always explain things right as well, so I'm not sure what to do when there are little to no resources at hand without me going through 4 round-abouts and getting lost in a maze.
And especially those docs are providing examples to work with
the create method
is saying to create a new one
Not what I want.
It already should do that on ready.
The command file n stuff is already made.
Lots of the guide is okay and lots of it is straight bullshit like the process of dealing with slash commands
mhm
Yeah but thatâs exactly what your copied and pasted code from the guide does, too
But even more complicated
still confused but okay
And both is not what you need
how can it detect if their is a new command and just create it?
Wouldn't that be the damn easy way? đ¤Ł
Yes as I mentioned above
there*
Thatâs how it works
._.
omllll
I don't understand that tho
It makes literally 0 (no) sense.
so this
client.application.commands.create({
it'll create a command that is not already created or what?
Rest does that perfectly fine
It will register a new command
That's what the commands look like
So it's not making much sense if the command is already there, and created. But its not created?
It's still making no sense tho
Wouldn't .create just make a copy of all of them?
The name
Description
why not use set?
All of that is already made within the actual command file.
Why not we use the simple way and use rest 𤣠I don't wanna use the native Discord ones when the Djs guide directs me to rest.
I already have it able to reload.
Lol nope
I just need rest to be able to create if the command isn't already created which if it is already created will then proceed to just reload them.
I don't wanna chase my own tail using these .create thingy's when I do not understand them one bit.
Like, its saying a specific one.
client.application.commands.create({
name: 'test',
description: 'A test command',
})
Right there.
Registering a command to discord is just telling discord the command name, description and options if available
name: angegei
desc: getet
When those are already in the command file.
but the command file already has that.
Literally in the exports.
You donât seem to understand the difference between the user interaction you need to respond to and the actual registered command Discord needs to show it in the guilds UI
holy still didn't understand a word of that, that just made it even more confusing.
Your command module structure is not far off
You load all your command modules (files), save them into a map for example and use this map to register non-registered commands or update registered commands if an update is required
An interacting user - running your slash command - does trigger the interaction_create event which fires your command modules execute function
I have no idea how to use maps either btw.
Just another thing
Istg if you point me to a docs đđ
Doesnât matter can also be an array
pretty sure you already use a map
Idek how to do that
yeah you use a map
Also
That's makes again no sense.
Why would I have it trigger a interactiomCreate
When I can just check if they're already made on the 'ready'
Your throwing me in a complete different direction than what I wanna go đđ
At this point I really wanna recommend learning the basics of JS and trying and testing own written code
You wonât really get forward by just copy and pasting stuff which doesnât work as supposed to
interactionCreate only fires if a user uses an interaction
Okay I have, but as I stated previously, they are not written well, so I have read them a thousand times, which is why I'm here, now.
Why would I on god's green earth, move it into the interaction create when it can just create them on ready?
Why wait for someone to use a command.
Makes no sense to me tbh
Just another sign pointed in the wrong direction đđ
You need to stop mixing up the registration process and user interactions
Before all your code and interaction reply shit takes in place, you have to register your command - in other words tell discord your command name, description and optionally itâs options to let Discord SHOW them if you enter a /
In simple words
No you didnât
This does not register a command
Clearly, but it does something.
Can you link an example or something? Your words are confusing me đ
This builder methods just create an object not more
Have you ever console logged an embed?
You will magically see the structure- itâs just an object
Yeah
Thatâs what you do in your command file
â ď¸ confused as hell
data: âŚ
Is your slash command object
Well yeah
But this module does not register the command or anything
Mhm
Thatâs what youâre doing with the screenshot you sent before
Wymmmmm?!?
With the copied bullshit from the guide
Tbh imma just use normal prefix commands at this point đ slash commands make no sense and this makes me hate em more
normal prefix commands wont be usable soon
Well they make no sense for you because you completely mixing up any stuff
unless you get message content intent, which that bot you linked above wont get
Eh
Then looks like my development career is gone đâ ď¸ just like that.
I'm done trynna understand this, I don't get it one bit đ¤Ł
đ¤ˇââď¸ just code what you want to code.
if its not perfect its not perfect
I donât actually know how else to explain what a registration is and what the response in your code to the actual user interaction is
If it's doesn't work, it doesnt work, all I came here was was for a simple answer and fix, no I gotta go chasing a tail because I'm not doing it right.
Anywho, see ya it's night here
Well yeah the more stuff you copy and mix will result in even more issues, unfortunately thatâs how it is
The guide is meant for copying FakE đđđđ
That's why it's called a guide.
It points you in the right direction and shows you how.
If youâre not willing to sit down and learn/study the stuff it will end up sadly
Well even if donât agree with itâs meant to be copied, yeah it may is but you at least need to know what the copied code does
The guide does even differentiate between global and guild commands and has code examples for both but you copied the first you saw and you wonder why no global command is being registered successfully
Copy pasting from the guide just because itâs a guide is like following directions off of a cliff just because itâs from your GPS so it knows best
You gotta have a little independence and realize when something isnât as right as it can be
Which takes time to learn
And thatâs perfectly ok
Take a look and my command module structure, it looks "similar" to yours except I donât use that useless builders I write the object per hand
{ name: "command name", description: "âŚ", options: null }
Is what your helper tools creates, not more or less
And thatâs (this object) is what you send to Discord to register the command
Donât start the same discussion as Klay
Bulk update doesnât replace a proper handling of creating or deleting commands
It says it does
How do you think you can delete a command then?
Or well it shows removing and adding commands with it
Maybe I'm misreading the examples though
you should actually read the real meaning of it
Why do I want to overwrite any application command with its 1 hour delay ?
There's no one hour delay unless you're deleting (iirc) OR adding commands
Updating it will work the second time you try to use the command you updated
At least for me, 100% could confirm
Deleting shouldnât have a delay, too afaik
First time it'll say invalid application command but it actually updates it
So uh, I assume this is one of the side effects?
Mine loaded instantly.
Yeah thatâs also nonsense why should I live with that downside if I donât need to force overwrite the commands?
Fetching the commands and update/delete a single command if required doesnât have that consequences
But it works while being simple though, which seems to be their goal(not everyone has the same goal)
Wait so im confused FakE, I took a minute to calm down đ¤Ł
The guide says this is how to do it?
https://discordjs.guide/interactions/registering-slash-commands.html#global-commands
I still donât agree as the endpoint of creating and deleting the application commands exists for a reason
Sure, and the bulk set exists for a reason.
Yeah to bulk update more than one command if needed instead of sending tons of single patch API requests
Which is what they seem to be doing, right?
That code block they showed is for re-registering all their commands, and what the guide suggests it's for.
So I guess I presumed that's what they are doing
Well it seems we have a different option here but overwriting content without a reason and living with downsides like invalid command warnings instead of correctly dealing with what needs an update and what not doesnât seem to right for me, easy doesnât mean okay
The code block in the guide is not meant to be added in your code to be run on any startup
Which is probably an issue with the api, not the set.
They just show an example how to manually register commands
Im not entirely sure, too so itâs just guessing
But yeah once again overwriting things on force without a reason doesnât seem to be needed and I wouldnât do it or recommend it
Especially because of that
This will overwrite all types of application commands
But I see we will not agree on this part, which is okay for me
But it doesnât change the fact that he had no clue what code actually does he copied and the difference between registering the application command and replying/responding to it
Which is still the core of the discussion
I wonder what are the odds a bots commands are stored in a single database column, and needs to be entirely set again on any update to a bots commands.
Seen a few open source projects that do that for whatever reason(db limitations?). Probably not likely on a discord scale right? đ
Actually a good point to protect my standpoint
Fetching the commands to figure out in my code if an update is required or not, results in a READ process of Discordâs database
Forcefully overwriting the commands on any startup requires a WRITE process
Either way they need to read the same amount of data thought?
And if itâs technically not needed it is nonsense, in my mind
Oh I see what you are saying
Thereâs a difference between reading and writing 
But you can use bulk set without setting on startup.
Wym, they need to read each bot command on any command patch right?
No matter if its bulk set or single patch(or post)
Afaik
Actually not on patch right? Hmm ^_^
Since patch requires including the command id
Not sure how theyâre actually store it
I guess our simple relational thinking of how itâs stored especially if you speak about it being written into a single column is far away from reality
But more and more assuming than knowing
No
Well, single column would be faster for read wouldn't it?
99% of the time these are reads.
I fucking need to sleep 
Op ty for informing
Good conversation. Sleep good
If Tim was here he would have given us the exact number of optimal instructions either way.
@_@
Hi tim
fucking same
Just wanna say on a technical point of view, bulk updating (overwriting each command) requires READ & WRITE processes on any command (if not stored as bulk)
Fetching all commands just requires a READ process and a WRITE process only when I update a command if needed
true if you dont account for network overhead and latency
Shut up
lmao
I would have no input on that anyway.
That's above me ^_^
What's the topic now.
If bulk setting commands makes sense.
fuck it I go sleeping too
Gn folks
Bulk setting meaning?
Woo has managed to break me
Like sending the JSON?
bulk = bull + elk
lmao
^
Iâm curious tim
I mean it makes sense.
Did you stay up until almost 6am or did you just wake up really early 
when?
he says he needs to sleep so I assume he is just still up
6 am 
also what timezone is Tim in?
dn
its 2am for me lol
Brazil?
Oh wait
yes
I was thinking u were in EU
did you recently move?
He got thrown out
about 3 months ago
most of south america in 2am
i was demoted from gold to bronzil
Sucks starboard doesn't work
Iâm sure youâre posting pictures on Facebook and sitting there the whole day long waiting for somebody to hit the like button

And youâre sad if nobody likes it
Ha! Got you again Sir
whoever you're talking about aint me
Obviously Woo wtf
Get your sleep
This discussion has cost me 2h of my sleep cycle ffs
đ spooky
i go too kthxbye
Iâm on break so I can go to bed at 4 and wake up at 3 like a cat so 
đ what did I do
Iâm sure woo can take it
Kek doesn't bother me


gotta love when js code doesn't load into the discord website
Thats just JS in any situation
yeah
my fucking window.close won't work and i don't know what permission i need for that
website development bruh
so annoying
WHAT THE FUCK
little shi
when executing window.close() in the terminal it works but on websites it doesn't
hella weird
message = await inter.reply({ embeds: [embed], components: [row], fetchReply: true })
const filter = (filter) => {
if (inter.user.id === filter.user.id) return true
return filter.reply({ content:'you cant do that', ephemeral: true })
}
const collector = message.createMessageComponentCollector({ filter: filter })
collector.on('collect', async i => {
switch (id) {
case 1:
if (num === 1) return i.deferUpdate()
...
break;
case: 2:
if (num === 2) return i.deferUpdate()
...
break;
})
I have a problem: When num is 2 and the case is 2 if makes a defer update. But when I press a second time no matter which button it says:
DiscordAPIError: Unknown interaction
method: 'post'
code: 10062,
httpStatus: 404,
requestData: { json: { type: 6 }, files: [] }
The same thing when the case is 1 and the num is 1 too. At first it makes a defer Update and it all works fine. But when I press another button no matter which one it says unknown interaction again
Whole code: https://pastebin.com/2rhXWhAd
How do you get the search bar content for a chrome extension?
like this search bar
Look on inspect element
oh okay
See if that bar input has a unique id
okay
If so you can get it
okay
how would i read the last line of a txt file?
for a big file, or for a small file that fits into memory?
How can I get a picture in vsc that I have as a .png with code for js
wat
certainly one way to respond to that
yeah
you're gonna have to explain better because i have no idea what you just said
there you go 
Though it depends on what you are doing with the picture
a picture from the internet?
you have to download it using any http lib, like node-fetch, axios, etc
I think he already has it downloaded
He specified it was a png file so I assume it is already downloaded
Yeah, it's downloaded on my folder
then read the file using fs
Okay
Got a small problem where can I find the intends I need
I mean I am not so sure what I will be needing
There is a website right
For d.js
no
slash commands do not use the intents system
you dont need any intent for slash commands
when for a music bot
I mean I am gonng to set the prefix for the bot mention as its allowed
You'll need to look through the intents and determine what you think your bot will need. For example, GUILD_VOICE_STATES may be useful.
But if I had to assume, you probably won't need it.
not only useful, but required
GUILDS
GUILD_INTEGRATIONS
GUILD_VOICE_STATES
GUILD_MESSAGE_REACTIONS
DIRECT_MESSAGE_REACTIONS
DIRECT_MESSAGES
@quartz kindle Sorry for the ping.
Is this all or are sone not needed
some*
do you need to see when random people start typing?
<@mention> help - Commands
do you need to see when random emojis and stickers are updated by their guild admins?
that no
why does that need to see when people "start typing"?
like "xyz is typing..."
ooh that is what it means
integrations = what
some weird crap nobody understands
rip
PRESENCE INTENT & SERVER MEMBERS INTENT & MESSAGE CONTENT INTENT
Is not needed right
So the final list is ```
GUILDS
GUILD_VOICE_STATES
GUILD_MESSAGE_REACTIONS
DIRECT_MESSAGE_REACTIONS
DIRECT_MESSAGES
you can check it yourself
Integrate your service with Discord â whether it's a bot or a game or whatever your wildest imagination can come up with.
you probably want GUILD_MESSAGES
But is this not a premium thing
no
DIRECT_MESSAGE_REACTIONS Need this right if your using a reaction system
Yes true but I dont like the buttons
have fun getting rate limited alot
https://static.capy.host/MCX0pV8L.png is it possible to do this sort of thing in tailwind?
(its a mockup i made)
yes
anything you can do with css you can do with tailwind 
but from top thoughts
either a relative-absolute container combination
or
would it be easier for me to make them as an image/svg 
translation
i mean you could?
no
no
a lot of people dont as well tho
Okay hear me out, my last handler sucked dooty, so I swapped to commands that look like this:
module.exports = {
name: 'move',
description: 'Move a Thread.',
options: [{
name: 'category',
type: 'STRING',
description: 'Input a Category Name.',
required:true,
}],
async execute(interaction, client) {```
But how would I make **SubCommands** using that?
You could make one of the props be for subcommands and you could then also tie those subcommands to methods in it?
._. what
So something like
module.exports = {
name: 'move',
description: 'Move a Thread.',
subCommands: ['show']
options: [{
name: 'category',
type: 'STRING',
description: 'Input a Category Name.',
required:true,
}],
async execute(interaction, client) {},
async show(interaction, client){}
Something similar to a framework I used to use did it this way
ahh
but what if a sub command needs a string?
Wdym?
What if the sub commands need options as well?
like /move show category: blah
Mmm, good question It was just an idea I thought of off the top of my head
Ah yea
Not to mention I am more used to using classes for commands so it would be a lot easier for me to come up with a method for a class :p
lol
I was thinking something like a option yk?
You could probably do something like a lookup.
subCommands: [{
name: 'name',
descripion:'description',
}]
You could probably do that yea
Like all that within the Sub command and just add a option?
You would just have to register all sub commands as well
I don't think I can add a option within a alr existing {..} huh?
Yeah, they already are.
You can
It wont bother it
That's the first thing on my command handler I fixed.
oh ah
Ig I'll just go have to try some things hah
but if I did that
How would I fetch the sub command & its option?
I think if anything that is a decent way of doing it
yeah
If it actually works 𤣠I'll go try some things
Okay yeah that worked.
subCommands: [{
name: 'create',
description: 'Create a Snippet',
options: [{
name: 'name',
type: 'STRING',
description: 'Input a Snippet Name.',
required: true,
name: 'description',
type: 'STRING',
description: 'Input a Snippet Description.',
required: true,
}]
}],```
Noice
Okay, I have no clue how I'm even doing thsi rn
I've hit 2 429 Errors.
Meaning I've been timed out or temp banned 2 times.
But I'm barely editing it.
The limit of edits is 1000, I've used 11, and I'm already hitting a 429?
đ I dont think you hit the daily limit
thats not the only ratelimit
the timeout appears to be for 40 seconds
possibly sending put requests too fast
pretty sure the limit is 100 not 1000 last time i checked
It's firing the event when nobody is messaging it.
That's straight from the debug, it says out of 1000 đ¤ˇ
oh you instansiating ws connections
sorry i was on interactions mode
wait nvm not it is interactions
yeah its not 1000
the 1000 is how many websocket logins you can do in total per day
the remaining value is how many logins you can make for the rest of today
that's not what's 429'ing
The application commands are.
you're 429ing from sending a PUT request to a specific guild's application command
Because I am put'ting them to fast.
^^ yep
yes
you probably have a cycle somewhere
Ahh, I swapped to a new handler, I was logging a general messageCreate and not on DM, I also forgot to add DM Type Intents.
So uhh, yeah this happened
for (const file of commandFiles) {
const commandfile = require(`./commands/${file}`);
client.commands.set(commandfile.name, commandfile);
data.push({
name: commandfile.name,
description: commandfile.description,
options: commandfile.options
})
}
client.once('ready', () => {
console.log('Ready!');
client.guilds.cache.get('834615041537867806')?.commands.set(data)
})```
Although I'm not creating multiple with this, am I?
That happens when the global slash-commands and the guild commands with the same names conflict, or if that's not the case, it can also be caused by your Discord client, try reloading it, if reloading does not fix it, then it's the first case, you can delete the global ones or the ones on the guild to fix that
It is caused due to the global commands also loading
If he goes to another server and invites the bot it would not dupe
So, ultimately just make em global and not guild tbh?
It doesn't matter what you do
After you are done testing you can remove the guild commands if you want and the global will remain
I can remove all guild commands right n just 1 line? w/o going though and putting each id?
is there a way to do that? đ¤Ł
Choose one of them, if you want to test the slash-commands out, I recommend registering them to the guild since they get cached instantly while global slash-commands take an hour to be cached
Yep
Slash Commands load instantly for me.
Though registering them as guild commands also seem to register them globally
It just prioritizes one guild
Cause you are registering them as guild commands
Guild Commands are instantly loaded
Ahh
The global ones does not load instantly for anybody, you've registered them about an hour ago or less, which both now one load
Global commands take up to an hour to finally appear in the cache
Just call the <Guild>.commands.set() method and pass an empty array to it to remove all of the slash-commands from that guild
^
for (const file of commandFiles) {
const commandfile = require(`./commands/${file}`);
data.push({
name: commandfile.name,
description: commandfile.description,
options: commandfile.options
})
}
client.once('ready', () => {
console.log('Ready!');
client.guilds.cache.get('834615041537867806')?.commands.set(data)
})```
So that?
Pass an empty array instead of the data variable
so nothing in .set(*here*)
nothing there^?
pass an empty array
as he said
[]
Done.
Yeah I had to think lol
Only do this if you are done testing though
No point in doing it now
It didn't delete all of em
Maybe because they're already globally loaded?
They were loaded both globally and in that specific guild, you've deleted all of the guild slash-commands by calling that, so now only the global ones remain
ohh okay.
Keep in mind though if you wanna make more slash commands you have to load them respectively either guild (for testing) or global
Ahh, okay, tysm
SO just like
If I wanna test
add back the guild n test that one command
but if I am good n they're all set, just load global?
bettt
ty
what is happening
the image is cut off
the g part?
yes

yep that worked
pogger
@earnest phoenix do you like the design 
i made the categories bit smaller
to the point i can't see them
i haven't added the categories yet
i have the images, just need to make the row and add them
suggestion: use a flexbox instead of grid
so it automatically wraps to the next line on smaller screen
why is that an image anyways?
to fuck accessibility ofc
because of the design
idk how to make it work in html
that's easily doable man
images on top alright, talking about the border and text
yeah
Anyone?
Oh so only the star is in the image? or what
the star is the image on top of the border and text
try
<fieldset>
<legend><img role="presentation none" src="https://star img" /></legend>
<h3>Starboard</h3>
<p>ultra cool starboard that ACTUALLY works</p>
</fieldset>
Is it possible to get a user's IP with js? (chrome extension)
the server has access to that iirc
okay
But why is "Categories" an image
me when the css has ocr
Fieldset wouldn't be right here.
there aren't any fields in ther lmao
its the image background for the text
.name {
background: url("https://static.capy.host/9o4rrC4e.png") repeat;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}```
Reliably, no
User can always use vpn
Oh
And there are some other things that can end up messing the passed ip
true
should you really be using vendor prefixes
<!DOCTYPE html>
<html>
<head><style>fieldset {text-align: center;} legend img { width: 5rem; height: 5rem; }</style>
<title>Page Title</title>
</head>
<body>
<fieldset>
<legend><img role="presentation none" src="/favicon.ico" /></legend>
<h3>W3Schools</h3>
<p>Terrible website. Don't go there</p>
</fieldset>
</body>
</html>
TEST THIS IN AXE DEVTOOLS
NOW
I DO NOT WANT TO TEACH PEOPLE INACCESSIBLE CODE
how do i style it white
fieldset h3, fieldset p { color: white; }
don't forget the fieldset part otherwise it will style every h3 and p tag on the page
i did style="border:1px solid white"
oh wait
i thought you meant the text lmfoa
how do i add a gap between each one tho
text-white as its tailwind
tailwind 
hey I have a bot that I need for my company's discord. I have asked a couple people for help with it but it seems to be very difficult. It is a channel countdown bot that show up as a locked voice channel. It needs to countdown to 8am monday and then restart and do it over.
If anyone thinks they could make this I am looking to hire
You can use a cron job and lock/unlock the vc
or something similar to a cron job
Got a small error on d.js v13
const chalk = require("chalk");
Error: ```
Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\bla\bla\Discord Development\Public\Radio_X_Alpha\node_modules\chalk\source\index.js from C:\Users\bla\bla\Discord Development\Public\R
adio_X_Alpha\tools\Logger.js not supported.
what the fuck is a cron job
That has nothing to do with djs tho
Downgrade your chalk version
You dont even know what cron jobs are
New versions of chalk use ESM instead of require()
đŠ
Depends on how precise you want the countdown to be
which version
Cron jobs execute tasks every x time and usually are done on a separate process
Second-precise? Forget abt it
Minute-precise? Maaaaybe
Hour precise? That's fine
well, you realistically only want to edit the channel every 10 minutes
And a single channel
we have a server already
Wait did I mistake what they wanted đŠ
like a discord server and a server with pebble
I am too tired ima head out of the dev channel
and you can litterally only edit the channel twice per 10 minutes although that still seems to potentially be more restrictive
Tf is pebble?
oh noe
i have NO CLUE about any of this
pebble is some server my company has for discord bots
I think the op wants someone to develop a bot for them with that capability.
rip
lol why?
So like
Probably, not that it's a hard task
Maybe s/he could be directed on how to do it
Please learn javascript before you make a bot
And since the task was assigned to them, I deduce that there has to be some programming background there
honestly that was the most javascript developer moment i've ever seen
Nvm found my mistake
Thank you though
every seen
đ
Dum me
Any way thanks
Yes, but they said they just need a bot with that capability and would be willing to hire someone to develop it. Hence, it would probably be better to ask on a site like Fiverr or ask if they want to develop it themselves.
you're welcome
ok thanks
happy new year topggers
the first three letters of the last word hmm
ers
topggers
cringe
topggians
also cringe
topgang
better
Yes
topggista
topggay
top
Alright. I have some code here that does reaction roles. Why is the keep_alive() returning an unexpected unindent error?
@client.command()
async def roles(ctx):
embed=discord.Embed(title="Reaction Roles", description="React with the corresponding emoji to get the role", color=0xff0000)
embed.set_author(name="Joca Management", icon_url="https://images-ext-1.discordapp.net/external/CxjorkQC8xvkLM-OeH78kpf_yP2LNGUYCEltqM3Iomc/%3Fsize%3D128/https/cdn.discordapp.com/avatars/638089573687099442/a9e972fcae9dd9b581da9f9e4f21fb26.png")
embed.add_field(name=":red_cirle:", value="Red", inline=True)
embed.add_field(name=":orange_cirle:", value="Orange", inline=True)
embed.add_field(name=":yellow_cirle:", value="Yellow", inline=True)
embed.add_field(name=":green_cirle:", value="Green", inline=True)
embed.add_field(name=":blue_cirle:", value="Blue", inline=True)
embed.add_field(name=":purple_cirle:", value="Purple", inline=True)
msg = await ctx.send(embed=embed)
await msg.add_reaction(':red_circle:')
await msg.add_reaction(':orange_circle:')
await msg.add_reaction(':yellow_circle:')
await msg.add_reaction(':green_circle:')
await msg.add_reaction(':blue_circle:')
await msg.add_reaction(':purple_circle:')
def check(reaction, user):
return user == ctx.user and reaction.message == msg and str(reaction.emoji) in [':red_circle:',':orange_circle:',':yellow_circle:',':green_circle:',':blue_circle:',':purple_circle:']
while True:
try:
reaction, user = await client.wait_for("reaction_add", check=check)
if str(reaction.emoji) == ':red_circle':
mrole = discord.utils.get(ctx.guild.roles, name='Red')
await user.add_roles(mrole)
print ('gave a role to someone')
keep_alive()
client.run(token)
You seem to have some indentation above it.
is it wrong?
Notably
so just remove that
I don't know if it's causing the error, but if I had to give advice, try removing it.
That's interesting.
also tried adding a matching indent above it since its an unindent error but that didn't help
Wait shit wrong chsnnel
I think it's due to the try block
You don't have an except: in there, so it's looking for it.
hmm
Which causes it to look at keep_alive and get confused about its indentation.
Soo where should I add the except:
In the same scope as the try, like so
ty
By the way, you can improve your code by applying loops to add embed fields and message reactions.
oh ok
while True:
try:
reaction, user = await client.wait_for("reaction_add", check=check)
if str(reaction.emoji) == ':red_circle':
mrole = discord.utils.get(ctx.guild.roles, name='Red')
await user.add_roles(mrole)
print ('gave a role to someone')
except: Exception as e:
pass
like so?
You don't need the colon after except
wot
Your bot shouldn't send typing indicators when using interactions to my knowledge.
If you want it to.
alr so I have another issue. Its saying that positional arguments and one keyword was passed.
@client.command(pass_context=True)
async def ticket(ctx):
guild = ctx.guild
embed = discord.Embed(
title = 'Ticket system',
description = 'React đŠ to make a ticket.',
)
embed.set_footer(text="React to create a ticket")
msg = await ctx.send(embed=embed)
await msg.add_reaction("đŠ")
reaction = await msg.fetch_message(msg.id)
def check(reaction, user):
return str(reaction) == 'đŠ' and ctx.author == user
await client.wait_for("reaction_add", check=check)
await guild.create_text_channel(name=f'ticket - {ctx.author}')
@client.command()
async def roles(ctx):
embed=discord.Embed(title="Reaction Roles", description="React with the corresponding emoji to get the role", color=0xff0000)
embed.set_author(name="Joca Management", icon_url="https://images-ext-1.discordapp.net/external/CxjorkQC8xvkLM-OeH78kpf_yP2LNGUYCEltqM3Iomc/%3Fsize%3D128/https/cdn.discordapp.com/avatars/638089573687099442/a9e972fcae9dd9b581da9f9e4f21fb26.png")
embed.add_field(name=":red_cirle:", value="Red")
embed.add_field(name=":orange_cirle:", value="Orange")
embed.add_field(name=":yellow_cirle:", value="Yellow")
embed.add_field(name=":green_cirle:", value="Green")
embed.add_field(name=":blue_cirle:", value="Blue")
embed.add_field(name=":purple_cirle:", value="Purple")
msg = await ctx.send(embed=embed)
await msg.add_reaction(':red_circle:')
await msg.add_reaction(':orange_circle:')
await msg.add_reaction(':yellow_circle:')
await msg.add_reaction(':green_circle:')
await msg.add_reaction(':blue_circle:')
await msg.add_reaction(':purple_circle:')
def check(reaction, user):
return user == ctx.user and reaction.message == msg and str(reaction.emoji) in [':red_circle:',':orange_circle:',':yellow_circle:',':green_circle:',':blue_circle:',':purple_circle:']
while True:
try:
reaction, user = await client.wait_for("reaction_add", check=check)
if str(reaction.emoji) == ':red_circle':
mrole = discord.utils.get(ctx.guild.roles, name='Red')
await user.add_roles(mrole)
print ('gave a role to someone')
except Exception as e:
pass
You'll need to find where the error is occurring, as should be outlined in the error message.
its not though. Thats the issue.
Can you show us the error?
Ok, now you know that it's coming from add_field(...)
And the error says that one positional argument is expected, but you gave two, along with a keyword argument
yeah
I tried searching the code for all usage of add_field but I don't see the issue
I might be blind tho so
The error likely displays the line number.
the error above it mentions this line
embed.add_field("$roles", value="View all the roles and their info.")
Anyone wanna make a bot together? im looking to make any bot and go out of my knowledge and learn more!
In the docs (https://discordpy.readthedocs.io/en/latest/api.html?highlight=add_field#discord.Embed.add_field), add_field expects keyword arguments rather than positional arguments, yet you've passed "$roles" as a positional argument.
Also, are you using discord.py, or a fork of the library?
You should consider migrating to a fork of it, like Pycord or Nextcord.
Discord.py has been deprecated and won't receive updates in the future.
ik
alright
maybe I'm stupid but why isn't it' registering my emojis?
embed.add_field(name=":red_circle:", value="Red")
embed.add_field(name=":orange_circle:", value="Orange")
embed.add_field(name=":yellow_circle:", value="Yellow")
embed.add_field(name=":green_circle:", value="Green")
embed.add_field(name=":blue_circle:", value="Blue")
embed.add_field(name=":purple_circle:", value="Purple")
msg = await ctx.send(embed=embed)
await msg.add_reaction(":red_circle:")
await msg.add_reaction(":orange_circle:")
await msg.add_reaction(":yellow_circle:")
await msg.add_reaction(":green_circle:")
await msg.add_reaction(":blue_circle:")
await msg.add_reaction(":purple_circle:")
error:
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 10014): Unknown Emoji
Check the documentation for adding reactions
You can't supply emoji names like that.
I did
You have to use their identifiers.
If I remember correctly, you have to use the emoji format (https://discord.com/developers/docs/reference#message-formatting-formats).
If you're using a regular emoji, you have to use the raw unicode emoji. For example, đş should be sent as \đş
oh ok
while True:
try:
reaction, user = await client.wait_for("reaction_add", check=check)
if str(reaction.emoji) == 'đĽ':
# mrole = discord.utils.get(ctx.guild.roles, name='Red')
mrole = ctx.guild.get_role(926536964860158074)
await user.add_roles(mrole)
print ('gave a role to someone')
except Exception as e:
pass
So why isn't it giving me the role?
while true đŠ
yes ik
and remove the try catch
Its reaction roles
you're muting the error
that's why u don't get any error on console
or at least add print(e)
try except 
while(troll) 
ok so now it says that the value "reaction" is undefined
cuz it is
(reaction, user) = await not reaction, user = await
the way u did is the same as
reaction
user = await ...
oh
u could do reaction = something, user = otherthing, abc = 123
it's a valid syntax
the way u did u only initialized variable user
foo, bar = await wait_for() is perfectly valid code
doesn't it need parens?
basically everything Kuu said is incorrect
wot
and is basically the opposite
I mean, in all languages I saw multiple declaration had parens
reaction = something, user = otherthing, abc = 123 isnt valid
it is
run it
I've never seen that
ah wait, yeah it'd be semicolon
only this
because it's incorrect
nothing wrong with that, its very common to see
well I did this
try:
(reaction, user) = await client.wait_for("reaction_add", check=check)
Would this work?
literally isnt any different to the code you had
ok
does python have ternary operators or something equivalent
foo if condition else other
a, b, c = "a", "world123", 3
mm Ic
again, python
^
so python doesn't have something like how js has expression ? true : false
I just showed you the equivalent
that is valid python
Well yes I know the equivalent
also for immutable items a = b = c = 1
I was just wondering if python had what js had
yet not inline declaration
idk how that's called, but it's a different thing
well they exist as key words yes
I did not know this
they dont actually behave as ternary operators though, they just lazily evaluate the truthyness of an object
icic
bearing in mind | and & are purely bitwise arithmetic operators in py / separate to or and and logic
like to call a function from a module script
how?
@opaque fern
basically i have a js module in a script tag that is the create user function
bc it doesnt work outside of it for some stupid reason
so idk how to actually call the function
đ¤
bc it says the function isnt found if its in the module
I assume this is web dev stuff
yeah
<script type="module">
import { initializeApp } from 'https://www.gstatic.com/firebasejs/9.6.1/firebase-app.js';
const firebaseConfig = {
...
};
const app = initializeApp(firebaseConfig);
import { getAuth, createUserWithEmailAndPassword } from "https://www.gstatic.com/firebasejs/9.6.1/firebase-auth.js";
const auth = getAuth();
function _signup() {
const email = document.getElementById('email').value;
const password = document.getElementById('password').value;
createUserWithEmailAndPassword(auth, email, password)
.then((userCredential) => {
// Signed in
const user = userCredential.user;
alert("signed up");
// ...
})
.catch((error) => {
const errorCode = error.code;
const errorMessage = error.message;
alert(errorMessage);
// ..
});
}
</script>```
and it doesnt let me call it
you can do an onclick event in a button if that is what you're trying to do
yeah
exactly
but it doesnt let me
so basically for the createUserWithEmailAndPassword function
it needs the const auth = getAuth();
and for. that it needs the imported thing and the app
so in the docs for it, it says to "pass it in" but that doesnt make sense
any ideas?
@earnest phoenix @marble juniper ?
sowwy
and no ping yes
Any alternatives to canvas talking about the npm package
I find installing canvas to be rather annoying unless they've changed it
depends on what you are doing I would think
canvas kinda does "everything"
other libs dont
Just trying to make a card with information people give
So I am stuck with canvas great
lets go see if it is still aids to install
it is, but only takes 10 minutes or so.
Pure JS image drawing API based on Canvas. Export to PNG streams.
đ¤ ?
the problem with canvas alternatives is performance
one of the most popular pure js image compositing is jimp, and its terribly slow
đ
Gpk or something else is needed too iirc.
Idk if that's in build tools
build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
on ubuntu/debian
Was gtk I was thinking of.
For windows
ah yes windows is speshul
https://static.capy.host/VJAgW9AH.png how the fuck do i fix this on mobile
flex boxes and flex-wrap is your friend
https://static.capy.host/5Nx18C4s.png thats the pc view
welleach one of those cards should be its own container
and then have a parent container
so basically just flex flex-wrap or more likely for mobile flex flex-col lg:flex-row
depending on how you wan the flex box behavour to go
flex-wrap probably better tho and / or a combo
its uh
fieldset
<div class="w-1/4" onclick="location.href = '/dashboard/822059901568024616';" style="cursor: pointer;">
<fieldset class="text-white rounded-lg text-center" style="border:1px solid white">
<legend><img role="presentation none" src="https://cdn.discordapp.com/icons/822059901568024616/f7ba9cd05f50205e4ecacaa35dbab5d5" style="border-radius:50%; width: 80px" onerror="if (this.src != 'https://eu.ui-avatars.com/api/?name=big bun's server&size=128') this.src = 'https://eu.ui-avatars.com/api/?name=big bun's server&size=128';"/></legend>
<h3 class="text-2xl mx-5 mb-5">big bun's server</h3>
</fieldset>
</div>```
blame @earnest phoenix
although your child having a width of w-1/4 is a little eak
if you have a really big screen then shit gonna grow too big
too small and it's gonna be tiny
you would know
eye balling it, it looks around w-64
2 secs
luckily i'm production testing

epic that works
ty @modest maple
now how do i center it 
yeah that shit doesnt look straight
did you use margin or something
on your parent flex box you probably want flex justify-center
What's masonry
animated grids
its a pain for elements you do not know the size of beforehand
such as videos
what your parent should look like:
flex flex-wrap justify-center w-full lg:w-3/4 space-y-8 lg:space-y-0 lg:space-x-4
What children probably want
w-full lg:w-64```
hi ok so if anyone understands firestore rules pls help
email: user.email,
},
account: {
name: user.displayName,
photo: user.photoURL,
},
user: { // uneditable
isBirthday: false,
badges: [],
created: user.metadata.creationTime,
last_login: user.metadata.lastSignInTime,
admin: false,
},
data: {
profile: {
bio: "",
location: "",
pronouns: [],
gender: "",
age: null,
birthday: [null, null, null], // day month year
},
connections: {
website: "",
twitter: "",
github: "",
instagram: "",
youtube: "",
discord: "",
twitch: "",
steam: "",
}
}```
this is the user boject right
so i want the user's email to be only readable if the user is the actual author, have everything else public, and editable by the author except for the user key
if i need to change stuff around then its fine, just someone pls explain cuz the rules are very complicated
match /databases/{database}/documents {
match /users/{uid} {
allow read;
allow write: if request.auth.uid == uid;
}
}
}``` this is my rules rn, its jsut that everyone can edit their own documents




