#development

1 messages Ā· Page 1981 of 1

earnest phoenix
cinder patio
#

The mongoDB node.js driver is simple

#

that package basically renames some of the methods, that's all it does

earnest phoenix
#

its not mine I just asked if I should use it

cinder patio
#

u shouldn't

rigid maple
#
let fetched = { user: "TuranGe" };
let user = fetched.user 
[ERR]: Cannot read properties of undefined (reading 'user')
```šŸ¤” 🤨
cinder patio
#

user is a string

#

wait

rigid maple
#

😃

cinder patio
#

can you give more context

rigid maple
#

oh ok i solved the problem

#

When I send an object to the website, I can't get its content
but when I send the content of the object there is no problem

boreal iron
#

@wheat mesa

#

We talked about the placeholder for text input fields yesterday

#

There actually is a pre-filled value available

#

value? string a pre-filled value for this component, max 4000 characters

#

Which will be send with modal intertaction if the user doesn't change it

wheat mesa
#

Oh nice

boreal iron
#

testing it rn

#

it's a little bit annoying it's not implemented in djs yet

spark flint
#

Does anyone know how to use Forms or file upload commands with discord.js yet?

wheat mesa
#

just use detritus

earnest phoenix
#

just do fetch requests to discord api ez

rose warren
#

Omg Discord... I had a user complaining they couldn't interact with a button on a command because they kept getting an "Invalid Form Body" every time they clicked it. It was working for everyone else which was weird and I wasn't getting anything in my logs. Turns out his app was out of date. Discord released slash commands how long ago now? And they're still not working for everyone. I'm glad my bot's got message intent because interactions still seem half-baked and not at all ready to be the sole point of interaction with bots from April onwards.

wheat mesa
#

4head

boreal iron
#

err what

#

DiscordAPIError: 404: Not Found

#

is the modal ressource only available on v10?

wheat mesa
#

Don’t think so

#

Afaik detritus is still on v9 and it works for me

#

I’d test but I’m on mobile atm

boreal iron
spark flint
rose warren
spark flint
#

Also this feature tho Pepe_Sheesh

austere surge
#

oo

rose warren
# spark flint Also this feature tho <:Pepe_Sheesh:850093000889204756>

I mean, I don't mind and I think it's cool they have new features, but when they introduce them and then break them for older versions in app updates, it's not cool. Now on top of debugging our code we have to debug people's @everyone perms for slash commands to show correctly in their server and make sure the user's app is up to date! why_ducky I'm all for new features, but this adds on a load more work for devs and their support teams.

boreal iron
#

Checked my code once again, I don't see any issue

earnest phoenix
#

because they have to

earnest phoenix
#

yea thats unfair

#

they didnt even finish slash commands and they are still forcing ppl to use slash commands

rose warren
earnest phoenix
#

yea that too

rose warren
#

My point is they're forcing everyone to switch to using interactions whilst making breaking changes to their apps.

lament rock
#

so many 500s

earnest phoenix
#

its not like itll work forever

quartz kindle
#

forget discord

#

return to monke

earnest phoenix
#

return to skype

rose warren
boreal iron
earnest phoenix
#

but a user should update their app though

lament rock
#

They're not in draft anymore?

earnest phoenix
#

i use discord mobile canary and i update it everytime hoping id get something pog

lament rock
#

Not like I need forms anyways

earnest phoenix
rose warren
lament rock
#

dunno why semver major for just forms/non breaking changes ā˜ ļø

boreal iron
#

I wonder about the API error as the data should be correct

lament rock
#

theoretically, switching to v10 should just be a ver bump you can do manually and easily

rose warren
earnest phoenix
#

just make an faq and direct them to there kekw

lament rock
#

šŸ…±ļøot šŸ…±ļøroke

sudden geyser
#

Like anyone wants to read that

rose warren
lament rock
#

responding to interactions via rest helps you know wtf is going on

boreal iron
#

ffs I have literally no time to figure that out

lament rock
#

im not excited to update SnowTransfer or CloudStorm to v10 or the upcoming changes I'll need to reflect

rigid maple
#
<script>
    let asd = { username: response.user.username, avatar: response.user.avatar, bot: response.user.bot }
    console.log(asd) // { username: response.user.username, avatar: response.user.avatar, bot: response.user.bot }
    console.log(asd.username) // response.user.username
    console.log(typeof asd) // object
    console.log(typeof asd.username) // string
</script>
...
<div>
    { asd } <!-- { username: response.user.username, avatar: response.user.avatar, bot: response.user.bot } -->
    { asd.username } <!-- Cannot read properties of undefined (reading 'username') -->
</div>
```šŸ¤” 🤨
wheat mesa
#

Because that’s not how html works...?

earnest phoenix
#

that's vuejs or some template language

wheat mesa
#

I would assume so but on the off chance it isn’t

boreal iron
#

hey waffle can you check if your interaction callback goes to the v9 api endpoint?

earnest phoenix
#

major respect for not using a framework for a website

boreal iron
#

I still don't get why I get a 404 API error

wheat mesa
#

I’m not home atm

boreal iron
#

then go home, now!

wheat mesa
#

Fair enough

#

I’d rather be at home than sitting in an English class right now!

boreal iron
#

why do you fucking play with your phone then, when being in school?

sudden geyser
#

The phone apparently teaches more

#

And better too

boreal iron
#

how is it possible nobody knows if the fucking modals require the v10 api endpoint

sudden geyser
#

It probably doesn't

boreal iron
#

probably

sudden geyser
#

Discord nor anyone else mentioned it in the announcement on GitHub

boreal iron
#

šŸ¤¦ā€ā™‚ļø

#

ok, why does the API then return 404 for the interaction callback post?

#

the data structure should be right, if im not wrong

#

I'm responding to a slash command

sudden geyser
# boreal iron

Assuming the dot notation follows the API url structure, wouldn't it be .api.interactions rather than .api.applications

boreal iron
#

err lemme check

#

"https://discord.com/api/v8/interactions/<interaction_id>/<interaction_token>/callback"

#

lol oops

#

stupid fake

sudden geyser
#

Got ya

boreal iron
#

Just wanted to test you

#

Test was successful

sudden geyser
#

Also does discord.js really let the you specify the name of the type like that

#

It being a low level API I thought it would require the integers

#

Which is 5 if I remember correctly

boreal iron
#

Nope the API also accepts the name instead of the value

#

ok nvm I was wrong

#

djs actually accepts the names, not the API

#

it does convert the names to ints

#

DiscordAPIError: Invalid Form Body
type: Value "MODAL" is not int.

#

looks like they have constants for each fucking possible name

#

stupid fake²

marble juniper
#

discord.js tries to abstract that away

#

Cuz imagine having to remember the correct numbers each time

boreal iron
#

yeah figured it out already :D

rigid maple
rigid maple
wheat mesa
wheat mesa
boreal iron
#

Because why not? I dont need to listen to a teacher smh

sudden geyser
#

But you need to listen for the upcoming sirens and $10k bill

boreal iron
#

who says it's illegal over here?

sudden geyser
#

You're trying to get yourself killed run over

boreal iron
#

how is it my fault if some idiot is running in front of my car?

wheat mesa
#

Lol

#

I use my phone in class because there’s a distinct lack of content that I actually need to pay attention to

#

For classes like math and physics I pay attention because those have new concepts to teach all the time

#

Whereas all my English classes in school are all fundamentally the same thing as the previous years

#

They’re easy and imo pretty much pointless at a certain point

#

Somehow probably about 60% of my English class is failing

boreal iron
#

turns out djs doesn't even show the base interaction for a modal interaction

#

[INTERACTION] Received interaction with unknown type: 5

wheat mesa
#

@boreal iron this is what detritus uses for responding with a modal

boreal iron
#

ya modal is just missing in the current djs build

#

not an issue for me

#

to use the int then

wheat mesa
#

Reason #173648928273 to not use djs KEKW

boreal iron
#

LISTEN TO YOUR FUCKING TEACHER

wheat mesa
#

Nope

#

No teaching happening rn anyways

#

3 mins until class ends for lunch

atomic fox
#

this guild invited my bot too it is bad or good?

#

damn

#

did i just reply to an old msg šŸ’€

#

nvm its not old

earnest phoenix
#

can i add in mongodb? like if the value was 5, and i add 2 more, it'll be 7

earnest phoenix
#

ty

#

I was thinking about insert

waxen idol
#

but i left it anyway

atomic fox
waxen idol
#

xD

spark flint
#

It caches the leave for up to 2 months

earnest phoenix
#

Can I do a query like this?

#
let query = {coins, silver };
wheat mesa
#

...what?

atomic fox
#

wdym HyperThonkSpin

spark flint
#

I’m guessing the server was deleted

#

By discord

#

Example

atomic fox
#

nice

hazy pasture
#
const browser = await puppeteer.launch()
        const page = await browser.newPage()
        await page.setViewport({
            width: 1600,
            height: 1200,
            deviceScaleFactor: 1,
          });
        await page.goto(link)
        const buffer = await page.screenshot({ path: `img.jpg` })
        
        sleep(1000)

        

        let originalImage = 'img.jpg';

        let outputImage = 'img2.jpg';

        sharp(originalImage).extract({ width: 130, height: 62, left: 40, top: 210 }).toFile(outputImage)
            .then(function(new_file_info) {
                console.log("Immagine ritagliata");
            })
            .catch(function(err) {
                console.log("Errore");
            });
        
        ReadText('./img2.jpg').then(text => {
            const embed = new Discord.MessageEmbed()
            .setTitle("Journaling")
            .setDescription(`Link: ${link}\nEntry: ${entrata}\nRisk: ${risk}%\nSL: ${stop_loss}\nTP: ${take_profit}\nRR: ${rr}\nPair: ${text.split(",")[0]}`)
            interaction.reply({ embeds: [embed] })
        }).catch(err => {
            console.log(err);
        }).then(function(deletefiles){
            fs.unlink('./img2.jpg', function (err) {
                if (err) throw err;
            });
            fs.unlink('./img.jpg', function (err) {
                if (err) throw err;
            });
        })
        
        
        
        
    }
}```
it works 1 time, but at the second time it creates the file so late, so in tries to read it before creating it... can anyone help?
Please reply with MENTIONING on, so I can read the answer, thank you
cinder patio
#

You need to await the call to sharp so the code after it runs after the image has been saved to the file

#

Also, you should probably await sleep, too.

#

I can imagine how that function looks like

pale vessel
#
function sleep(b) {
    const a = new Date().getTime(), c = a + b;
    while (new Date().getTime() < c);
}```
cinder patio
#

big brain

earnest phoenix
#

monkaW wtf

sudden geyser
#

saw some code in my cs class on par with that

#

except they used for and just looped for a very long time

marble juniper
quartz kindle
#

@_@

lament rock
raw nest
#

Is there a way to make a GET request with a body in ReactJS/NextJS??

spark flint
#

You can use Ajax ig

#

If there’s another way then I’m gonna try that

raw nest
#

with axios you can make get request with body?

#

that would be absolutely bs but I hope it works xD

spark flint
raw nest
#

thanks man

earnest phoenix
#

Anyone know python that can help me

sudden geyser
#

don't ask to ask

#

just ask what you need help with

earnest phoenix
#

Well Ik a little bit of python and I’m trying to make a help command but when I do everything it gives a error and says discord.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias

#

Even tho when I click Ctrl f and type help nothing shows up

sudden geyser
#

Did you create your own help command?

#

If so, you probably didn't unregister the one your library has built-in

spark flint
#

client.remove_command(ā€˜command-you-want-to-remove’)

sudden geyser
#

Isn't there an option on the constructor for this as well

spark flint
#

Idk

#

But this works

earnest phoenix
earnest phoenix
spark flint
#

Did you replace the ā€œcommand-you-want-to-replaceā€ bit

earnest phoenix
#

Yh

spark flint
#

send the client = code

#

Or just some code to help us get an idea

earnest phoenix
#

Uh kinda can’t do that bc it’s something that’s against tos for some stupid reason

spark flint
#

What, your bots purpose?

earnest phoenix
#

Yes

spark flint
#

What is it’s purpose?

earnest phoenix
#

Even tho it’s a private bot lmao

spark flint
#

We kinda can’t help without any context

wheat mesa
#

What does it do that’s against ToS..?

spark flint
#

^

dry imp
#

if you dont share any private infos it is not againsts tos

#

also i think there is a method to remove the default help cmd

spark flint
#

I already sent

wheat mesa
earnest phoenix
#

It’s a private Roblox cookie checker bc I use it a lot bc my cookie keeps going dead so I need to know when it’s dead bc I flip limiteds and stuff so yk

wheat mesa
#

Huh

spark flint
#

Against roblox and discord tos but ok

earnest phoenix
#

And I use websites were u use ur cookie to log in

spark flint
#

Yeah that’s sus

wheat mesa
#

Oh

earnest phoenix
wheat mesa
#

Well then I’m afraid you won’t get help with that here :p

spark flint
#

Still

#

Can’t help here

earnest phoenix
#

Like I use rbxflip

#

And stuff

wheat mesa
#

The point is that it still violates ToS

#

And this server doesn’t help with that kind of thing

earnest phoenix
#

Roblox have said it’s not against tos tho on Twitter to use rbxflip bc alot of ppl were asking about it

wheat mesa
#

You just said it was against to

#

ToS

spark flint
#

using cookie to login is against roblox tos

wheat mesa
#

And that

dry imp
wheat mesa
#

And using discord to violate any other company’s ToS is against discord’s ToS as well

boreal iron
#

@wheat mesa
So.. after doing some tests I ended up not to use modals.
The (bot) config command contains the choices for the features you wanna edit, like nickname, channels etc.
The next argument would need to be dynamic as the nickname is a string and the channel selection the, guess, channel type

I thought I could solve this with by displaying different modal components depending on the option choice but it only supports text input, not even a fucking channel or user selection

#

I mean wtf is that trash

#

And going to validate your text input to check if it actually matches or channel, user etc. isn’t an option

#

What a waste of time tho

carmine summit
#

how do I fetch last 10 messages of a channel id?

sudden geyser
#

What library are you using

carmine summit
#

djs

cobalt junco
#

You can use

const x = req.body?.x || req.query?.x;
sudden geyser
#

You could also look in the .cache for the .first(10)

#

Or the .last(10)

carmine summit
#

whats the difference in cache?

sudden geyser
#

Cache will look for what your bot has stored in memory

#

Assuming you have the message intent

raw nest
#

When you build like a ReactJS app or a NextJS app (npm run build OR next build), are they also removing all system errors and things like Fetch finished loading: <FetchURL> etc.? Or what's really happening?

carmine summit
#

is there a limit on how much I can fetch?

sudden geyser
#

Up to 100 at a time

carmine summit
#

do this normally return undefnined when there is no messages in a channel?

sudden geyser
#

Yes, because a client is not associated with a channel.

#

Just like how you as a user aren't associated with a specific channel, like #development.

#

What channel do you want to get? The current channel?

#

e.g. message.channel

carmine summit
#

oh wait im dumb

#

forgot to fetch the actual channel

#

how can I tell if there is a specific string inside a message?

m.content.includes(userInfo.uid)
```this is what I have but TypeError: Cannot read properties of undefined (reading 'includes')
sudden geyser
#

cannot read property x of undefined means you're trying to get the value of a property under undefined

#

In this case, m.content returns undefined, so you can't do .content.includes(...)

#

You'll need to fix that first

#

probably by figuring out what m is

carmine summit
#
      for (const m of mList) {
        console.log(m);
        if (m.content.includes(userInfo.uid)) {
          m.delete();
        }
      }
sudden geyser
#

still don't know what m is

carmine summit
#

m is an object inside a map

sudden geyser
#

does it have content?

carmine summit
#

yep

sudden geyser
#

well that's odd

#

the error says otherwise

cobalt junco
carmine summit
#

wait, mList is actually the fetched 50 last messages.

#

it could be that im not iterating them properly

cobalt junco
wheat mesa
#

m is probably [string, Message] and not Message as you think it is

carmine summit
#

it works, but dont know why. why?

wheat mesa
#

interface TestObj {
    content: string;
}

const a = new Map<string, TestObj>();

a.set('message1', {content: 'test'});
a.set('message2', {content: 'test2'});

for(const m of a) {
    // Not allowed: m is [string, TestObj]
    console.log(m.content);
}

for(const m of a.values()) {
    // Allowed: m is TestObj
    console.log(m.content)
}
carmine summit
#

does .values() work in any key value object?

wheat mesa
#

.values() returns an iterator of all the values in the map

carmine summit
#

does it only work in maps?

wheat mesa
#

maps, things that extend maps, etc

#

depends on the implementation

#

discord's Collection class is just an extension of Maps

#

so it works the same

cobalt junco
#

^this

wheat mesa
#

you could also do something like ```ts
for(const m in a) {
console.log(a.get(m)?.content);
}

pearl trail
#
for(let [, m] in a) {
     m
}
wheat mesa
#

you don't need the key for that implementation so it's better to just use values

#

@boreal iron not sure if you ever figured out your issue but detritus is definitely still on v9

#

and modals work just fine

lament rock
wheat mesa
#

yes

#

whoops

bright hornet
#

How do I start when author used a command then the bot will dm the author?

#

I only know dm-ing the user using ?dm @user <message>

#

nvm

#

xD

lyric mountain
#

That's...that's a specific bot command sir

pearl trail
#

lmao, i thought when a user used any command, the bot will dm

lyric mountain
#

That's mee6

bright hornet
#

I used message.author.send('message') to send dm to its author

lyric mountain
#

Wait you're seriously dming the user on every command?

bright hornet
lyric mountain
#

Understandable, hava good day

boreal iron
oak lotus
#

Hi @remote shell

#

I submitted a bot on Top.gg, but I can't see the website page in my bot intro-overview
Can someone help me with this please

lyric mountain
#

Tf you just pinged a random dude

wheat mesa
#

that's a war crime

lyric mountain
#

You probably didn't wait for approval, bots are only public after approved and indexed

oak lotus
#

@lyric mountain thank you The problem is solved

#

Another question I want another person to help me maintain the information in top.gg but don't know how to change the bot manager

delicate shore
#

const jokes = require("./jokes.json");

function getRandomInt(min, max) {
  return Math.floor(Math.random() * (max - min + 1)) + min;
}

exclude_tags_default = ["sex"];

const getRandomJokeWithTag = async (
    tag,
    options = {
      exclude_tags: exclude_tags_default,
    }
  ) => {
    var jokesWithTag = getAllJokesWithTag(tag);
    const exclude_tags = options["exclude_tags"];      // Get a random integer between min and max
      const idx = getRandomInt(min, max);
      // Get a random Joke
      let joke = jokes[idx];
      // Declare flagged as a variable to be used in the loop
      let flagged = 0;
      for (let i = 0; i < exclude_tags.length; i++) {
        if (joke.tags.indexOf(exclude_tags[i]) > -1) {
          flagged = 1;
        }
      }
  
      if (flagged === 0) {
        return joke;
      }

}
#
       if (joke.tags.indexOf(exclude_tags[i]) > -1) {
                 ^

TypeError: Cannot read property 'tags' of undefined
austere surge
#

joke is undefined

delicate shore
#

it is not

#

see the whole code. Ijust posted

austere surge
#

the errors says

delicate shore
bright thorn
#

mongo db schema not delete after 10 sec

const { Schema, model } = require("mongoose");

module.exports = model(
  "history",
  new Schema({
    userId: { type: String },
    tracks: { type: Array, expireAfterSeconds: 10 }
  },
  )
);

#

can anyone help me

delicate shore
#

im dumb

#

i figured it out

pearl trail
# bright thorn mongo db schema not delete after 10 sec ```js const { Schema, model } = require...
delicate shore
#

What is this supposed to mean

quartz kindle
#

i means the file jokes.ts does not export anything named getRandomJoke

earnest phoenix
quartz kindle
#

you can?

#

i mean idk if require supports it, but JSON.parse does

earnest phoenix
#

require doesn't support it

#

I have tried it

quartz kindle
#

lel rly

earnest phoenix
#

you have to put the array as a property

#

{
"jokes": []
}

quartz kindle
#

then just fs.read it

#

and json.parse it

earnest phoenix
#

const { jokes } = require("jokes.json");

earnest phoenix
delicate shore
#

all I was doing was

#
function({
shit1:,
shit2:
})
quartz kindle
delicate shore
#

but i had to do

 function(shit1,{
shit2
})
earnest phoenix
#

I guess nextjs was just really cringe for not letting me store an array in json

quartz kindle
#

thats a lot of shit

delicate shore
#

I know

earnest phoenix
#

tim you won't believe how replit decided to write their css in jsx

quartz kindle
#

wot

earnest phoenix
quartz kindle
#

idk anything about react/jsx

#

is that code bad?

earnest phoenix
#

yep

quartz kindle
#

huehuehue

earnest phoenix
#

they downgraded from actual css to this monstrosity

quartz kindle
#

isnt modular css a thing tho? like react is split into modules/components, and each component has its own self contained css?

#

well i go sleep kthxbai

boreal iron
#

And earn some cash, Tim

#

You said you’re poor, since sleeping is a waste of time and money, you not gonna sleep anymore

#

Why do you think I’m working around the clock? freerealestate

marble juniper
#

Just make money in ur sleep

#

ez

austere surge
#

bitcoin mining how would you do that

marble juniper
#

Have a patreon

#

Ez monthly income

#

you are effectively making money in ur sleep

austere surge
#

just having a patreon lmao

marble juniper
#

Or you have a product u made urself with a subscription based service

boreal iron
#

Then you wake up and remember how reality actually is

austere surge
#

yes

earnest phoenix
#

So I plan on making something so a user can run a command in a channel and in that channel it will send an image every hour. Now I know I should use setInterval but I obv will need to save those intervals so if the bot goes down it can rerun em (which is my issue here). Also if i set an interval in the command once the command is finished executing will it still keep sending those images in that channel

#

SCREENSHOT NFT EVERY HOUR?????

#

It isn't an nft

marble juniper
#

He was joking

earnest phoenix
#

it is ur house's location on a map

earnest phoenix
rustic nova
#

Screenshot the precise location of you every hour PekoSmile

boreal iron
#

lol people are concerned about privacy but share their whole life on social media services

rustic nova
#

True true

#

"I don't want to tell you in what country I am"
Also them: shares selfies from their school

boreal iron
#

Aye

#

And using an Android smartphone tracking them continuously 24/7

rustic nova
#

Yes

boreal iron
#

That’s how the world is

pearl trail
#

googleā„¢ļø

cinder patio
rustic nova
#

Owned by Google, Google collects data

boreal iron
#

Oh you think you can disable tracking in Android completely without routing the device?

rustic nova
#

"haha lemme disable location access smartboi"

cinder patio
#

Isn't the OS open-source šŸ¤”

boreal iron
#

You can’t even disable simple tracking without getting spammed with errors or warning Android or installed apps won’t work any longer

cinder patio
#

Phones using the OS could do that, but the OS in itself most likely doesn't since it's open source

rustic nova
#

Still am sure that Google's applications collect stuff that are "essential for usage"

boreal iron
#

Try to remove googles key apps or disable them

#

It’s an endless story of things you can’t do

rustic nova
#

At least not possible without rooting and removing them

#

But that will essentially make the android system unusable without sideloading stuff

#

Is micro-G open source?

boreal iron
#

Even if the base Android is open source is completely dislike the permissions structure

#

And how everyone is forced to use googles key services

cinder patio
#

Hmmm... I'm not sure if Android comes with google or if most manufacturers put google on it

#

Don't Huawawei phones use the Android OS? And they've banned google apps

#

Huawei

boreal iron
#

Ok which devices comes without the google services and apps? Except those manufacturers who are banned by the US

cinder patio
#

ĀÆ_(惄)_/ĀÆ

#

you could make one

boreal iron
#

lmao

#

We already have one poor boy dealing with OS development

cinder patio
#

manufacturers prolly put google on it for the $$

boreal iron
#

Don’t need to join that sad team

#

I actually used Android for quite a while and got rid of it really fast

#

I also don’t refer to things which manufactures collect silently and hidden but I’m speaking about the stuff you as user actually can control

cinder patio
#

What phone are u using then

boreal iron
#

Well iOS of course as it allows to disable any sort of tracking without exceptions
(except the stuff which happens silently and hidden as I already mentioned)

cinder patio
#

🤭 ok then

#

It's ironic cause Apple is very restricting and they're more likely to track you

#

If you'd want more control you'd surely go with Android?

boreal iron
#

That’s correct but the difference is the company doesn’t sell your data to third parties as they need it themselves as nr 1 global player

cinder patio
#

how do you know that. Apple is much worse than Google

#

such a scummy company

#

We talked about this yesterday

boreal iron
#

In which way apple, their ecosystem, their devices or their user data got compromised or leaked the last years?

#

As I said I’m not talking about the telemetry data any manufacturer collects

#

Also the iOS permission system allows a completely separate allow/deny permission structure for any access needed

#

Back when I used Android you had to allow all access when downloading the app from the App Store

#

Apple doesn’t allow that

cinder patio
#

When did u last use Android

boreal iron
#

Hmm 3y ago?! Maybe 4

#

Not sure

cinder patio
#

Android has that

boreal iron
#

Not to mention the App Store in general, the restrictions and safety

boreal iron
cinder patio
#

And I can deny chrome & other google apps location so

boreal iron
#

Ok and you can disable tracking on the system level, when enabling wlan, for your mobile cell etc.?

cinder patio
#

Can you do that with Apple?

boreal iron
#

Yes of course

cinder patio
#

iOS

boreal iron
#

Lemme grab an image in a readable language

cinder patio
#

I don't know but how can u be sure Apple respects that?

carmine summit
#

how do I turn fetched messages into an array?

cinder patio
#

The difference between iOS and Android is that Android is "general purpose" you could say, anyone could build it and use it, iOS is made specifically for Apple phones. Therefore Apple can put whatever spyware they could in their iOS, and the data would go tooooo... Apple.

#

And you can't do anything about it

carmine summit
#

    console.log(typeof mList);``` returns `object`
boreal iron
boreal iron
#

And I can at least see and check the traffic and the tracking (location) and will see it comes to a minimum (or to null) after disabling all of them

cinder patio
#

I haven't dabbled into it, mostly because I disable location all my apps

boreal iron
#

And apps can’t overwrite the system level settings also you can’t accidentally enable it for app

boreal iron
cinder patio
#

It's automatically disabled on android tho

#

The app has to ask u

boreal iron
#

The system not

#

Any google service is tracking you by default

#

To ā€œimproveā€ their services

#

Even if you don’t use the app

#

Like I said try disable the default google services on your android device

#

It’s not possible without routing the device

#

And yes the fact doesn’t let anybody else take a look into their ecosystem is problematic, too

#

No doubts on that one

carmine summit
#

how can I search for fetched messages for a string?

#

using .filter()?

#

.find()? .map()?

pale vessel
#

one message = find(), multiple = filter()

carmine summit
#

I think it only works for exact values

boreal iron
#

That depends on your statement (expression)

#

find((a) => a.includes("b"))

#

As example

#

filter((a) => a.includes("b")) // returns multiple items which include b

carmine summit
#

@boreal iron then when should I use map()?

#

isnt it the same as filter()?

#

or is it completely different

boreal iron
#

filter returns a collection iirc, map of course an array

#

(if you refer to djs collections)

boreal iron
carmine summit
#
m.content.match(`/(${pids.join("|")})/`)
// /(2e565cdec9dcdff44afa2b1ea71c2c2c|34482dc7c754a30aba97065d165b1b38|703aea31975f2fa45fdb3e4a8e378ad1|1789250aaf0335d750de2acf2faa707d|5737cbbf29e7e1bde4520253e920cc26|9aa92dce525591ed890cf7869cd62900)/

why when I match my string for a regex, it returns null. But when I test it in https://www.regextester.com/, it finds the string.

cinder patio
#

Why are you using regex for this?

carmine summit
#

because the message contains more content than the actual string, and I have multiple pids...

cinder patio
#
for (const pid of pids) {
   if (string.contains(pid)) {
       //...
   }
}
carmine summit
cinder patio
#

that's one way to do it without regex

carmine summit
#

is a loop better for this?

cinder patio
#

I'd say so

carmine summit
cinder patio
#

oop my bad yeah it's includes

carmine summit
#

i thought i have to learn something new again...

carmine summit
cinder patio
#

why would you want to modify it

carmine summit
#

i want to remove the pid that is already been used

cinder patio
#

You could turn the pids array to a Set so all the pids inside of it are unique

carmine summit
cinder patio
#

Alright explain your problem in detail

carmine summit
#

i have multiple strings in an array. i also have multiple pids in an array. if a string has pid, i want pid to be deleted, so in case if another string has the same pid, the string will get deleted. those two strings are not identical.

cinder patio
#

store the deleted pids in a Set

#

check if a pid is in the set, if it is then you've seen it already, delete the string or whatever

carmine summit
#

how will i know what pid it is. the strings contain more than the pid

cinder patio
#
const deleted = new Set();
for (const pid of pids) {
   if (string.contains(pid)) {
       // string contains deleted pid.
       if (deleted.has(pid)) {
         //...
      } else {
         //... do something
         deleted.add(pid);
     }
   }
}
carmine summit
#

that might actually work. thanks!

hazy pasture
lyric mountain
hazy pasture
bright thorn
#

Is there any way to get the announcement channel to be followed in Discord JS by the bot.

lyric mountain
#

what announcement channel?

#

if it's discord's, you can simply monitor the message event

bright thorn
lyric mountain
#

you can't

#

this has to be done by clicking that button

bright thorn
#

how?

lyric mountain
#

they aren't probably

#

just regular webhook messaging system

boreal iron
#

You’re officially getting old Sir

hazy pasture
# lyric mountain how did ya try?

        const browser = await puppeteer.launch()
        const page = await browser.newPage()
        await page.setViewport({
            width: 1600,
            height: 1200,
            deviceScaleFactor: 1,
          });
        await page.goto(link)
        const buffer = await page.screenshot({ path: `img.jpg` })
        
        await sleep(1000)

        

        let originalImage = 'img.jpg';

        let outputImage = 'img2.jpg';

        await sharp(originalImage).extract({ width: 130, height: 62, left: 40, top: 210 }).toFile(outputImage)
            .then(function(new_file_info) {
                console.log("Immagine ritagliata");
            })
            .catch(function(err) {
                console.log("Errore");
            });
        
        ReadText('./img2.jpg').then(text => {
            const embed = new Discord.MessageEmbed()
            .setTitle("Journaling")
            .setDescription(`Link: ${link}\nEntry: ${entrata}\nRisk: ${risk}%\nSL: ${stop_loss}\nTP: ${take_profit}\nRR: ${rr}\nPair: ${text.split(",")[0]}`)
            interaction.reply({ embeds: [embed] })
        }).catch(err => {
            console.log(err);
        }).then(function(deletefiles){
            fs.unlink('./img2.jpg', function (err) {
                if (err) throw err;
            });
            fs.unlink('./img.jpg', function (err) {
                if (err) throw err;
            });
        })
        
        
        
        
    }
}```
quartz kindle
#

and what error did you get?

hazy pasture
#

worker.send(packet);
^

TypeError: Cannot read property 'send' of null

#

@quartz kindle

#

at the 2nd time executing command

#

the first time it works perfectly

quartz kindle
#

... what? that error is not from this code?

#

show full error

hazy pasture
#

C:\Users\Pietro\Documents\Lavoro\TradingView\node_modules\tesseract.js\src\worker\node\send.js:9
worker.send(packet);
^

TypeError: Cannot read property 'send' of null
at module.exports (C:\Users\Pietro\Documents\Lavoro\TradingView\node_modules\tesseract.js\src\worker\node\send.js:9:10)
at C:\Users\Pietro\Documents\Lavoro\TradingView\node_modules\tesseract.js\src\createWorker.js:47:7
at new Promise (<anonymous>)
at startJob (C:\Users\Pietro\Documents\Lavoro\TradingView\node_modules\tesseract.js\src\createWorker.js:43:5)
at Object.load (C:\Users\Pietro\Documents\Lavoro\TradingView\node_modules\tesseract.js\src\createWorker.js:57:5)
at C:\Users\Pietro\Documents\Lavoro\TradingView\node_modules\text-from-image\index.js:17:20
at new Promise (<anonymous>)
at ReadText (C:\Users\Pietro\Documents\Lavoro\TradingView\node_modules\text-from-image\index.js:15:16)
at Object.run (C:\Users\Pietro\Documents\Lavoro\TradingView\commands\journaling.js:93:9)

#

it seems like the 2nd time it tryes to read the texzt from the photo BEFORE actually creating it

quartz kindle
#

is the code you showed the file journaling.js?

hazy pasture
#

yes

quartz kindle
#

can you show the full file?

hazy pasture
#

the rest of the code is the handler i am using

#

msg is too long

quartz kindle
#

you pobably need to await ReadText

hazy pasture
#

ok lemme try

quartz kindle
#

but fs.unlink is also async

#

you need to either promisify it, or use unlinkSync

hazy pasture
#

doesn't work with readtext asynced too

#

awaited*

quartz kindle
#

fs.unlink is an async operation, your ReadText function will not wait until the file is deleted before returning

#

it will return first, and then delete the file in the background at the same time other code is running

hazy pasture
#

so... what should I do

quartz kindle
#

either use unlinkSync

#

or use the promise version

#

fs.promises.unlink

hazy pasture
quartz kindle
#

unlinkSync does not have a callback

#

its just fs.unlinkSync("file to delete")

hazy pasture
#

ok

#

same error :d

quartz kindle
#

then your problem is elsewhere

#

what does the log show before the error?

hazy pasture
#

Ready as TradingView#6185
Immagine ritagliata
Immagine ritagliata
C:\Users\Pietro\Documents\Lavoro\TradingView\node_modules\tesseract.js\src\worker\node\send.js:9
worker.send(packet);
^

TypeError: Cannot read property 'send' of null
at module.exports (C:\Users\Pietro\Documents\Lavoro\TradingView\node_modules\tesseract.js\src\worker\node\send.js:9:10)
at C:\Users\Pietro\Documents\Lavoro\TradingView\node_modules\tesseract.js\src\createWorker.js:47:7
at new Promise (<anonymous>)
at startJob (C:\Users\Pietro\Documents\Lavoro\TradingView\node_modules\tesseract.js\src\createWorker.js:43:5)
at Object.load (C:\Users\Pietro\Documents\Lavoro\TradingView\node_modules\tesseract.js\src\createWorker.js:57:5)
at C:\Users\Pietro\Documents\Lavoro\TradingView\node_modules\text-from-image\index.js:17:20
at new Promise (<anonymous>)
worker.send(packet);
^

TypeError: Cannot read property 'send' of null
at module.exports (C:\Users\Pietro\Documents\Lavoro\TradingView\node_modules\tesseract.js\src\worker\node\send.js:9:10)
at C:\Users\Pietro\Documents\Lavoro\TradingView\node_modules\tesseract.js\src\createWorker.js:47:7
at new Promise (<anonymous>)
at startJob (C:\Users\Pietro\Documents\Lavoro\TradingView\node_modules\tesseract.js\src\createWorker.js:43:5)
at Object.load (C:\Users\Pietro\Documents\Lavoro\TradingView\node_modules\tesseract.js\src\createWorker.js:57:5)
at C:\Users\Pietro\Documents\Lavoro\TradingView\node_modules\text-from-image\index.js:17:20
at new Promise (<anonymous>)
at ReadText (C:\Users\Pietro\Documents\Lavoro\TradingView\node_modules\text-from-image\index.js:15:16)
at Object.run (C:\Users\Pietro\Documents\Lavoro\TradingView\commands\journaling.js:93:15)
PS C:\Users\Pietro\Documents\Lavoro\TradingView>

#

the first "immagine ritagliata" it's the time when the bot works

quartz kindle
#

you are not awaiting the function

#

you are using the function multiple times at once without waiting for it

hazy pasture
#

which function should I await? I am coinfused

quartz kindle
#

the function in the file journaling.js where your code is inside

hazy pasture
#

I awaited readtext and sharp

quartz kindle
#

the function that your code is inside

#

you need to show more of the file

hazy pasture
quartz kindle
#

show where you use the run function

#

in your handler

hazy pasture
#

it's a package made by a friend

quartz kindle
#

i mean this

#

show where you use .run(client, interaction)

hazy pasture
#

the handler is literally this, I need to search up in the package

#

give me a min

#

I can't find out, I think I'll use the slash commands creator from discord.js guide

quartz kindle
#

are you trying to use the bot command 2 times very fast?

hazy pasture
quartz kindle
#

run the command again before the previous command finished

hazy pasture
#

no, but just after it finished

#

just after it sent the embed

quartz kindle
#

add a return to the interaction

#

retun interaction.reply()

hazy pasture
#

same error

quartz kindle
#

you log is showing this

hazy pasture
#

yea

quartz kindle
#

meaning you are doing 2 images at once, without waiting for one to finish

hazy pasture
#

no, it sends "immagine ritagliata" as the last console log of the command

#

it sends it 1 time on the first time doing the command

#

and it works

#

then it sends it again right before the error

#

on the 2nd time doing the cmd

quartz kindle
#

ah

violet jewel
#

a

quartz kindle
#

well apparently its an issue with the module you are using

hazy pasture
#

so I need to remove part of the package

quartz kindle
#

there is a fix already but not merged

hazy pasture
#

omg it works now

#

thank you so so so much

#

you made my day

quartz kindle
#

the author of the package made it in a way that it can only be used once per process lol

#

probably meant to be used in cli

boreal iron
#

Hey @quartz kindle can I actually check if I already registered an event listener?
I have to register one in a module (temporarily) for reasons which would of course cause another registeration if the module is loaded again

#

I mean I could set a simple var, but maybe there's a thing I don't think of?!

vale garden
#

hey btw does anyone know

#

how this bot doesn't have any status

spark flint
#

i think

#

it sbecause

#

its been invited application not a bot

vale garden
#

wot?

#

you can invite an app?

pale vessel
#

it's because they use interaction webhooks instead to receive events instead of connecting to the gateway

boreal iron
#

Is that actually listed as member in the member list or did you click on his name to popup the client info?

earnest phoenix
boreal iron
#

ahh good to know, that's already a thing

charred jetty
#

how to get all users json data on discord.js?

wheat mesa
#

And with that question you provided us

  • no context
  • no library
  • no code
  • no idea what data you want
  • and no specifics
final mica
#

what

earnest phoenix
charred jetty
#

aaaaaaaaaa.....just need ansšŸ˜”

lyric mountain
#

explain your question better

charred jetty
#

i just need to store all of my guild members data (my bot is only in one server)...but i cant find a way to get all the users data

solemn latch
#

I feel like discord wouldn't want you to store everyone's data.

wheat mesa
earnest phoenix
#

i agree

charred jetty
#

im getting only bot data from client.users.cache

earnest phoenix
charred jetty
#

i last used d.js on v12 so idk

lyric mountain
#

store the id, any other data just fetch from the api

charred jetty
#

im getting only the bot data

lyric mountain
#

or better yet, don't store anything since it'd be pointless

lyric mountain
charred jetty
#

with client.users.cache

charred jetty
lyric mountain
#

yes, and is it also enabled during client initialization?

charred jetty
#

is it ok or have to add something?

#

idk about this intents stuffs.. everything looks new to me now

lyric mountain
#

the one you want to enable is Intents.FLAGS.GUILD_MEMBERS

charred jetty
#

oh

#

ok lemme try then will tell if it works

lyric mountain
#

also it's quite clear you just copypasted from the docs

#

don't do that, take some time to understand what you're doing

#

else you'll become dependant of this channel

charred jetty
lyric mountain
#

that's no excuse

#

read the docs, don't just copypaste

charred jetty
spark flint
#
const guild = client.guilds.cache.get("822979643589787688");
guild.channels.cache.first()
.createInvite()
.then(invite => message.channel.send(invite.url))```
#

why does that not work

#

or am i being stupid

lyric mountain
#

maybe no permission to create an invite in that channel?

spark flint
#

TypeError: guild.channels.cache.first(...).createInvite is not a function

wheat mesa
#

Channels are not just text channels iirc

spark flint
#

ah

wheat mesa
spark flint
#

after evalling message.guild.channels

wheat mesa
hazy pasture
#

does someone know if there is a way to make that every new week and every new month the bot does something?

spark flint
#

what do you mean

hazy pasture
#

like
on every monday it sends a message

on every month it sends another message

wheat mesa
#

Cron scheduler ig

lyric mountain
#

why do they always ping after answering the question

wheat mesa
#

Because they want a response in 2 seconds mmulu

lyric mountain
#

yes, that's definitely a task for cron

wheat mesa
#

They’re deferring the interaction

#

Waffle is thinking...

lyric mountain
spark flint
#
const channels = message.guild.channels.fetch().array()```
wheat mesa
#

Iterate through the channels until you find the first one that’s a TextChannel

lyric mountain
#

or something like that

wheat mesa
#

Nah not instanceof

#

Use c.type

hazy pasture
#

this means that

chron.schedule("1 * * * * * *", () => {}```

executes every monday?
spark flint
wheat mesa
#

You need to await it

#

You’re probably trying to call .array on a promise

quartz kindle
#

(await ...channels.fetch()).array().filter(...)

wheat mesa
#

^ that

spark flint
#
let channels = [];
message.guild.channels.cache.forEach(chn => {if (chn.type == "GUILD_TEXT") { channels.push(chn) }})
channels;```
#

that worked

wheat mesa
#

Channels aren’t guaranteed to be cached I don’t think but yeah if it works it works

lyric mountain
quartz kindle
boreal iron
wheat mesa
#

Ah

#

God imagine fetching every single channel and caching it on startup with a massive bot

#

That sounds like hell

quartz kindle
#

good thing nobody does that

wheat mesa
#

4 hours later

boreal iron
#

the more you know the better

wheat mesa
#

ā€œMy bot is finally online!ā€

#

Hey fake

#

I’m in English class again šŸ˜‰

boreal iron
#

Give me the number of your teacher... I will call him and tell him you're a bad boy

#

Now!

wheat mesa
#

Pffft she doesn’t care

earnest phoenix
boreal iron
#

pretty good teacher

earnest phoenix
#

me when the word wrap

wheat mesa
#

There’s a certain point where teachers stop caring about what you do in their class because you’re old enough to know that it’s your education not theirs

lyric mountain
earnest phoenix
wheat mesa
#

There’s a few of my teachers that care

lyric mountain
#

not if u enforce item count

wheat mesa
#

Most don’t though

lyric mountain
#

like, force 4 items per row

#

then it WILL fit 4 items in a row

boreal iron
#

I'm actually so done with modals as they don't support anything other than text input, right before the feature really makes it way into discord

wheat mesa
#

I can see it being way more useful in the future

boreal iron
#

only if it will support other fields

wheat mesa
#

Maybe once they support dropdowns, numbers, etc

boreal iron
#

once

#

2030

#

I mean why can't they publish something after thinking of it a little bit more

proven lantern
#

is there a way to tell intellij where the source code is? /opt/ is a special directory for aws lambda layers.

#

also how can i tell my unit tests where the source code is. i tried this for jest

{
  "jest": {
    "moduleNameMapper": {
      "^/opt/nodejs/(.*)$": "<rootDir>/layer/nodejs/$1"
    }
  }
}
lyric mountain
#

as for unit tests, you probably shouldn't include layer/nodejs/

proven lantern
#

like this?

lyric mountain
proven lantern
#

i have to use /opt/ as the path. that tells aws lambda to load from the lambda layers

lyric mountain
#

intellij doesn't know that, so it yellows the path as invalid

proven lantern
#

i want to tell it

lyric mountain
#

alt + enter -> inspections -> suppress for statement

proven lantern
#

i'm trying to get all the refactoring tools enabled

lyric mountain
#

idk if that's possible at all

proven lantern
#

it might not be

lyric mountain
#

unless you connect intellij to aws

#

which I also don't know if it's possible

proven lantern
#

i have the plugins all setup, and i opened a ticket to see if they can add the feature

lyric mountain
#

it is

proven lantern
hazy pasture
spark flint
#

try js const channel = await client.channels.cache.get("941750305022947331") await channel.send({ content: 'test', components: [row] })

#

idk

wheat mesa
#

Because it doesn’t know what msg is and you never defined client

#

Assuming that’s your whole file

hazy pasture
#

I need to define msg cuz I need to edit the msg later

wheat mesa
#

Is that snippet the only thing in your file?

#

I would assume not since it works without components

#

Do you get an error?

#

Because if I’m looking at these docs right it seems like addComponents() takes an array

pale vessel
#

it does not require an array

wheat mesa
#

In that case I’m going to assume that guild isn’t cached, I don’t know

hazy pasture
#

it's the only guild the bot is in

boreal iron
#

Do you get an error?

hazy pasture
#

no

marble juniper
#

Random but

#

how do I restart the containers in a docker compose only if the images for them have been changed

#

so like I got container 1 and 2 but only the image for 2 changed

#

so only container 2 gets restarted

eternal osprey
#
 if(!category2){
  po2 = await message.guild.channels.create(`COMMUNITY-MONDAY`, {
  type: 'category',
  permissionOverwrites: [
      {id: message.guild.id, allow: ['SEND_MESSAGES']},
      {id: message.guild.id, allow: ['VIEW_CHANNEL']},
      {id: client.user.id, allow: ['VIEW_CHANNEL']},
      {id: client.user.id, allow: ['SEND_MESSAGES']},
  ]
})
 }``` and ```js
  channel2 = await message.guild.channels.create("community-nominates", {
      type: "text",
      parent: po2.id,``` why is this returning me the id undefined error?
sudden geyser
#

where though

#

the error means you're trying to do something.x when something is undefined

#

so where it's occurring is helpful

split hazel
#

Help pls

earnest phoenix
#

oh god i've seen the same code before and don't create an invite link to the guilds your bot joins

sick agate
#

Oh boi

split hazel
#

sorry that was my arch nemesis

sudden geyser
#

guessing sibling

boreal iron
#

Editing a non-ephemeral deferred response with an ephemeral one and vise versa still doesn’t work

#

Is that considered to be a bug or intentionally?

#

Has anyone ever said something officially about that one?

#

@pale vessel usually knows such weird things

pale vessel
#

i don't do weird things unlike a certain person in this channel

wheat mesa
earnest phoenix
# boreal iron Is that considered to be a bug or intentionally?

I've already asked about this in the Discord Developers server, it doesn't work because when you defer the response to the interaction, the "thinking" state becomes the initial response to the interaction, and when you edit it, it doesn't change the response's ephemeral optionality, because you're editing a response, not creating a new one

fallen holly
#

what is this error

Invalid form Body 

  method: 'get',
  path: '/channels/931996787953270843/messages?limit=',
  code: 50035,
  httpStatus: 400,
  requestData: { json: undefined, files: [] }
}

sudden geyser
#

?limit= is suspicious

#

there's supposed to be a number after the =

#

or there could be no reason to include the ?limit= since it'll default to 50

boreal iron
#

But as thinking as response isn’t ephemeral, too it should be in theory to adjust it for the first response (after deferring)

earnest phoenix
#

Yeah, I suggested that the "thinking" state should at least be a separate placeholder instead an initial response placeholder to prevent the upstream response from taking the options the "thinking" state has, but I don't think they'll ever change that

boreal iron
#

Hmm probably not

#

I usually like to display the response non-ephemeral and errors as ephemeral messages

#

But yeah this doesn’t work

#

Guess I gotta do the validation first, then deferring

#

Or set a timeout for error messages being removed after some time

boreal iron
#

Show the associated code to the error

vivid fulcrum
#

you need to parse amount into a number

fallen holly
#

what u mean by that i don't get it

vivid fulcrum
#

right now your amount variable is a string

#

"50" is not the same as 50

#

former is a string, latter is a number

fallen holly
#

ok

vivid fulcrum
fiery stream
#

why does this not start 🄲

split hazel
#

because you have a dream pfp

split hazel
fiery stream
fiery stream
split hazel
#

two very conflicting statements did it or did it not

fiery stream
#

Mostly yes but no i have to have a run def in class so it actually runs šŸ™‚

split hazel
#

is there a method called run_async or something

#

i dont exactly know how python handles this stuff

fiery stream
#

there's a package called asyncio but im not really good with concurrency

split hazel
#

yeah its a blocking call

#

i think you need to do something like asyncio.run(bot.run)

#

then it wont block

#

oh

#

dont use run

#

@fiery stream replace bot.run with bot.start

#

that way it shouldnt block

fiery stream
#

ahhh what if i user asyncio on both of the things web n bot itself

split hazel
#

i dont know but you should use start

fiery stream
#

hmm that solved the issue

#

i think

#

maybe

#

no its not gonna work lel

#

cuz bot.run() is this def

#

ayyy i fixed everything šŸ™‚

split hazel
#

in that case i think you should change that to start

#

nice

fiery stream
fiery stream
split hazel
#

yeah

fiery stream
#

only one works at a time

#

once i control + C the other starts working

#

H!ping

sharp saddle
#

Coding is for the weaks, I use Bot Ghost šŸ˜Ž šŸ˜Ž šŸ˜Ž

vivid fulcrum
#

bot ghost is for peasants

#

i wrote my entire bot with google speech to text

sudden geyser
#

can you use it with google speech

#

would like to join a call and read out commands

fiery stream
boreal iron
#

With that knowledge, soon the google ai will develope own discord bots

fallen holly
#
      if (message.member.id === member.id) return message.reply("You can't put your self in timeout");
                                       ^

TypeError: Cannot read properties of undefined (reading 'id')
    at Object.execute (/Users/dhruvshah/Documents/GitHub/Archer-Bot/Bot/commands/moderation/timeout.js:29:40)
    at Object.execute (/Users/dhruvshah/Documents/GitHub/Archer-Bot/Bot/events/Message/messageCreate.js:45:17)
    at Client.<anonymous> (/Users/dhruvshah/Documents/GitHub/Archer-Bot/Bot/Handlers/eventsHandlers.js:13:58)
    at Client.emit (node:events:402:35)
    at MessageCreateAction.handle (/Users/dhruvshah/Documents/GitHub/Archer-Bot/Bot/node_modules/discord.js/src/client/actions/MessageCreate.js:26:14)
    at Object.module.exports [as MESSAGE_CREATE] (/Users/dhruvshah/Documents/GitHub/Archer-Bot/Bot/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (/Users/dhruvshah/Documents/GitHub/Archer-Bot/Bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:351:31)
    at WebSocketShard.onPacket (/Users/dhruvshah/Documents/GitHub/Archer-Bot/Bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (/Users/dhruvshah/Documents/GitHub/Archer-Bot/Bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
    at WebSocket.onMessage (/Users/dhruvshah/Documents/GitHub/Archer-Bot/Bot/node_modules/ws/lib/event-target.js:199:18

i'm so confused this is my code
https://sourceb.in/wy0VzkW0Fl

lament rock
#

member is undefined

fallen holly
#

it is

  const member =
        message.mentions.members.first() ||
        message.guild.members.cache.get(args[0]) ||
        message.guild.members.cache.find(
          (x) =>
            x.user.username.toLowerCase() === args.slice(0).join(" ") ||
            x.user.username === args[0]
        );
earnest phoenix
#

It wasn't able to get a member mention from the message, get a member from the cache by user ID and get a member by their username

lament rock
#

all of those values returned a falsy value

earnest phoenix
#

Not all members are cached, so be sure to check for that as well, as you might be trying to get an uncached member

simple stump
#

I'm trying to make a suggestion bot by fetching the message ID via a button. However, I get the error that this.options.embeds?.map isn't a function. Can I not fetch the message ID of a message sent?

      const suggestEmbed = new Discord.MessageEmbed()
        .setColor("#99ffb3")
        .setTitle("Suggestion by " + interaction.member.user.username)
        .setDescription(firstResponse)
        .setTimestamp();

      interaction.guild.channels.cache.get("918613584672591912").send({ embeds: makeSuggest }).then((msg) => {
        let msgId = msg.id;
        const row = new MessageActionRow().addComponents(
          new MessageButton()
            .setCustomId("suggest-" + id)
            .setLabel("Make a Suggestion")
            .setStyle("SUCCESS")
        );
        msg.edit({ components: [row] });
      });
earnest phoenix
simple stump
#

Oops wrong embed

#
      const makeSuggest = new Discord.MessageEmbed()
        .setColor("#99ffb3")
        .setTitle("Make a Suggestion")
        .setDescription("If you wish to make a suggestion, click the button below! **Joke suggestions will get removed.**")
        .setTimestamp();
earnest phoenix
#

It must be an array

#

embeds: [makeSuggest]

simple stump
#

OOPS

fallen holly
#

can i put this into a embed

#
  aliases: ["avatar"],
  
  descriptions: "Shows users profile picture",
  cooldown: 5,
simple stump
#

ty

#

mb

sudden geyser
#

yes if you try hard enough

#

just get that object and treat it like an object

#

e.g. ```js
let command = ...; // figure out how to get it

send({ embeds: [{ title: ${command.name} (${command.aliases.join(", ")}) }] });

quaint wasp
#

yo

#

ping in replies

fallen holly
#

how do i add text next to each other in embed

sudden geyser
#

That's just plain old Markdown

#

You'd use ** for bold and a line break to separate the two.

fallen holly
#

how i have it

sudden geyser
#

Not exactly.

#

The difference is you're using fields while the first image is using a single field/description with line breaks.

#

You could use .setDescription instead

fallen holly
#

aight

#

i forgot i could use that

proven lantern
#

is it possible to create a symbolic link in windows that would point to a unix type directory like /opt/nodejs/

#

i mean /opt/nodejs/ would point to c:\something

#

maybe if i run from cygwin

boreal iron
#

just play around with mklink in the command prompt

#

mklink /D ../.. ../..
if I’m not wrong

lyric mountain
proven lantern
lyric mountain
#

It wouldn't be an issue in code since most libs parse the path to the proper format

proven lantern
#

i need to make a symlink at a system level to trick intellij, but i cant make unix links

#

at least i dont think so

#

but i should at least be able to run unit tests

lyric mountain
#

Doesn't intellij understand both forms of path tho?

proven lantern
#

it understands the relative paths using ../, but not absolute paths from the root

lyric mountain
#

No plugins for that?

proven lantern
#

perhaps...

#

good idea

carmine summit
#

How do I insert multiple buttons in an action row using discord.js

let row = new MessageActionRow().addComponents(new MessageButton().setCustomId(`${act.pid}_getLink`).setLabel("GET LINK").setStyle("PRIMARY"));
proven lantern
#

maybe i should just test the small functions and ignore all the integration level functions

proven lantern
#

custom id cannot be the same or else it will give a 4xx error

carmine summit
#

yep

#

thanks!

proven lantern
#

np

proven lantern
carmine summit
#

yep, ive read

#

but dont understand why they have to have a limit for those

#

wait, why didnt the setCustomId show up when I logged the button?

#

wait, it does show up. its just not in console when I logged it.

earnest phoenix
#

How should I handle sending something every x amount of time to a channel a person used a command in.

#

Should I use a interval?

wheat mesa
#

setInterval depending on how long you want it to go on

#

If you want something sent every few days or something though then there’s probably a lib out there for that (not sure if cron is a good choice or not for your situation)

earnest phoenix
wheat mesa
#

Probably best to use cron

bright hornet
#

Im having a problem with my set-prefix command which is the bot not sending back the command,

I'm using slappey package to create my command, here's the code:

in my MessageEvent.js

async run(client, message, prefix) {
    if (message.author.bot) return;
    if (message.content.startsWith(prefix)) {
      const [cmdName, ...cmdArgs] = message.content
      .slice(prefix.length)
      .trim()
      .split(/\s+/);
      const command = client.commands.get(cmdName);
      if (command) {
        command.run(client, message, cmdArgs);
      }
    }```

in my `index.js`:

```js
(async () => {
  client.commands = new Map();
  client.events = new Map();
  let prefix;
  await registerCommands(client, '../commands');
  await registerEvents(client, '../events');
  await client.login(process.env.DISCORD_BOT_TOKEN);

  client.on('messageCreate', async message => {
  
    const PrefixSchema = require("./prefixSchema");
    let data = await PrefixSchema.findOneAndDelete({
      guildID: message.guild.id
    })
    if(data === null) {
      prefix = "?"
    } else {
      prefix = data.newPrefix
      console.log(data.newPrefix)
    }
  })
})();```
wheat mesa
#

Is it necessary to require the schema every single time a message is created..?

bright hornet
#

If i called the prefix outside of (async) im receiving an error such as prefix is not defined

wheat mesa
bright hornet
austere surge
#

wait is that 2 message events

wheat mesa
#

From what it looks like your logic here is backwards

bright hornet
reef pebble
#

I have a heroku server for votes collection, the problem is when the server idles and I get a vote it logs 2 times on my side, is it a problem with top.gg. im not using dbl package to listen for votes. Is there a timeout and retry in top.gg or should I change my code?

wheat mesa
#

You need to check the prefix in messageCreate, and if it passes the check in messageCreate, then run the command

#

You don’t need to pass it to the command every single time

#

That’s a waste

#

Also I just have a lot of questions about this

bright hornet
wheat mesa
#

I think you should rethink most of your design here

#

Because it doesn’t really make sense... at all

austere surge
#

^

bright hornet
austere surge
#

1 why

#

2 i still think theres 2 message events

wheat mesa
#

I don’t know what that is but it still doesn’t make sense regardless

wheat mesa
#

None of this design makes sense

#

I’m not trying to shit on it but I’m just saying that I think it needs to be recreated with more planning

austere surge
#

its supposed to be a really nice easy bot template but tbh its just horribly confusing

bright hornet
#

^

austere surge
wheat mesa
#

Seems like it’s overcomplicating everything

austere surge
#

yes

bright hornet
#

but overall

austere surge
#

i used slappey for a very short bit and hated it

bright hornet
#

its nice

wheat mesa
#

I would have to disagree from looking at it

bright hornet
#

xd

wheat mesa
#

Wdym

earnest phoenix
wheat mesa
#

I’m saying that the design looks flawed and overcomplicated for no reason when you could just use normal djs

austere surge
#

a bot in a single file is better

wheat mesa
#

Uh...

#

Not sure if I agree with that one

austere surge
#

better than slappey* ||imo||

earnest phoenix
#

A bot in a single file is like asking to be pushed off a cliff

austere surge
#

yes

wheat mesa
#

The worst part of it is that it’s easy to get lost in

copper fog
austere surge
#

yes

carmine summit
#

how long does ephemeral interactions last?

pale vessel
#

until you dismiss the message or close the app?

carmine summit
#

but the message isnt dismissable

#

do I have to add the ephemeral tag into the reply or to the buttons?

#

seems like I need to add it to the reply...

#

what does ephemeral do to the buttons?

austere surge
#

wdym

carmine summit
#

wait nvm im so dumb, you cant put ephemeral in buttons

rocky hearth
#

why would <Interaction>.channel_id could be undefined? coz a interaction should definitely come from a channel

marble juniper
#

well

#

context menus maybe

#

but idk

pulsar bone
#

you need to learn basis of English

dry imp
pulsar bone
# dry imp who?

besides if you really think this is a basis thing why don't you just tell me instead of being a helpless person

dry imp
#

why must i tell u?

#

why dont u figure the simple things urself?

pulsar bone
dry imp
#

im not obligated to help you, i ask you to learn the basics because it is all in the basics of python, if you know the basics then you should have your answer. I just dont want to spoonfeed small things because it tends to make people lazy and ask another simple question instead of learning abt them or searching them online.

#

hope you understand

pulsar bone
#

and fetch is a part of discord.py which not the basic of python

pulsar bone
#

not just asking simple question