#development

1 messages · Page 1989 of 1

spark flint
#

yep out

earnest phoenix
#

Oh sweet

#

I was thinking about the attachments thing

#

:^)

marble juniper
#

discord.js has no attachment support yet so cringe

sudden geyser
#

well it technically does

#

but you won't like the api

lyric mountain
#

old email MIME attachments ptsd

warm swan
earnest phoenix
#

1 month maybe

#

1-3 month

pale vessel
#

more than a month

spark flint
#

5 week+ wait atm

lyric mountain
#

Verification? Around 2-3 weeks.

Message intent? About 2 months

#

You can put the tos in ur repo or a new public repo if urs isn't

#

The idea is that it's readily available to anyone wanting to read it without having to join servers or login to sites

#

Ye

#

Took about 3 emails

#

2 where they kept asking for info that I already supplied on the form

#

The third they finally sent someone that's not an intern to process my intent application

junior pecan
#

Will she still answer me?

earnest phoenix
#

Is it for message content?

lyric mountain
#

To supply a privacy policy and valid reasons that justify me getting the intent

#

At least in my case

#

Those thing which were already present in the form

earnest phoenix
#

Very simple why do you need this

#

You dont need message content intent for this

#

You can use slash commands they will tell you so

#

I have message content intent freerealestate

lyric mountain
#

Anything that don't require user interaction or can't be converted to slashes

#

For example, in my case, they're are: custom answers, anti-spam/raid/link and interactive games (crisscross, reversi, tcg, shiritori, etc)

#

There are probably more, but those are the ones I remember

#

Leveling isn't a valid reason

#

Because they can still work even without message content

#

You just need to know whether an user sent a message, not what they sent

#

As for games, any interactive game is valid

#

Cuz they can't be slashed

#

Any game where it doesn't end after the command is sent

#

Like, in board games you'd send more messages after the initial command

#

Those which cannot be counted and making one command for each move would be ridiculous

#

Take chess as an example

solemn latch
#

cant you use modals instead of commands though?

#

or messages

lyric mountain
#

For board games? Unfeasible

solemn latch
#

I think it would work quite nicely

lyric mountain
#

And modals would close the moment the user refreshed the page

#

You CAN make them work with interactions yes, but the amount of work to make them slightly as convenient as with actual messages is absurd

#

What if users want to watch the match? What if it's an in-server tournament?

solemn latch
#

tournaments on sites are going to be used 99% of the time anyway

lyric mountain
#

I'd say closer to 40% based on my observations

#

People like to host event on their servers

#

It gives socialization opportunities to server members

bright hornet
#

Why i keep getting js client.users.fetch(...) is not a function

craggy pine
#

So I've used this query before on other things in my user table but oddly enough I'm receiving an error this time and I'm honestly unsure why

await db.query(`UPDATE user SET commands_used WHERE userid = ${message.author.id}`, [commandsused[0].commands_used + 1])
   "error": [
    "Error: (conn=30144, no: 1064, SQLState: 42000) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE userid = 160679942319767552' at line 1",
    "sql: UPDATE user SET commands_used WHERE userid = 160679942319767552 - parameters:[1]",
]

My user ID does indeed match.
https://scs.twilightgamez.net/cYabz.png

boreal iron
#

That doesn't make sense

#

await db.query(UPDATE user SET commands_used = commands_used + 1 WHERE userid = ${message.author.id})

craggy pine
#

I'm using node mariadb, and the whole , [] thing is proper

#

but ill try urs out a sec

boreal iron
#

It's not, you can also provide an empty array

craggy pine
#

I see

boreal iron
#

await db.query(UPDATE user SET commands_used = commands_used + 1 WHERE userid = ${message.author.id}, [])

#

would it be then

craggy pine
#

I'll try it out 🙂

boreal iron
#

oh well discord removed the ticks

#

THANK YOU DISCORD

craggy pine
#

lol

wheat mesa
woeful pike
#

WHERE userid = ?

boreal iron
#

Yes makes sense since youre already using prepared statements

#

lol

#

didn't even see that xD

craggy pine
#

I never fully understood. I can use ? instead of ${message.author.id}?

#

Kinda newer to mysql

boreal iron
#

await db.query("UPDATE user SET commands_used = commands_used + 1 WHERE userid = ?", [message.author.id]);

craggy pine
#

oh got it

#

That makes sense now

boreal iron
#

The array represents your values you SET a placeholder for (? in this case)

bright hornet
boreal iron
#

They will be insert in the same order you placed your placeholders

craggy pine
#

Didn't realise I could do that for a WHERE statement

#

but I suppose it's for any ? i put in the query

boreal iron
#

Good thing is, since this a prepared statement, you don't have to worry about SQL injections

wheat mesa
boreal iron
#

You literally replace all of your arguments with a placeholder (?), and will then add them to the array

craggy pine
#

and it goes in order left to right

boreal iron
#

Yes, the order and amout is important

craggy pine
#

Learning mysql WoweeDance2

boreal iron
#

Adding one more placeholder than the array has items, you will get an error

#

And vise versa

wheat mesa
#

actually hold on a second lemme look at the types

bright hornet
craggy pine
boreal iron
#

👍

craggy pine
#

besides my name is the actual db value

wheat mesa
#

are you sure args[0] is the id?

#

from what I'm looking at now, your code SHOULD work if it's an id

bright hornet
#

alright imma try this one, yeah the js starts with 0,1,2,3

craggy pine
#

I'd console.log args and just see what the value is

wheat mesa
#

^^

#

ah wait I'm stupid

#

you're not awaiting your fetching

bright hornet
#

ha?

boreal iron
# craggy pine ya got it. It worked btw ty

Keep in mind your arguments in the array will be converted to either a string, int, bigint (float) etc.
Means if you wanna set a value like null, default or now() (which is the current time stamp) you can not use placeholders

wheat mesa
#

client.users.fetch() returns a Promise<User>, you need to await it to get the actual user

#

that wasn't really your problem from what I saw in your error, but it would still cause problems

craggy pine
boreal iron
#

"UPDATE user SET commands_used = ?", [null] -> null would be the same as "null", a string and not null
"UPDATE user SET commands_used = null"

bright hornet
boreal iron
#

Same goes for other keyword values, like default, now() etc.

craggy pine
#

Ya I haven't had a case where I needed to set null or now() yet. But I'll keep that in mind for the future.

boreal iron
#

Alright

wheat mesa
bright hornet
#

oh

craggy pine
#

Assuming the command is suppose to get a user in the guild it's ran in,
message.guild.members.cache.find(m => m.user.id === args[0]) could be another option

#
  user: User {
    id: '160679942319767552',
    bot: false,
    system: false,
    flags: UserFlags { bitfield: 0 },
    username: 'Miyuka',
    discriminator: '0425',
    avatar: 'b21284b99f84c72c5f4adf85f5242180',
    banner: undefined,
    accentColor: undefined
  },
  avatar: null
}
boreal iron
#

You don't need to use find here

craggy pine
#

ah lol

boreal iron
#

Use get()

wheat mesa
#

just use cache.get(id)

boreal iron
#

get() will search for the key in the collection which are user IDs

craggy pine
#

Makes sense. But you wouldn't be able to do that if you were matching multiple checks right. Example:

message.guild.members.cache.find(m => m.user.id === args[0] || m.user.username.toLowerCase().inludes(args[0])) //id or args includes a match to the username
woeful pike
#

if you wanna substitute things like Where tough luck cuz u can't

#

not without string manip

boreal iron
#

Yeah true, but in which case do you pass column names are arguments?

#

I mean there are even more placeholders tho

#

I just never had any use case but yeah, you're right

woeful pike
#

you might want to template column names if you don't have an ORM I guess

#

a generic select function should accept table and column names as variables

boreal iron
#

If I ever have a use case I need that I will keep it in mind

lament rock
boreal iron
#

My gosh... I don't need to explains things down to the language basics...

#

It's a fucking map, simply said and uses the user IDs as keys

lament rock
#

You don't need to. I'm just recommending that you don't use ambiguous terms where people can misinterpret your knowledge of the language or get the wrong idea how the language works.

If someone told me Maps "searched" the store, I would just not even bother with Maps since that would imply filtering and looping

#

Nothing against you personally btw. I'm not trying to bully or anything. Just genuinely concerned

boreal iron
#

Well don't worry I totally agree, I don't feel bullied here.

#

it just proves that I'm a common JS noob

spark flint
#

I’m a professional shitty coder, no matter the language

boreal iron
#

I KNOW

spark flint
#

I mean just look at my portfolio, I forgot to change CDN kek

boreal iron
#

damn... I'm done, 8h of continuesly frontend developing is just pain

fiery stream
#

Hii ppl

pale oasis
#

Front end = creativity.
Who said I had that?

earnest phoenix
#

I would prefer backend to frontend any day

#

I am not creative enough

pearl trail
#

people that do both:

earnest phoenix
#

Likely didn't find the message you are trying to do soemthing to

craggy pine
#

It's like running message.reply() on a message that you deleted. This happens a lot if you autodelete the message after a command is ran

earnest phoenix
green pebble
#

asking for help in custom css day 4

how can i only bob the bot image up and down? i tried using the css for .chakra-avatar__img.css-1f5ob72 but that is literally the id for ALL pfps 🤦‍♂️ please help

#

man i wish there was unique ids for unique stuff like bot pfp, invite btn, vote btn etc..

#

or am i doing it wrong?

#

pls ping on reply

#

kthx

earnest phoenix
#

help?

green pebble
earnest phoenix
#

only start.js exist

green pebble
earnest phoenix
#

yea it is replit

green pebble
#

yea.. either you have to rename it or there is some .replit file you can configure ig.. idk abt it much

earnest phoenix
earnest phoenix
#
await profileModel.find({userID: message.author.id, infoCards: {[low]: "lvl"}})
``` why it doesn't work?
#

I want to get the value of lvl

#

low => card.lowercase

#

lowercase is not the toLowerCase, it's a defined value in object

#

Every user has it's own cards so I'm searching the card's level with the user id

pale vessel
#

why do you need to put that in the filter then?

#

just use userID and grab the needed value inside the object

earnest phoenix
#

yeah ik

#

but ```js
await profileData.infoCards[low].lvl

#

profileData is what you said, the userID and i'm grabbing items from there

pale vessel
#

if the user models are unique then it shouldn't be a problem, have you tried logging the full object?

earnest phoenix
#

oh

#

will try

#

and yeah, they're unique mostly (some bugs happened and some objects were duplicated)

#

looks like InfoCards is an array of objects

earnest mural
slender thistle
#

Is this Redbot

#

Bypassed hiw

#

What's wrong with my typing

earnest mural
#

its meant to be an rpg bot

earnest phoenix
#

😎

earnest mural
#

ig i can make a blacklist thing

earnest phoenix
#

Also can you use f"" outside of print functions?

#

Does python have f"" I can't remember if that's the language that has it or not

dry imp
earnest phoenix
#

So what's the difference between using that and the format method

dry imp
#

the same the format one is the old one

earnest phoenix
#

Oh

#

So chewy is outdated

#

Ha nerd

earnest mural
#

:(

#

i haven't done a proper bot until like 2017 in js

earnest phoenix
#

Chewy do you still have that minion onesie ?

earnest mural
#

yes

earnest phoenix
#

Livestream yourself wearing it while making a minion themed bot in python

earnest mural
earnest phoenix
#

It's a quality idea

#

Make the minion army bigger

earnest mural
#

pain

earnest phoenix
#

Well I guess you're just not a guild leader

earnest mural
earnest phoenix
#

It's likely your checks are wrong but idek python

dry imp
earnest mural
#

i haven't even made a create guild command Pepega

#

python 3.10 added switch case statements

dry imp
#

damn didnt know that

earnest phoenix
earnest mural
#

yes yes

slender thistle
earnest mural
earnest phoenix
#

Cause python wanna be different

slender thistle
#

Hint hint

#

Different types

earnest mural
#

OHHHH

slender thistle
earnest phoenix
#

shiv ur a saint

earnest mural
#

but now im even more dumb on for some reason brain unable to figure out how fix

dry imp
#

int()

#

or just str()

slender thistle
#

Either int() the shit in your file, save it as integer directly, or stringify your user.id

earnest mural
#

ahhh okie

earnest phoenix
#

Stringifying the id is probably easier

earnest mural
dry imp
#

its the same ig

earnest phoenix
#

I mean it just makes sense

#

Why move away from the file when you can just stringify the id

#

It's called me being lazy

earnest mural
dry imp
#

holy

earnest phoenix
#

yandere dev moment

earnest mural
dry imp
#

that is a bad idea

earnest mural
#

i should try to match case as much as i can

#

what is wrong with me

#

how much crack did i sniff during the summer

earnest phoenix
#

one thing I hate about python is its use of indents

#

It gets very ugly very fast imo

earnest mural
#

its agony

dry imp
#

cmon its not that bad

earnest phoenix
#

daff

#

It's bad

earnest mural
#

cause if you indent everything too much by one you have to manually backpace each one

dry imp
#

noooo topggSob

earnest phoenix
#

Time to go into daffs code and indent everything incorrectly

earnest mural
#

time to do user inputs Sadge

earnest phoenix
#

With one extra indent I can fuck ur entire program up daff

earnest mural
#

cause im meant to be making a guild settings command

earnest phoenix
#

I might make my own rpg bot that I probably won't ever release to the public and will work on it rarely

earnest phoenix
#

Oh god

#

Just filter or smth

earnest mural
#

i would uses classes but i don't even know how

#

other than cogs

earnest phoenix
dry imp
#

i love my indent

earnest phoenix
#

Daff I will learn python just to fuck ur code up in a way you won't understand

#

time to finally update my bot to v13 smirk

#

Or better yet

#

@slender thistle how do you secretly put bugs in people's python code

#

I need the sauce

earnest mural
earnest phoenix
#

Okay what

#

chewy

#

I hope you find an unfixable bug for that statement

earnest phoenix
slender thistle
slender thistle
earnest mural
slender thistle
#

if answer.content.lower() == "paladin":
Do stuff

earnest mural
earnest mural
#

what about upper

slender thistle
#

Add ZWS somewhere

#

I mean feel free to do it but your lazy ass can't be bothered with using Shift

earnest phoenix
#

Shiv what should I make an RPG bot about

slender thistle
#

Your mom

marble juniper
#

an RPG

#

Ayyyyy

earnest phoenix
#
let filteredC = await profileData.infoCards.filter(item => item === card.low);
let xp = await filteredC.exp;
let lvl = await filteredC.lvl;
``` doesn't work
slender thistle
#

Idk make it milsim

earnest phoenix
#

too much await lol

marble juniper
#

Why would you make it in python though

#

Just

#

why

earnest phoenix
#

Wanna know what shiv

slender thistle
#

You think I'm creative?

dry imp
earnest phoenix
#

You're my brother so doesn't that mean you're talking about ur own mom as well

slender thistle
#

Yes

earnest phoenix
#

I'm telling sora you made bad comment about her

slender thistle
#

Wdym

#

She'll love an RPG bot about her

#

Probably

earnest phoenix
#

I was about to make a joke but I don't want to be offensive

#

Yes

slender thistle
#

DM me the joke

earnest phoenix
#

Filter doesn't need await

earnest phoenix
#

call?

earnest phoenix
#

You might have to do item.low === card.low

#

there's no item.low

marble juniper
#

Random but

earnest phoenix
#

the item is written in lowercase

marble juniper
#

would disney kill me if I use thier characters in a discord bot

#

lol

earnest phoenix
#

so then that means no item is being found with that comparison

earnest phoenix
marble juniper
#

Not like as pfp or anything

earnest phoenix
#

Disney a bitch like that

marble juniper
#

just in a command

earnest phoenix
#

but there IS a item with that

#

in the db

marble juniper
#

But I mean

earnest phoenix
#

Apparently not

marble juniper
#

pokemon bots exist

#

so if they can exist my bot can too right

earnest phoenix
#

nintendo

rigid maple
#

I want the nickname on the right to change as the text input changes. What can I do?

earnest phoenix
#

And you do realize Pokecord got dmca

marble juniper
#

Yeah

earnest phoenix
#

There's your answer

marble juniper
#

but that was cuz pokecord made money

#

probably

earnest phoenix
#

I mean go for it

#

But if you get dmca just delete bot

marble juniper
#

ye

#

ig

earnest phoenix
#

you can't delete bots KEKW

marble juniper
#

Will just

#

not run the bot anymore

#

and kill it

#

ig

earnest phoenix
#

Yes you can

marble juniper
#

lol

earnest phoenix
#

Once you make the application a bot account it becomes bot

#

from when

marble juniper
#

That deletes the bot ig

earnest phoenix
#

Yea

#

oh

earnest mural
#

i hate making this bot

marble juniper
earnest phoenix
#

Then don't

earnest mural
#

it requires all my brain cells for this

earnest phoenix
#

Your first mistake was downloading python

rigid maple
#

hey

earnest phoenix
#

Second mistake was using it in a bot

marble juniper
earnest phoenix
#

4am im fucked

#

Time to sleeo

#

Gn

marble juniper
#

cya

earnest phoenix
#

I'll be back in an hour still awake probably

#

:^)

boreal iron
#

he‘s gone - now let’s party!

earnest mural
earnest phoenix
#

hi

rigid maple
#

hi

earnest mural
#

oh

#

@slender thistle save me :(

slender thistle
#

What are you doing

#

Oh

#

Sec

earnest mural
#

ahh ty

#

time to use brain

next crown
#

So I started new bot and I tried staring it with node . that doesn't work, I tried node index.js that doesn't work either. I tried reinstalling node.js that doesn work either

#

Any help?

tulip ledge
#

Errors?

#

Just saying it doesnt work doesnt rlly give any info

next crown
#

Nope no errors

#

Just go to new row

#

Nothing happen

tulip ledge
#

You do node index.js and it doesnt do anything?

next crown
#

Yup

tulip ledge
#

Is your bot online?

next crown
#

Nope

tulip ledge
#

Can you show screenshot

next crown
#

Sure

#

1 sec

#

@tulip ledge

tulip ledge
#

And sdmn is the directory of the bot?

next crown
#

sdmn is bot file

tulip ledge
#

Can you type node -v and tell me what it sais

#

Oh

#

Wait

#

I see the issue

#

Try pressing ctrl + s in your index file

#

And then run node index.js again

next crown
#

crtl + s doesnt do anything

tulip ledge
#

Then run node index.js again

next crown
#

It works

#

Than you so much @tulip ledge

tulip ledge
#

Yes, next time save the file before running it x)

#

You were running an empty file

next crown
#

Ok thx

#

My auto save was off

wind solstice
#

i have a scheme just like that:

const schema = new mongoose.Schema({
    id: mongoose.SchemaTypes.Number,
    item1: {type: mongoose.SchemaTypes.Number, default: 0},
    item2: {type: mongoose.SchemaTypes.Number, default: 0},
    item3: {type: mongoose.SchemaTypes.Number, default: 0},
    item4: {type: mongoose.SchemaTypes.Number, default: 0},
    item5: {type: mongoose.SchemaTypes.Number, default: 0},
    item6: {type: mongoose.SchemaTypes.Number, default: 0},
    item7: {type: mongoose.SchemaTypes.Number, default: 0},
    item8: {type: mongoose.SchemaTypes.Number, default: 0},
    item9: {type: mongoose.SchemaTypes.Number, default: 0},
    item10: {type: mongoose.SchemaTypes.Number, default: 0}
})

and im making a buy command with the item id
example: !buy <item id> <quantity>
but i want to search the item by its id
example: the item is "1"
inventario.(item + quantity.toString())

would be the same as
inventario.item1

but obv that doesnt work, how can i make that?

wheat mesa
#

inventario["item" + quantity.toString()]?

wind solstice
earnest phoenix
#
"infoCards": [
    {
      "giantt": {
        "lvl": 1,
        "exp": 0
      },
      "archers": {
        "lvl": 1,
        "exp": 0
      },
      "minions": {
        "lvl": 1,
        "exp": 0
      },
      "arrows": {
        "lvl": 1,
        "exp": 0
      }
    }
  ],
``` ```js
let filteredC = await profileData.infoCards.filter(item => item.includes(card.low));
``` what is wrong with the filter?
wheat mesa
#

There is no property named low on those cards

#

Oh wait hold on

#

I misread

earnest phoenix
#

oh

sudden geyser
#

not to be rude, but are you just going to post a question on every small issue you have on this system

earnest phoenix
#

well i'll stop then

sudden geyser
#

feels like the 20th time

wind solstice
earnest mural
lyric mountain
#

Also be warned, json-based storage is really bad if you use it frequently

earnest phoenix
#

is really if

lyric mountain
#

Autocorrector

wooden ember
#

anyone know where theis error is coming from

#

all it does is ping minecraft servers

#

and every now and then it crashes

lyric mountain
#

Address not reachable

#

Catch ur errors

wooden ember
#

and its not coming from any of my code cuz i handled if the host is unreachable

lyric mountain
#

Did ya use try-catch or .catch?

wooden ember
#

yup

#

it does work 99% of the time

#

says whether the server is up or down and lables the chat as such

lyric mountain
#

Check the inner workings of that function

#

See if it throws an exception before starting the promise

wooden ember
#

how would it do that

lyric mountain
#

Ctrl + click

wooden ember
#

bruh im using notepad ++

lyric mountain
#

Rip

wooden ember
#

indeed

#

some times i get an error but it doesnt crash the code

#

well i mean thats a different error but its not fatal

lyric mountain
#

That's when u restart the router or something

wooden ember
#

and nither of them are comming from my code

#

bruh i mean my internet is pretty bad at times

lyric mountain
#

If it drops and promptly returns u get econnreset

wooden ember
#

ah

#

sounds like my internet

#

is there any way that i can catch these errors so that it doesnt kill the entire program?

#

or do i have to go through every module that im using and correct someone elses code

lyric mountain
#

That's a tricky question

#

Cuz it's crashing due to connection itself

#

Tim is required here

wooden ember
#

lol

#

why is it i get all the "fun" errors

#

i mean im guessing theres no universal error handling thats like

on "error" => {
console.log("somthing somewhere broke but who cares")
}
green pebble
#

asking for help in custom css day 4

how can i only bob the bot image up and down? i tried using the css for .chakra-avatar__img.css-1f5ob72 but that is literally the id for ALL pfps 🤦‍♂️ please help
for current state of my bot page check this link https://top.gg/bot/851532461061308438 all the images are bobbing up and down 😢

man i wish there was unique ids for unique stuff like bot pfp, invite btn, vote btn etc..
or am i doing it wrong?

lyric mountain
#

I just don't remember how was it

wooden ember
#

oh damn

earnest phoenix
#

There are ways to select elements without using classess

#

The classname changes on every page refresh so you have to use stuff like first-child selectors instead

green pebble
green pebble
boreal iron
#

All "unique" elements on the site have a static class name

#

You simply can't access the img directly as it's class name is dynamic, but you can access it's parent element, thus you can access it's child - which always is an img (selector) in this case

orchid otter
boreal iron
#

Since your profile avatar is a button the selector span in span.chakra-avatar will not access the button

#

That means only your bot avatar will float around

heavy marsh
#

In d.js v13
I get this error

const collector = m.createMessageComponentCollector({
                                    ^

TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')

But m is already defined

            const generateAPIMessage = (page = 1) => {
              const embed = {
                  color: data.config.color,
                  title: 'Radio Searched Results ...',
                  description: matches
                  .slice((page - 1) * INDEX_BUTTONS.length, page * INDEX_BUTTONS.length)
                  .map(
                      (s, i) =>
                      `:${INDEX_BUTTONS[i]}: - [${s.name}](${s.favicon}) | Language: ${s.language || `Unknown Language`}`
                  )
                  .join('\n'),
                  footer: {
                  text: `Page: ${page} of ${Math.ceil(
                      matches.length / INDEX_BUTTONS.length
                  )} | React on the correct buttons - 30 seconds response time`
                  }
              }
          return { embeds: [embed], components: [row1 , row2] }
          }

          interaction.reply(generateAPIMessage()).then((m) => {
                const buttons = PAGE_BUTTONS.concat(INDEX_BUTTONS).concat([CANCEL_BUTTON]);
            
                let page = 1
            
                const collector = m.createMessageComponentCollector({
                  componentType: 'BUTTON',
                  idle: 3e4,
                  filter(interaction) {
                    if (!buttons.includes(interaction.customId)) return false;
                    return true;
                  }
                })
boreal iron
green pebble
boreal iron
#

The fetchReply option is what you need to define

#

By default the message object will not be fetched when replying to an interaction

boreal iron
#

img, a, div etc.

#

would be a valid selector

#

Yours is a class

#

If you just wanna animate the bot avatar, then it's exactly what I wrote above

green pebble
boreal iron
#

You mean all the elements not btns?

#

Any HTML element is valid selector

pale vessel
#

bruh what

#

class is a valid selector

boreal iron
#

html body div img a

pale vessel
boreal iron
#

My gosh read the context

earnest phoenix
#

@green pebble here's a fun fact:
Right click the element in developer tab then click copy selector

green pebble
earnest phoenix
#

it should give you a selector to select the element

green pebble
earnest phoenix
#

maybe

boreal iron
#

It's like in every browser nowadays

#

F12 should also work

earnest phoenix
green pebble
#

.css-1dhgl5b > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > a:nth-child(1)

#

uh wtf is this

boreal iron
green pebble
green pebble
earnest phoenix
#

no the actual div it is applied to

#

screenshot the html

boreal iron
#

The issue with the button is, it has no unique identifier

green pebble
boreal iron
#

You're either going to adjust all buttons using a.chakra-link.chakra-button as selector or you can try to indentify the invite button by it's rel attribute

heavy marsh
#

@boreal iron
so just this ...

return { embeds: [embed], components: [row1 , row2], fetchReply: true }
boreal iron
#

noopener noreferrer might be unique but I'm not sure

heavy marsh
boreal iron
#

If you necessary need to fetch it, then yes

heavy marsh
#

I guess it fixed it

#

Thank you

boreal iron
#

I mean calling generateAPIMessage() will then always fetch the message

#

Since it's hardcoded into the options you return

split hazel
#

POV you use typescript

earnest mural
#
                await ctx.send(("created: %s" % time.ctime(os.path.getctime("guilds/{}.json".format(answer1.content)))))```
boreal iron
#

So for example to just get the invite button

a.chakra-button[rel^="noopener noreferrer"]
{
    background-color: purple !important;
}
green pebble
boreal iron
#

But there's no guarantee there's no other element with noopener noreferrer as rel attribute

boreal iron
#

I haven't found another one at least

#

You can also use this identification method to indentify parts of class names, or any attribute inside a tag etc.

#

very limited regex

green pebble
boreal iron
#

Lemme check

raw nest
#

In ReactJS, how am I able to re-render a component in an onClick function? The component that should be rerendered isn't the one containing the button...

green pebble
#

like thats one vote btn

boreal iron
#

No the vote button is very easy

#

As you can take it's href attribute value using regex

#

One second, lemme give you an example

green pebble
#

ok cool

boreal iron
#
a.chakra-button[href$="/vote"]
{
    background-color: purple !important;
}
#

I now see a better selector to match the invite button would be

a.chakra-button[href$="/invite"]
{
    background-color: purple !important;
}
#

You as suggestion, you shouldn't change the site background as you will have to change like every font color

#

If you do that, in your case by choosing a dark background, make sure to enforce dark theme in your bot settings to adjust all font colors for a DARK site

boreal iron
#

Oh... wut I see that option has been removed lol

green pebble
green pebble
void patio
#

For your invite url on top.gg can i use a url that redirects to the bot's website

boreal iron
#

Nope

void patio
#

ight

green pebble
#

no ig... cuz they will need a discord one

boreal iron
#

Well I mean in theory you can

void patio
boreal iron
#

You can add your URL as invite link to topgg

#

But that will only redirect you to your site

#

That somehow destroys the purpose of the invite button but yeah it's possible of course

void patio
#

rythm redirects to the website after its been added

green pebble
boreal iron
#

Not sure if there's a redirect_url parameter you can add to the query string

raw nest
#

In ReactJS, how am I able to re-render a component in an onClick function? The component that should be rerendered isn't the one containing the button...

boreal iron
#

Might be... never tested it

void patio
#

huh imma just check the docs

boreal iron
#

yeah

void patio
#

thanks for your help though

boreal iron
#

👍

#

I only know it exists for OAUTH urls

junior pecan
#

Hey someone

green pebble
boreal iron
#

Maybe also for invite links who knows

junior pecan
#

can someone give me some rest apis?

boreal iron
green pebble
#

i too have an api (for graphs) but its not a rest api

boreal iron
#

lol yeah I'm stupid

#

the invitation is just an OAUTH process, too

solemn latch
cinder patio
junior pecan
solemn latch
#

lol

cinder patio
#
function Parent() {
  const [state, setState] = useState();
  return <div>
     <Child onClick={() => {
        setState(...);
  }} /> 
  </div>
}
#

then the child uses the onClick provided by the parent

raw nest
#

aight, thanks man:) I think that should work

green pebble
#

jus sending the link for the wrapper...

earnest phoenix
# green pebble

perhaps this might work

div.chakra-stack > div.chakra-stack a.chakra-link.chakra-button[rel="noopener noreferrer"]
boreal iron
boreal iron
#

In this case it makes more sense to work with the href tag

earnest phoenix
boreal iron
#

why tf do you repeat anything I already said?

earnest phoenix
#

¯\_(ツ)_/¯

boreal iron
#

Still makes more sense to indentify it by it's href attribute as the rel attribute can change

#

The URL will stay the same

earnest phoenix
#

yup

#

why do they need noopenner noreferrer anyways

#

maybe for botum analytics?

boreal iron
#

dunno, just try to find if you can find them in any JS code

#

doubt they're relevant for the CSS

#

Oh btw

#

They exist multiple times on the website

#

Found them 3 times

#

Just open the site source code and search for noopener noreferrer

wooden ember
#

discord api go brrrrrrrrr

boreal iron
#

Doesn't need to be an API issue

#

Guilds can also be unavailable for any reason

spark flint
#

like discord deleted

#

for tos breaking

#

they cache for like 60 days or some shit

wooden ember
#

bruh the bots only in 23 servers

spark flint
#

mine had that issue on 10 servers KEKW

wooden ember
#

lol

boreal iron
#

Regarding your timestamps you somehow call the unavailable guild multiple times

earnest phoenix
#

@spark flint what the actual fuck is that banner

spark flint
#

my pfp?

#

or my banner?

earnest phoenix
#

*pfp

spark flint
#

ah

wooden ember
#

its garry

spark flint
#

i thank misty

earnest phoenix
#

@earnest phoenix you have officially been sentenced to 2 months in Florida

earnest phoenix
wooden ember
boreal iron
#

Yeah probably repeatedly for the same guild

wooden ember
#

mmm

#

wonder which one it is

boreal iron
#

The guild doesn't exist any longer and you're still receiving the event

#

Doesn't the deletion event include at least a guild ID?

#

If so, get it and try to leave the guild

wooden ember
#

i dont think it does

#

thats why i implamented that filter to beginwith cuz i use the id to delete a file with the server id as its name

#

and i kept getting errors comming from the fact there was no id

#

i cant remember exactly how i filter it but i think it looks to see if guild name exists

#

and if it doesnt then its a fake event

boreal iron
#

Check if the guild ID is available at first

wooden ember
#

mmm

#

idk if its still a problem though cuz i restarted the bot today and for the first time in ages it didnt send the message on startup like it has done for the last several days

raw nest
earnest phoenix
#

you should store the state in the parent if you want a child to modify something else's state

cinder patio
# raw nest can a Child call a state from another child?

Directly - no. But you could make a connection between the two children if the state is taken from the properties:

const [childOneState, setChildOneState] = useState();

<div>
<Child1 state={childOneState} /> 
<Child2 setChild1State={setChildOneState} />
</div>
earnest phoenix
#

that's mutating the parent's state

cinder patio
#

yes

#

but it still works

earnest phoenix
#

it would rerender both childs instead of just child1

cinder patio
#

no it won't

earnest phoenix
#

how tho

cinder patio
#

Child1 isn't affected by the parent's state at all

#

so react won't re-render it

raw nest
#

alright thanks guys I will try some things out

cinder patio
#

You could also potentially use events - child 1 subscribes to an event and child 2 emits the event. But some people consider this to be an anti-pattern

earnest phoenix
cinder patio
#

I meant Child2

earnest phoenix
#

Child2 might potentially skip a render

cinder patio
#

Child1 always gets re-rendered when childOneState changes

earnest phoenix
#

is the setState function same for every rerender?

cinder patio
#

should be

earnest phoenix
#

pog

#

so if i store state in parent instead of child and the state update affects only one child, react won't rerender the entire tree but just the child?

pale oasis
#
cmd.info.name.set.add({
        [message.author.id]: Date.now() + (cmd.info.cooldown * 1000)
    })```
This is supposed to work, right? No. It doesnt, I don't even know why.
earnest phoenix
#

what does that do

pale oasis
#

cmd.info.cooldown cooldown for a command in seconds.

cmd.info.name.set cooldown's set.

earnest phoenix
#

what is set.add

#

shouldn't it be set.set

#

or are you using an actual Set instead of Collection

pale oasis
#

I am using a set.

earnest phoenix
#

then i don't know the problem

pale oasis
#

Its saying its reading undefined, my brain has been on this for the past 5 minutes.

#
TypeError: Cannot read properties of undefined (reading 'add')```
I even console logged everything.
#

Well, atleast I can ask copilot.

#

Copilot did it first try, I'm quitting.

sudden geyser
#

ai will replace us all

raw nest
sudden geyser
#

Artificial intelligence will replace us all.

raw nest
#

bro didn't you read it?

sudden geyser
#

The end of the world is coming and you better get ready.

#

Put on your tinfoil hat.

raw nest
#

oh man 🙄

earnest phoenix
#
            const webhookClient = new Discord.WebhookClient({ url: process.env.webhook });
            webhookClient.send(`<@${client.user.id}>`) 

405 method isnt allowed

boreal iron
#

You know that feeling when after days of frontend development your site fucking looks as it should - with a backwards compatibility back to IE6

#

and the hate begins

raw nest
#

xDD

split hazel
#

my mangodb database

earnest phoenix
boreal iron
#

wut

earnest phoenix
boreal iron
#

shhh

#

go on and scam some Windows grandmas

lament rock
#

ai will replace us all

boreal iron
#

finally a valid solution to the big human-issue on this planet

sudden geyser
#

or just earth 2

lyric mountain
#

The ai:

boreal iron
lament rock
#

yolo is not perfect

split hazel
#

lmfao cry about it react

sudden geyser
boreal iron
#

shovel lmao

#

Good catch tho

ember lodge
#

Hello, anybody has any idea about why my form is not giving any value in a dropdown input, i am using express and ejs

split hazel
#

that screenshot of your html code is more compressed than my discord bot

#

actually no its just the width and discord client making it look like that

#

and have you given the dropdown input a name? cant see because it ends

pale oasis
#

Would it be better to pass in my packages needed in my command handler or require them in every command I need to use it for?

const stuff = {
message: message,
args: args,
fs: require('fs'),
config: require('../config.json')
}
cmd.run(stuff);```

I just wrote this on my phone.
cinder patio
#

require

pale oasis
#

Yes, require..

cinder patio
#

require them in every command

atomic kindle
pale oasis
#

exports.run({ fs }) => {

}

cinder patio
#

time as in your time? I guess so but if we're talking speed then theoretically requiring them every time is going to be faster

pale oasis
#

Well, it’s cached isn’t it? All require() objects are cached.

cinder patio
#

you could do it either way, it's mostly personal preference

cinder patio
#

Yes but you're storing a key and a value with a reference in each of ur commands

ember lodge
atomic kindle
warm swan
#

How can i set the channel Announcement to true / false

earnest phoenix
warm swan
#

?

solemn latch
warm swan
#

like

#

imma send u an example

warm swan
#
            if not before.is_news() and after.is_news():
                if i.user.top_role >= i.guild.me.top_role:
                    return
                await after.guild.ban(i.user, reason="Anti-Nuke: Changing Channel Announcement")
                await after.edit(news=False)
#

this is an example

#

i tried using the kwarg of "news" but in the docs it says smth about type.. channel type n shit

#

basically if the before is not "news" and after is "news" to edit back to "false"

boreal iron
#

Is it just me or is this dude speaking a different language?

warm swan
#

Bro what

#

im just bad at explaining

#

lol

warm swan
#

omfg

#

How can i edit this to true/false

#

if this makes more sense to u 🙄

solemn latch
#

I dont think thats possible, I think you need to set the type. I dont think true false exists for that

warm swan
#

what if it's true

earnest phoenix
#

Yea this is probably not possible

warm swan
#

how can i set the type to false?

#

ah

solemn latch
#

type is a string

#

not a boolean

warm swan
#

that was good for channel extra security

earnest phoenix
#

But with an if loop you can have the bot return an error message if the channel is a news channel

warm swan
boreal iron
#

Is GUILD_NEWS the channel type for announcements?

#

Might be the right one…

warm swan
#

so is there a way to do it or not?

boreal iron
#

This is only available to guilds that contain NEWS in Guild.features.

#

Yes

solemn latch
#

yep, just set the type to news

boreal iron
#

By editing the channel type to news

warm swan
#

alr but that's if the before is true and after is false

#

how can i set it to false?

solemn latch
#

it doesnt take a true false

warm swan
#

oh

#

only text channels have topics right?

#

i mean ye

#

so i can use

        if not isinstance(before, discord.TextChannel):
            return

to avoid errors

split hazel
#

OTQ3NjAyNzI3NTcwMTEyNjE0.Yhvpzw.oUrGRGIGVQEkD9FALQmF894T44s

earnest mural
dry imp
#

damn

split hazel
#

you can do anything with my token just pls don't spam images of among us

dry imp
boreal iron
#

I promise it won’t be images of among us

#

To make sure it’s your authentication token, please send me your PayPal login and password to verify yourself

lunar palm
#

a

#

because the background is white

buoyant swan
#

OTM0NTQ3Mjc2NDk0NDI2MTUy.Yexq-Q.p2VYhAlG7uIm_-v7r2gamwsCVAY

lunar palm
#

free token? o_O

buoyant swan
#

one one server 👍

#

jk. its a test acc

lunar palm
#

the only code I have is for my campaign bot i'm making, and it's not done so peepo_shrug

buoyant swan
#

ok

split hazel
#

OTQ3NjAyNzI3NTcwMTEyNjE0.Yhvpzw.cfmSjDxlAqRVtSwdXdNbgNwEPHs

spark flint
#

how can i get buffer and filetype from url

#

js

quartz kindle
#

you download the file with any http lib

#

filetype you can get from the file name or from the file data, there aere a few libs that can detect file type from data using whats known as "magic bytes"

spark flint
#

alr

heavy marsh
#

in Javascript how can you send 2 HTTP headers

            var details = {
                'username': member,
                'type': form,
                'message': `Test authorised by xxx: ${request}`
            };
            
            var formBody = [];
            for (var property in details) {
              var encodedKey = encodeURIComponent(property);
              var encodedValue = encodeURIComponent(details[property]);
              formBody.push(encodedKey + "=" + encodedValue);
            }
            formBody = formBody.join("&");
            
            fetch('xxx' + '/request', {
              method: 'POST',
              headers: {
                'Accept': 'application/json',
                'Content-Type': 'application/x-www-form-urlencoded',
              },
              body: formBody
warm swan
#

How can i return 2 prefixes?

#

in the bot?

boreal iron
#

Your function can be returned once only

#

You could return your prefixes as array for example

#

By pushing each prefix to the array your returning you can later check if that array includes the entered prefix by the client

boreal iron
boreal iron
#

Well if you don’t expect a JSON result then remove the header

earnest phoenix
#

Should I make a bot in C# to practice C#?

boreal iron
#

Should I drive without drivers license to practice driving? smirk

solemn latch
#

Yes and yes

boreal iron
sudden geyser
solemn latch
#

I mean typically you do start driving before your license.
By law(for minors) you need to drive a certain number of hours before you can get a license in the US.

#

^_^

sudden geyser
#

A discord bot is usually a good beginner-medium sized project to learn a language

earnest phoenix
solemn latch
#

That's what I did

earnest phoenix
#

fuck waiting 6 months before I can get my license

solemn latch
#

Got my license in a week

spark flint
#

Should I install Linux on my laptop which I use only for school

#

Just to piss off my teachers

solemn latch
#

Did the school provide it?

spark flint
#

Nah it’s mine

earnest phoenix
spark flint
#

I paid

earnest phoenix
#

:^)

#

The OS that can't connect to the internet

solemn latch
#

If its yours why not ^_^

earnest phoenix
#

^_^

sudden geyser
#

Then you're not pissing anyone off

spark flint
#

I should install amogos

sudden geyser
#

Except yourself maybe if you don't like Linux

spark flint
earnest phoenix
#

I like linux but I do wish steam supported linux

#

😔

spark flint
#

They always like checking what I’m doing so

earnest phoenix
#

Imagine being able to play all your games on linux

#

it'd be nice

sudden geyser
#

You can't just dual boot?

earnest phoenix
#

I tried and failed

spark flint
#

uh

earnest phoenix
#

so I went with just linux

spark flint
#

how does dual boot work

#

Idk

sudden geyser
#

Was referring to misty

solemn latch
#

When you hit power you can choose the OS

#

You can even have the same OS multiple times

earnest phoenix
#

It just splits the OS on separate partitions iirc

#

Some installers come with the option to install that OS alongside another

split hazel
#

doing something you'll enjoy doing is the best way to learn

earnest phoenix
#

Who said i enjoy making discord bots

#

:^)

split hazel
#

not some boring boilerplate tutorial

#

well-

earnest phoenix
#

I just cant think of anything else to do to practice C#

solemn latch
#

Make a game?

earnest phoenix
#

PFFT

#

you're smoking rn right?

#

my pc can't handle that

split hazel
#

bro make snake 💀

#

I made snake for my custom OS

#

was fun

earnest phoenix
#

mm

solemn latch
#

Snake is a fun one

#

Battleship is really fun too

earnest phoenix
#

I don't really like making games tho

solemn latch
#

Make a game engine? ^_^

#

Lol

#

Rendering is a very fun concept

earnest phoenix
#

Woo, I would love to do that

split hazel
earnest phoenix
#

But I am beginner C#

split hazel
#

very epic

earnest phoenix
#

As a beginner I have 0 confidence to make a game engine

#

My game engine would be a bootleg godot

#

:^)

split hazel
#

or just make anything gui related

#

windows form?

#

drawing pixels and shapes?

earnest phoenix
#

I have a good idea i just wont use C# 😎

#

I am too lazy now

boreal iron
wheat mesa
#

misty smol brain

earnest phoenix
#

or

#

I can just wait until im 18 and not have to do the requirements a minor has

wheat mesa
#

You still have to do the driver’s ed

#

Just not the permit for 6 months thing

vivid fulcrum
#

c# can do everything

earnest phoenix
#

Can it do ur mom

vivid fulcrum
#

no, but i already did yours

earnest phoenix
earnest phoenix
boreal iron
#

smh

craggy pine
#

I'm kinda mad at myself for just realizing ? : true / false is a thing and how useful it can be

wheat mesa
#

Ternary?

craggy pine
#

ya

wheat mesa
#

It’s just a shorthand if else

boreal iron
#

Aka Shorthand statement

wheat mesa
#

Nothing too special about it

craggy pine
#

Just makes code look a little neater

#

and I like it more

wheat mesa
#

Just syntactic sugar

craggy pine
#

Caught a glimpse of it in a YT video and I'm like "tf is that suppose to be?"

#

Started immediately using it for my music system message.previousSongs.length === 0 ? client.distube.seek(message, 0) : client.distube.previous(message)

boreal iron
#

If you don’t have an endless statement chain then yes it’s very useful and good to look at

proven lantern
#

is there a way to make an interaction button that can only be clicked once? like a client side thing that enforces it

boreal iron
#

Well disable it after clicking?!

earnest phoenix
proven lantern
#

dang

#

i was hoping i could do something client side

boreal iron
#

Nah

proven lantern
#

like a button type that is disposable

#

idk

boreal iron
#

Nope you will have to listen to the event to respond

#

or Discord webhook

proven lantern
#

dont rub it in

#

discord hates me

boreal iron
#

I mean disabling it isn’t a big deal

proven lantern
#

it's just a hassle to keep that state

#

and check it

#

for every user

boreal iron
proven lantern
#

i'm doing big big optimizations

#

i have a fancy new dev environment

sudden geyser
#

you work at google?

proven lantern
#

nope

boreal iron
#

Can’t be fancy then

proven lantern
#

my pipeline went straight to prod

#

and i couldn't really work on branches

#

but i setup some fancy stuff to let me make branches and keep the prod branch untouched

boreal iron
proven lantern
#

i have an integration environment and a prod environment now

#

or dev and prod

#

i called it dev

boreal iron
#

Wtf you always gotta work on the production site

#

Only

earnest phoenix
#

fuck them kids if they using it

#

I gotta make sure the text is perfect!

#

Is there a way to add a placeholder for an img tag so it has something to display while the image is loading?

pearl trail
earnest phoenix
#

ty

#

I wish I could use top level await but setting the module to ES2022 makes this error occur
SyntaxError: Cannot use import statement outside a module

earnest phoenix
#

idk much

cobalt junco