#development

1 messages · Page 1865 of 1

wheat mesa
#

^^

forest drift
#

look, im a simple guy, i like simple things

#

when it breaks i rage, simple

wheat mesa
#

You don’t have to take advice from me, but I know for sure that Papi knows what he’s talking about

forest drift
#

wait how do u get the role name again if u have the role id?

lament rock
#

Nah. I'm dumb

wheat mesa
#

Get the role from cache and use the .name property

#

(Unless you already have the full object in which case you can skip the getting from cache part)

forest drift
#

reaction.message.guild.roles.cache.find(role => role.id === rolereacts[i]).name?

wheat mesa
#

I believe so

errant flax
wheat mesa
#

Huh?

errant flax
#

reaction.message may be a partial

#

so in some cases u wont get a .guild property

wheat mesa
#

He handled that already

fleet lion
#

I just made the stupid mistake of trying to add a certificate to my server using brute force
At the end, the server was down for 30 minutes

coarse topaz
#

Hi again, I have some questions (discord.js)

How can I make my bot count all the reactions from a message?
For example if two people reacted to this message with 2️⃣ and 1️⃣, the final count would be 4. Apart of that, I'd like to know how it'd be possible for the bot to do something like:

  • Check if the user reacted to a message
  • Check if the user reacted to the message with another reaction
  • If this happened, then delete the user's previous reaction and leave the most recent one
#

(Please ping when answering, thanks!)

wheat mesa
pale coral
#

@alpine lagoon

#

stop deleting message

#

ask someone for help here

#

all are know to tech

earnest phoenix
#

Pycord or Nextcord?

mint rain
#

How to do this

pale vessel
#

you defined it as discord not Discord

mint rain
#

How to do this?

hollow loom
#
{
  "data": [
    {
      "id": 2712722,
      "rootPlaceId": 75743778,
      "name": "kniterider11's Place",
      "description": ""
    }
  ]
}

can anyone tell me how to get the "id" i tried JSON.parse but no wok

earnest phoenix
#

data[0].id

earnest phoenix
#

what help do you even need

#

GuildCreate does not work

#

can you show where does the event get fired

errant flax
#

is Google Cloud a good host for small bots?

#

the free tier atleast

rose warren
#

I've heard good things. Fine if you're not planning to scale.

errant flax
#

"to scale"
wdym by that

rose warren
#

It's a proper VPS not a container like replit so it's good to learn how to use one. By "scale" I mean if you're not planning on growing your bot to thousands of servers.

errant flax
#

ah

rose warren
#

But replit isn't good for that either so...

errant flax
#

wonder if Google Cloud free tier has some catches :monkaHmm-2:

rose warren
#

If you're planning to grow, plan to pay

errant flax
#

and also thx for accepting my bot annie_hug_miso

rose warren
#

Oh yeah that was me! dog_Happy

#

It's refreshing to see a bot that isn't a clone when doing queue dog_Joy

errant flax
rocky pulsar
quartz kindle
#

but its like a few cents per month

#

my bot was in there until around 1k guilds

errant flax
#

ill probably move to google cloud when my laptop is feexed

earnest phoenix
#

I found a pretty dumb codewars kata (convert a number to a string) and I made it worse:

function numberToString(num) {
  const str = String(num);
  
  delete str; // cuz yes
  
  return Array(String(num).length).fill(i => String(num).charAt(i)).map((x, i) => x(i)).join("");
}
errant flax
#

how do i setup a google cloud project for my djs bot?

quartz kindle
#

just start a compute engine instance

#

chose the free one, the f1-micro

#

then install some linux on it, like ubuntu or debian

#

then login with ssh

tired panther
#

Does someone knowns a fontawsome icon for this /?
Cant find one

tired panther
earnest phoenix
#

are slash commands DESIGNED to be hard to use?

#

or is it just my bad code

tired panther
earnest phoenix
#

no

pale vessel
#

then skill issue

earnest phoenix
#

or maybe lib issue mmulu

#

100 command limit

boreal iron
#

then skill issue
lol

cinder patio
#

Is it my internet or are github and npm dead

errant flax
cinder patio
summer torrent
earnest phoenix
#

why is repl's typescript always high

earnest phoenix
#

why do people use repl instead of a local environment

pale vessel
#

he explained why

errant flax
#

wtf is this

signal estuary
#
    let user = inter.options.getUser('user');
    let member = await inter.guild.members.fetch(user);
    member.ban({ days: 7, reason: reason })

When the member is banned ( member is not longer on the server), you can still select him in the user options in the slash command. I guess because the user is still cached. So it will give an "Unknown member" error when executing the command. I tried if(!member) return but it doesnt work. So anyone knows how to catch this error?

pale vessel
#

use try catch?

#

you said so

#

catch

#

you can use if (!member) return if you use await inter.guild.members.fetch(user).catch(() => null);

errant flax
pale vessel
#

Garbage collection completed on ThreadManager, which had a LimitedCollection of the ThreadChannel.

#

What's the context anyway

errant flax
#

it spammed my console so i wonder what it was

earnest phoenix
earnest phoenix
#

nvm

#

I got my slash commands to finally work

#

turns out I needed to run client.run() in an async context

pale vessel
#

so it wasn't lib issue was it

earnest phoenix
#

i mean if it is djs very well still may be mmLol

#

i use detritus soooo

#

um guys

#

I need help w loading my commad in my main index.js file

#

I dunno how to load commands so can anyone teach me

signal estuary
#

I am trying to filter the files for the command name:

const fs = require('fs');
module.exports = {
    name: 'interactionCreate',
    async execute(interaction, client, con) {
        if (interaction.isCommand()) {
            console.log(interaction.commandName)
            fs.readdirSync('./slashCommands/').forEach(dir => {
                fs.readdir(`./slashCommands/${dir}`, (err, files) => {
                    let filter = files.filter(file => file.name === interaction.commandName + ".js")
                    console.log(filter)
                })
            })
            let slashCmds = client.SlashCmds.get(interaction.commandName);
            if (slashCmds) slashCmds.run(interaction, con)
        }
    }
}

What I get is this:

ban
[]
[]
[]

Anyone knows why there are just 3 empty brackets?

If I do console.log(files) It will log all files who are in the dirs (ban.js is there, too). I cant just filter them idk why

sacred aurora
#

so you don't need to file.name

pale vessel
#

why are you combining sync with callbacks

#

Use readdirSync on both or even better fs/promises

#

you're confusing yourself

split hazel
#

weakly typed moment

earnest phoenix
#

can I have a simple command loading thing in js

#

im tryna do this since 10 mins

#

and can't figure it out

pale vessel
#

Naw

earnest phoenix
#

yay

lyric mountain
#

wow, 10 mins

#

your will is strong as steel

#

/s

empty pumice
#

How to update nodejs to version 16.6.1 (or higher) in termux? It's possible?

lyric mountain
#

well, it's a normal terminal so yes

blissful coral
#

I already have it setup on my server with the correct SSL same as all my other sub domains for this domain

#

Could it just be that cloudflare is taking its sweet time updating the dns route?

rose warren
#

It says your server doesn't have a valid SSL Certificate

#

Are you forcing full SSL?

blissful coral
#

No

#

I’m doing the same methods I do for all my other subs

#

Same ssl and everything

#

And same settings on cloud flare

#

Do I need to regen my ssl when I add a new sub? I don’t think I do atleast

quartz kindle
#

each sub has its own ssl

#

you dont need to do anything to others

#

how did you create the ssl for it?

split hazel
#

tim do you have any tips on checking if a key exists in a map? other than checking every bucket individually

earnest phoenix
#
Fontconfig error: Cannot load default config file```
earnest phoenix
pallid jungle
#
client.on('interactionCreate', async interaction => {
    if (!interaction.isCommand()) return;

    const slash = client.slashCommands.get(interaction.commandName);

    if (!slash) return;

    try {
        await slash.execute(client, interaction);
    } catch (error) {
        console.error(error);
        await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
    }
});

Why not working in the dms?

sudden geyser
#

what happens when you try to use it in a dm

#

Also I'd advise against sending an error reply since Discord will for you

pallid jungle
#

But in the guild it working

#

@sudden geyser
2021-09-03T14:14:16.453546+00:00 app[Worker.1]: TypeError: Cannot read property 'me' of null

blissful coral
sudden geyser
#

So you're trying to get the .guild somewhere

#

even though you know it wasn't sent in a guild

pallid jungle
#
        if(!interaction.guild.me.permissions.has('SEND_MESSAGES', 'EMBED_LINKS', 'READ_MESSAGE_HISTORY')) return interaction.editReply({ content: '![pp802](https://cdn.discordapp.com/emojis/768864899543466006.webp?size=128 "pp802") The bot is missing \`SEND_MESSAGES,EMBED_LINKS,READ_MESSAGE_HISTORY\` permission(s)!'})

sudden geyser
#

You should account for that

pallid jungle
#

So how to skip this in the dms ?

#

oh wait

sudden geyser
#

.guild is may be undefined which is your indicator

#

If you need a guild, check if the guild is there beforehand.

#

There's no option to restrict a command to guilds.

pallid jungle
#

@sudden geyser Sorry but this permissions working for slash commands?

if (cmd.clientpermissions) {
   if (interaction.guild) {
   const clientPerms = interaction.channel.permissionsFor(interaction.guild.me);
   if (!clientPerms || !clientPerms.has(cmd.clientpermissions)) {
       return interaction.reply({ content: `![pp802](https://cdn.discordapp.com/emojis/768864899543466006.webp?size=128 "pp802") The bot is missing \`${cmd.clientpermissions}\` permission(s)!`, ephemeral: true });
   }
  }
}    
sudden geyser
#

try it out and see

#

There are differences between guilds and DMs, so it's up to you to decide what permissions you need to check in the guild and what you can do in a guild you can't in a DM and vise versa

quartz kindle
split hazel
#

but then some keys get relocated due to collisions

#

to effectively check i'd have to iterate over the whole map

#

if one isnt present that could cause performance issues

quartz kindle
#

you follow the same relocation strategy

#

in case of robin hood, you do the same, linear search starting from the hashed index

#

until yiu find the value, or find an empty value, or find a value with lower relocation count

pallid jungle
# sudden geyser try it out and see
const discord = require('discord.js');
const { SlashCommandBuilder } = require('@discordjs/builders');

module.exports = {
    clientpermissions: ['SEND_MESSAGES', 'EMBED_LINKS', 'READ_MESSAGE_HISTORY'],
    data: new SlashCommandBuilder()
        .setName('ping')
        .setDescription('Replies with bot ping!'),
    async execute(client, interaction) {
    },
};

?

quaint wasp
#

Hello... do yall know how to send over like a whole folder over with express js ?

sudden geyser
#

stop throwing code at me

#

it's up to you to test it

#

and see if it works

quaint wasp
quartz kindle
#

or display it like a file explorer

quaint wasp
#

no like then using the folder

quartz kindle
#

wdym

pallid jungle
#

OOK

quaint wasp
#

like I would send a folder, then user the index in it, and be able to use to get like other files such as css

#

and stuff

#

bc zip makes u download it

quartz kindle
#

so you dont want to send a folder

#

you want to display a folder

#

like an index

quaint wasp
#

yea

solemn latch
#

apache has one by default if you wanted to use that.

rose warren
#

WP pog

#

👀

idle heart
#

Hello, I'm a mmorpg player and I'm managing a guild. I want to hide the level and items of my players with bots. Me and my players need to see these whenever I want. How can I do it

pallid jungle
#

My bot loaded slash commands 2 times Why ?

solemn latch
#

did you load them twice in code?

pallid jungle
earnest phoenix
#

i've got a css question:
is there a selector for when an element enters the viewport (when i scroll to it)

solemn latch
earnest phoenix
#

yeah

#

i can try intersection observer

feral aspen
#

DiscordAPIError: Unknown Message

#

It occurs when the code inside the else { ... } runs.

earnest phoenix
#

you dont have permission to do something

#

idk

#

what line of code caused that error

quartz kindle
#

youre missing an authorization header

earnest phoenix
#

looks like dblapi

#

did you pass your token correctly

#

well
then you tried to send something to discord without permission

quartz kindle
#

its not discord, its dbl

earnest phoenix
#

can you send your code for the vote listener

#

discord bot list mmulu

quartz kindle
#

also, dblapi.js is deprecated

earnest phoenix
#

that's not official

#

we cannot guarantee it wont steal your token

#

but it wont probably

quartz kindle
#

its open source lol

#

try it lol

#

but whats wrong with using the official one?

earnest phoenix
#

nothing

#

the unofficial one is probably just the first result in google

feral aspen
#

try {
    const embedA = new MessageEmbed()
    .setColor(black)
    .setDescription(`Successfully deleted **${amount}** messages!`)

    await interaction.channel.bulkDelete(amount, true)
    return await interaction.followUp({ embeds: [embedA] });
} catch (err) {
    embedError.setDescription(tryError)
    return await interaction.followUp({ embeds: [embedError] });
};
#

Unknown message at interaction.followUp({ embeds: [embedError] }).

#

It's because I deleted my own message.. but how can I fix so?

quartz kindle
#

check if interaction.message.deleted is true

feral aspen
#

Well.. it is according to me.

earnest phoenix
feral aspen
#

I can do .catch(err => interaction.channel.send({ embeds: [embedB] }));

#

... but that leaves it unfollowed up.

#

NVM DIDNT WORK

#

Cannot read property deleted of undefined

hollow loom
#

7393988102/4xa94xl5iqs-Place
i have this string here i want to cut off everything after the "/" how do i do it tell me pls

feral aspen
#

It means it is deleted.

earnest phoenix
feral aspen
#

Should all slash commands have a .followUp().

hollow loom
#

btw thats the only string and its connected i dont think i can split it

feral aspen
hollow loom
#

yep

#

lmao

#

i dont think you can split with a / between

#

and not a space

feral aspen
#

Here.

#
let string = "7393988102/4xa94xl5iqs-Place";
let regex = /7.*?2/;

console.log(string.match(regex)[0]);
#

It will return the numbers.

hollow loom
#

ok but like the numbers can be random lmao

#

cuz im using node-fetch

#

welp i think its impossible

#

lmao

earnest phoenix
#

i said split

#

not a regexp

feral aspen
#
let string = "7393988102/4xa94xl5iqs-Place";
let regex = /\d+/;

console.log(string.match(regex)[0]);
earnest phoenix
#

string.split("/") this will cut the string at the slash

hollow loom
#

ok

solemn latch
#

regex is slow

feral aspen
#

code913's better.

hollow loom
#

well thats alot simpler

earnest phoenix
#

so the string becomes ["7393988102","4xa94xl5iqs-Place"]

hollow loom
#

ok i see

#

thanks

earnest phoenix
#

now just use the first element in the array

hollow loom
#

thanks

earnest phoenix
#

you're welcome

feral aspen
#

code913

feral aspen
#

I'm confused... 😐

#

The interaction message gets deleted.

earnest phoenix
#

i dont know what a follow up is tbh

feral aspen
#

Ah.

#

But quick question...

#

Is this how you delete messages from a specific user?

#
try {
    const embedB = new MessageEmbed()
    .setColor(black)
    .setDescription(`Successfully deleted **${amount}** messages sent by **${user.user.username}**!`)

    const userMessages = (await interaction.channel.messages.fetch()).filter((m) => m.author.id === user.id);
    await interaction.channel.bulkDelete(userMessages, true);

    interaction.channel.send({ embeds: [embedB] });
    // return await interaction.followUp({ embeds: [embedB] });
} catch (err) {
    embedError.setDescription(tryError);
    return await interaction.channel.send({ embeds: [embedError] });
    // return await interaction.followUp({ embeds: [embedError] });
};
sudden geyser
#

try it out and see

feral aspen
#

It deletes them all. 😐

sudden geyser
#

including the ones not from the user?

feral aspen
#

.. no, all the messages sent by the user.

sudden geyser
#

then it seems to work

feral aspen
#

I didn't want that.

#

I want it delete the amount I input.

sudden geyser
#

ah

feral aspen
#

Yeah.. 😐

sudden geyser
#

So if I had /purge HamoodiHajjiri#9923 5, it would delete 5 messages from you rather than a number like 50/100.

The bulk delete endpoint (https://discord.com/developers/docs/resources/channel#bulk-delete-messages) only accepts a collection of message snowflakes, so, instead, you could fetch a collection of messages, filter by the author (like you're doing), then take a subset of the result.

In fact, Discord.js has a method for that: https://discord.js.org/#/docs/collection/main/class/Collection?scrollTo=first

Discord Developer Portal

Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.

earnest phoenix
#

Do I need a React context when I only need to pass props down two levels (Home => Navbar => User)?

quaint wasp
#

whats the rate limit for bot to send messages?

#

ping in replies

solemn latch
#

5/5s @quaint wasp

#

ish

#

keep in mind discord ratelimits are dynamic

#

you really should be looking at the dynamic ratelimit, not a static one

lyric mountain
#

generally u won't want to put stuff into a tight loop

#

like, if ratelimit is 5/5s put at least 5 seconds between each message, just to be safe

quaint wasp
feral aspen
sudden geyser
#

try it out and see

feral aspen
#

It does work. 🎉

signal estuary
#
    let time = inter.options.getInteger('time')
    let reason = inter.options.getString('reason')
    switch (time, reason) {
        case time:
            console.log("time")
            break;
        case reason:
            console.log("reason")
            break;
        case reason && time:
            console.log("reason && time")
            break;
        default:
            console.log("nothing")
            break;
    }

Time and reason are optional so I want to check if they are given or not. But the output is always "reason".

sudden geyser
#

Switch statements don't take two "parameters"

lyric mountain
#

imagine switches with 2 params KEKW

sudden geyser
#

You're better off using some ifs

lyric mountain
#

although hacky, this works

sudden geyser
#

yuck

lyric mountain
#

although !!reason && !!time might be unnecessary

#

since && will turn it into a boolean already

sudden geyser
#

it would need to be higher up anyway

lyric mountain
#

true

#

funny enough, !!reason && !!time is necessary

quartz kindle
#

because its a strict comparison

#

the switch evaluates each case with === against true

lyric mountain
#

ye but shouldn't reason && time become a boolean?

quartz kindle
#

it doesnt

#

it returns the right most value

lyric mountain
#

weird

quartz kindle
#

try logging it xd

lyric mountain
#

I did lul

lyric mountain
#

or you could be a normal person and use if-else

#

up to you to use either one

signal estuary
lyric mountain
#

dot dot dot

quartz kindle
#

just check for them individually lol

#
let string = "";
if(time) string += " time"
if(reason) string += " reason"
console.log(string)
lyric mountain
#
let arr = [];
if (time) arr.push("time");
if (reason) arr.push("reason");
console.log(arr.join(" && ") || "nothing")
sudden geyser
#

now you just have more checks

solemn latch
#

more checks, but may be more in line what they want

cinder patio
#

Tim's doesn't add &&

quartz kindle
#

neither "nothing"

coarse topaz
#

My bot is marking this IF condition as true, even though I'm running the code from a channel that doesn't belong to the category with ID "699265633128546374", so it SHOULD run the code inside of this IF statement, but it doesn't and just checks the next one. Can someone please tell me what I'm doing wrong?

}```
#

I know parentId might be nullable but in that case, is there a way to make it "not nullable"?

tired panther
tired panther
coarse topaz
# tired panther Remove the `!` at front of the if case

No, that's not what I actually want
If the command is ran outside the category with ID 699265633128546374, the bot should run the code I put into that If condition, however, as I said the bot is literally ignoring that part of the code and checks the rest of conditions, because after that if statement there're some } else {'s

coarse topaz
quartz kindle
#

and not if a not-equals b

lyric mountain
#

which in js becomes if boolean equals string

coarse topaz
signal estuary
#

How do I check if the role from the bot is higher than the role of the user / member?

split hazel
#

@quartz kindle sorry to keep bugging you i never knew the inner workings of most shit until now lmao

#

just to confirm std strings are allocated in the heap?

#

and when another string is appended on a new heap block is allocated and copied over?

signal estuary
vivid fulcrum
#

member.roles.highest will get you their highest roles

#

then just compare the position property of those two roles you got

proven lantern
#

i want to point my INTERACTIONS ENDPOINT URL to my localhost. is the best way to do that to use a service like noip.com to get a domain name pointed to my ipaddress and then buy a certificate and install it on my local?

quartz kindle
#

its like a small buffer manager

split hazel
#

yeah thats what i thought

#

so i'm doing it right nice

#

i also made my own smart pointers

quartz kindle
#

nice

pallid jungle
#

If i added in my bot config it will display the server count ?

"Authorization": "my-topgg-token-here"
solemn latch
#

nope, youll need to have the code to post it

pallid jungle
#

Wait it's public or ?

solemn latch
pallid jungle
#

What should i add here ?
I am not using shards my bot is not in 2500+ servers

#
int serverCount = ...; // the total amount of servers across all shards
proven lantern
amber wagon
#

Do we need intent for on_member_join ?

vivid fulcrum
#

yes, GUILD_MEMBERS

amber wagon
#

oof

proven lantern
#

is it possible to make events like guildDelete and guildCreate go to the INTERACTIONS ENDPOINT URL?

vivid fulcrum
#

nope

#

the interactions url is just that, the url to post interactions to

proven lantern
#

the bot joining the guild is an interaction

vivid fulcrum
#

it isn't

proven lantern
#

in a way

#

bot interacting with guild

vivid fulcrum
#

it isn't an interaction lol

proven lantern
#

i think this should work await msg.guild.members.fetch()

#

oh yeah

#

do that in a loop

#

but you might want to slow down the loop so you dont get rate limited

vivid fulcrum
#

that's a not so smart idea though anyway

#

your ram is going to get filled up really quick

proven lantern
vivid fulcrum
#

member objects are super heavy

proven lantern
#

if you are running this right when discord starts there might not be any users populated in the cache

vivid fulcrum
#

then you don't need to fetch all members at all

#

just reduce the guilds' memberCount property

proven lantern
#

maybe its a cross guild member count

#

idk

#

id just save it in a db

vivid fulcrum
#

it's a dumb and a useless statistic anyways

#

nobody cares but you lol

#

it doesn't, you just don't know how to use the library lol

#

it sucks when it comes to being optimized

#

but other than that it's a great library

proven lantern
#

i'm converting my code to slash commands and i dont think i'll even need a library

#

the api gives you everything you need

#

like in the request body

vivid fulcrum
#

yeah

#

stateless design

proven lantern
#

ngrok works perfectly for testing slash commands locally

vivid fulcrum
#

discord wants bots completely off the gateway

proven lantern
#

they force us to use websockets and then force us to stop using them

vivid fulcrum
#

yeah well

#

they themselves don't know what they're doing

#

if it wasn't clear enough with the message intent coming soon lmfao

proven lantern
#

they are doing the right thing now

#

discord was basically a POC that grew too fast

vivid fulcrum
#

they actually had plans for bots to integrate with the client back in 2016

#

like slash commands and all

#

but only got around to doing it now

#

probably got under new management

quartz kindle
#

cry me a river

pallid jungle
#

DiscordAPIError: Invalid Form Body
embeds[0].description: This field is required

sudden geyser
#

You probably supplied an empty string for the description

sterile lantern
#

button.channel.send(button.clicker.user.avatarURL())

how can i make it send the avatar animated if its animated

#

my avatar is animated but it doesnt send it as the gif

#

hmm wait nvm i think its just dynamic: true

#

ya it is nvm

blissful coral
sudden geyser
#

You tried look up some DNS address that didn't exist

blissful coral
#

It exists lol

#

It's my own domain

#

oh wait

#

I see

woeful pike
#

fyi JiuSipRLY

const users = client.guilds.cache.flatMap(guild => {
  return guild.members.cache.filter(member => !member.user.bot)
})
sterile lantern
#

how do i fetch a channel with buttons

#

await button.guild.channels.fetch

#

doesnt work obvs

lyric mountain
#

button.message.guild.channels.fetch ig

sterile lantern
lyric mountain
#

that's why I said "ig"

sterile lantern
#

this is what data it gets from button clicker

#

aka the user who clicks the button

lyric mountain
#

there you have it then

sterile lantern
#

for guild

lyric mountain
#

member.guild.channels

vivid fulcrum
#

channels are guaranteed to be cached, you don't need to fetch them

sterile lantern
#

since when

vivid fulcrum
#

since always

sterile lantern
#

i always heard that channels weren't always in the cache

#

weird

vivid fulcrum
#

you might be confusing them with members

sterile lantern
#

o

blissful coral
#

Anyone know how to setup influxdb and grafana

#

I am having a shit ton of trouble

sterile lantern
#

let ticketchannel = button.guild.channels.cache.some((channel) => channel.name === "ticket-logs")

#

ticketchannel.send dont work

#

hm wait lemme try ID

blissful coral
#

It's best to always use ID when searching for a specific channel

sudden geyser
#

.some returns a boolean

blissful coral
#

and use .find() or .get()

vivid fulcrum
#

^

sterile lantern
#

ah ic

wary swan
#

how can i change the label background if radio button is selected in this structure:

<label>
    <input type="radio">
    <span>
      <i></i>
    </span>{{label}}
  </label>

#

i have tailwind installed on the project btw if it makes things simpler

proven lantern
#

can i register a slash command in some way that forces it to send me the guild name without me having to make an api call?

vivid fulcrum
#

nope

#

the response only returns the guild id

quartz kindle
#

there is a hacky way to do it by putting the label after the radio input and using the label-for attribute and some css selector shenanigans

#

the same principle used in css tabbed boxes

wary swan
empty pumice
#

What command I use for update nodejs for version 16.6.1 (or higher) in termux?

proven lantern
#

how does this caching logic look?

sudden geyser
#

why not use rest syntax to merge the map and extra props (...res.data)

#

though it looks pretty standard

cobalt spruce
#

msg.member.voice.channel.leave

#

uhh

#

should i add

#

channel.cache.leave?

lament rock
#

no. Voice channels have no cache

#

the method was either renamed, moved or removed

low bone
#

msg.member.voice.disconnect()

quartz kindle
# proven lantern

you may have issues with very high concurrency, otherwise looks fine

errant flax
#

what is the recommended servers to do sharding

quartz kindle
#

1500+

errant flax
#

thx :iara_sunglasses_cool:

spark flint
#

anyone know how i can get a mysql value

#

using python

#

its stored in the format userid, pronouns

#

actually

#

i'm switching to json

low bone
#

you know the mysql query line first?

lament rock
#

Across all languages, it's similar. Just how you execute the statement.

SELECT * FROM Table WHERE key = val;

Although, I would recommend using prepared statements. So, something similar to

SELECT * FROM Table WHERE key = ?
val;
signal estuary
#
                let row = new MessageActionRow().addComponents(
                    new MessageButton()
                        .setLabel("YES")
                        .setStyle("SUCCESS")
                        .setCustomId("yes"),
                    new MessageButton()
                        .setLabel("NO")
                        .setStyle("DANGER")
                        .setCustomId("no")
                )
                let message = await msg.channel.send({ content: "Button test", components: [row] })

                const filter = (inter) => {
                    console.log(inter.user.id, msg.author.id)
                    if (inter.user.id === msg.author.id) return true
                    return inter.reply({ content: "You cant use that" })
                }
                const collector = msg.channel.createMessageComponentCollector({
                    filter,
                    max: 1
                })
                collector.on('end', (ButtonInteraction) => {
                    let id = ButtonInteraction.first().customId
                    if (id === 'yes') {
                        return msg.channel.send({content: 'Confirm'})
                    }else {
                        return msg.channel.send({content: "Decline"})
                    }
                })

I would like to disable the buttons after collector.on('end'). How can I do this so?
Using discord.js

wheat mesa
#

I believe the only way to “disable” the buttons entirely is by editing the message to no longer have the components in them

solemn latch
wheat mesa
#

Wait that’s a thing

#

Had no idea

low bone
#
message.edit({components:[new MessageActiveRow().addComponents(message.components[0].components.map(v=>v.setDisabled()))]})

try this (didn't test tho)
before

let id = ButtonInteraction.first().customId
coarse topaz
# quartz kindle !a === b means `if not-a equals b`

It should work now, but instead the bot doesn't listen to the command at all... What should I do? I'm not even getting any errors in the console
if (message.content.startsWith(`${prefix}gamevote`)){ if (message.channel.parentId !== "699265633128546374") { let errorEmbed = new Discord.MessageEmbed() .setTitle(`**Something went wrong**`) .setDescription(`something here`) .setColor("RED") .setFooter(`Command ran by: ${message.author.tag} (${message.author.id})`, message.author.displayAvatarURL) .setTimestamp() message.channel.send(errorEmbed).catch(console.error); } else { some more code } }

low bone
#

seems good if your intention is:
1- message must start with prefix+gamevote
2- category ID shouldn't be 699265633128546374

#

if it's not working, then probably he don't even check this whole code
or ur prefix is undefined
so do some console.log to check

#

message.author.displayAvatarURL
should be

message.author.displayAvatarURL()
coarse topaz
#

2- category ID shouldn't be 699265633128546374
Correction, category ID shouldn't be other than 699265633128546374

Will try again with the displayAvatarURL() fix, thanks!

low bone
coarse topaz
low bone
coarse topaz
proven lantern
#

do slash commands have a built in way to rate limit?

coarse topaz
#

is it something bad

low bone
low bone
coarse topaz
coarse topaz
low bone
#

to avoid such mistake, in discord.js.org documentations

select ur version
because it will show u the latest version documentation by default

coarse topaz
#

because it will show u the latest version documentation by default
got it, didn't know about that!

#

@low bone do you know how should I set up my code so that my bot checks if the user reacted to a message, and if they reacted again (with other emoji) the bot would remove the previous reaction by the user and leave the most recent one?

lyric mountain
#

Aka pagination

#

Use collectors for that

coarse topaz
#

Alright, will look into it!

Another question; is there a way to make the bot display a category's name by its ID?

solemn latch
#

just get it and .name

blissful coral
#

I need some help with influxdb configuration to a subdomain on my host

coarse topaz
lyric mountain
#

What didn't u understand abt collectors?

coarse topaz
#

How to literally setup one lol, I don't know where I should start from

solemn latch
#

djs?

coarse topaz
#

yes

coarse topaz
#

I'm so sorry, but I still can't get it at all
An example of an actual reactions collector that'd work similarly to what I want would help me a lot

#
  1. check if a user reacted to the message;
  2. check if the user reacted to the message with other emoji
    -> if that happens, remove the first reaction and leave the second one
lyric mountain
#

So, you want an example conveniently adapted to your use-case

#

That's sus

coarse topaz
#

xD well, yes! but that doesn't mean I wouldn't love to learn how to create it myself

#

I'm just literally out of ideas, I don't know how to create one

coarse topaz
#

As I said I've checked docs and many articles already, but I'm unable to find something similar to what I need, so I can't really learn how to adapt those examples from internet to my case

lyric mountain
#

Have a break then, if you're exhausted there's no good in burning ur head

#

It's not hard at all, you just need to look at it with a fresh mind

coarse topaz
#

I'm sure my mind is fresh enough, I just, don't know how to do it, not even after looking at docs

chilly sparrow
#

Just realized I have to completely rewrite my bot in js by April Bc discord.py is not implementing slash commands

lyric mountain
#

Dpy has a technically official slash lib

#

Even then, all you need is to have the intent whitelisted if you need to use message content

chilly sparrow
#

According to the sole d.py dev: “If you want to apply for the message content intent, you cannot use it for command handling purposes; they will explicitly deny you the intent.“

lyric mountain
#

Well, ask for something else

#

If you have it, obv

coarse topaz
#

What does "time" mean in this code line?
const collector = message.createReactionCollector({ filter, time: 15000 });

lyric mountain
#

Timeout

chilly sparrow
lyric mountain
#

Bad idea

#

If all you use message content for is command handling just move to slashes then

coarse topaz
chilly sparrow
#

then it circles back to the fact that d.py slash commands is “not implemented” according to the dev. Whatever, hopefully by then someone will make a working fork and I won’t have to switch languages

lyric mountain
#

Doesn't the documentation talk abt that?

#

Like setting timeout to -1 or something

#

They probably talk about it somewhere

#

And do note, keeping collectors open indefinitely is...sub optimal at best

lyric mountain
#

Dpy slash iirc

chilly sparrow
#

Hey if it works sure hashflushed

#

Ty

lyric mountain
#

It's been around since slashes became a thing, often referred as the main slash lib for dpy

chilly sparrow
#

Gotcha, I’m relatively new to bot dev stuff so I didn’t even know slash commands were gonna be a thing until today

coarse topaz
coarse topaz
lyric mountain
#

Is timeout a required attribute?

coarse topaz
#

Looks like it's optional!

So just leaving that line as
const collector = message.createReactionCollector();
Should work, right?

proven lantern
#

how would i send the followup message?

hearty karma
digital ibex
#

u like send a type 4 like 99% of the time lol

#

but

digital ibex
#

like usin the raw api or a library

proven lantern
#

i would send an ack and it's in loading state. then i need to send the actual message after

#

i am using slash command INTERACTIONS ENDPOINT URL

lyric mountain
digital ibex
proven lantern
digital ibex
#

the type should be 4

proven lantern
#

i need more time

#

than 4 gives me

digital ibex
#

ur like, doin some weird stuff

lyric mountain
#

Just edit the message with the same content

#

Then do whatever u want to do and edit it later

proven lantern
#

like make an api call

digital ibex
#

yeah, usually its how ur making the api call. ur sending multiple responses for one request

#

if that makes sense idk ive barely slept

#

how r u making the api call

proven lantern
#

discord is calling my INTERACTIONS ENDPOINT URL

#

i am not making any api calls currently

digital ibex
#

what library u usin

proven lantern
#

no library

#

well expressjs

digital ibex
#

yeah so i mean

#

r u using http to like, dispatch the command or jwayever

proven lantern
#

i registered my INTERACTIONS ENDPOINT URL with discord and made slash commands. discord calls my nodejs expressjs project with info

digital ibex
#

i honestly have no idea what ur trying to say and how that works but im going sleep

long marsh
#

Does anyone have experience with the ShardManager.broadcastEval() from discord.js?

proven lantern
proven lantern
blissful coral
#

hm

earnest phoenix
blissful coral
#

Webstorm

earnest phoenix
#

nice

#

Is it possible to use replit inside VSC? All I need to do is connect to repl.run but idk how

blissful coral
#

Yeah probably

earnest phoenix
#

how do i connect

near stratus
#

Isn't repl.run() deprecated ?

earnest phoenix
#

it's a website

#

not a command

proven lantern
#

I am returning DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE. it says to ACK an interaction and edit a response later, the user sees a loading state. How do i do the edit a response later part?
https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type

Discord Developer Portal

Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.

pale vessel
earnest phoenix
#

what happens if i run an openssh server on replit then connect with the repl.co domain

feral aspen
#
RangeError [EMBED_DESCRIPTION]: MessageEmbed description must be a string.
#
.setDescription(warn.content.map((w, i) => `**\`${i + 1}\`** | Moderator: ${interaction.guild.members.cache.get(w.moderatorID).user.tag}\nReason: ${w.reason}`))
#

Did I do something wrong?

earnest phoenix
#

warn.content.map returns an array

#

after mapping you need to join it to a string

feral aspen
#

It is legit 1 INDEX.

blissful coral
#

If you map them it becomes an array of strings

#

You still need to join it

feral aspen
#

That sucks.

#

But alright. 👍

blissful coral
#

.join(“\n”)

#

Not really

earnest phoenix
#

correction: javascript sucks

blissful coral
#

It’s done like that for a reason

feral aspen
#

V13.. 🤷‍♂️

#

I was waiting for someone to just say Typescript is better. 😂

#

.. but guess not.

earnest phoenix
#

how do i implement an iterator for a class
I have this:

class LinkedList {}

and I want to be able to do this:

for (let node of list) {}
#

nvm i can just iterate the nodes property which is an array

solemn copper
feral aspen
#

Oof.

last tapir
#

i cant seem to lock a channel

#
const role = message.guild.roles.everyone;
const perms = role.permissions.toArray();

const newPerms = perms.filter((perm) => perm !== 'SEND_MESSAGES');
console.log(newPerms);

await role.edit({ permissions: newPerms });
message.reply("channel locked")
earnest phoenix
#

This is my kick command

module.exports = {
    name: 'kick',
    description: 'kick users!',
    execute(message, args){
       
        const member = message.mentions.users.first();
        if(member){
            const memberTarget = message.guild.members.cache.get(member.id);
         memberTarget.kick();
         message.channel.send("User has been kicked");
        } else{
            message.channel.send('couldnt kick mentioned member');

        }
    }
}```
I want only people with a specific role to be able to kick 
so where can I add this 
```js 

  if(message.member.roles.cache.has('782908342548299778')```
so that only members with that role can kick?
small plume
#

and close it at the end

earnest phoenix
small plume
#

So pre much js if(message.member.roles.cache.has('782908342548299778') { const message blah blah blah }

earnest phoenix
earnest phoenix
# small plume before `const member` but open it with`{`

like this?

module.exports = {
    name: 'kick',
    description: 'kick users!',
    execute(message, args){
    
        if(message.member.roles.cache.has('782908342548299778')
    const member = message.mentions.users.first();}
        if(member){
            const memberTarget = message.guild.members.cache.get(member.id);
         memberTarget.kick();
         message.channel.send("User has been kicked");
        } else{
            message.channel.send('couldnt kick mentioned member');

        }
    }
}
small plume
#

check my above message

#

you need to open it with { and then close it at the end

last tapir
#

Hi can you giv my profile cod js

#

@small plume

small plume
last tapir
#

Do you not know

earnest phoenix
#

should i worry about this

near stratus
earnest phoenix
#

hello need help

#
/home/runner/EVON/commands/cat.js:2
const fetch = require('node-fetch');
              ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/runner/EVON/node_modules/node-fetch/src/index.js from /home/runner/EVON/commands/cat.js not supported.
Instead change the require of index.js in /home/runner/EVON/commands/cat.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/home/runner/EVON/commands/cat.js:2:15)
    at /home/runner/EVON/index.js:30:17
    at Array.forEach (<anonymous>)
    at /home/runner/EVON/index.js:28:9
    at FSReqCallback.oncomplete (node:fs:185:23) {
  code: 'ERR_REQUIRE_ESM'
}
exit status 1```
#

can any one help me

quiet topaz
#

is it possible to make ```js
if(myArray.includes("myString"){
//code here
};

(nodeJS)
near stratus
quiet topaz
earnest phoenix
#

why

#

just put more than one case for the same command

#

case "command":
case "alias":
message.reply("both work");
break;

quiet topaz
#

yeah, but i have that, but i want to have it in a json

earnest phoenix
#

?

quiet topaz
#

like that i only edit the json not the code

feral aspen
#

Is it allowed to use the cache of all servers in a bot and fetch all the member count of each server and add it to the number variable?

#

Go to server cache > in each server fetch member count > add each member count to the total amount variable.

earnest phoenix
#

Everyone does that though

#

So it's allowed

#

Also you can just use client.users.cache.size instead of adding all member cache

feral aspen
earnest phoenix
#

no?

feral aspen
#

.. so I want to go to each server, and get the member count by fetching.

earnest phoenix
#

rate limits

feral aspen
#

Ah.

earnest phoenix
#

and bad idea

feral aspen
#

Yeah..

#
<client>.users.cache.size;

This keeps increasing.

cinder patio
feral aspen
#

.. meaning it is caching users slowly.

earnest phoenix
#

not as bad of an idea as to have a nextjs file structure made entirely of index.js files

feral aspen
earnest phoenix
#

and i don't see what's wrong with a non accurate user count

feral aspen
earnest phoenix
#

Not even possible bro

#

Users update every few milliseconds

cinder patio
split hazel
#

you can only really keep a rough estimate

earnest phoenix
#

guilds.redcue

pale vessel
#

It's such a useless metric, why do you need this?

earnest phoenix
earnest phoenix
#

It doesn't

cinder patio
#

no

earnest phoenix
#

Because it's using the cache

feral aspen
#

Ah. 👍

earnest phoenix
#

why aren't they together

#

I mean side by side

cinder patio
#

prolly cause you're on mobile

#

or you've placed them in different rows, we can't know for sure because we can't see the code

earnest phoenix
#

Yes i put them in different rows

#

This is the problem thanks for help

slender thistle
#

@drowsy crag oi

earnest phoenix
#

No thank you

rapid geode
#

❤️

slender thistle
#

@rose warren

earnest phoenix
rapid geode
#

WHO

rose warren
#

No ads please

rapid geode
#

okk

timber fractal
#

hello can i dm someone to help me with my automoderation system?

earnest phoenix
#

Hello

#

this is my ban command, but the thing is if I try banning myself it obviously doesnt work and shows error in console but then the bot stops responding until I restart it. Anyway I could fix that?

module.exports = {
    name: 'ban',
    description: 'bans users!',
    execute(message, args){
    if(message.member.permissions.has('ADMINISTRATOR')){
    
        const member = message.mentions.users.first();
        if(member){
            const memberTarget = message.guild.members.cache.get(member.id);
         memberTarget.ban();
         message.channel.send("User has been banned");
        } else{
            message.channel.send('couldnt ban mentioned member');

        }
    }
  }
}```
timber fractal
#

you mean, if you try to ban the bot?

earnest phoenix
timber fractal
#

what error it shows?

cinder patio
#

You should try...catch the ban call

rose warren
#

Try ```js
memberTarget.ban().catch(err => console.log("Can't ban that user"));

#

(edit: missing bracket)

earnest phoenix
#

oh okay thanks

rose warren
#

Also, you can just require the ban members permissions for a ban command. Not all people with ban permissions need to be administrators

earnest phoenix
#

How do i set url to button

vivid fulcrum
#

set the style to 5 and the url to your url

finite flume
#

does anyone have any good resources for learning about asynchronous stuff with python? I'm trying to wrap my head around like async io and stuff and i just... can't.

earnest phoenix
slender thistle
vivid fulcrum
#

link buttons also cannot have a custom_id

earnest phoenix
#

I saw one in select menu

vivid fulcrum
#

select menus =/= buttons

earnest phoenix
#

I just started buttons

timber fractal
#

why do i get this error? (node:16096) UnhandledPromiseRejectionWarning: TypeError: setTimeout(...).then is not a function

earnest phoenix
#

So dk anything

vivid fulcrum
#

and must be imported from timers/promises

timber fractal
#
const wyr = require("wyr");
        msg.channel.send(`:loading: fetching random wyr...`).then(m => {
            wyr().then((response) => {
                let question1 = response.blue.question;
                let question2 = response.red.question;
                let embed = new Discord.MessageEmbed().setAuthor(`WYR Generator`, msg.author.displayAvatarURL()).setTitle(`Would you rather...`).setDescription(`**A:** ${question1}\n**B:** ${question2}`);
                setTimeout(() => {m.edit(embed);}, 150).then(
                    m.react('🅰️').then(() => {
                        m.react('🅱️')
                    })
                );
            });
        });``` this is the code btw
#

so whats wrong

vivid fulcrum
#

i wish i was jared, 19

timber fractal
#

whats wrong in my code?

earnest phoenix
#

It has Emoji

vivid fulcrum
#

it has an emoji in the label

earnest phoenix
#

Not in the labek

#

Label

vivid fulcrum
#

oh

timber fractal
#

how can i edit a message and also remove the previous content v12?

vivid fulcrum
#

guess it can have an emoji then

#

but anyway, robot isn't a valid emoji

#

and link buttons cannot have a custom id

#

\🤖 is a valid emoji though

timber fractal
quartz kindle
#

give it null content

timber fractal
earnest phoenix
#

so I placed it above staff roles

#

as it has admin perms

#

and dont want mods to be giving it to themselves

quartz kindle
earnest phoenix
#

and because of that these mods were kicking each other so made it admin only for a while sazum

timber fractal
#

works now, thx

split hazel
#

took them long enough to add async timeouts natively

#

callbacks are a thing of the past am i right

#

unless you don't have async support

signal estuary
#
let message = await msg.channel.send({content: 'test'})
setTimeout(async () => {
    if(!message) return;
    message.delete()
}, 10 * 1000)

The 'message' gets deleted before the timeout starts so he should return because the message was deleted. But he doesnt so he will throw an "Unknown message" error. If I do console.log(message) in the timeout he will log the message and deleted = false.
I dont know if it is important but the message gets deleted while the 10 seconds are running

sudden geyser
#

Which you should be doing anyway since you don't know if that promise is going to be rejected for whatever reason

split hazel
#

or you can silently handle the promise via .catch(() => null) which wouldn't throw an unhandled rejection and let you check via NOT operator

quaint wasp
#

uh

#

How do you open tgz files?

#

ping in replies

split hazel
#

dark magic

#

in what context

#

in code or

quaint wasp
#

code

#

@split hazel

split hazel
#

I mean for the easiest way you'd download some kind of library that does all the heavy lifting for you

quartz kindle
#

you mean .tar.gz files? or what

#

thats basically a zip file

#

what do you want to do with it?

split hazel
#

targz is usually just zips for linux

vivid fulcrum
#

message is undefined

#

show your command handler

#

that's not the handler

#

the handler is the run part

#

in the message event

quartz kindle
#

your command has a run function

boreal iron
#

You’re calling your <command>.run() in your message event

quartz kindle
#

we need to see where you use it

#

where you do something.run()

#

there you go

quaint wasp
quartz kindle
#

the first argument is message, not client

quartz kindle
pale vessel
#

7zip smh

#

7zip is love 7zip is life

quartz kindle
#

i dont like 7zip

#

at least last time i tried it i didnt like it

signal estuary
#

I am trying to make a timout for buttons so the buttons get disabled after a few seconds. This works fine but now I want to cancel the timout if you interact with the buttons. So I am now so far that you make sth with the buttons but the buttons still get disabled after a while. How can I cancel the timeout if a interaction was given?

quartz kindle
#

clearTimeout

split hazel
#

winrar moment

quartz kindle
#

yes

#

i like winrar

split hazel
#

tfw free trial expired but you can still use it

quartz kindle
#

i crack it anyway lol

#

to get rid of the annoying message

split hazel
#

alright you pirate

boreal iron
#

Imagine calling it cracking just by replacing the reg file.
What a strong security layer of WinRAR KEKW

#

These methods are oldschool… once again oldschool rockz

split hazel
#

it is a very old program lol

#

pretty sure they don't care about some kiddies cracking it

#

they get tons of revenue from businesses using it anyways

#

since to "legally" be able to use it they need to have a license

placid sundial
#

test

split hazel
#

test received

#

connection quality 9/10

quartz kindle
#

lel

boreal iron
#

Can’t see your test message and test received either
Must be a skill issue

split hazel
#

skill issue confirmed

high crown
#

can anyone reccomend me web hosting websites

#

free ones

#

pls

tulip ledge
#

github pages?

high crown
#

noi

#

web hosting

#

where I can get a custom url

quartz kindle
#

custom url?

#

like a domain name?

cinder patio
#

You mean a domain

tulip ledge
#

You can get a domain on github pages

cinder patio
#

You can get a custom domain with gh pages right

tulip ledge
#

yes

cinder patio
#

but you have to buy it yourselff

high crown
tulip ledge
#

github pages.

quartz kindle
#

there are very few domain names that are free

#

like .tk

tulip ledge
#

Can't u get a free domain from github if ur a student?

#

or do they not do that anymore

#

I remember there was a time they did that

high crown
vivid fulcrum
#

you get github student pack which includes services that offer a year free on certain TLDs

high crown
#

tim where did u host your website?

tulip ledge
#

it's not free prob

high crown
#

oops

tulip ledge
#

most free webhosts have catches to them

high crown
#

let me make a github acc

quartz kindle
#

those are two different things

buoyant swan
#

Is there any reason why I should make a bot open source?

high crown
#

both

quartz kindle
#

hosting is like a server where your programs/websites run, they only give you an ip address

quartz kindle
#

a domain name is something you buy separately, and point it to an ip address

high crown
solemn latch
#

I buy my domains from a few places depending on the TLD and price of the specific domain

solemn latch
#

typically just do your research on the domain side

quartz kindle
#

if you want both domain and hosting, many providers give you 1 domain for free if you buy their hosting

high crown
#

waao

buoyant swan
#

How to change perms of a text channel?

solemn latch
#

just like, in discord?

buoyant swan
#

yes

#

for a specific role

solemn latch
buoyant swan
#

ok

spark flint
#

How do I create a progress bar using PIL in Python?

#

@drowsy crag

rose warren
#

Don't ping mods please

spark flint
#

it was nitro scam

#

its deleted now

rose warren
#

Ah ok np

earnest phoenix
#

The error I get when the bot has 0 permissions

#

button.defedUpdate()

#

Should i remove it?

solemn latch
#

are you taking more than 3 seconds to deferUpdate?

near stratus
#

Ping: 69420ms

boreal iron
#

lol

solemn latch
#

yeah feels bad for replit bots which sometimes have more than 3 seconds of ping

earnest phoenix
earnest phoenix
#

I mean this command's code

near stratus
solemn latch
#

lol

hollow loom
#
let reply = `Previous warnings for <@${userId}>:\n\n`

how can i turn the string into a code block

solemn latch
#

use

\`\`\`
near stratus
hollow loom
#

ok ty

earnest phoenix
#
if (i.customId === 'help') {
        await i.deferUpdate();
        await wait(500)
        await i.editReply({ embeds:[help], components: [row, row2, row3] });
      } 
solemn latch
#

why wait 👀

earnest phoenix
#

It was like this in the sample code

#

I didn't change it because Discord knows something.RooSip

solemn latch
#

actually, pretty sure they just have that to show how to defer updates. like if defering is needed.

#

such as if you are unsure how long something will take

earnest phoenix
#

So if i remove it i dont get any problem?

solemn latch
#

yeah looking at the djs guide the wait period is over 3 seconds

#

yeah, its only for if you need more than 3 seconds to respond to the interaction

earnest phoenix
#

But it doesnt give any problem when bot has permissions

solemn latch
#

still, all your doing is just waiting 500ms for zero reason

earnest phoenix
#

It was so that the bot wouldn't be counted as spam.

solemn latch
#

thats not what discord, or the guide says

#

https://discordjs.guide/interactions/replying-to-slash-commands.html#deferred-responses

As previously mentioned, you have three seconds to respond to an interaction before its token becomes invalid. But what if you have a command that performs a task which takes longer than three seconds before being able to reply?

In this case, you can make use of the CommandInteraction#deferReply() method, which triggers the <application> is thinking... message and also acts as initial response. This allows you 15 minutes to complete your tasks before responding.

earnest phoenix
#

So if i only edit it is no problem

#

Okay thanks

hybrid cargo
#

@solemn latch i think the .editReply() method is actually used to edit the reply the interaction previously made. For example if a button is clicked and it sends a message and then u edit that message later again. He needs to send a message first before editing, or needs to update the message containing the button. I might be wrong

earnest phoenix
#

If i dont use .deferUpdate()

hybrid cargo
#

Yep, i was right, u are trying to edit a message which u never sent

earnest phoenix
#

Actually i sent

#

Hmm

#

I am editing buttons not embed message

#

Maybe its bc of this

raw gust
#

Is there a way for bots to turn off the speaker's mic when muted?

cobalt spruce
#

for me this are contained in obj
{ str: 'hello', elapsed: 33.237 } //logs this
how i can send str and elapsed if i use obj[str,elapsed ] i get not defined
if i send obj i get Cannot send an empty message
(as discord message)
Ex: message.channel.send(obj);
message.channel.send(obj[str, elapsed ]);

near stratus
#

??

cobalt spruce
cobalt spruce
#

also

#

is unhashing in discord illigal

wheat mesa
#

Unhashing?

burnt citrus
wheat mesa
#

If you can crack a hash in a reasonable amount of time it was a shitty hashing algorithm to begin with

rose warren
#

unhashes MD5

#

thinks "im hecker"

wheat mesa
#

unhashes your browns

cobalt spruce
cobalt spruce
lyric mountain
#

Bruh

rose warren
#

An unhash command for MD5?

wheat mesa
#

I mean I highly doubt it because your bot will likely not be able to crack any hashes

cobalt spruce
rose warren
#

lol

#

That's not illegal

lyric mountain
#

Hashes are specially made to be one-way ops

cobalt spruce
lyric mountain
#

You'd take a fuckton of resources just to break a single hash

wheat mesa
#

MD5 hashes are weak though iirc

#

Still not worth it though

boreal iron
#

I’m running a lookup hash table for 4 billion game account IDs

rose warren
cobalt spruce
boreal iron
#

Still haven’t been banned yet KEKW

wheat mesa
#

I’m not sure what type of specs this information is based on, but I highly doubt that you’ll want a bot taking up those resources

lyric mountain
#

That's like

#

Using a turbofan to cool your cracking system

rose warren
#

Yeah no MD5 is the worst way to store passwords after just plain text

cobalt spruce
boreal iron
#

Since there are already gigantic lists with known passwords out there

wheat mesa
cobalt spruce
wheat mesa
#

Unless your bot is running on some really impressive specs

lyric mountain
#

Passwords are one thing but arbitrary data? Even md5 is gonna take some time

earnest phoenix
#

markdown has versions?

wheat mesa
#

He cracking those 3 character passwords in 30 seconds 😳

boreal iron
#

It’s not like a stolen password would be an issue if somebody has stolen personal data out of a database

lyric mountain
#

Daring today ain't we?

solemn latch
hybrid cargo
#

check the git codes

#

He isn't editing the original message of the interaction, neither trying to create a new response

solemn latch
hybrid cargo
#

Again, I might be wrong from what I've understood. So pls explain to me aswell if I am wrong 😂

#

Ahh

solemn latch
#

Didn't look at anything else tbh

hybrid cargo
#

Gotchu

warm prawn
#

where can I get bot cookie

#

:/

quartz kindle
#

in the kitchen

warm prawn
#

Bruh

#

I specified " bot cookie " on top.gg

earnest phoenix
#

Type again delete old one instead edit

warm prawn
#

:/

earnest phoenix
warm prawn
#

Uff

#

No one can help me

rose warren
#

Do you mean token?

earnest phoenix
lyric mountain
#

Skill issue

warm prawn
#

:/

rose warren
#

Welp

warm prawn
#

Idk I also came across it new

#

:/

rose warren
#

There's no such thing as a bot cookie

lyric mountain
#

What's your native language?

warm prawn
#

Hindi, Kannada, English, Hinglish

#

:x

#

Why so

pale vessel
#

Kannadian

rose warren
warm prawn
#

Nah