#development

1 messages · Page 1932 of 1

spark flint
#

didn't work

delicate zephyr
#

hm

spark flint
#

instead it fully removed the todos bit

#

instead of the indivudual todo

#

it removed the todos array

delicate zephyr
#
users.updateOne({
            _id: userId,
        }, {
            todos: {
                $unset: {
                    todoId: todoId
                }
            }
        })
#

cc @spark flint

spark flint
#

ty

delicate zephyr
#

I mean

#

I think

#
users.updateOne({
            _id: userId,
        }, {
            $unset: {
                'todos.todoId': []
            }
        })
#

this should work

spark flint
#

ok

delicate zephyr
#

based on example

#

change [] to a number @spark flint

spark flint
#

what number

delicate zephyr
#

any

#

specifically 1 would work

spark flint
#

didn't do anything

delicate zephyr
#

Oh

#

Sorry

#

so Im reading up on the syntax

#

as I tell you

#

lol

spark flint
#

lol

delicate zephyr
#
// { name: "book", tags: { words: ["abc", "123"], lat: 33, long: 22 } }
db.collection.updateMany({}, [{ $unset: ["tags.words"] }])
// { name: "book", tags: { lat: 33, long: 22 } }
#

so

spark flint
#

blame @solemn elk, i would be using mysql if i wasn't working with others lol

delicate zephyr
#
users.updateOne({
            _id: userId,
        }, {
            $unset: ['todos.todoId']
        })
delicate zephyr
#

its not hard

#

I went from Mongo to pg

delicate zephyr
spark flint
#

ok

delicate zephyr
#

hmmm

#

can you not just do

#
users.updateOne({
            _id: userId,
        }, {
            todos: {
               todoId: undefined
            }
        })```
#

sorry

#

there

#

copy pasting is bad

#

@spark flint

spark flint
#

just logging in again lol

delicate zephyr
#

hold on

#

waut

spark flint
#

express-sessions KEKW

delicate zephyr
#
users.updateOne({
            _id: userId,
        }, {
            $set: {
                todos: {
                    todoId: undefined
                }
            }
        })```
#

there

spark flint
#

ok

delicate zephyr
#

god I hate mongo

#

lmfao

spark flint
#

slight issue with that

#

it gets rid of all other todos

delicate zephyr
#

Oh?

spark flint
#

also doesn't let me add data now either

delicate zephyr
#

OH

#

The way you were doing it

#

should have worked

spark flint
#

which bit

#

i deleted the todos array and redid the command and it readded the todos array

delicate zephyr
#
users.updateOne({
            _id: userId,
        }, {
            $pull: {
                todos: {
                    todoId: todoId
                }
            }
        })

#

this

spark flint
#

ah ok

#

it did nothing

delicate zephyr
#

are you parsing an int into the db

#

or is the value a string

spark flint
#

its a strting

delicate zephyr
#

do

spark flint
#

string

delicate zephyr
#

You need to parse it

#

the value in the database is a number

spark flint
#

ah ok

delicate zephyr
#

if you wanna check value types

#

do

spark flint
#

YES IT WORKED

#

finally

delicate zephyr
#
// Value 1
console.log(typeof value)
// Value 2
console.log(typeof value2)
// Value comparison
console.log((typeof value) === (typeof value2))
spark flint
#
users.updateOne({
            _id: userId,
        }, {
            $pull: {
                todos: {
                    todoId: Number(todoId)
                }
            }
        })``` was the final code
delicate zephyr
#

yea

#

there ya go

#

also

#

parseInt() would be better

spark flint
#

alr

delicate zephyr
#

Number is a constructor

#

parseInt is a func

#

Number will cause a fatal error if passed wrong value
parseInt will return NaN

just for reference @spark flint

spark flint
#

yep that worked

#

tysm

delicate zephyr
#

np

spark flint
#

now to get the user icon working KEKW

#

i will fix the button too i promise

novel snow
#

So asked tghis yesterday too but am kinda stoopid;

How can I delete guild specific commands? Still haven't found anything, Neither do I know how to find the ID of a command

delicate zephyr
#

GET Request To https://discord.com/api/v8/guilds/:id/applications/:appid/commands
DELETE Request To https://discord.com/api/v8/guilds/:id/applications/:appid/commands/:commandid

#

iirc

#

@novel snow ^^

novel jetty
#

It says channel.guild.nsfwLevel

#

Should it be

channel.channel.nsfwLevel
tulip ledge
#

no lol

#

it should be channel.nsfw

#

like I said

#

channel.guild.nsfwLevel is for the guild

#

NOT the channel

split hazel
#

nsfw level how lewd the guild is

delicate zephyr
pale vessel
#

If you want to parse both integer and floats, use Number()

#

Otherwise parseInt() for integers and parseFloat() for floats

delicate zephyr
#

Yea

#

he wanted int

#

so

#

my reasoning was wrong

#

my logic was also wrong

#

but i gave the right answer

#

😎

pale vessel
spark flint
#

either way it works

novel snow
spark flint
#

now does anyone know how to centre a button in tailwind

novel snow
#

I am confused and am lost

#

I have tried everything I could even think of

delicate zephyr
#

its that

#

sorry

novel snow
#

Lemme check that

delicate zephyr
#

got it the wrong way round

sudden geyser
#

y'all doing hour of code?

spark flint
sudden geyser
#

aw

spark flint
#

google doesn't help

novel snow
delicate zephyr
#

get rid of the/ at the end

pale vessel
spark flint
#

and the entire rest of the dashboard uses tailwind

novel snow
delicate zephyr
#

if it returns nothing then theres no commands on that guild

#

if there are

#

check global

#

/applications/{application.id}/commands

novel snow
#

I kid you not

sudden geyser
novel snow
#

I had the data variable defined twice

#

One was blank

#

The other one wasn't

delicate zephyr
#

oh god

novel snow
#

I am dumb as hell

delicate zephyr
#

lmfao

sudden geyser
#

In my project, I ended up using flex and growing the elements around it (I was placing an image between two dividers)

earnest phoenix
#

Can someone help me convert this to respond to all messages and not just guild messages?

client.on('messageCreate', (msg) => {
    if (msg.author.bot) return;
    if (msg.guild) {
        if (msg.content.startsWith(`<@${msg.client.user.id}>`) || msg.content.startsWith(`<@!${msg.client.user.id}>`)) {
            client.util.handleTalk(msg);
        }
    }
});
#

This is my code for converting my bot to V13 and it's hard to figure out DM messages, The flag is already in the intents.

oak cliff
#

you're checking if msg.guild but not doing anything If it's not

#

You need something in the else to handle dm

earnest phoenix
#

Yeah How would I check messages in DM?

oak cliff
#

Put an else statement?

#

If (guild) {guildstuff}
Else {dmstuff}

earnest phoenix
#

But with msg.(what)

oak cliff
#

You don't need that if you just put it in the else

#

You can check the channel iirc to see if its a dm channel

earnest phoenix
#

Thanks I was gonna use Message.content

errant flax
oak cliff
#

You can load a file into client and call it whatever you want

earnest phoenix
#

it's the utility file

oak cliff
#

I have a utils file full of functions

errant flax
oak cliff
#

const client.utils = require(filepath)

#

Yeah not default no

earnest phoenix
#

How would I go of putting this in, I never used a else statement

#

just if statements

errant flax
earnest phoenix
#

Same error

errant flax
#

wait im confused

#

idk what happened okeh

earnest phoenix
#

Syntax error for the {

#

idk

#

oh else if

#

What do you mean curly?

#

this (

quartz kindle
#

wtf is that code

#

lmao

errant flax
#

learn basic js waitWhat

earnest phoenix
#

I did, It's just V13 is confusing

quartz kindle
#

that has nothing to do with v12 or v13

#

if else is pure javascript

earnest phoenix
#

How does this look

quartz kindle
#

bad

#

dude

#

if you want your code to work on all messages

#

just remove the if in the first place?

#

like,

#

you're literally doing "if message is from a guild, do this"

#

just make it "do this"

#

lol

earnest phoenix
#

okay

#

still getting syntax error

quartz kindle
#

also for future reference, if else doesnt necessarily need another if

#
if(something) {
  // do something
} else {
  // do something else
}
earnest phoenix
#
    if () {
        ^

SyntaxError: Unexpected token ')'
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1031:15)
    at Module._compile (node:internal/modules/cjs/loader:1065:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
    at node:internal/main/run_main_module:17:47
exit status 1
#

That's the error I got

quartz kindle
#

well you cant have an empty if...

#

i said remove it

#

lol

earnest phoenix
#

oh

#

another error...

quartz kindle
#

you're just trying random shit without knowing what you're doing

#

i said remove it

#

do you understand what an if block does?

earnest phoenix
#

Yes

#

What do I remove

quartz kindle
#

then remove the if block

#

...

earnest phoenix
#

oh

#

I removed it

#

Now it works thanks

drowsy flume
#

what would be the best way to convert seconds to hours / minutes

quartz kindle
#

math

drowsy flume
#

math isnt fun

#

I thought there would be a way with time.time() or somth

quartz kindle
#

there probably is

#

check docs

boreal iron
#

poor Tim

#

I see you’ve got some hard work to do freerealestate

lament rock
#

You have to do it manually or use moment

#

but I don't like moment

errant flax
sudden geyser
#

It'll have a Duration object which you can use.

drowsy flume
sudden geyser
#

For now, you're stuck with math (seconds * 60) or some library

drowsy flume
#

yeah I just did the math for all of them lol

boreal iron
#

Sounds about right

#

Interesting new math methods been revealed in this channel

sudden geyser
#

slow down there Pythagoras

boreal iron
#

Imagine if 60s become 3600 min… damn

#

That would make my day even more stressful

boreal iron
drowsy flume
#

yeah I didnt want to comment on it lol

#

I knew what they meant

boreal iron
#

Or just spells math, meth

#

I’m worried since you wrote

#

math isnt fun

drowsy flume
#

I just dont like writing tons of lines of it

boreal iron
#

Then use a library lol

#

Even that requires some work freerealestate

sudden geyser
#

oh damn

#

didn't notice the error

coral palm
#

hey guys

#

Need a little help here.

#

How could I be creating these chats within a category? (V13)

#
if (search) return interaction.reply({ content: `**\❌ ${interaction.user} Você já possui um chat metas aberto: ${search}**`, ephemeral: true })

            interaction.guild.channels.create(`meta-${interaction.user.tag}`, {
                permissionOverwrites: [
                    {
                id: interaction.guild.roles.everyone,
                deny: ["VIEW_CHANNEL"],
                    },
                    {
                        id: interaction.user.id,
                        allow: ["VIEW_CHANNEL", "SEND_MESSAGES", 'READ_MESSAGE_HISTORY']
                    }
                ], 
quartz kindle
coral palm
#

thank you.

#

you know how to put a category inside a variable?

coral palm
quartz kindle
#

wdym?

coral palm
#

like the right way to put a variable here?

interaction.guild.channels.create(`meta-${interaction.user.tag}`, {
                permissionOverwrites: [
                    {
                id: interaction.guild.roles.everyone,
                parent: id_categoria_no_servidor ,
                deny: ["VIEW_CHANNEL"],
                    },
                    {
                        id: interaction.user.id,
                        allow: ["VIEW_CHANNEL", "SEND_MESSAGES", 'READ_MESSAGE_HISTORY']
                    }
                ], ```
#

in parent

#

@quartz kindle

quartz kindle
#

do you know which category you want to put it in?

#

do you have the category id?

#

or do you want to search by name?

coral palm
#

no

#

the category id is inside "id_categoria_no_servidor"

#

I just want to know how to put the variable here correctly

quartz kindle
#

just like that

quartz kindle
#

but

#

you put it inside permissionOverwrites

#

you have to put it outside

#

{ parent: ..., permissionOverwrites: ... }

coral palm
#
 interaction.guild.channels.create(`meta-${interaction.user.tag}`, {
                parent: id_categoria_no_servidor,
                permissionOverwrites: [
                    {
                id: interaction.guild.roles.everyone,
                deny: ["VIEW_CHANNEL"],
                    },
                    {
                        id: interaction.user.id,
                        allow: ["VIEW_CHANNEL", "SEND_MESSAGES", 'READ_MESSAGE_HISTORY']
                    }
                ], ```
#

this way?

quartz kindle
#

yes

coral palm
#

Will test

#

Perfect

#

thank you bro.

quartz kindle
#

de nada

undone otter
#

can some one help me

#

i want my bot to show that Add to Server button

#

but i dont know how

#

can anyone help me

earnest phoenix
#

depends on how you want them to input the date ig.

#

You could have em do month/day/year (separated by slashes ofc)

#

and then split on slashes to get the individual values

#

that is one way to do it

#

or some people like month.day.year and simply split on the .

#

true, I can't think of any way to differentiate

#

I guess you could check if the first value is over 12 and if so its def referring to days and not months

#

but idk if that is the best option

vital void
#

or u can just add 3 options one for date , one month , one year ? (||code may get long but ok if u want to||)

earnest phoenix
#

What are you doing with the dates anyway?

#

is this for some kind of timer?

#

Ah

#

Well

#

Is it supposed to be of the current date ?

#

or when it should be done by

#

Ah mk, nvm then

#

If it was the current date you can just use a time module for whatever language you are usingg they usually have em built in

#

didn't know if you were using js or not

#

but Date.now() returns a timestamp

coral palm
#

how can i put this variable here?
the variable ${role_membro_no_servidor}

 let painel = new MessageActionRow().addComponents( new MessageSelectMenu()
        .setCustomId('menu')
        .setPlaceholder('Verifique as opções') // Mensagem estampada
        .addOptions([
               {
                    label: 'Painel Inicial',
                    description: 'Apenas o painel inicial da mensagem',
                    emoji: '📓',
                    value: 'painel_inicial_fac',
               },
               {
                label: 'Promoção: ${role_membro_no_servidor}',
                description: 'Promova este membro a ${role_membro_no_servidor}',
                emoji: '🔥',
                value: 'promomembro',
            },```
earnest phoenix
#

unless that is what you'd want you can just do new Date() to get the current date

earnest phoenix
#

fair enough

#

I usually like using timestamps as well so I can format it how I want later

#

Honestly

#

you could do something simple

#

well maybe not extremely simple

#

but you can give the option to supply the time you want it to be done in e.g /reminder feed dog 20m (this could work for days, months, or years)

#

Just a suggestion

coral palm
#

thanks

earnest phoenix
#

I assume with a to do list of it being required to supply when it needs to be done you'd send a reminder at least right?

#

I see, some people send reminders at least I do kek

#

Well the thing is you don't need to constantly check

#

Yea

#

You can set a interval that uses the time provided to send a reminder when the time is up

#

setTimeout runs instantly

#

setInterval doesn't run until the time provided is up

#

At least I think that is how it went let me check I haven't used js in a while

#

wait no I am dumb setTimeout would work

#

I haven't used js in ages

#

lol

#

Anyway as for your original question, you can just do what you were originally doing and just have them provide days or whatever since you dont plan on sending a reminder it is just for show

#

Well, I am probably not the best to answer this. I just code I don't know the exact drawbacks to using multiple setTimeouts if there even is a big drawback

#

I think for now as long as the bot isn't big it should be fine before needing reworking.

#

Then again i've been wrong before mmLol

#

hopefully someone who is savvy enough can answer this question.

#

no problem.

#

I might actually make a bot in go to do reminders and such 🤔

#

I haven't tried discordgo v9 stuff yet

#

yes

#

the pog lang

#

oh no here comes shiv

#

👀

#

probably going to roast me for using go

slender thistle
#

Instead of many timeouts you could run one cron job that runs through all reminders on an interval. Reminders could be pulled directly from the database or cache, choice is yours

#

Not sure why one cron job would

earnest phoenix
#

that is actually a good idea shiv

#

👍

slender thistle
#

Having many timeouts however is a different story on larger scales, as @earnest phoenix mentioned

#

To put it simply, yup

#

Make a function that will go through them and do whatever and make it run at an interval like 1 minute

#

Instead of fucking up your CPU and RAM with lots of data to be calculated, you just have one function running every minute doing what you need

earnest phoenix
#

shiv you are a py dood right?

slender thistle
#

Not on a larger scale

slender thistle
#

Let me explain it

#

If you run many timeouts at once, my bet is that your CPU power is used to calculate the time when the reminder will go off. Multiply that by 1000 and you may not get pretty results.

Now, compare that to just one function that runs every minute and on each reminder, it checks if the timer has expired

#

It'll do it synchronously + not as bad

slender thistle
#

I mean, it'll be limited to one reminder at a time

#

You're practically barely using your CPU there

earnest phoenix
#

I want someone to choose for me :p

knotty wraith
#

k

slender thistle
#

You indecisive little bi-

Do you want to? What are your other options?

earnest phoenix
earnest phoenix
slender thistle
#

Something new might be better although I don't have much hope for it

earnest phoenix
#

and might I add I wont really use that language again

slender thistle
#

Python then sure

earnest phoenix
#

Ight

#

then I will continue my py course

#

We have two courses going on now, py, and html +css +js

slender thistle
#

Yee ha

lament rock
#

I wanna try some new languages in my free time, but my brain capacity and time is mostly dedicated to existing projects to rewrite and update with Discord

slender thistle
#

Sad

lament rock
#

I am overworked I'd say

#

I took on too much at once

slender thistle
#

Oh dear

#

I feel your pain

boreal iron
slender thistle
#

We all do at some point

boreal iron
#

Nvm I actually wrote batch and meant powershell lol

slender thistle
#

Give yourself a break...

... with KitKat!

boreal iron
#

Damn auto correct

slender thistle
#

PHP is pain, change my mind

boreal iron
#

Lol says the guy dealing with python

slender thistle
#

Eyo

boreal iron
slender thistle
#

Why you gotta do me like that sir

boreal iron
#

Because you need that hate to live

slender thistle
#

Nah I feed off people's hate towards PHP

boreal iron
#

You devil!

slender thistle
#

Mwahahaha

marble juniper
slender thistle
#

PHPHP

boreal iron
earnest phoenix
#

tom scott loves php

#

😔

crystal wigeon
#

Hey is there a way I can add a custom method to message.channel? Something like message.channel.sendMessage() in typescript

earnest phoenix
pale vessel
#

Not sure if you could do that anymore since they removed the ability to extend structures

earnest phoenix
#

oh right forgot about that

pale vessel
#

Especially in TS

#

You'd need to use ts-ignore

earnest phoenix
#

I think you still can as long as you declare the new class with the updated method right?

pale vessel
#

You have to modify the library itself probably

#

You can't make it use the class you extended

earnest phoenix
#
declare module 'discord.js' {
  interface ClassName {
    updatedMethod: functionHere
  }
}

iirc

pale vessel
#

That's only the typings

earnest phoenix
#

Mmm, true

#

I forgot about it only giving it intellisense

crystal wigeon
#

Yeah I tried extending the Message class but I actually need to add the method to the Message.channel

#

And channel is readonly

earnest phoenix
#

You wouldn't wanna extend the message class anyway

#

You'd wanna extend one of the channel classes.

#

since you are accessing a channel at that point

#

but like flaze said idk how to do that anymore with structurres not being a thing

crystal wigeon
#

Yeah but how will I assign the channel to another variable

#

Since I can’t clone the channel

#

I need to inherit other methods and add this extra method

earnest phoenix
#

What?

crystal wigeon
#

I need to inherit all of the channel methods and props and add an additional custom method to it

#

I mean extends ig

earnest phoenix
#

That is the entire point of extending a class, it inherits all of the methods and props of the class you are extending. but either way I don't even know if extending the class will work the same way anymore since structures isn't a thing

crystal wigeon
#

Mmmmm let me try a couple of things

pale vessel
#

"Wahh wahh it can break things" It's for people that know what they're doing

#

No shit it'll break if some dumbass tried to use it

#

But I understand, most people that use the library are dumb

earnest phoenix
#

cause most people who use it aren't exactly iCrawl or Tim

#

they are completely noob at coding

#

I personally didn't mind the structures I thought it was kinda cool

#

I've broken shit a few times trying to use it though I won't lie. I kinda fucked up on some stuff kek

crystal wigeon
#

welp, thats that

cinder patio
#
ClassName.prototype.sendMessage = () => { ... }

declare module 'discord.js' {
  interface ClassName {
    sendMessage: () => ...
  }
}
split hazel
#

because I did tons of extending before that because it just makes things easier but now suffering entails

pale vessel
#

I was curious and checked who sent that link before

#

You were one of them haha

split hazel
#

yeah structures were my easy way of reverting stupid discordjs petty syntax and name updates

crystal wigeon
#

how to ts-node shard.ts? I keep getting the error "cannot use import outside of module" inside of my client.ts that gets called from shard.ts

#

my current folder sturcture

      src/
        server/
          client.ts
          shard.ts
      .env```
carmine magnet
versed gulch
pale vessel
#

Yes

#

Without

#

That's exactly how you do it

carmine magnet
#

Without

pale vessel
#

?

#

Did you read the docs they sent?

#

It's quite literally const user = await client.users.fetch(idFromDB);

lament rock
slender wagon
#
 bsc.address = $(el).children("a").text();

do u guys know how i can filter the bsc address to not catch addresses longer than 42 characters

sudden geyser
earnest phoenix
#

how do I let the users know that they dont have enough perms to run the command?

#

it just keeps thinking

#

no no

#

I meant

#

its a dm command, so if DMs are closed I can just catch error and send an error message

earnest phoenix
#

so how do I let the user know they dont have enough perms to run the command

quartz kindle
#

add an else?

earnest phoenix
#

mm hmm will try that

pale vessel
#
  1. my ears
#
  1. why here
earnest phoenix
#

selected wrong channel

high crown
#

Deleted

crystal wigeon
#

How do I start a shard file in typescript ;-;

quartz kindle
#

new ShardingManager(file, { execArgv: ["-r", "ts-node/register"] })

coral palm
#

For a vps to host a bot what is the better operating system?

#

Ubuntu (Linux)?

crystal wigeon
quartz kindle
#

debian is a bit smaller than ubuntu, doesnt have so many features included

crystal wigeon
#

ok now the client messageCreate event isnt being invoked

#
    // handleGuildEvents(client, discord);
    client.on("ready", async () => {
        console.log("listening");
        client?.user?.setPresence({
            activities: [{
                name: config.IZZI_WEBSITE,
                type: 3
            }],
        });
        try {
            // handleMusicEvents(client, discord);
            // client.music.init(client.user.id);
            // client.musicQueue = new Map();
            // erelajs for streaming music from lavalink service
            if (client?.shard?.ids.includes(0)) {
                // client.user.setAvatar("./izzi.jpeg")
                console.log(`Logged in as ${client?.user?.tag}!`);
                // setInterval(async () => {
                // await redisClient.flushAll();
                // }, 1000 * 60 * 60 * 2);
            }
        } catch (err) {
            console.log(err);
            return;
        }
    });
    client.on("message", (message) => {
        console.log("work pls");
        message.channel.send("worked");
    });
};

export default handleClient;```

I can see the "Logged in as botTag" but the message event isnt working at all. i tried messageCreate as well..... this worked with js
#

ahh, what am i supposed to specify? i think i specified 0

#
    messageSweepInterval: 2,
    messageCacheLifetime: 2,
    retryLimit: 5,
    intents: 0,```
#

what about for interactions? "guild interactions"?

quartz kindle
#

interactions are always on

#

they dont need an intent

crystal wigeon
#

gotcha

#

thanks!

#

i think those are only available on djsv13

crystal wigeon
coral palm
crystal wigeon
#

declare module "discord.js" {
    class BotChannel extends TextBasedChannels<CustomEmbedProps> {
        sendMessage: (content: string | CustomEmbedProps) => BotChannel;
    }
}``` Am i doing it right? i dont have access to any of the other channel methods...

```const newChannel = new BotChannel()
    newChannel.sendMessage() // exists
    newChannel.send() // doesn't exist```
#

i tried GuildBasedTextChannel class too.

cinder patio
#

no

#
  interface ClassName {
    sendMessage: () => ...
  }
crystal wigeon
#

new class?

#

well, i cant extend the Message class

#

TextBasedChannels and GuildBasedTextChannels are types

simple stump
#

I’m using Node Canvas and have converted the current canvas to a buffered image using canvas.toBuffer(), but for testing I want to save the file as a .jpg. How would I do this? AKA how would I save a buffer

simple stump
#

Oh mb thanks

slender thistle
#

C++
Is it possible to use cin on a variable of type int x [10]? If yes, how would the input be read?

wheat mesa
#

Pretty sure it’s easier to just use a vec and use a for loop to push to the vec

slender thistle
#

This is gonna be fun as I've never worked with C++!

#

Thanks for the advice

#

Vectors are pointless here it seems, I only need 10 elements

earnest phoenix
lyric mountain
slender thistle
crystal wigeon
lyric mountain
#

just enough to power a house

crystal wigeon
#

kuu

#

can you help

#

;-;

quartz kindle
#

either extend the types you need, or extend the base types

crystal wigeon
#

mm

quartz kindle
#

threads are a channel type yes

#

the base class for all channels is Discord.Channel

#

the base class for text channels is Discord.TextChannel

#

the base class for guild channels is Discord.GuildChannel

stiff lynx
#

agent ??= new https.Agent({ ...this.client.options.http.agent, keepAlive: true });

I get this err on heroku, how can I fix it?

lyric mountain
#

that's not an error

#

that's a line of code

stiff lynx
#

I think bcs the node version in heroku is too old

#

how can I update it?

spark flint
stiff lynx
spark flint
#

how to fix

#

i haven't imported functools

simple stump
#

Super confused why I am getting this error. I specified the commands and redeployed them, but when using the /user command the sub command option appears as “mentionable” instead of “user”.
Code:
https://sourceb.in/94LQXPMa8e

lyric mountain
#

user is mentionable

#

ah nvm, it does show different for users nvm, u choose what it should show

lyric mountain
simple stump
lyric mountain
#

that's the reason

#

the name of the property is "mentionable"

#

but the type is user

simple stump
#

Oh wait

#

Lol mb

#

Thx

lyric mountain
#

yw

simple stump
#

Well the slash command appears correctly, but I still get the sub command error

lyric mountain
#

welp, that one idk the cause

earnest phoenix
#

or ig you can just npx esbuild index.js --target=2015 | node

stiff lynx
split hazel
#

pov: your website uses the lamp web design

rustic nova
#

because of your "includes"

#

you're checking "does assistance have ass in there"

#

shrug, am not skilled in js

modest maple
#

Aurel told you

#

ass is in assistant

rustic nova
#

just not how to make it actually check if it has that word

#

possibly a regex that checks for the full word?

cinder patio
#

swear filters are pointless anyone can bypass them

#

å§§

lyric mountain
#

ass is tant

sudden geyser
#

If you want a basic filter, split the string by a space and check if an individual word is equal to a word in your filter box

lyric mountain
#

swear filter is good on paper

#

but it's a lost fight the moment you start

sudden geyser
#

They're useful for certain communities

lyric mountain
sudden geyser
#

like that

lyric mountain
#

basically, you can't win against leetspeak

#

d|ck

#

d!ck

sudden geyser
#

everyone knows filters are exploitable

#

but we still use them since they're useful

#

particularly younger communities

#

but some filters are aggressive and build a worse experience

#

cough Roblox

lyric mountain
#

genshin

#

where you cant type dog

sudden geyser
#

taiwan is a country

#

banned

lyric mountain
#

words.forEach(w => "a text".toLowerCase().split(" ").includes(w))

#

although you'd probably be better saving the split text to a variable

#

and using a normal for instead of forEach

#

dangling }

#

format ur code to see where you're missing a {

#

also don't simply copypaste my example

sudden geyser
#

Try using .some instead of .forEach

#

Personally, I'd rather write

"Lorem ipsum dolor sit amet, consectetur adipiscing elit.".split(" ").some((word) => array.includes(word.toLowerCase()))
simple stump
#

When using the /user command this error below is thrown. I haven’t seen anything on Google related to getSubcommand throwing an error, so I’m not too sure what’s going on.
Code:
https://sourceb.in/94LQXPMa8e

lyric mountain
#

that's the thing, your code isn't properly formatted so I cant find it

#

always indent the code

#

show it

#

also, stop using var, it'll cause you more trouble than it's worth it

#

that's nowhere near formatted

#
//==============For Uptime Robot ============
const express = require("express");
const app = express();

app.use(express.static("public"));

app.get("/", (request, response) => {
    response.sendFile(__dirname + "/views/index.html");
});

const listener = app.listen(process.env.PORT, () => {
    console.log("Your app is listening on port " + listener.address().port);
});

const config = require('./config.json');
const token = config.token
const Discord = require('discord.js');
const client = new Discord.Client();
const ms = require('ms');
const fs = require('fs');

client.on('ready', () => {
    console.log(1)
    client.user.setActivity(`naughty words`, {type: "WATCHING"}).catch(console.error);
    console.log('Bot is ready to read cmds!')
})

client.on('message', async (msg) => {
    if (msg.author.bot) return;
    if (!msg.guild) return;
    if (msg.content.length >= 200) {
        msg.delete();
        var bulk = new Discord.MessageEmbed()
            .setTitle('🚨 The Cops have arrived! 🚨')
            .setDescription(`${msg.author}, you cannot send big messages in the server!`)
            .setColor('RED')
            .setTimestamp()
        msg.channel.send(bulk)

    }

    var array = ['fuck', 'shit', 'bitch', 'ass', 'arse', 'dick', 'arsehole', 'asshole', 'cunt', 'wtf', 'pp', 'wank', 'whore', 'pussy', 'twat', 'specy', 'nonce', 'tosser', 'piss', 'vagina', 'penis', 'sex', 'testicles', 'balls', 'cum', 'nonny'];
    array.some(w => "a text".toLowerCase().split(" ").includes(w))
    msg.delete();
    var embed = new Discord.MessageEmbed()
        .setTitle('🚨 The Cops have arrived! 🚨')
        .setDescription(`${msg.author}, please do not swear in ${msg.guild}!`)
        .setColor('RED')
        .setTimestamp()
    msg.channel.send(embed)
    try {
    } catch (err) {
        console.warn(err);
    }
})

client.login(token);
#

this is formatted

#

also I did find the bracket

#

when you format the code, two brackets cant exist like that

#

aligned brackets = there you have it

#

well, that's bcuz you just copypasted our examples

#

both mine and Klay's have hardcoded strings

#

so it'll always trigger

earnest phoenix
#

So I'm having issues with some web development stuff. I made this typewriter effect but now everything under it moves along with it

#

I'm not sure if it's because everything is in the same div as the typewriter effect stuff

woeful pike
#

anyone do aoc day 3?

sudden geyser
#

yes

#

finished part 1

woeful pike
#

nice

#

part 2 is kinda confusing

#

but u get it after reading the example I think

#

it really helps if you know bitwise operators

sudden geyser
#

it is a bit confusing

#

but it feels more like a sorting algorithm

#

I've been staying away from using bitwise operators. Instead, I just store them as strings and parse it with a radix of 2.

modest maple
#

sip Why would you avoid using bitwise?

sudden geyser
#

don't feel like using them

modest maple
#

🤨

sudden geyser
#

It's been much easier for me to say "for all the columns, if the number of 1s is greater than 0, x, else y. Then, parse with radix of two and multiply"

coral sigil
#

Does anyone here use the interactions endpoint url for receiving interactions? If -> Why?

solemn latch
#

kek

cinder patio
#

the websocket uses a lot more resources

#

And if all your bot does is interactions then there's no reason not to go with an HTTP server

#

Scales a lot easier

coral sigil
coral sigil
solemn latch
#

nothing, hit tab and swapped from search to chat

#

typed half my search into chat, just was goofy ^_^

spice finch
#

does anyone have the code for buttons on node.js and help implement them for me?

spice finch
#

ok!

slender wagon
#

nvm i fixed

acoustic whale
#

could i use slash commands while still having per server languages?

spark flint
#

how do i use discord oauth with express.js? can't find an easy and suitable solution online

boreal iron
acoustic whale
boreal iron
delicate zephyr
#

Btw, localisation for slash commands is going to be a thing

#

so you can define multiple languages for slash commands

acoustic whale
#

do slash commands still have that slow caching thing
can i enable and disable commands depending on the user, role, channel and server
is there a good way of calculating the ping time (for a ping command)

coral sigil
coral sigil
boreal iron
boreal iron
boreal iron
#

At least it doesn’t support an online status of you app yet iirc

#

Based on that pings

#

But may I’m not up to date

coral sigil
coral sigil
acoustic whale
boreal iron
boreal iron
#

The guild commands would be available immediately

#

But respect the rate limits when being able to enable/disable specific commands

acoustic whale
#

would making an action queue solve the rate limits?

boreal iron
#

No rate limits regarding how much commands you can register per guild per day

#

Disabling and reenabling commands will cause a rate limit quickly

acoustic whale
#

yes, i will queue up the commands and do the ammount that can be done in a day and then save the rest for the next day

boreal iron
#

Or limit it in your panel

earnest phoenix
#

That looks like a bot token to me

#

Unless they didn't use the whole thing

#

I don't really know how to use whatever module they are using tho so I def can't help much here

#

If it is a self bot no one will help em

spark flint
#

@earnest phoenix what module?

#

and it looks like you're trying to selfbot KEKW

earnest phoenix
#

its For My server Mate

#

It Posts My Bots Inv In # announcement

spark flint
#

still selfbotting

earnest phoenix
#

Well Yes But Not Pub

spark flint
#

stil

#

against discord tos

oak cliff
#

dont ask for selfbotting help here

earnest phoenix
#

Self bot not good

oak cliff
#

its against TOS and nobody will help you do it

earnest phoenix
#

I Did Not Know

#

Sorry

oak cliff
#

sure you didnt

spark flint
#

well don't ask anywhere for selfbotting help KEKW

earnest phoenix
#

Mate Who Reads TOS

#

Dang Xiuh going off on em

spark flint
earnest phoenix
earnest phoenix
#

I read the bot guidelines normal guidelines and tos

spark flint
#

i didn't read the whole tos but any halfwitted bot dev or general user will know

oak cliff
#

you should read the TOS on anything you use because otherwise you might get banned iara_smh

earnest phoenix
#

yeah

#

I wonder if Xiuh read the tos

lyric mountain
spark flint
#

just use a regular bot

lyric mountain
earnest phoenix
#

Xiuh quickly reading tos

sudden geyser
#

A second must be a minute for you if you can read the ToS of anything.

lyric mountain
#

actually ToS are pretty quick to read

lyric mountain
#

the actual content is the mid of it

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

lyric mountain
#

the start is just declarations

#

the end is just footnotes

sage bobcat
#

One message removed from a suspended account.

oak cliff
#

remember this chat is for development and should be chat about development rolykittieonvacuum

sage bobcat
#

One message removed from a suspended account.

sudden geyser
#

ok new dev subject

#

day three of advent of code complete

#

it took me way too long to finish

spark flint
#

new subject x2

#

how do i check if a string contains symbols with nodejs

sudden geyser
#

any symbol? there's a lot of them

spark flint
#

the main ones

sudden geyser
#

how about a regular expression

boreal iron
#

Regex

spark flint
#

/[ !@#$%^&*()_+\-=\[\]{};:"\\|,.<>\/?~]/

boreal iron
#

Yeah

earnest phoenix
#

New subject x3

How can I compile fancy letters like thîś to normal characters like this in discord.py or py

sudden geyser
#

use some normalizing library

earnest phoenix
#

okay

sudden geyser
#

actually python has the unicodedata module built-in

boreal iron
#

Check for a-z and 0-9 and negate the result since that has way more performance

sudden geyser
#

so you may be able to use that

boreal iron
#

Checking this cases, results in way less iterations of your regex than actually checking for each special char

#

yee @boreal iron don’t talk to yourself

#

… I know

#

Leave me alone sir!

lyric mountain
#

let's see the result

#

excuse me?

#

line 55

boreal iron
#

Welcome to dealing with US businesses

#

Not that Snowden has already told us any shit

#

You can shorten that even more until this final result:

Our software - fuck you - we can do and keep what we want! Follow or fuck off.

lyric mountain
#

"include but are limited to"

#
You agree (do not attempt) to  use the Services for any  purpose other than 
(i) expressly permitted by these Terms. 
(ii) Copy, conformity, modification, derivative creation, distribution, licensing, sale, broadcast, public display, public execution, broadcast, streaming, broadcast, source code discovery attempt, reverse engineering, decompilation , Disassembled Use This service or  part of this service, unless expressly permitted in this Agreement.
#

"public execution"

#

the more you try to summarize the ToS the more it looks like a 7yo wrote it

crystal wigeon
earnest phoenix
#

No?

#

I don't see why it would be

earnest phoenix
#

I'm asking you cause you've talked about it before and I had questions I never got around to asking (I'm talking about slash commands)

boreal iron
#

Just ask… as long as I answer means I haven’t hit a tree yet

errant flax
crystal wigeon
earnest phoenix
#

google

#

just google a topic and you will likely find stuff related to it that explains it

boreal iron
#

Hmm most things you deal have a documentation or manual these days

#

you should have asked that question 15y ago

crystal wigeon
#

Property 'sendMessage' does not exist on type 'Message<boolean>'. Getting this error```import { Message } from "discord.js";
import { CustomEmbedProps } from "./types/embed";

declare module "discord.js" {
interface Message {
sendMessage: (content: string | CustomEmbedProps) => Promise<Message>;
}
}

Message.prototype.sendMessage = (content) => {
return Message.prototype.channel.send(content);
};``` This the code

boreal iron
#

Where like nothing of this stuff exists and you had to read the source code to understand things and to try things yourself

sudden geyser
#

Just wondering, but why not use a function?

function sendMessage(message, content) {
  message.channel.send(content);
}
crystal wigeon
#

true. i still get into source code these days to understand things better. but my basics is surely out the window

earnest phoenix
#

you'd have to import that function when you wanna use it.

sudden geyser
#

And what's wrong with that?

earnest phoenix
#

Well, it just looks meh

#

when you can just attach it to the class itself ezpz

crystal wigeon
earnest phoenix
#

why

#

like I get the point of adding your own stuff onto the classes and such

#

but why with sending

crystal wigeon
#

i used message.channel.send() content the other way in djs12. where i could somply just send(embed)

#

now in djs13 I have to send({ embeds: [embed])

#

i cant change that everywhere in my project

#

so writing a wrapper

#

that way i could easily just replace the method being used

#

and not the way args are being passed

earnest phoenix
#

okay

earnest phoenix
#

but that makes no sense to me.

#

Anyway as for how to fix that problem I don't even know anymore

crystal wigeon
#

:p

earnest phoenix
#

I'd have to experiment since they removed structures

#

which I just so happen to be about to do so when I find an answer if no one has given you one I will help

crystal wigeon
#

i thought this would work but mmmm

#

sure

#

pls do ping me if you find an answer

earnest phoenix
#

ye sure

#

also, my question about slash commands is how I should handle loading em.

#

My thought was make a collection of sorts that loads the commands from their files and then loop through them to grab the metadata and load it using the d.js slash command thingy

#

but how should I check to make sure im not loading already loaded commands and will this effect me editing the slash commands?

boreal iron
#

Seems like a lot of work regarding the fact messages can now contain raw content, embeds, components etc.
To figure out any that by passing it to your new method instead of passing it as option which already defines which options it is (like an array of embeds, components etc)

earnest phoenix
#

I thought you were responding to me

crystal wigeon
#

lel but that would actually save a lot of time instead of changing how i send the embeds etc

#

so im willing to put some work and time now which would help me later on

boreal iron
#

Huh did you ask something? Hard to follow any message on mobile

crystal wigeon
#

imagine i change things everywhere now and later djs decides to change the way messages are sent again :>)

#

so better to have an abstraction on top of any 3rd party lib

#

atleast for the important ones

sturdy abyss
#

Hello!

boreal iron
#

I don’t think that syntax will change again as passing that as options seems to become the standard

#

Not only in JS

#

But I got what you mean

crystal wigeon
#

yeah but considering the way my project is alreayd structured, its better to put some time on the abstraction rather than changing things everywhere

#

ye

earnest phoenix
boreal iron
#

I would be more concerned about to adjust and rewrite your prototype replacement if the background changes in any djs update

#

Oh gimme a second

crystal wigeon
#

true, but for now I have to go down that path

boreal iron
#

Yeah sure I mean why not, your decision of course

earnest phoenix
#

I think if I were to loop through my collection and load my slash commands while also checking if I have already loaded that slash command might hinder me editing a slash command

boreal iron
#

Back to you

#

It seems you’re mixing loading commands into your apps cache and registering them

crystal wigeon
#

how do add that github connection on my profile?

boreal iron
#

The structure of the command files is mostly the same like common commands

#

You load any of that when initiating your code into the cache, yeah for example in a collection or map

#

That’s the first part

crystal wigeon
#

nvm about what i asked lol

boreal iron
#

Second part is to register the loaded commands and to check if they are already registered or if they need an update or need to be removed

boreal iron
earnest phoenix
boreal iron
#

That’s actually less complicated than you think.
I wrote a function doing that shit which will be called in the READY event

earnest phoenix
#

actually I don't have to loop through the commands do i

#

the body can accept an array of commands

#

I am talking about doing it the rest way

boreal iron
#

That function fetches the registered commands from Discord and loops through them and your loaded commands, compares names, descriptions and options to each other and registers/updates/removes commands if needed

earnest phoenix
#

mmm

#

let me make a function of what i'd think that would look like

#

Also do you think it'd be worth messing around with decorators?

boreal iron
#

Since anything is saved as map/collection you can easily check if a command exists on Discord or loaded from your files

One example:

earnest phoenix
#

I had the idea of making a decorator that would take the slash command metadata but then again it seems kinda dumb

boreal iron
#

The fetched command from Discord is called "ping"
Looping through your loaded command files checking if the map/collection has an item with the key "ping" (if the command name is the key)
If not remove the registered command from Discord (bc it doesn’t exists locally anymore)
If yes check if the description and options are the same - if not update them

earnest phoenix
#

I see

#

I will make an example function of what i'd think that look like in a sec

#

I might need help with it :p

boreal iron
#

I have shared an example in here already containing like a big part of this handler

#

If you’re good in searching give it a try

#

It sucks on mobile tbh

#

You basically need two loops after fetching the commands from Discord

#

// 1st loop
Loops through the fetched commands to check if it does contain a command which doesn’t exist locally anymore and removes it

// 2nd loop
Looping through your loaded command map/collection, get the item of the collection of the fetched commands from Discord to compare the description and options

earnest phoenix
#

Mmmm

#

yea

earnest phoenix
earnest phoenix
#

No one uses detritus

#

tf

#

145 discord.js refugees

#

compared to djs

#

so its literally barely anyone

#

don't get me wrong tho detritus is still noice

#

I just don't like how some of it works with ts. then again that is just my personal preference

#

like svelte

#

and also ts is just weird to begin with so it isn't entirely detritus' fault

#

it's AMAZING but barely any community support

earnest phoenix
#

is starboard working

#

my biggest complaint about detritus with ts from the last time i asked for support on this issue, it was me needing to use mixins to extend their classes to add my own stuff onto em. which isn't a giant issue if i can't get it to work but it would make stuff a lot easier

#

and I don't like the way it is done so I was like eh no thanks not worth the effort

#

"djs is easier"
the same reason you don't find quality content on top.gg

#

if im being honest

#

no you're not

#

detritus is actually fairly easier

#

You just proved my point

#

it is just I don't agree with ts a lot cause of how fucked some things has to be done

#

so I just dont use detritus

#

a lot of it has to do with me being a lazy boi

#

it's hard because it's just an api wrapper with the only helpers being slash commands and message components

#

yea

#

I'd like to use detritus it just confuses the shit out of me when I wanna do my own custom shit to it.

#

I can't overwrite the types and shit without it yelling at me

#

so I am forced to just go off of one of the examples even tho I wanna try my own stuff.

earnest phoenix
#

check dms

#

don't open #lobby channel

#

ty

#

sucks I join on that channel

earnest phoenix
#

someone made better docs?

#

google feud did

#

nice

#

hopefully i can actually do what I wanna do and not get yelled at by detritus

solemn latch
#

I've only heard good things about ts

earnest phoenix
#

don't lie

solemn latch
#

Is it actually bad CB_pika_think

earnest phoenix
#

ts isn't bad

#

its just dumb sometimes

#

it has its moments where it can be an absolute dummy

solemn latch
#

That's js too ^_^

earnest phoenix
#

what are you trying to do

earnest phoenix
#

@earnest phoenix

import { InteractionCommandClient } from 'detritus-client'
import {Configuration} from "@sach1/dahlia";

declare module 'detritus-client' {
    interface InteractionCommandClient {
        config: Configuration
    }
}

export class CandyClient extends InteractionCommandClient {

}

this is what I mean
TS2689: Cannot extend an interface 'InteractionCommandClient'. Did you mean 'implements'?
I am not entirely sure what to do here since this is what I am used to doing to overwrite types on something mmLol

#

and when I asked for help in the support server erwin just said "use my example" instead of actually explaining the issue or helping

#

well, why are you trying to directly hit the api with node-fetch

#

can't u just use djs

#

well first you need your bots token to use as an authentication thingy then you'd look at discord's docs and find the endpoint to send a message and follow their example

#

you'd wanna use put

#
const resp = await fetch("someURL", {
  method: "PUT",
  headers: header,
  body: {
    content: "Some message"
  }
})
#

I think

#

I can't exactly remember

#

yea

#

that looks correct

#

idk if you gotta stringify it probably not tho

#

no

#
let header = {
"Authorization": `Bot ${token}`
}
#

might even have to do "Content-Type": "application/json" i dont remember if you do or not

#

I don't really know how to explain it well

pale vessel
earnest phoenix
#

Wdym

earnest phoenix
#

can someone explain how a library written in typescript doesn't work with typescript

#

this is why deno stopped using ts for internal code

#

what lib ?

pale vessel
#

It won't complain if you use CandyClient.config since it's part of the class

earnest phoenix
#

I am trying to attach config onto interaction command client

#

and best wya I know how is to extend it with my own class

earnest phoenix
#

so I can use it anywhere in my code

pale vessel
#

You're already doing that by extending the class

earnest phoenix
#

since the command client will be accessable in all commands

#

I can use config when I need to

pale vessel
#

Yes, it's all instantiated by the extended InteractionCommandClient, assuming you use new CandyClient(...props)

#

The config property will be accessible

earnest phoenix
#

mmm

pale vessel
earnest phoenix
#

I see

earnest phoenix
worldly drift
#

hi

#

I need some help

earnest phoenix
#

cool

#

but uh we can't help if you just say you need help

#

so ask your question

earnest mural
#

person went offline dead

earnest mural
#

ikr sad

earnest phoenix
#

ye I figured it out :p

next crown
#

Hi developers I need some help if someone is free rn?

supple oriole
#

hi developers, can yall code me a bot for free?!?!??! absolutelybadmeme 💀 ☠️ CH_Dead CH_PepeDead

earnest phoenix
#

People who ask a question then go straight to general chat 3m later asking for help

earnest phoenix
#

It's not even a question it's more of a statement

earnest phoenix
#

We sadly can't read minds

next crown
#

Ok I am sorry

#

Problem is

#

I am making suggest command

#

It should go like

#

=suggesti suggestion

#

And then that suggestion go to my dms

#

Problem is

#

When someone type their suggestion

#

It doesn't send it all

#

Just a first word of what they said

#

AND I fixed it

earnest phoenix
#

nice story

#

can you send it in one message only

pale vessel
#

Ok I am sorry. Problem is, I am making suggest command. It should go like =suggesti suggestion and then that suggestion go to my DMs but problem is, when someone type their suggestion, it doesn't send it all. Just a first word of what they said and AND I fixed it

earnest phoenix
#

also can you use slash commands

#

i know a good library for that

feral aspen
#

Hey dude, interesting story. Anyways, in order to solve your issue, you may use let suggestion = args.slice(1).join(" ");.

stiff lynx
#

I see a little spam here 💀

feral aspen
#

My popcorn finished before I even finished the story.

stiff lynx
stiff lynx
feral aspen
stiff lynx
#

ping me for other stories

feral aspen
#

Sure, will.

earnest phoenix
acoustic whale
#

Where could I find a list of all bot related discord APIs implemented since early 2018 (an estimation of how dated my knowledge on bot development is) or could someone tell me?

#

Ok yes, definitely early 2018

#

Would phone bots against the rules or just unmoderated phone bots?

earnest mural
#

wdym by phone bots

#

bots made on mobile

#

i mean there are people who clone on mobile but they need to have 5 unique commands or more

#

but its best to be original and honest with work

spark flint
#

Like one that allows you to talk between servers

earnest mural
#

OH

#

i wouldn't really recommend it

#

but i think its fine