#development

1 messages ยท Page 1903 of 1

quartz kindle
feral aspen
#

I'm using slash commands for the buttons, now, what could I do?

earnest phoenix
#

here's an example:
npm uninstall discord.js && npm install detritus-client

const { Utils: { ComponentActionRow } } = require("detritus-client");

const row = new ComponentActionRow();
// first button
row.addButton({
label: "whatever",
run: context => didn't need to differentiate
});
// second button
row.addButton({
label: "whatever 2",
run: context => didn't need to differentiate
});
quartz kindle
#

erwin 2.0

earnest phoenix
#

I'm following detritus code of conduct

#

I have to encourage people to uninstall discord.js

quartz kindle
#

religious freak smh

#

church of detritus

feral aspen
#

Does something like this, work?

earnest phoenix
#

djs is so hard

#

the only that sucks about detritus is docs

feral aspen
#

Wait, messed up in something.

earnest phoenix
#

ayo wouldn't this always return true

feral aspen
#

Does this work?

const row = new MessageActionRow()
    .addComponents(
        new MessageButton()
            .setCustomId('yes')
            .setLabel('No')
            .setStyle('SUCCESS'),
        new MessageButton()
            .setCustomId('no')
            .setLabel('Yes')
            .setStyle('DANGER')
    )

const filter = (interaction) => {
    if (interaction.user.id !== message.author.id) return interaction.reply({ content: 'You cannot use this button.' });
};

const collector = message.channel.createMessageComponentCollector({ filter, max: 1 });

collector.on('end', ButtonInteraction => {
    const id = ButtonInteraction.first().customId;

    if (id === 'yes') return message.channel.send('Banned user.');
    if (id === 'no') return message.channel.send('Cancelled Action');
})

return await message.channel.send({ content: 'Hello World!', components: [row] });
earnest phoenix
#

A promise is also a truthy value

feral aspen
feral aspen
quartz kindle
#

you're over complicating

feral aspen
#

I thought this is how you can handle each button, alone.

quartz kindle
#
const row = new MessageActionRow()
    .addComponents(
        new MessageButton()
            .setCustomId('yes')
            .setLabel('No')
            .setStyle('SUCCESS'),
        new MessageButton()
            .setCustomId('no')
            .setLabel('Yes')
            .setStyle('DANGER')
    )

const filter = interaction => interaction.message.id === message.id && interaction.user.id === message.author.id

const response = await message.awaitMessageComponent({ filter, time: 10000 }).catch(() => null);

if(!response) { return message.channel.send("timed out") }

if(response.customId === "yes") {
  // do something
} else {
  // do something else
}
feral aspen
#

Remind me, mine is more complicated, that's all?

quartz kindle
#

and dont forget to edit the message and remove the buttons once its done

feral aspen
quartz kindle
feral aspen
#

Ah, makes sense.

feral aspen
#

Oh, I found it.
False alarm.

quartz kindle
#
const newmessage = await message.channel.send(...)
const response = await newmessage.awaitMessageComponent(...)
feral aspen
#

Didn't work either...

#
const m = await message.channel.send({ content: 'Please select a button to perform an action.', components: [row] })

const filter = (interaction) => interaction.message.id === m.id && interaction.user.id === m.author.id;
const response = await m.awaitMessageComponent({ filter, time: 15000 }).catch(() => null);

if (!response) return message.channel.send({ content: 'You have timed out.' });
switch (response.customId) {
    case 'yes':
        message.channel.send({ content: 'Hooray.' });
        break;
    case 'no':
        message.channel.send({ content: 'Failed' });
        break;
};
#

WAIT-

#

It's not working, yet.

quartz kindle
feral aspen
#

In my interaction event, I did this.

if (interaction.isButton()) {
    
};
#

I have nothing to handle there...

quartz kindle
#

you dont need the interaction event

feral aspen
#

Alright, I just removed it. What can I do for this?

#

It says interaction failed, so do I do something like...

earnest phoenix
#

did you defer the button?

feral aspen
earnest phoenix
#

response.reply() instead of msg.ch.send

#

Or

#

response.deferUpdate(); with message.channel.send

feral aspen
#

response.followUp()?

#

Why won't that work, too?

#
switch (response.customId) {
    case 'yes':
        response.followUp({ content: 'Hooray.' });
        break;
    case 'no':
        response.followUp({ content: 'Failed' });
        break;
};
sterile brook
#
// โ€”โ€” Confirms to the "interaction" that it has worked
await button.reply.defer()
feral aspen
feral aspen
sterile brook
feral aspen
sterile brook
feral aspen
sterile brook
#

what u expect from me to say?

feral aspen
#

I just asked what I could do to make it followUp based on my code.

sterile brook
#

ic

feral aspen
#

I didn't mind you not knowing the answer, so I'm just waiting for an answer from anyone.

earnest phoenix
feral aspen
earnest phoenix
#

Hmm

#

Is that all your code ?

feral aspen
feral aspen
earnest phoenix
#

You need that buttons one time or everytime?

feral aspen
#

One time.

earnest phoenix
#

Okay than collector is better

#

Create a collector

feral aspen
#

Use it one time for a command.

feral aspen
boreal iron
#

Why would you wanna use a collector if pressing a button is triggering the interactionCreate event?

earnest phoenix
#

and

 collector.on('collect' async i => {
if(i.customId === "yes") {
//Code here
}
});
quartz kindle
#

collector is not good for one time

#

collector is used to collect multiple things

feral aspen
#

I'm using mine for one time use, like one performing command, use.

earnest phoenix
#

Yes but using it on interaction create event isnt logical

sterile brook
feral aspen
#

Tim, could you tell me how I could follow up the button?

earnest phoenix
#

i.fallowUp()

feral aspen
earnest phoenix
#

interaction.fallowUp()

quartz kindle
#

followups can only be used if you defer it first

feral aspen
quartz kindle
#

yes

feral aspen
#

What does defer do, exactly?

boreal iron
#

As he said you have to defer the button reply, then sending the follow up message

sterile brook
#

i said to u

#

what it does

quartz kindle
#

when you receive an interaction, you have 3 seconds to reply. if you dont reply in 3 seconds, the interaction fails

#

defer basically responds with "i will respond later"

feral aspen
quartz kindle
#

so you have more time

feral aspen
#
TypeError: Cannot read properties of undefined (reading 'followUp')
#
await response.defer.followUp({ content: 'Hooray.' });
quartz kindle
#

no

earnest phoenix
#

Lol

feral aspen
#

Wait-

quartz kindle
#

await response.deferReply()

boreal iron
quartz kindle
#

but you only need this is your response actually takes time

#

if you can respond immediatelly, just reply

feral aspen
quartz kindle
#

because followup only works if you defer

boreal iron
#

Because you didnโ€™t replied yet

#

Or replied

sterile brook
#

If u need so

royal herald
#

Error [ERR_REQUIRE_ESM]: require() of ES Module node_modules/node-fetch/src/index.js from

not supported.

quartz kindle
#

use node-fetch v2

feral aspen
quartz kindle
#

or use const fetch = (await import("node-fetch")).default

feral aspen
boreal iron
#

Dude if you can reply to somebody pressing a button immediately then do it.
If you canโ€™t you have to defer the reply to send your follow up message later on

sterile brook
#

@feral aspencan u send ur snippet?

feral aspen
earnest phoenix
#

No

#

It is waiting your interaction untill you reply it or for 10 mins

boreal iron
#

No deferring is telling Discord to expand the lifetime of the webhook to 15 min instead of 3s

earnest phoenix
#

It is using for if codes take more than 3s to run

boreal iron
#

Tim still writing omg oldEyes

feral aspen
#

Ah, so now I understood. How exactly, in code, are you supposed to defer then follow up? Now I have the response as the button interaction object.

quartz kindle
# feral aspen

when you receive an interaction, you have 3 seconds to respond with one of these:
reply = respond immediately.
update = respond immediately by editing the message.
deferreply = respond with "i will respond later".
deferupdate = respond with "i will edit the message later".

if you defered it, you have 15 minutes to respond.
if you used deferreply, you can use reply
if you used deferupdate, you can use update
followup = respond to a defered interaction or to an already responded interaction

boreal iron
#

Then later on in your code you send your follow up message if youโ€™re ready to

#

If somebody is pressing a button and you only perform an action like deleting a message or anything else doesnโ€™t take longer than 3 s, respond with a reply which is immediately

feral aspen
#

Ah, now this all makes sense. I remember in the slash commands whereas it would defer the reply, so I believe adding a line like

if (interaction.isButton()) await interaction.deferReply({ ephemeral: false }).catch(() => {});

.. would solve all the issues for my buttons, correct? (Confirmed after testing)

feral aspen
quartz kindle
#

the messagecomponent helper methods are selfcontained

feral aspen
feral aspen
quartz kindle
#

awaitMessageComponent and ComponentCollectors do not need the interaction event

#

the interaction event does not affect them

feral aspen
quartz kindle
#

you are just making it automatically defer all buttons

#

no matter where they came from

feral aspen
quartz kindle
#

if you use the helper methods, dont mix it up with the interaction event

#

otherwise you're working on the same thing from two different places, which will create a mess, and possibly race conditions (strange bugs depending on which happens to be executed first)

feral aspen
#

So instead of if (interaction.isButton()) await interaction.deferReply({ ephemeral: false }).catch(() => {});, I remove it and defer the reply manually?

quartz kindle
#

yes

#

delete your entire interaction event if you're not using it for anything else

feral aspen
#

.. but yeah, removed.

quartz kindle
#

its the same with reactions for example

#

you have awaitReactions and reactioncollector

#

and also the messageReactionAdd event

#

when you use reactions, you dont mix them up

#

you dont use both the messageReactionAdd event and awaitReactions for the same thing

boreal iron
#

How long are buttons actually triggering the event? Forever?

boreal iron
#

Tim? Youโ€™re aware of that?

feral aspen
#

Anyways, to handle each button alone. I define a message variable by sendnig a message and its buttons, create a filter to do a couple of checks, and a response variable to await the message component returning the button interaction object. We check if it is nulled (aka timing out), else checking the ID and performing an action in response.

#

That's it, right? ^

#

Now we did this all using messages, how does this differ from interactions (slash commands)? It's the same, right?

sterile brook
#

kek

#

again

royal herald
#
node:events:371

      throw er; // Unhandled 'error' event

      ^

Error: socket hang up

    at connResetException (node:internal/errors:691:14)

    at Socket.socketOnEnd (node:_http_client:471:23)

    at Socket.emit (node:events:406:35)

    at endReadableNT (node:internal/streams/readable:1331:12)

    at processTicksAndRejections (node:internal/process/task_queues:83:21)

Emitted 'error' event on ClientRequest instance at:

    at Socket.socketOnEnd (node:_http_client:471:9)

    at Socket.emit (node:events:406:35)

    at endReadableNT (node:internal/streams/readable:1331:12)

    at processTicksAndRejections (node:internal/process/task_queues:83:21) {

  code: 'ECONNRESET'

}
royal herald
boreal iron
#

@quartz kindle hashflushed

lyric mountain
quartz kindle
#

not sure if there is any limit

#

there could be an age limit based on the message timestamp, but idk

feral aspen
#

Tim, last question.

#

Why does the bot send the third thinking message?

quartz kindle
#

thats what it sends when you defer

feral aspen
quartz kindle
#

if you used deferReply you have to reply at least once

feral aspen
#

Ah.

sharp saddle
#

i wanted to do a search bar using json (expressjs), but i have no idea how it works

#

someone help me?

lyric mountain
#

errr...search bar using json?

sharp saddle
#

let me explain

#

freerealestate i fogor

#

oh

feral aspen
sharp saddle
lyric mountain
#

u mean return a json?

sharp saddle
#

yes

lyric mountain
#

ah, now it makes sense

#

@drowsy crag

sharp saddle
feral aspen
#

I did.

#

For $9.99. lmao

lyric mountain
#

just return the json normally

#

like, as a string

feral aspen
#

KuuHaKu, are you experienced with slash commands?

lyric mountain
#

only in java (jda)

feral aspen
#

๐Ÿ‘

feral aspen
#

I understand what defer does, so yeah. ๐Ÿ‘ .. but I want to know why it sends that third line.

#

AYY

#

I took

#

Now leave

#

@drowsy crag

quartz kindle
#

so if you did deferReply once, you have to use reply once

#

no matter how many followups you do

#

one of your followups has to be a reply

feral aspen
#

.. and the same time, defer reply gives me more time?

#

How so, in slash commands, I never used deferReply ONCE, or is it because it responds in less than 3 seconds?

#

Could you check if my token arrived, I clicked.

#

Nevermind.

quartz kindle
#

thats why i said

#

only use defer if you think it will take more than 3 seconds

#

otherwise just reply

feral aspen
#

I got lost in the code.

#
const m = await interaction.followUp({ content: 'Please select a button to perform an action.', components: [row] });

const filter = (int) => int.message.id === m.id && int.user.id === interaction.member.id;
const response = await m.awaitMessageComponent({ filter, time: 15000 }).catch(() => null);

if (!response) return interaction.followUp({ content: 'You have timed out.' });

switch (response.customId) {
    case 'yes':
        // await interaction.deferReply({ ephemeral: false }).catch(() => {});
        await interaction.deferReply({ content: 'Hooray.' });
        break;
    case 'no':
        // await interaction.deferReply({ ephemeral: false }).catch(() => {});
        await interaction.deferReply({ content: 'Failed' });
        break;
};
#

Should I send a message in the first line? .. or follow up?

lyric mountain
#

try just reply

feral aspen
#

Interaction Already Replied

quartz kindle
#

because you are defering in your interction event

#

which i told you not to

feral aspen
#

Alright. I currently made it so it sends a message and then the user picks a button. It deletes the message afterwards and follows up.

feral aspen
# quartz kindle only use defer if you think it will take more than 3 seconds

I'd like to ask.. now for this code that I sent..

https://sourceb.in/VCPmOXRGNo

You told me to use defer when it would take more than three seconds, now to use defer, do I just add

await interaction.deferReply({ ephemeral: false }).catch(() => {});

.. and what else, exactly? I reply, where? In the follow-ups? Like replacing those with follow up?
I promise this is the last question, I have over-disturbed.

novel jetty
#

Anyone know where this error is coming from?

/workspace/node_modules/discord.js/src/rest/RequestHandler.js:298
      throw new DiscordAPIError(data, res.status, request);
            ^
DiscordAPIError: Invalid Form Body
message_reference: Unknown message
    at RequestHandler.execute (/workspace/node_modules/discord.js/src/rest/RequestHandler.js:298:13)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (/workspace/node_modules/discord.js/src/rest/RequestHandler.js:50:14)
    at async TextChannel.send (/workspace/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:171:15) {
  method: 'post',
  path: '/channels/895641534823792671/messages',
  code: 50035,
  httpStatus: 400,
  requestData: {
    json: {
      content: 'We all look at the world through our own eyes.',
      tts: false,
      nonce: undefined,
      embeds: undefined,
      components: undefined,
      username: undefined,
      avatar_url: undefined,
      allowed_mentions: [Object],
      flags: 0,
      message_reference: [Object],
      attachments: undefined,
      sticker_ids: undefined
    },
    files: []
  }
}
[nodemon] app crashed - waiting for file changes before starting...
feral aspen
earnest phoenix
#

Apparently vercel's own swr package supports nextjs ssr

woeful pike
#

I prefer react-query

#

but that's not going to give you caching

#

the caching swr and react-query have are all client side meant for deduplication

earnest phoenix
#

Using vercel's nextjs to host a website on vercel using vercel's swr

woeful pike
#

the vertical integration baby

earnest phoenix
#

With vercel analytics

quartz kindle
#

followups can be used anywhere after .reply

feral aspen
#

You can't just do .followUp() and it's empty.. and for fast interaction, you can also use followUp, only, correct?

quartz kindle
#

?

#

followups are just extra messages

#

if you ever need them

#

for example if your interaction reply needs 2 messages

#

because its too big for 1

feral aspen
#

OH.. but I have never used .reply() in slash commands, ever. ๐Ÿ˜‚

quartz kindle
#

then do

feral aspen
#

I will switch, then.

sterile brook
#

ghost msgs

quartz kindle
#

hmm apparently its editReply in discord.js

#

.deferReply(...)
then
.editReply(...)

sterile brook
#

ye

quartz kindle
#

discord.js is confusing af lul

feral aspen
#

This is why it takes time for me to understand.

#

I'm trying to comprehend.

quartz kindle
#

i find it easier to use the raw api than discord.js lmao

feral aspen
severe perch
#

It all started when they did the v13 ๐Ÿ˜‚

feral aspen
#

.editReply() is basically .followUp()

#

Mostly same result.

sterile brook
#

me still using require man

feral aspen
#

I do, though?

sterile brook
#

ES6 is not for me

quartz kindle
#

you mean ESM?

feral aspen
#

Alright, so I understood the idea. ๐Ÿ‘

quartz kindle
#

nobody actually uses ESM lul

feral aspen
cinder patio
#

ESM is so much better but node.js does it terribly

#

I don't get why you can't have both require and ESM

quartz kindle
#

because of how esm works

#

require is sync, esm is async

#

esm relies on the entire process being compatible with its asynchronous multi-stage loading system

stiff lynx
#
                                             ^

Error [INTERACTION_ALREADY_REPLIED]: The reply to this interaction has already been sent or deferred.
    at CommandInteraction.reply (C:\Users\Utente\Desktop\novabot recon\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:89:46)
    at Object.run (C:\Users\Utente\Desktop\novabot recon\SlashCommands\monete\lavoro.js:108:30)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  [Symbol(code)]: 'INTERACTION_ALREADY_REPLIED'```
#

How can I fix this?

pale vessel
#

Don't reply if you already replied to the interaction. Edit the original response or create a follow-up message instead

stiff lynx
#

If I have a string to return from a slashCmd, i need only interaction.followUp

#

?

pale vessel
lament rock
#

export default was the worst thing ever to happen to js change my mind

cinder patio
#

I won't cause I agree

#

who thought that was a good idea???

lament rock
#

dont know

#

wish devs would stick to cjs

quartz kindle
#

whats so bad about it lol

sterile brook
eternal osprey
#

How do i update a role constantly?

#

So it will constantly chheck the new members.size

sterile brook
#

what do u mean by new members

eternal osprey
#

i use !start

#

and want to check the members.size each 5 secondsd

#

if (minigame1.members.size == 5){

#

as the minigame1 role object only changes when !start is used

#

so i was thinking about a setinterval?

#

on the role defining

sterile brook
#

if u need smth every N time

#

ofc interval func

eternal osprey
#
if(subcommand == 'start'){
let minigame11;
setInterval(() => {
    
  
  minigame11 = guild.roles.cache.find(r => r.name === "old-wise-man-minigame")
}, 1000);
}
    if (minigame11.members.size == 5){ //here
eternal osprey
sterile brook
#

where

#

i am not overseer here

eternal osprey
#

in the last line

wheat mesa
#

Post the error message

sterile brook
#

ye

eternal osprey
#

`` if (minigame11.members.size == 5){
^

TypeError: Cannot read property 'members' of undefined``

sterile brook
#

log minigame11

#

check

#

what it contains

eternal osprey
#

sure

wheat mesa
#

Well itโ€™s gonna log as undefined

eternal osprey
#

yeah

#

so that's the issue.

wheat mesa
#

Because minigame11 is undefined

eternal osprey
#

As the interval needs to start?

#

So could we fix it by addding a timeout?

#

As i have a reaction collector, that adds a role to users. But i need to actively check if 5 people have that role

#

but the role size doesn't update by itself, as it's under the !start command

#

that's why i was thinking about an interval to check

#

Can i just wrap my whole if() statement in a settimeout\

sterile brook
#

Mb cuz ur interval func starts after u check ur member size

eternal osprey
#

till the interval gets it

quartz kindle
#

why are you waiting 1 second to set minigame11?

eternal osprey
#

so a function can trigger

sterile brook
#

but in checks after 5 sec first time

quartz kindle
#

then you need to do this:

#
let minigame11 = client.guilds....
setInterval(() => { minigame11 = client.guilds.... }, ...)
eternal osprey
#

looks sturdy! Thanks

sterile brook
#

i mean that why it undefined in ur if statement

spark flint
#

Should I make my bot use slash commands now as its a bot that likely will shutdown after christmas (seasonal bot)

#

it has no good reason to keep using message intents

sterile brook
#

its just after u bro

#

if u want to code this

#

then code

quartz kindle
#

if you're gonna shut down the bot after christmas then there is no need for slash commands

quartz kindle
#

most people are still used to normal commands

sterile brook
#

also tru

spark flint
#

Its a christmas bot which just plays christmas music

sterile brook
#

about normal

eternal osprey
#
if (minigame11.members.size == 5){```this still doesn't trigger
#

as it's under the !squidgame command, which is only fired once

#

awit it's not

#

it's under none

stiff lynx
#

There isnt another way on activating slash commands without kicking the bot?

lament rock
#

if the app has to post to the guild slash commands, no other way

wheat mesa
#

You just have to reinvite the bot with the applications.commands scope

#

No need to kick it

stiff lynx
#

client.on("ready", () =>{

    
    client.user.setActivity(`${client.guilds.cache.size} server | ${client.users.cache.size} membri`);

    console.log(`${client.user.tag} รจ pronto!`)

});

There is a way to actually update this?

wheat mesa
#

What

stiff lynx
#

uhm

#

in the bot activity

#

update the number of guilds and users

#

without reloading the bot

wheat mesa
#

Yeah, use setInterval

#

Just be careful with spamming presence changes, the limit is 5 every 20 seconds iirc

stiff lynx
#

setInterval()

quartz kindle
#

setInterval(() => { client.user.setActivity(...) }, 20000)

wheat mesa
#

^^

#

Where 20000 is the number of ms between running the code inside of the function

stiff lynx
sterile lantern
#

(node:194) UnhandledPromiseRejectionWarning: MongooseError: Query was already executed: GSMData.findOne({ LOACode: 'LOA-7ONC' })

   const loareq = await tickets.findOne({ "LOACode": code }, function (err) {
     if (err) {
       console.log(err)
     }
   })

if(loareq === null)  return message.channel.send("Code does not exist in database.")


 await tickets.deleteOne({ LOACode: code }, function (err) {
  if (err) {
    console.log("THIS ERRORS")
  return message.channel.send("Ran into an error attempting to delete that LOA request.")
  }
   return message.channel.send("Deleted that LOA request from the database.")
 })```
#

idk what that means im only running the query once

boreal iron
#

I wouldnโ€™t call that a command handler since it does only load your files and stores the modules in your collection.

The actual handler manages the event, your commands and their execution as well as it should include a permission handler, maybe a guild or global command handler, a proper registration, update or delete handler of the commands itself etc.

#

Loading the modules is just, hmm, a small part of it.

#

Weew code blocks on mobileโ€ฆ

#

As I said a proper handler also handles permissions etc.

#

Based on all the properties you provide in a command module

#

You should more likely think about to switch to slash commands before rewriting something you have to rewrite later againS

earnest phoenix
#

Slash command handler ain't bad

grim aspen
#

Slash command handlers are harder to understand than the current code I have

quartz kindle
#

handling permissions is not really a must, depending on your bot

#

i dont bother with them lul

grim aspen
#

^

boreal iron
#

Yeah that fairly depends on your needs and commands

#

I got some commands configurating the bot on a guild which should only be possible for members which specific permissions

earnest phoenix
boreal iron
#

But that doesnโ€™t need to be the case for you

#

I mean if you wanna lock some commands to specific permissions and need to build a command handler anyways, these few lines checking for member permissions combining them with permissions set in the module isnโ€™t complicated, just a few lines

#

The way discord let you handle or lock commands to user IDs is just trash in my mind

#

(or roles)

quartz kindle
#

why do you want .env on github?

solemn latch
#

The way I handle that is by having a comment at the top of my code which shows what .env variables I need.
Or listed in the Readme without the actual values.

quartz kindle
#

i keep my keys outside of the project

boreal iron
#

I still copy my files per hand and move them on my backup HDDs

#

works like a charm

solemn latch
#

I'd imagine there's an automated way to do that

#

Not including raid kek

boreal iron
#

Only for the database I wrote some bash scripts to dump the tables and send them over via FTP

#

Actually not required for anything else tho

#

But Iโ€™m old and tired you know KEKW

#

I wonder how Tim must feelโ€ฆ

quartz kindle
astral lava
#

i finally got self hosting done with my raspberry pi, feeling pretty accomplished

quartz kindle
#

nice

earnest phoenix
#

if(warnings === 1) return; {

  const embed = new Discord.MessageEmbed()
  .setAuthor(`Advertisement Deleted`, message.guild.iconURL())
  .setDescription(`![mod_action](https://cdn.discordapp.com/emojis/899833918277177366.webp?size=128 "mod_action") **-** \`Moderator\`: <@${message.author.id}>\n![reason](https://cdn.discordapp.com/emojis/899834145478422558.webp?size=128 "reason") **-** \`Reason\`: ${reason}\n![2nd_warning](https://cdn.discordapp.com/emojis/899836718121910304.webp?size=128 "2nd_warning") **-** \`2nd Warning\`\n\n> Please make sure to read: [#765952677213110272](/guild/264445053596991498/channel/765952677213110272/)! `)
  db.add(`warnings_${user.id}`, 1)
  channel.send(`<@${user.id}>`)
channel.send(embed)
}


if(warnings === 0) return; {

  const embed = new Discord.MessageEmbed()
  .setAuthor(`Advertisement Deleted`, message.guild.iconURL())
  .setDescription(`![mod_action](https://cdn.discordapp.com/emojis/899833918277177366.webp?size=128 "mod_action") **-** \`Moderator\`: <@${message.author.id}>\n![reason](https://cdn.discordapp.com/emojis/899834145478422558.webp?size=128 "reason") **-** \`Reason\`: ${reason}\n![warning1](https://cdn.discordapp.com/emojis/899834971840204870.webp?size=128 "warning1") **-** \`1st Warning\`\n\n> Please make sure to read: [#765952677213110272](/guild/264445053596991498/channel/765952677213110272/)! `)
  db.add(`warnings_${user.id}`, 1)
  channel.send(`<@${user.id}>`)
channel.send(embed)


}```

This is my code, when I do the command, it sends both 1 and 2, meaning it sends both of the embds, I want it to only send the #1 embed which is the bottom one,  then when the Staff Member runs the command again, it goes to the top #2 embed, how do I do this?
#

So first time they use the command it adds 1 warning to the DB then sends the embed

#

The 2nd, it adds the users warning to the DB and sends the top embed.

solemn latch
#

Why do you need two embeds for this anyway?

earnest phoenix
#

Well, one has different emojis

#

If the user has 2 warns, it changes the emoji

solemn latch
#

You dont need two embeds for that or two sends. You only need to set each description separately(or use tenorary and do it in one).
Then add the send to the end

earnest phoenix
#

Huh

#

How do you have 2 sperate descriptions?

solemn latch
#

Also you have a return in the first if statement

earnest phoenix
#

Oh?

#

Ah ty

#

How do you have 2 sperate descriptions tho?

solemn latch
#
const embed = new Discord.MessageEmbed()
.setAuthor(`Advertisement Deleted`, message.guild.iconURL())

if(warnings === 1){
  embed.setDescription(...)
}
else if(...){
  ...
}
channel.send(embed);

or

const embed = new Discord.MessageEmbed()
.setAuthor(`Advertisement Deleted`, message.guild.iconURL())
.setDescription(`${dynamic stuff} static stuff`)
channel.send(embed);

or

const embed = new Discord.MessageEmbed()
.setAuthor(`Advertisement Deleted`, message.guild.iconURL())
.setDescription(warnings ?? desc0 : desc1)
channel.send(embed);
earnest phoenix
#

So, would I need warnings === 0 or would I want that to be one?

#

Cause I want it to send a initial message

#

Wait nvm

solemn latch
#

Personally the middle method(its called template litterals) makes the most sense to me.

loud tree
#

``num = int(input("Enter the number to check it is prime or not\n"))

for digit in range(2, num):
if num % digit == 0:
print("Not a prime number")
break``

#

now here i wanna add a reply for

#

Is a prime number

#

so how can we add in this existing code

slender thistle
#

what

#

wtf is that

loud tree
slender thistle
#

I don't even mean to disregard that code, I literally don't understand it KEKW

slender thistle
#

Just do num % 2

loud tree
#
f=0
if num==1 or num==0:
     f=1
for i in range(2,num):
     if num%i==0:
          f=1
if f==1:
     print("Number is not prime")
else:
     print("Number is prime")```
#

although did with this

#

still..

slender thistle
#

Overcomplicating

loud tree
slender thistle
#

I'm dumb

#

Hold on

#

Yeah oops my English decided to mix even-odd with prime

loud tree
#

F

#

lmao

slender thistle
#

Yeah okay

slender thistle
#

...

#

No, I need to get my shit together

#

Use some sort of variable, type bool possibly

#

flag probably. Default it to False and in your if, set its value to True so that it indicates that the number is prime

#

Then later in the code add another if-else that actually works with that variable and outputs "Prime number" if it's True

loud tree
#

thanks buddy for the help

earnest phoenix
#

Uhm hey, when I uploaded my code for my bots website on to my topgg page

#

I am not sure where to place the css

#

Like:

<style>
my CSS stuff
</style>```
But nothing showed up like none of the CSS
#

Or is there a different way of adding it

sly sierra
#

@ripe prairie

elfin marsh
split hazel
#

maybe highlight the line its coming from?

#

don't know crypto too much

onyx torrent
#

Snippet:

const msg = await interaction.deferReply({ embeds: [embed] }).catch(err => console.log(err));
for (i = 0; i < 3; i++) {
            await msg.react(emojiArray()[i]).catch(err => console.log(err));
        }โ€Šโ€Š```


Error: 
```TypeError: Cannot read properties of undefined (reading 'react')
    at Object.execute (F:\VOTIFY_new\commands\ynpoll.js:57:23)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Client.<anonymous> (F:\VOTIFY_new\index.js:192:16)
F:\VOTIFY_new\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:89
    if (this.deferred || this.replied) throw new Error('INTERACTION_ALREADY_REPLIED');
                                             ^

Error [INTERACTION_ALREADY_REPLIED]: The reply to this interaction has already been sent or deferred.
    at CommandInteraction.reply (F:\VOTIFY_new\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:89:46)
    at Client.<anonymous> (F:\VOTIFY_new\index.js:195:22)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  [Symbol(code)]: 'INTERACTION_ALREADY_REPLIED'
}```
#

Help me in reacting to interactions

sterile brook
#

What is emojiArray()

pale vessel
#

Otherwise msg will always be undefined

#

And for the other error, don't reply twice

#

Edit the initial response or create a follow-up message

onyx torrent
onyx torrent
#

Once the interaction is replied with

pale vessel
#

Then fetch the reply

#

It's an option

onyx torrent
#

yes it works now

#

i did interaction.fetchReply();

earnest phoenix
#

whats this now

#

./Commands/ping.js

const discord = require('discord.js');
const { SlashCommand , CommandOptionType, CommandContext} = require('slash-create');

module.exports = class ping extends SlashCommand
{
    constructor(creator){
        super(creator, {
            name: 'ping',
            description: 'Replies with the Bot and the Api latency. Nothing Special.'
        })
    }

    async run(ctx){
        const ping = 'Pong!'
        return ping
    }
}```
#

index.js

const fs = require('fs');
const { SlashCreator, FastifyServer } = require('slash-create');
const discord = require('discord.js');
const intent = new discord.Intents(32767);
const client = new discord.Client({intents: intent});
const config = require('./config.json');
const clientToken = config.token;
const prefix = config.prefix;
const ApplicationId = config.applicationId;
const PublicKey = config.publicKey;
const path = require('path');

const creator = new SlashCreator({
    applicationID: ApplicationId,
    publicKey: PublicKey,
    token: clientToken
});

creator.on('commandRun', (command, _, ctx) => {
    console.log(`${ctx.user.username}#${ctx.user.discriminator} (id: ${ctx.user.id}) just used ${command.commandName}!`);
    let totalCommands = config.commandsUsed;
    totalCommands += 1;
});

creator.on('commandError', (command, error) => {
    console.log(`Unable to run ${command.commandName}! The error is given below. \n Error: ${error}`);
});

creator.withServer( new FastifyServer())
creator.registerCommandsIn(path.join(__dirname, 'Commands'))
creator.syncCommands()
creator.startServer()

client.login(clientToken).then( _ => {
    console.log('Successfully logged into the Client!');
});
rustic nova
#

gamer forgot to unlock channel

earnest phoenix
#

hi gamers

eternal osprey
#

hey, how do i stop a code from moving on as an alternative of timeout?

#
run code1

-the block-

run code2```
#

As i don't want to wrap the whole code2 function in my settimeout.

earnest phoenix
#

Someone know how bot leave a server less tha 25 or 30 members,?

pale vessel
#

Check the member count

earnest phoenix
pale vessel
#

What library are you using?

earnest phoenix
#

Js

pale vessel
#

I see

earnest phoenix
#

@pale vessel like i want to leave bot which less than 30 members

stiff lynx
#
message.canale.send( {embeds: [benvenuto] });```
#

how can I fix this?

pale vessel
#

Fix what?

lyric mountain
lyric mountain
rustic nova
#

there we go

#

now just translate that into code through using the discord js docs

lyric mountain
#

errr...invert ur boolens

quartz kindle
#

discod.js

earnest phoenix
#

Discord.js-light

lyric mountain
#

detritus.js

earnest phoenix
#

Hello how do you add a website to the bots page not editing the bots page

lyric mountain
#

<iframe> on longdesc

earnest phoenix
#

ohh

quartz kindle
#

because codfish

#

i know i am funny

earnest phoenix
earnest phoenix
earnest phoenix
#

i did that but its not showing up?

quartz kindle
#

aka bacalhau

lyric mountain
#

iframe is a "window" to another site

earnest phoenix
#

Oh okay

#

ohh sorry

#

i googled it

earnest phoenix
lyric mountain
#

ye

spark flint
#

you can do iframe without domain

lyric mountain
#

u CAN use raw ips, but...well...yk

spark flint
#

you can iframe code

lyric mountain
#

on top.gg? it'd probably get in the way

spark flint
#
<iframe srcdoc="HTML CODE HERE"></iframe>```
earnest phoenix
#

ohh

spark flint
#

not the best thing to do

#

but yeah it works

lyric mountain
#

inline html be like

spark flint
#

or just use something like github pages, vercel or dbot.cc

#

then its a proper iframe

#

html code iframes suck

earnest phoenix
#

yea

#

it doesnt show

spark flint
#

ah

deft citrus
#

hello any one knows vote reminder

#

code

#

python code

lyric mountain
#

oh boy, if it was that easy

slender thistle
#

We can give you the general idea and help with specific parts of implementing it, but we will not give you the whole thing

lyric mountain
#

I'd hate programming

rose warren
#

You just get the vote timestamp from the vote event and store the ID and timestamp in your database. Then check it for expired votes.

slender thistle
#

My point still stands

deft citrus
slender thistle
#

Which part exactly?

deft citrus
#

the bot should dm

#

him

#

after 12hrs

slender thistle
#

Look into cron jobs

deft citrus
#

bro do you know how the bot dm the person

#

saying

#

hi

slender thistle
deft citrus
#

yeah

rose warren
#

Look at your lib's docs

deft citrus
#

if the person type ^hi

#

the bot should respond

#

to

#

him in dm

#

not channel

#

how

slender thistle
#

You'll have an on_message event handler for that case

deft citrus
#

but i dont know the code

slender thistle
#

Do you want it to be a command or just some sort of "random message" the bot will reply to as non-command?

deft citrus
#

for dm a user

slender thistle
#

command in the first part refers to the commands framework of d.py

#

I assume you're familiar with the commands framework?

deft citrus
#

client.command()
async def help(ctx)

#

after

#

this command

#

what should i type

slender thistle
#

ctx in commands is a Context object, which happens to implement an attribute named author as a shortcut for <Context>.message.author

deft citrus
#

client.command()
async def vote(ctx):
await ctx.send('Vote use here')

slender thistle
#

Meaning, to get the user who used the command, you refer to ctx.author. That will be an instance of either User or Member, but both implement Messageable, meaning you can use .send() on both of them

#

ctx.send will reply in the channel where the command was used

deft citrus
#

yes

deft citrus
slender thistle
rustic nova
#

lmao @rose warren nice name

rose warren
rustic nova
#

oh hecc this development

rose warren
#

Ty hop

#

Yes hop

deft citrus
#

@slender thistle i need 1 more help
how to set a time for dm

#

means it should dm every 12h

slender thistle
deft citrus
#

ty

earnest phoenix
#

does having some custom background means the website you wont show in <iframe>?

slender thistle
#

You're gonna have a database to save last time you DM'd the user and probably work with d.py's tasks framework for that

deft citrus
#

@slender thistle await asyncio.sleep(5) how to write that 5 in hrs

slender thistle
#

Calculations, math

native walrus
#

I feel like you might be missing some of the basics of python at this point

slender thistle
#

^

native walrus
#

making discord bots is cool but you're going to have a hard time running into a wall at every step like this

deft citrus
#

and insert

slender thistle
#

Yup

native walrus
#

pretty self explanatory, need to see the code tho

deft citrus
#

@slender thistle will the code work forever or when we type ^vote

#

only

slender thistle
#

If you put the sleep in the command, take a guess

deft citrus
#

bot.command()
async def vote(ctx):
await ctx.author.send('Vote use here')
await asyncio.sleep(5)

#

will it work

#

forever

native walrus
#

you have commands defined as bot.commands but you're trying to reference commands here which doesn't exist

#

that first error message is like pretty obvious

slender thistle
#

wdym "forever"

deft citrus
slender thistle
#

No

deft citrus
#

how to make it like that

slender thistle
#

It will DM once, and not even after waiting

#

Because you put the sleep after the .send part

deft citrus
#

if i put before

#

will it dm every 5 seconds

#

@slender thistle

#

?

boreal iron
#

Register them once only.

deft citrus
boreal iron
#

Then in the future fetch the registered commands, compare them with your loaded ones to check if your commands need to be registered, updated etc.

slender thistle
#

There's nothing indicating it will do it repeatedly

boreal iron
#

Instead of copy and pasting the guide ugly example, just use djs inbuilt class and methods

sterile brook
native walrus
#

maybe don't blame your lack of experience on slash commands

boreal iron
#

Well Iโ€™m okay with it, later on registering global slash commands over and over again will overwrite existing ones causing your bot to not be able to deal with slash commands for up to an hour until they are deployed in any guild

sterile brook
#

hilarious

boreal iron
#

Which means like a full hour of interaction failed messages anytime you start your app

#

As discord states handling registrations accurate in the future will become important

#

Which maybe means spamming the API with registrations for the same commands for no reason might get you rate limited, locked out, banned etc. in the future

vivid fulcrum
#

win11 is actually a good dev env

#

like combine it with win terminal and powershell

wheat mesa
#

Enjoy your performance drops

vivid fulcrum
#

i didn't notice any dips so far

#

if anything, it's been faster

grim aspen
#

i think they fixed the performance issues

wheat mesa
#

AMD hardware gets hit pretty hard by win11

boreal iron
boreal iron
#

You just have to install it yourself

vivid fulcrum
#

ikik

#

it all just looks more cohesive in win11

#

plus wsl is even easier to set up

boreal iron
#

Wow they are capable of improving things? Wut

deft citrus
#

anyone help me to make a reminder that reminds the people every user that use the command'

wheat mesa
#

People can help you if you have issues with figuring out the implementation, but I donโ€™t think anyone here is going to just write your code for you if thatโ€™s what youโ€™re asking

boreal iron
#

Meanwhile the whole shit they are carrying around since Win 7, or 8 is still running in the background as well as any old app to manage your PC just harder to find

deft citrus
boreal iron
#

Iโ€™m not a fan and will never be but yeah

wheat mesa
grim aspen
#

i'm sticking with windows 10

royal herald
grim aspen
#

no thanks

royal herald
#

its good

deft citrus
grim aspen
#

i'm not interested in coding a browser

royal herald
#

rlly good

royal herald
boreal iron
grim aspen
#

i think microsoft already patched most vulnerabilities that were found

deft citrus
#

@wheat mesa hello

wheat mesa
#

I know very little about python

deft citrus
#

@boreal iron do you

#

know

#

python

boreal iron
#

Iโ€™m not speaking snakish either

deft citrus
#

client.command()
async def vote(ctx):
await asyncio.sleep(5)
await ctx.author.send('vote here')

#

how to make it run forever

#

like it should dm the person every 12h

boreal iron
#

Thatโ€™s almost a bad idea

wheat mesa
#

Yeah

#

Seems like unwarranted spam

boreal iron
#

Considered spam as more people will receive a message

deft citrus
#

every 12h

#

bro

#

every 12hour

wheat mesa
#

Users typically donโ€™t like random bots DMing them on a schedule about what I assume is an ad to vote for it

deft citrus
#

if they run comand ^vote remind

#

understand

#

not spam

boreal iron
#

If you do not have the chance to opt out of that itโ€™s just spam

grim aspen
#

kind of against tos? what if the people who vote at the same time keep getting the message at the same time?

deft citrus
deft citrus
grim aspen
#

oh if they do the command

boreal iron
#

Even then imagine sending 1000 users a message every 12 hours, around the clock somewhere, itโ€™s still end up being API spam

grim aspen
#

i was thinking like right after they vote they recieve the message

boreal iron
#

Sending a reminder once is okay not forever

deft citrus
#

they can stop

#

it

#

also

grim aspen
#

i thought top.gg used to have that system

#

sent as a chrome browser notification

deft citrus
wheat mesa
#

In theory you could schedule it for 12 hours after the command is run, that user gets a DM

wheat mesa
#

But if you plan to send the messages all at once, then thatโ€™s gonna be an API problem

grim aspen
#

yeah discord will throw a shit fit over api issues

boreal iron
#

Even then imagine sending 1000 users a message every 12 hours, around the clock somewhere, itโ€™s still end up being API spam

#

Thatโ€™s what I stated already

wheat mesa
#

Youโ€™d have to store a timestamp of 12 hours after the time of the command being run along with the user id, then once that timestamp is hit then you send the message to them

#

Still wouldnโ€™t recommend it though

deft citrus
#

okay i understand

wheat mesa
#

Not sure how to implement that in python

deft citrus
#

i will make two types of comand

#

vote remind

#

and

#

direct it will dm

#

the

#

person

#

if they run the command

#

^vote

#

and ^vote remind

#

it will remind the person 1 time

#

and if the person type the command again

#

after 12h

#

then again after 12h he will recieve dm

#

of voting

#

60X60

#

=

#

3600

#

3600x12

#

=

boreal iron
#

Well itโ€™s your decisionโ€ฆ doesnโ€™t change the fact we canโ€™t help you out with python

spark flint
#
{
  "userid": "Timestamp"
}```
deft citrus
#

43200

spark flint
#

then do a commands.tasks.loop

deft citrus
#

=

#

12h

wheat mesa
#

json isnโ€™t good for writing and reading lots of data as a db

#

Probably best to just use an actual db with K/V pairs

spark flint
#

I know how to do time checking

boreal iron
#

huh JSON is not a database okeh

wheat mesa
#

^^

spark flint
#

it stored the time from datetime.time.now()

wheat mesa
#

When you have a large JSON file with lots of data itโ€™s better to just use a database

spark flint
#

and then would check every 60 seconds if datetime.time.now() had X second difference and reset if so

boreal iron
#

Tbh if so I would also use the timestamp as key, not as value checking each process tick if that key exists, if so use itโ€™s value

wheat mesa
#

Which in this case storing data for 12 hours, json may be suitable for a small bot, but if it gets larger then a db is a much better option

boreal iron
#

Which is more cost efficient

spark flint
deft citrus
#

how to add good frame

spark flint
#

I store over 1k blacklisted user ids in a json KEKW

spark flint
deft citrus
spark flint
#

what do you mean by that-

deft citrus
#

like when we type .help

spark flint
#

oh like an embed?

deft citrus
#

ye

#

i like it very much

boreal iron
#

Should help you how to generate them

spark flint
#
embed = discord.Embed(title="Embed Title")
embed.add_field(name="Command name", value="command description")

await ctx.reply(embed=embed)```
boreal iron
#

Play around a little with it

spark flint
#

add embed.add_field(name="Command name", value="command description") for every command you have etc

#

or just use the embed generator FakE sent

boreal iron
#

Itโ€™s actually good to understand how to format (style) and build your embed

spark flint
#

yep

#

thats why i sent a base code for an embed

boreal iron
spark flint
#

yup

#

I'm blacklisting like 30+ a day so I should really migrate soon

boreal iron
#

Or move to a less destructive format

wheat mesa
#

Databases are pretty easy to set up

spark flint
#

Might use Mongo

wheat mesa
#

Just gotta make sure to implement a cache if youโ€™re querying for information fairly often

boreal iron
#

CSV might also work for some time until it reaches a specific size

spark flint
#

I also have MySQL but hosted on a webserver so it may be slower

#

and I don't want my API to be slow

wheat mesa
#

Ew ew ew ew ew ew ew

spark flint
#

MySQL sucks ass

wheat mesa
#

MySQL ๐Ÿคข

boreal iron
#

Actually not, no

spark flint
#

DB options I have on cPanel

boreal iron
#

If you can ever reach its limits, tell me

wheat mesa
#

Use Postgres or Mongo

boreal iron
#

Shhhh Java user, go on, Sir

wheat mesa
#

Iโ€™m not a Java user!

#

Just use Java from time to time

#

I much prefer c++, typescript, and C# over Java

boreal iron
#

From time to time? Thatโ€™s even worse.
Thought you just touched it once by accident

#

But that changes everything

wheat mesa
#

My CS classes all use Java sadly

earnest phoenix
#

My class doesnt know even programming langs lol

wheat mesa
#

Our teacher told us today that js arrays start from 1

quartz kindle
#

wtf

wheat mesa
#

Good thing sheโ€™s teaching Java and not js

#

She probably got confused with Lua

grim aspen
wheat mesa
#

She teaches Java

#

Not her job to know Javascript but also not a good idea to tell kids stuff about js if she isnโ€™t sure about it

quartz kindle
#

bed teacher

boreal iron
#

bed

#

You dirty, dirty men

quartz kindle
#

:^)

boreal iron
#

Thought about saying boy, but no, not for you grandpa

wheat mesa
#

Iโ€™m at school looking at C++ stuff and a website I was looking at just got blocked in the middle of me looking at it

#

Nice ๐Ÿ‘

#

Because itโ€™s a โ€œForum/Message boardโ€

boreal iron
#

lmao

#

Back when I was young, playing Medal of Honor on a school PC, after "hacking" the administrator account (on XP), just by reading the password written on the note, sticking on the school server and nobody closed the door, because the room got to hot for the servers

earnest phoenix
#

hello how increase size of image in html js <img src="https://images-ext-1.discordapp.net/external/gF0US_OD9LvVWMeHwHApjHIJ_Up6wn26jkBLGO6SaSk/https/media.discordapp.net/attachments/858687192099454979/896262275273482260/standard_3.gif" >

earnest phoenix
#

if you want to make it look bigger you can use the width and height attributes

#

done

#
<img width="69" height="420" />
#

done

earnest phoenix
#

ok

wheat mesa
boreal iron
#

You better use CSS here to scale up, keep aspect ratio

earnest phoenix
boreal iron
#

I meant working with width and height as well but entering % as values

#

Like 110% width and height to keep the ratio

deft citrus
#

@boreal iron what are the url

earnest phoenix
#

bruh

#

nvm

boreal iron
#

I think it's the URL of the title

#

The title can be a link

deft citrus
#

oh

boreal iron
#

If you specify an URL

earnest phoenix
earnest phoenix
earnest phoenix
#

`

#

you can style the <code> element

boreal iron
deft citrus
#

@boreal iron what is author link icon

earnest phoenix
earnest phoenix
deft citrus
earnest phoenix
boreal iron
#

An icon above the title left of the author

earnest phoenix
#

hmm thanks

spark flint
#

How do I use EJS

#

thats my question

earnest phoenix
#

Error: Cannot find module 'quick.db'

boreal iron
#

cough PHP

earnest phoenix
#

bruh

#

that is appearing like flash destroying the console

#

my bot suck on approve from 17 days

spark flint
# boreal iron _cough_ PHP

I've already got a working HTML site which I have setup with Flask but I want to run on root domain and on a webserver rather than using Replit

#

No idea how to use PHP lmao

earnest phoenix
boreal iron
earnest phoenix
boreal iron
#

Back in the past it took months

earnest phoenix
#

idk why appears

earnest phoenix
earnest phoenix
#

i checked the package.json, reinstalled and all that but same

#

any solution?

earnest phoenix
earnest phoenix
#

oh can you help

#

to make event

earnest phoenix
boreal iron
earnest phoenix
#

when even npm is anti detritus

earnest phoenix
earnest phoenix
earnest phoenix
boreal iron
#

using a template language calling it complex

earnest phoenix
boreal iron
#

What in the...

earnest phoenix
#

empty responses is one of detritus's special powers

boreal iron
#

You better switch to PHP now

earnest phoenix
lyric mountain
#

are you still watching?

earnest phoenix
deft citrus
#

why it shows the commands when i type ^help

#

i dont make it

#

@boreal iron

quartz kindle
#

3rd season was disappointing

boreal iron
#

what, huh, how, why, me?

#

Tim's the person to ping for issues.

spark flint
#

don't even ping him

#

hes always here

earnest phoenix
boreal iron
#

woow, double ping, scary

deft citrus
#

@boreal iron bro

deft citrus
#

come

boreal iron
#

Dude, not needed to ping me, I can't help you with python, still

#

That hasn't changed the last 30 min

spark flint
#

or bot.remove_command("help")

deft citrus
#

ty

earnest phoenix
#

Lol python is so easy

spark flint
#

yup

earnest phoenix
#

On js
client.application.commands.delete(command.name)

boreal iron
#

Don't think delete supports the name

#

Let me check

earnest phoenix
#

Than its being much hard

lyric mountain
#

name is the command's identifier

boreal iron
#

Nope it does not

earnest phoenix
#

Than

boreal iron
lyric mountain
#

never gonna understand their logic

#

like, aren't names supposed to be unique already?

earnest phoenix
#
let cmd = await client.application.commands.fetch()
let c = await cmd.find(c => c.name === "help")
client.application.commands.delete(c)

#

Yes i forgot ()

sterile brook
earnest phoenix
#

@quartz kindle I need help
I have a bunch of <figure> elements inside a <section> on a page and I want the tab key to go through each of those elements
but it instantly jumps to the <a> tags of the page <footer>

earnest phoenix
deft citrus
earnest phoenix
#

do you mean like
t 1
t 2
t
t
t {
}

earnest phoenix
spark flint
earnest phoenix
#

I didnt fully get what you wanna do

earnest phoenix
#

press tab and it jumps to the page bottom

#

instead of going to React

#

I am on phone

earnest phoenix
cinder patio
#

oh I'm blind

earnest phoenix
#

there are over 100 html semantic elements so you don't have to use js for accessibility

#

Its your choice

#

I don't even know if js can be used for accessibility

earnest phoenix
#

You don't need JS for that

earnest phoenix
#

I found the tabindex attribute

#

apparently that's all I needed to make it "tabbable"

native walrus
#

tabindex is the most misleading attribute name in history

#

because it's not an index, it's either a 0 or a -1 lol

#

and you're not actually supposed to set it to anything other than 0

earnest phoenix
#

@earnest phoenix problem solved in one line of html with no js (technically this is react but you get the point):

  <figure
+ tabindex={i + 1}
  />
#

No i didnt get it bc i just know react's name lol

native walrus
#

ya that causes issues for screenreaders. Just set them all to 0 and make sure the tabbable elements are rendered in sequential order

native walrus
#

read up on the MDN page

earnest phoenix
#

they're in two different sections but in sequential order

native walrus
#

you should be able to set it all to 0 then and they'll become tabbable

earnest phoenix
#

once it reaches the end of the first section's children it will move to the next right?

native walrus
#

yeah it moves to the next tabindex element on the page regardless of the value you give it if they're all 0, that's why tabindex is kind of misleading. Anything above or below 0 is problematic for screenreaders

earnest phoenix
native walrus
#

that's pog

#

accessibility is so difficult to get right honestly

earnest phoenix
#

eevis is great at accessibility

#

according to her dev.to description

native walrus
#

yeah it's complex enough to be people's entire job descriptions lol. It's important though

deft citrus
feral aspen
#

Can you edit a follow up message?

deft citrus
#

lol

#

4

earnest phoenix
#

anyways I have another question:
in nextjs I can put styles for individual pages with [name].module.scss
but I have to put the style name in a template string everytime as they're generated at build time with weird names:

- import "styles/index.module.scss";
+ import { skill } from "styles/index.module.scss";

<figure
-  className="m-4 has-text-centered skill"
+  className={`m-4 has-text-centered ${skill}`}
/>

any way to use the normal class name but still have class name override protection with css modules?

native walrus
#

are you using bulma with css modules?

earnest phoenix
#

I imported it in the global stylesheet and then added my custom styles in scss modules

old cliff
#

how do I check if a promise still hasn't been resolved?

feral aspen
#

^^ more complicated, visit 1st link better by code913.

earnest phoenix
#

Promise.allSettled will wait for all promises to resolve first

feral aspen