#development

1 messages · Page 1823 of 1

eternal osprey
#

i am using presenceupdate, but i don't stream nor do i know anyone that does.

sly sierra
#

For a stream status you don't need to stream

#

you just have to link an account

eternal osprey
#

owh wait really

#

how would i enable that

#

aha

quartz kindle
#

pretty sure you can put any twitch url there

bright thorn
quartz kindle
#

the stream doesnt need to be yours

bright thorn
# bright thorn

i got error be like thius

  • b.defer is not a function
  • Unknown interaction
#

any one can tell me how can i solve

eternal osprey
#

or wait

#

noo

#

i need to have the streaming presence myself

#

not my bot

#

as i want my bot to be detecting me

quartz kindle
#

then you cant. to put it on yourself you have to be streaming yourself

eternal osprey
#

ah shit

#

don't really know whether this is the right channel

#

client.on("presenceUpdate", (oldPresence, newPresence) => {
  if (!newPresence.activities) return false;
  newPresence.activities.forEach(activity => {
      if (activity.type == "STREAMING") {
        const newid = newPresence.user.tag
        const streamer = guild.members.fetch(newid)
        const streamerlogs = streamer.roles.cache.array()
        console.log(streamerlogs)
          console.log(`${newPresence.user.tag} is streaming at ${activity.url}.`);
      };
  });
});```would this only be activated when someone changed their activity to streaming? So not people who are already streaming?
#

none channel here

lyric mountain
#

but like, only if using the desktop client, not the browser one

worthy ivy
#

i am going crazy, anyways heres my problem
(node:21976) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of null

triggering on line 72:28, which is
message.guild.id
i suspect this being DISCORD API BEING AN IDIOT but eek
this USED to work.

#

thats my code, is it because its literally at the top of the listener?

#

and yes, i need help because new commands dont get pushed for some reason qpxoxo

marsh bluff
worthy ivy
#

like this

marsh bluff
#

yea something like that can work

worthy ivy
#

tf well that fixed the error but

#

now my new commands arnt being seen in the help command

#

which is dynamic

#

and i cant execute that command for some reason

pale vessel
#

You might have messed up some properties in those new commands then

worthy ivy
#

i copied paste the code from another command, and i put them in a new command

#

grr this is weird

pale vessel
#

Check again

#

Exdee

worthy ivy
#

no? the properties look fine

#

and other commands still work

#

ill try logging the command in console if anything would work

#

one sec

pale vessel
#

Debug too

#

Log all the commands in your help command

#

Make sure the new commands are there

peak patrol
#

Hi guys

#

I need help

#

In my bot I wanna do something like this:

#

I need help in a script
Actually
exemple:
.hat
bot answer: message1
.hat
bot answers: message2
.hat
bot answers: meaage3
ect...

worthy ivy
peak patrol
#

I think so

#

Idk what script should I use

peak patrol
worthy ivy
#

@pale vessel i logged other commands, it worked perfectly

#

EXCEPT FOR THAT ONE STINKY COMMAND

peak patrol
#

...

#

I need help here?-

worthy ivy
#

i-

#

wtf

#

I ADDED A NEW COMMAND

#

AND I LOGGED IT

#

AND IT WORKED?

peak patrol
#

Helloooo?

#

I need help in a script
Actually
exemple:
.hat
bot answer: message1
.hat
bot answers: message2
.hat
bot answers: meaage3
ect...

worthy ivy
#

oh wait.

peak patrol
#

._.

worthy ivy
#

im going to fking SMASH MY LAPTOP

#

HOLY FUCK

#

IVE BEEN DEBUGGING THIS SHIT PROBLEM FOR 4 HOURS STRAIGHT AND THAT WAS THE PROBLEM?

#

IM GOING TO FKING AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

#

ok to the mods, im sorry :>

peak patrol
#

....

#

I need help in a script
Actually
exemple:
.hat
bot answer: message1
.hat
bot answers: message2
.hat
bot answers: meaage3
ect...

#

please

worthy ivy
peak patrol
#

someone helps me

peak patrol
#

I'm new

worthy ivy
#

i-

#

how are you a bot dev

peak patrol
#

well I didn't developpe my bot for that

#

I use some other commands

#

not these

#

It's my first time trying to do this

#

can you DM me?

worthy ivy
#

oh so like 1 bot and 2 owners?

#

and youre one of those owners?

peak patrol
#

Yes

#

I'm the first official owner

#

I created the bot

#

and i started the idea of the bot

worthy ivy
#

but the other owner, they code everything?

peak patrol
#

No

#

They are just helping me with the ideas

#

I just use one command that I copy and paste and just change the content

worthy ivy
#

but who codes them?

peak patrol
#

I coded everything

peak patrol
#

the other owner helped me with the idea of the stories

peak patrol
#

we have an embed code

#

I change its content

#

and use the same code everytime

#

uc?

worthy ivy
#

do you even know what language you are coding in

peak patrol
#

Yes

#

ofc i do

worthy ivy
#

and that is?

peak patrol
#

js

#

and im using replit

worthy ivy
#

im sorry if i sound really angry rn, i just experienced the most shitty programming moment of my life

peak patrol
#

Oof

#

so you cannot help me in this?

worthy ivy
peak patrol
#

oof

#

alr

worthy ivy
#

my mind is melting and i might just throw a fit if i try to help lmao

peak patrol
#

thanks cya

pale vessel
#

Rookie mistake wearybread

eternal osprey
#
    if (activity.type == "STREAMING") {
        const newid = newPresence.user.id
        const streamer = await guild.members.fetch(newid)
        const streamerlogs = streamer.roles.cache.array()
        console.log(streamerlogs)
      };```hey streamerlogs contains: [Role, Role, Role , Role]. So basically an array with 4 role properties. How would i loop through each one of them and get their name
#
i already tried: for (const names of streamerlogs){
console.log(streamerlogs.name)}
peak patrol
#

@pale vessel can you help me in this?

#

I need help in a script
Actually
exemple:
.hat
bot answer: message1
.hat
bot answers: message2
.hat
bot answers: meaage3
ect...

pale vessel
#

What do you code in?

peak patrol
#

node.js

pale vessel
#

How many messages, 3?

peak patrol
#

yup

#

3

pale vessel
#

Or is it some sort of a counter?

peak patrol
#

3

pale vessel
#

Just three different messages, does it reset after the third one or what

peak patrol
#

Like OwO bot

#

y'know

pale vessel
#

I don't LUL

peak patrol
#

oh

#

When you write a command like .hug

pale vessel
peak patrol
#

it gives you a gif

#

u write .hug again

#

it gives you another gif

#

you write it again it gives another one

#

ect

pale vessel
#

Wouldn't that just grab a random element from an array?

lyric mountain
#

that's just a random reaction api

peak patrol
#

?

pale vessel
#

streamerlogs.name would be undefined

lyric mountain
# peak patrol ?

you make a GET request to some reaction api, which will return a random gif

#

or you make an array wil many gifs, and get a random entry

umbral lake
#

When I react in a reaction, the bot does this: ```js
client.on('messageReactionAdd', (reaction, user) => {
console.log('a reaction has been added');
});

but the bot dosen't send the message :/
peak patrol
pale vessel
#

Send what message?

lyric mountain
#

that's because you're getting the whole array

#

you need to get a single entry

umbral lake
#

me?

lyric mountain
#

like array[Math.random() * array.length]

pale vessel
umbral lake
peak patrol
#

Can you dm me so you explain it more to me?

pale vessel
#

Do you have the GUILD_MESSAGE_REACTIONS intent?

pale vessel
#

Did you possibly react to an old (messages sent before the bot started) message?

umbral lake
#

yes

pale vessel
#

You need to enable partials to support that

umbral lake
#

how?

pale vessel
#

REACTION one

umbral lake
#

only reaction?

pale vessel
#

Sure, if that's all you need

worthy ivy
#

er question
what are intents for in d.js?

pale vessel
#

They're "events" that you "subscribe" to

#

They're not exclusive to discord.js

worthy ivy
worthy ivy
#

thanks

pale vessel
umbral lake
#

I add a reaction in a message but not works

#

I click on a heart and actually I need to recieve a role

#

but nothing

worthy ivy
#

@pale vesselwhat intents should i enable?
so i dont have to screw around them in d.js and not worry

pale vessel
#

How'd you enable it?

umbral lake
peak patrol
pale vessel
peak patrol
#

rq

pale vessel
peak patrol
#

alr

worthy ivy
# umbral lake

are you sure you deconstructed the Intents constructor?

peak patrol
#

exactly
I'm using the embeds
and
let's take this as an exemple
else if (msg.content === ".hat"){
const exampleEmbed = new Discord.MessageEmbed()
.setColor('#0099ff')
.setTitle('One Hat for you :D')
.setAuthor('Little Kiwi')
.setDescription('' )
.setImage('https://i0.wp.com/boingboing.net/wp-content/uploads/2020/02/ezgif-3-6fafa7091356.gif?fit=489%2C408&ssl=1') .setTimestamp()
.setFooter('');
msg.channel.send(exampleEmbed);
}
});

Alr
and as i said earlier
i wanna do something like
when they write .hat

they get this
But when they write it again
they get something else

#

See what I mean?

worthy ivy
#

like ```js
const { Intents } = require('discord.js')

peak patrol
#

._.

worthy ivy
peak patrol
#

well nvm i give up

worthy ivy
pale vessel
umbral lake
#

I do what so?

pale vessel
peak patrol
#

Imma try

pale vessel
#

Don't you need message events?

#

So GUILD_MESSAGES

umbral lake
#

oof

pale vessel
#

What about member presences, like online status, activities, etc.

#

That would need GUILD_PRESENCES

worthy ivy
#

what does GUILD_BAN do?

#

makes the client ban people?

pale vessel
#

GUILD_BANS, the ban list

umbral lake
worthy ivy
pale vessel
#

Yeah, but you can fetch it even if you don't have the intent

#

IIRC

#

Unless you need the intent to fetch it too

peak patrol
#

It worked

worthy ivy
#

i see, i dont have the unban command so ill just put the intent whilst i still have it mmLol

peak patrol
#

thanks

pale vessel
#

Look here and make sure all the events you use are present

#

Otherwise it just won't trigger

#

@umbral lake I'm not sure what's wrong, sorry

#

Enabling partials should make the client emit partial events

worthy ivy
#

i see, so ['GUILD' , 'GUILD_MESSAGES', 'GUILD_PRESENCES, 'GUILD_BAN'] for now.

pale vessel
#

Sure

worthy ivy
#

thanks for the advice KEKW

pale vessel
#

You can pass the array directly to ClientOptions

#

Intents class isn't really needed

#

GUILD_BANS BTW

#

Just in case

worthy ivy
#

?

pale vessel
worthy ivy
#

@pale vessel this correct?

const client = new Discord.Client({
    presence: {
     status: 'online',
     activity: {
      name: 't!help',
      type: 'LISTENING',
     },
    },ws: {
      intents: ['GUILD' , 'GUILD_MESSAGES', 'GUILD_PRESENCES', 'GUILD_BAN']
    },
 });
pale vessel
#

Try it

worthy ivy
#

and it was GUILDS and not GUILD

#

lmao

#

RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number.

pale vessel
#

There's one more, but w/e

#

Guess you'll figure it out

worthy ivy
#

yeah lmao

#

GUILD_BANS, not GUILD_BAN

pale vessel
#

Don't say I didn't warn you mmLol

worthy ivy
#

gl to my bot having the correct intents, then

pale vessel
#

Ah, GUILD_BANS has nothing to do with fetching the ban list

#

It's for the GUILD_BAN_ADD and REMOVE events

#

If you need those for example logs then yeah

worthy ivy
#

error is (node:31936) UnhandledPromiseRejectionWarning: TypeError: Cannot set property 'prefix' of null

#

im going to go crazy man how do you set properties again

pale vessel
#

Ah wait but you need fetchprefix.prefix if it exists

worthy ivy
#

yep

#

wait wait

#

lmao

pale vessel
#

So const fetchprefix = (await prefixSchema.findOne(...))?.prefix ?? "t!";

worthy ivy
#
  let fetchprefix = await prefixSchema.findOne({
    guildID: message.guild.id
  })?.prefix ?? "t!"```
#

?

pale vessel
#

Do you know what that does?

worthy ivy
pale vessel
worthy ivy
#

?? is basically if(value === null) return "other string"

pale vessel
#

Or undefined yeah

#

You can use it as a substitute for ||

worthy ivy
#

then ?.prefix checks if that property exists

#

if not, it returns undefined

#

then the ?? operator kicks in

pale vessel
#

Damn I wish people learn as fast as you

worthy ivy
#

then it returns "t!" in return

tulip ledge
#

? is optional chaining on an object if that property doesn't exist it returns undefined eg person?.name if person is undefined prefix is undefined
?? is the nullish operator which "triggers" when the left hand variable equals null or undefined

worthy ivy
#

mf i learn shit for school? give me 10 years or more
shit for hobbies? give me 5 mins

pale vessel
#

Ikr

tulip ledge
#

same lol

#

u learn faster if it's actually something you're interested in

worthy ivy
pale vessel
#

Did you use the exact same code?

worthy ivy
#

and yes, i deleted the document from my mongodb

pale vessel
worthy ivy
#

fetchprefix.prefix still returns undefined

tulip ledge
#

yes

#

because

tulip ledge
#

it's fetchfprefix

#

not fetchprefix.prefix

#

Log fetchprefix

pale vessel
#

Yeah

#

"t!".prefix would be undefined

tulip ledge
#

and prefixSchema.findOne().prefix.prefix is also undefined

pale vessel
#

That'll never pass anyway

tulip ledge
#

You're setting the variable "fetchPrefix" to the value of prefixSchema.findOne().prefix ?? "t!" aka there's never a property prefix on fetchPrefix

worthy ivy
#

oh

#

wait

#

ok now it returned t!

#

wooh, it works

#

thanks guys

#

and TIL about ? and ??

tulip ledge
#

TIL?

worthy ivy
#

today i learnt/learned

pale vessel
#

Reddit

worthy ivy
#

time to push to github/heroku, thanks for all the help

rocky hearth
#

what is the max size of image in embed?

pale vessel
#

Less than 8 MB

#

Including the message itself

#

Or you mean resolution?

rocky hearth
#

No i meant the size, similiar to user.avatarURL({ dynamic: true, format: "png", size: 1024 })

#

yes, resolution

pale vessel
#

I'm sure it depends on the file size than the resolution

#

You can also do some experiment I suppose

tulip ledge
#

I think you'll hit the file size limit before you hit the resolution limit

pale vessel
#

Yeah

#

You can do a little 🗜️ though

rocky hearth
#

embed.setImage(user.avatarURL({ size: 1024 })) - here what should be my max size

pale vessel
#

Ah

#

4096

rocky hearth
#

but embed looks similiar in both sizes

pale vessel
#

Are you on phone or desktop?

rocky hearth
#

desktop

pale vessel
#

I think Discord resizes it anyway using the width and height query parameter

rocky hearth
#

yeah thats what I'm asking, what is that width and height

#

or is it not a matter of concern, and I can go safely with max size of 4096?

pale vessel
#

Naw, as in Discord downscales it

#

4096 might be a bit too much

#

I'd say 1024 or 2048

lyric mountain
#

don't think you can use query params to get anything bigger than 512

pale vessel
#

I think it's only for smaller resolutions (mainly for thumbnails)

tulip ledge
#

16-4096

lyric mountain
#

oh, you can

#

flaz pfp stopped at 1024

pale vessel
#

It's the maximum width for mine

earnest phoenix
#

Guys help me find the original google play console site

pure lily
#

Do you know a host that has a ping lower than 30ms?

peak patrol
#

Yall

#

B)

peak patrol
#

I discovered the script

#

of random messages

#

var cute = [ 'picture1idk', 'pic2', 'pic3', 'pig4' ] let cutepics = cute[Math.floor(Math.random() * cute.length)] msg.channel.send(cutepics)

#

And it works!

#

:D

#

ofc you add

#

else if (msg.content === " ")

cinder stratus
#
const { value } = await this.client.db.collection("guilds").findOneAndUpdate({ id }, {
    $set: {
        [`settings.${clientID}.${data.key}`]: data.value,
        [`settings.${clientID}.${data.key2}`]: data.value2,
        [`settings.${clientID}.${data.key3}`]: data.value3,

    }
},
    {
        upsert: true,
    });
``` hey anyone has any idea like how I pass a object which will be directly updated to db rather than doing this
peak patrol
#

hmmmm

#

wdym exactly?

cinder stratus
#

I'm trying to update key value data inside a object

peak patrol
#

Oh sorry I have no clue :|

cinder stratus
#
const { prefix, appID } = require("../config.js");

module.exports = {
  guilds: {
    data: {
      [appID]: {
      prefix: prefix,
      someKey: someValue
      }
    }
}
#

and this is my data structure

tulip ledge
#

wait, what are you trying to do?

sacred aurora
cinder stratus
#

yeah I noticed that and I fixed but still

#

I want to pass an object directly to db rather than using key2, key3

#

and then setting the value

tulip ledge
#

is that mongodb?

cinder stratus
#

yep

brittle shoal
#

Assalamualaikum

tulip ledge
#

I mean can't you just do

const object = { ... };
await findOneAndUpdate({ id }, { $set: object });
cinder stratus
#

I'm storing data for multiple clients

tulip ledge
#

I'm not following

#

what are you trying to do exactly?

#

You want to pass that object to the db?

cinder stratus
#

yes

tulip ledge
#

Right and it has to be a string to pass it?

#

it's like key value?

cinder stratus
#

ye

tulip ledge
#

(I don't use mongo)

#

Alright

#

Whats the key and whats the value?

#

appID.prefix: prefix

#

Like that?

cinder stratus
#

yes

tulip ledge
#

right and

#

why is appID an array?

cinder stratus
#

I wanted to make it like for multiple clients like obj inside obj

#

like one guild document for 3 of my bots

tulip ledge
#

ok

cinder patio
#

That's not an array

#

That makes the value of appID the key

cinder stratus
#

yes

tulip ledge
#
function insertIntoDB(object) {
  const clientIDs = Object.keys(object.guilds.data)[0];
  let output = {};
  for (const clientID of clientIDs) {
    for (const key of Object.keys(object.guilds.data[clientIDs]) {
      output[`settings.${clientID}.${key}`] = object.guilds.data[clientIDs][key];
    }
  }
  return output;
}

let object = insertIntoDB(YOUROBJECT);
await findOneAndUpdate({ id }, { $set: object }); 
#

Would this do?

#

I don't use mongodb so I may have miss interpreted something

cinder stratus
#

hmm

#

can you like explain that function I'm understanding few things

#
    const { value } = await this.client.db.collection(this.collection).findOneAndUpdate({ id },
      {
        $set: {
          [`data.${this.client.id}.${obj.key}`]: obj.value
        }
      }, {
        upsert: true,
        returnOriginal: false,
        projection: { _id: 0 }
      });
``` even this is not working
tulip ledge
#

Well I get the array of appID's (your client id's) then I'm looping over them so we can set the keys for each client, then we loop over the keys of the object to then set the key for each client to it's respective value which should return an object that you can then use

cinder stratus
#
obj = {
key: "prefix",
value: "-"
}
tulip ledge
#

Oh nvm I think your client id is undefined

cinder stratus
#

Can you like wait for few minutes. I'm taking my dinner now :/

tulip ledge
#

Maybe

cinder stratus
#

Thanks

#

It will just take few minutes I eat really fast tbh

#

Lol

cinder stratus
#

?

cinder stratus
#

@tulip ledge

#
  async update(id, obj) {
    const { value } = await this.client.db.collection(this.collection).findOneAndUpdate({ id },
      {
        $set: {
          [`data.${this.client.user.id}.${obj.key}`]: obj.value
        }
      }, {
        upsert: true,
        returnOriginal: false,
        projection: { _id: 0 }
      });

    this.cache.set(id, mergeDefault(this.defaults, value));
    console.log(this.cache.get(id))
    return true;
  }
eternal osprey
#
 if(streamer.roles.cache.has(role1.id)){
         console.log('test')
         streamer.roles.add(role15)
       }else{
        streamer.roles.remove(role15)
       }```hey i basically have this function that adds a certain role to a user if it is streaming. How would i make sure that this else statement works? because right now it doesn't (probably because it is not being updated).
#

Should i use a setInterval on the else statement?

#

or something

split hazel
#

does it not remove the role

#

streamer btw

eternal osprey
#

no. I removed the role1 from the streamer, but no change in role removal.

split hazel
#

i mean the else statement only works if the person doesn't have the role1 role

eternal osprey
#

Yeah, I removed it after the user had the role.

#

So I first checked added role1, so that gave a certain role to the streamer. Then I removed tole1 and It should remove role15 again.

#

but it doesn’t.

#

Its because there is no event triggering it.

#

I will put an interval on that code for like a minute.

#

On the else statement

#

Or else if there is a more efficient way?

stoic iron
#

hello, I wanted to know how the verification of bots in discord works.

umbral lake
#

I have this:
I console.log this: const apresence = message.author.presence.activities
how to get the state?

eternal osprey
#

Hey! I have a bot that adds a role to someone that is streaming. I also want to remove the role once someone stops streaming, but it doesn’t work. It logs nothing and doesn’t error:

it sadly still didn't delete the role15:```js
if (!newPresence.activities) return false;
newPresence.activities.forEach(async activity => {
if(oldPresence.activities.some(x => x.type == 'STREAMING') && !newPresence.activities.some(x => x.type == 'STREAMING')){
const newid = newPresence.user.id
const streamer = await guild.members.fetch(newid)
streamer.roles.remove(role15)

}
if (activity.type == "STREAMING") {

    const newid = newPresence.user.id
    const streamer = await guild.members.fetch(newid)
    const streamerlogs = streamer.roles.cache.array()

    if(streamer.roles.cache.has(role1.id)){
      console.log('user has founder role')
      streamer.roles.add(role15)
      
    } 
  }
  ```
#

(I am using precenseupdate btw)

#

ping me with the answer please!

umbral lake
#

But why apresence.state not works?

quartz kindle
#

its an array

limber saddle
#

Hello can someone help me? I don't know why it's saying it's undefined i'll post the full code if needed Thanks in advance!

pale vessel
#

How did you define User?

limber saddle
pale vessel
#

And you provided an ID?

limber saddle
#

Yeah

pale vessel
#

The member might not be cached, use fetch

#

await guild.members.fetch(id)

limber saddle
#

okay i'll try

#

uhhh i kinda forgot how to use await didn't develop a discord bot in a long time

rose warren
proven lantern
#

is 1msg.author.bot the best way to check if a message comes from a bot?

boreal iron
#

Yeah as it’s a boolean value

eternal osprey
lyric mountain
#

tbf it's the only way to verify

rose warren
# eternal osprey Anyone that knows the answer?

You're returning false if there are no activities. I'm not really familiar with the way activities work or how you're checking but maybe you should try without that line? Or code it another way. Basically what I mean is if they stop streaming and have no activities on their new presence data it'll return before it gets a chance to remove the role.

#

Maybe return if the new presence has no activities set and the user doesn't have the streaming role

eternal osprey
#

Or wait actually, stopping a stream is still seen as an activity as the presence changes.

rose warren
#

Tbh I'm watching Netflix so I didn't read through the rest of your code.

rose warren
limber saddle
eternal osprey
#

It returns nothing

rose warren
eternal osprey
#

It’s like that 2nd If statement just gets skipped or something

#

Yeah I will try that and let you know

rose warren
#

Your first line is saying "if the new presence doesn't have activities, ignore everything that follows this line" which is what happens every time they stop streaming.

quartz kindle
#

that code can be simplified a lot

rose warren
#

That also

quartz kindle
#
const oldStream = oldPresence.activities.find(a => a.type === "STREAMING");
const newStream = newPresence.activities.find(a => a.type === "STREAMING");
if(!oldStream && newStream) {
  // user started streaming
} else if(oldStream && !newStream) {
  // user stopped streaming
}
eternal osprey
#

alrighty. Thank you so much guys

rose warren
split blade
#

How would I modify this RegEx so that it will only capture if the full parameter is matched instead of just part of it?

trim nexus
#

/\.(gif|jpe?g|tiff?|png|webp|bmp)$/i

#

top answer in developer's best friend site

split blade
#

Ah ok! Cheers G

earnest phoenix
#

I need someone to create a bot for me? For the Olympics

tawny silo
#

I make my own bot but i don't know why my bot don't move to voice channel

#

when I check bot's voice_clients, it gives me an empty list

#

I'm doing my bot with python

ripe prairie
#

send code

tawny silo
#

how can I put my code in discord

ripe prairie
#

`

code

`

tawny silo
#
    async def join(self, ctx):
        print("join")
        if ctx.author.voice and ctx.author.voice.channel:
            channel = ctx.author.voice.channel
            await channel.connect()
        else:
            await ctx.send("not in voice channel")
#

in the class and self.__bot = bot

#

in main file I add this code

#
bot.add_cog(myclass(bot))
bot.run('token')
ripe prairie
gilded olive
#

ok there are 2things I'm wondering here, if you're in a class why is @commands.command() not @commands.Cog.listener()?

#

The code you copied should be indented back by one

tawny silo
gilded olive
ripe prairie
#

@gilded olive

#

Cog.listener() is an event

ripe prairie
tawny silo
#

oh got it

gilded olive
#

oh im fucking retarded

#

been a minute since i used dpy 😭

tawny silo
#

which language is better to make bot golang and python?

ripe prairie
#

there's no "better" language

#

unless you need a specific use-case

#

it's just whichever you prefer

tawny silo
#

got it

#

oh I handled it

#

pip install -U discord.py[voice]

ripe prairie
#

yeah you needed the voice part of it too

tawny silo
#

how can I install it full feature?

ripe prairie
#

once you dl the library i think you should have it

gilded olive
tawny silo
#

Are there other options?

gilded olive
#

nope

tawny silo
gilded olive
#

yes

tawny silo
#

thanks @gilded olive @ripe prairie

#

Really appreciate it

ripe prairie
#

👍

tawny silo
#

oh sorry another question

#

should I add this code using commands and events?

gilded olive
#

?

tawny silo
#

await bot.process_commands(message)

ripe prairie
#

shouldn't have to

gilded olive
#

that's for on_message

ripe prairie
#

iirc that's only if you have a on_message bot event in your main file

#

if you have an on message event in a cog, you won't need it

tawny silo
#

oh got it thanks 🙂

lyric mountain
#

@split blade simply don't use [] or quotes

#

[] in regex means char matching

#

and strings don't need to be quoted at all

wheat mesa
#

What's a reasonable permission to require a user to have in order to change the bot prefix?

lyric mountain
#

Manage channels

#

Users with that perm are usually moderators

wheat mesa
#

Alright, thanks!

errant flax
#

for me i think admins should control the bot's config akkoshrug

austere zealot
#
Traceback (most recent call last):
  File "C:\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Python39\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: DataError: invalid input for query argument $1: '![1st](https://cdn.discordapp.com/emojis/866878996863385600.webp?size=128 "1st") Edition Fossi... (a boolean is required (got type str))
```why am i getting this error when my data type for $1 is text?
terse finch
#

in discord.js how do i get a single member object from their ID? I was using await message.guild.members.fetch(ID) but after changing how the code works that no longer returns a valid member object.

austere zealot
gilded olive
#

?

austere zealot
#

did you even read the error?

gilded olive
#

are you updating target_name or target_state

austere zealot
#

yes i am

#
await self.client.pg_dbbbbb.execute("UPDATE hunt SET target_name = $1 AND target_image = $2 AND target_state = $3 WHERE user_id = $4",targetcard['card_name'],targetcard['card_url'],True,ctx.author.id)
gilded olive
austere zealot
cinder stratus
long crow
#
        try{
            await interaction.defer();
            if (interaction.options.getSubCommandGroup() == 'anime') {
                if(interaction.options.getSubCommand() == 'trending') {
                    const trend = await new Anilist().getTrendingAnime();
                    if (trend == 'no data found or unexpected server error!') {
                        return interaction.editReply(trend);
                    }
                    else {
                        const descArray = [];
                        for (const trending of trend) {
                            descArray.push()
                        }
                        const embed = new MessageEmbed({});
                    }
                }
            }
        }
        catch(error) {
            console.warn(error);
        }``` with new subgroup and subcommands be like `if else` everywhere
lyric mountain
#

They just say can or can't

flat copper
#

Can we create threads by discord.js bot?

long crow
#

with master branch, yes

flat copper
#

Oo

earnest phoenix
#

What is the difference between Google Cloud functions and Firebase functions

long crow
flat copper
#

Oo find it

#

Nvm

errant flax
long crow
#

If I have the confident sure

errant flax
#

without installing any api wrappers for discord m_keklaugh

long crow
#

not now

#

I'm able to make wrappers for my own bot mostly now, but taking to that level, maybe a few more steps

#

I mean like Jikan, trivia, anilist etc..

dusky harbor
#

does the mass ban cause discord api abuse?

wheat mesa
#

?

#

You mean like attempting to ban a lot of members in a server at once?

#

I believe it does count as API abuse

dusky harbor
#

i see

wheat mesa
#

The only reason you would do that though is probably for nuking, which is against ToS

errant flax
#

or raids/j

dusky harbor
#

there could be more reasons, my friends did it to mass ban dm advertisers whose ids they found through some kind of intel or something

errant flax
#

now i think of it i think my bot shouldn't kick members with anti-raid on misosface

#

imma make it lock channels instead pd_pepethumbsup

sage bobcat
#

One message removed from a suspended account.

errant flax
#

Heyo

long crow
#

HI rainbow applemmLol

sage bobcat
#

One message removed from a suspended account.

errant flax
#

LMaO an Apple

long crow
#

See, it's an apple

errant flax
#

i dont get it misosface

#

u mean the status bonk

long crow
#

It look like apple at one glance, hence the apple

earnest phoenix
#

did somebody say apple

worthy ivy
#

watch me install discord.js@junior musk and break everything

#

but first, were gonna do a funny and switch command handlers so i dont barf in my index.js

#

actually nvm

#

im lazy as shit

worthy ivy
#

DDI I JUST PING SOMEONE

#

HOLY SHIT IM SO SORRY

sly sierra
#

omg you pinged dev!!11

#

ban

pastel axle
#

?

long crow
#

HI dev

worthy ivy
#

funny pun bc arrow functions right lol XD!!!!111!!
send help

earnest phoenix
boreal flume
#

How do I set up Discord OAuth-2 on a python webserver?

cinder patio
#

like you would on any other server?

rocky hearth
#

I want ts to ignore this error A function whose declared type is neither 'void' nor 'any' must return a value.
but not with ts-ignore

#

is there any config setting for that?

small tangle
#

i mean this doesnt sound like a warning which can be ignored monkaHmm are you sure you return the right thing?

rocky hearth
#

I dont want implement the methods yet for clasess

cinder patio
#

Then use abstract classes?

rocky hearth
#

heck yeah! Then I'll remove it later

#

now Im getting this

cinder patio
#

make those methods abstract too

wheat mesa
#

Is that... comic sans?!

worthy ivy
#

WHY

#

PLEASE USE ANYTHING OTHER THAN FKING COMIC SANS

rocky hearth
#

comic sans, for code lens text, yeah

worthy ivy
#

based

#
        let reason2 = args.slice(1).join(' ')
        let reason = `Kicked by ${message.author.tag} with reason "${args.slice(1).join(' ')}"`

        if(!reason2){ 
            reason = `Kicked by ${message.author.tag} with no reason provided.`
        }

        target.kick({reason: reason})```
summer acorn
#

try using ${reason} instead

#

it may not seem it, but it is different

worthy ivy
worthy ivy
summer acorn
#

ah

cinder patio
#

In this case it wouldn't be different though, just unnecessary

worthy ivy
#

then that stupid [object Object] appeared

#

then i just changed it back to target.kick(reason)

#

still worked, no errors was slapped at me

cinder patio
#

what version are you using?

worthy ivy
#

v13

cinder patio
#

yeah, kick only accepts a string as the reason

#

ban accepts an options object

#

next time look at the docs because it's written clearly

earnest phoenix
#

how to make a command accessible to voters only in discord.py??

umbral lake
#

Hey, its my code:

client.on("presenceUpdate", function(oldMember, newMember){
    console.log(`a guild member's presence changes`);
    const guild = client.guilds.cache.get("771849019160920065")
    const role = guild.roles.cache.get("839493194680238100")
    const apresence = newMember.user.presence.activities
    if(apresence[0].state.includes(".gg/aruna")) {
        newMember.user.roles.add(role)
    } else {
        newMember.user.roles.remove(role)
    }
});

and apresence[0].state is undefined 😔

rocky hearth
#

if I do, client.emit("guildMemberAdd", message.member).
Will this trigger event for other bots too, which are in the server?

#

or will it be triggered only for my bot?

cinder patio
#

yours only

#

imagine if that wasn't the case lmao

earnest phoenix
#

Anyone know TRNs api well

rocky hearth
#

how do I make the bot.db of JsonDB type

#

currently bot.db is any

quartz kindle
#

with ts

#

or create a jsdoc typedef

cinder patio
#

JsonDB 👀

pale vessel
#

@ MILLION

woeful pike
#

if jsondb doesn't have typescript declarations ur out of luck

vapid reef
#

just create a type file

#

type.d.ts

winged juniper
#
client.on("channelCreate", async channel=>{
  console.log("create a new channe" +channel.name)
})

How i know who create a channel

quartz kindle
#

you need to fetch audit logs

winged juniper
#

How

quartz kindle
winged juniper
#

Thank you

vapid reef
#

is there a way by which i can add a piechart to an embed

#

like i have data on the go, so the pie chart should be rendered at that moment

#

when the user triggers the command

wary flame
#

Render the piechart on the server and attach the rendered image to the embed

vapid reef
#

yes how to create the image, any libraries that help with this?

wary flame
#

If you're using js you can use canvas

#

(npm package)

pale vessel
earnest phoenix
#

How can I make my bot display the number of guilds it’s in on a webpage

#

There’s a bot called bastion that does it but I have no clue how

vapid reef
#

thanks

devout vapor
#

AAAAAH i think i messed something up 🥺 i have always used heroku to host my bot but then today i decided instead of saving the code to github and reloading it on heroku, i used node index.js on the terminal of my visual studio code 😭

and now im getting this error:
MongooseError: Operation reactionsschemas.findOne() buffering timed out after 10000ms

and every command that i used comes out three times D:

#

does anyone know how to fix this 🥺

vapid reef
#

your db isn’t responding

#

check if your db is on

devout vapor
#

it is D:

vapid reef
#

also check the allowed ip addresses on your db’s security page

devout vapor
#

it has my IP address on it too T.T AAAH regrets, why did i do that tsk.

vapid reef
#

hm just press ctrl + c

#

it’ll shut the bot down

#

push to github

#

ez

devout vapor
#

AH THANK YOU i will try that!!

rocky hearth
near stratus
devout vapor
rocky hearth
#

How can I get a the join order of a member in a server?

quartz kindle
# rocky hearth yes by, jsdoc
/**
 * @typedef JsonDB
 * @type {object}
 * @property {string} id - an ID.
 * @property {string} name - your name.
 * @property {number} age - your age.
 */

/** @type {JsonDB} */
``` example
near stratus
#

do this for all

amber wagon
#

Is it a good idea to use discord to host images for bot instead of imgur ?

near stratus
rocky hearth
#

ooohh! that would alot of work.
How did than yggdrasil does that, for --userinfo command?

amber wagon
#

thats what i was concern about thanks

rocky hearth
#

yggdrasil bot, is somewhat popular for welcome and leave message images

near stratus
#

oh never heard of it (always used mee6)

long crow
#

canvas? I mean for the image

near stratus
eternal osprey
#

hey, so my bot creates a role named to himself as i am inviting the bot with permissions to the server. I changed the role positioning and put a few roles above the bot role. it then threw perm errors. Is that due to that hierarchy change, or is that just an error from a different source?

eternal osprey
#

nope

#

just changed its role positioning

near stratus
#

What was the error ?

#

you there ?

eternal osprey
#

hey i am here! Sorry!

#

I got a permission error.

#

I tried adding a role to a certain user

#

that had a role that was higher positioned than the bot's role that it got when it joined the server (according to some people it is because i invited him using perms)

quartz kindle
#

the bot cannot assign roles that are above him

eternal osprey
#

Or does that matter too?

#

Would that change if i just invited the bot as administrator?

#

many questions hahahah, sorry.

quartz kindle
#

that matters yes

#

even if the bot has admin, he cannot touch roles that are above him

eternal osprey
#

Okay uhhm... is there any way to make sure that particular role gets all the way on top of those roles?

quartz kindle
#

check their position and send an error message asking the server admins to move them

#

or make the bot create the roles he needs below him

obsidian flint
#

How do I make my bot sends a message when it joins a guild? (discord.js)

eternal osprey
#

how would i check the position?

quartz kindle
#

roles have a position property

obsidian flint
#

tl;dr: how to make discord.js bot send message to a channel on guildCreate

obsidian flint
quartz kindle
#

then you need to find it

vapid reef
#

they rejected my bot

#

last time

obsidian flint
vapid reef
#

for this

obsidian flint
#

also you see this

#

you see the color?

vapid reef
#

i have the code for this, but they rejected my bot because of it

quartz kindle
quartz kindle
vapid reef
#
module.exports = async (client: any, guild: any) => {
    logger(client, 'Server Joined', guild.name);
    //Store Guild
    if (guild) {
        const guildData = guildHelper.joinedGuild(guild.id);
        setGuildCache(client, guild.id, guildData);
        const channel = guild.channels.cache.find(
            (channel: any) =>
                channel.type === 'text' &&
                channel.permissionsFor(client.user).has('VIEW_CHANNEL') ===
                    true &&
                channel.permissionsFor(client.user).has('SEND_MESSAGES') ===
                    true
        );

            const messageToBeSent = await JoinMessage(client, guild);
            channel.send(messageToBeSent);
    }
};
#

here enjoy

obsidian flint
#

basically loop

#

and find

#

but idk how tbh

quartz kindle
#

just look at the code right above

obsidian flint
#

but yeah should be cautious

quartz kindle
#

yes, just take the parts you need

#

and modify them to fit yours

obsidian flint
#

yeah

vapid reef
#

@obsidian flint

quartz kindle
#

thats why it should be opt-in

vapid reef
#

how will it be opt in if the bot just sends it when it joins

obsidian flint
#

guess I should leave it

vapid reef
#

yeah leave it lol

quartz kindle
#

nvm i was thinking about join messages for all members

obsidian flint
#

welp wasted my privacy pass

devout vapor
obsidian flint
#

that's what I'm thinking

devout vapor
#

is there any way to put a delay between messages sent out in a Map? For example:

 client.guilds.cache.map(guild => {
   msg.channel.send(`**${guild.name}** [${guild.id}]\n`)
   //delay here for like 2 seconds           
 })

or something like that? because the delay that i put in right now, doesnt seem to work. Like it will send the first few messages and then stop sending even though the Map isnt done. I just didn't want the bot to spam everything really fast hence the delay :/

quartz kindle
#

no

lament rock
#

you can use a for loop in an async context and use the await keyword. If you need a specific delay like 1000ms, you can await a new Promise which resolves when a timeout is reached

quartz kindle
#

the map function is not even made for this

#

using map for this is double wrong

devout vapor
#

what do you mean? D: i'm sorry, this is just an example i found online for grabbing servers D:

lament rock
#

A Collection can be used as an IterableIterator. GuildManager.cache in this instance is the Collection.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of

The for...of statement creates a loop iterating over iterable
objects, including: built-in String, Array, array-like
objects (e.g., arguments
or NodeList), TypedArray, Map,
Set, and user-defined iterables. It invokes a custom iteration hook with
statements to be executed for the value of each distinct property of the object.

cinder patio
#

Are you using map just to iterate through the collection?

quartz kindle
#

to explain why its double wrong:

  1. the map function is used to convert an existing list/array/map to a new list/array/map with different/transformed contents. for example:
let array = [1,2,3,4,5];
let newarray = array.map(item => item + 1);
console.log(newarray) // [2,3,4,5,6]

If you are not doing this, then dont use map.

let array = [1,2,3,4,5];
array.map(item => /* do something with item */);
// wrong use of map because nothing is being returned, you are not creating a new remapped list
devout vapor
#

OH O: I did not know that, sorry about that! This is my first time using map, hence the confusion over delays and stuffs.

lament rock
#

The return value would be an Array of Promises who's state is pending

quartz kindle
#
  1. array looping functions such as map, forEach, etc, are synchronous, they cannot have delays between them, because they wrap around functions. for example:
let array = [1,2,3,4,5];
array.forEach(item => /* do something with item */);

is the same as doing this:

for(...) {
  function temp(item) { /* do something with item */ }
  temp(); // the loop runs the function then continues. the function is fire-and-forget, if there is a delay inside the function, the delay works only inside that function and does not affect the execution of all other functions.
}
devout vapor
#

AHHH. that explains why it did not work 🤔 THANK YOU, both of you n.n I will use a for loop for iterations :3

quartz kindle
#

yes, the only way to have a loop with delays its using loops like for and while directly and inside an async context so you can use await

lament rock
#

Promise.sequential when

quartz kindle
#

as for how to loop over guilds, discord collections implement the iterator protocol, which means you can iterate over collection.keys() collection.values() or collection.entries()

#

for example ```js
for(let guild of client.guilds.cache.values()) {
...
}

quartz kindle
#

the moment the promise is created, its already running, i dont think there is a way to create a paused promise

lament rock
#

Imagine pausing a promise

#

could pass a callback to create the promise

quartz kindle
#

you could create a custom Promise class that starts off as paused

#

or that

lament rock
#

None of you would happen to know how to stream raw Youtube googlevideo urls do you? I'm using https and can't figure out why googlevideo is closing the connection immediately

quartz kindle
#

it probably needs some user-agent shenanigans

#

check the sources for ytdl for example

lament rock
#

I set it to My FF's user agent

#

FF was able to stream just fine

quartz kindle
#

maybe theres something more

lament rock
#

That's why I'm asking

#

I tried looking through ytdl-core, but I couldn't find anything immediately obvious since it routes reqs through miniget which I do not use. Miniget must be doing something under the hood

#

Could try using the fake agent it passes there

quartz kindle
#

did you look here?

lament rock
#

I did

#

That's the User-Agent I was looking at

quartz kindle
#

they also do cookie stuff

lament rock
#

That's for get info. I'm referring to stream

quartz kindle
#

so your get request works?

lament rock
#

I get info through youtube-dl binary

#

but my server gets passed a raw yt url sometimes

#

if I proxy get track info that is

#

If the link doesn't match a yt regex, it gets passed to the http source handler which makes a get req

#

So I might need to implement a cookie jar anyways

quartz kindle
#

well idk, you'll have to keep digging

#

i dont think its miniget, i think is the headers

#

like range headers, etc

#

also they use the m3u8 package for streaming HLS instead of miniget

lament rock
#

I don't think m3u8 supports icecast/shoutcast

#

if it does, fuck https then

brave garnet
#

Ey, is here someone who didnt got banned on discord.py server? I just have a one thing - say to them that they should update api and docs... i wanna use threads and it uses old version...

earnest phoenix
#

Bru

brave garnet
#

Yea...

#

i dont want to overuse discord api with 2 instances at once.... (js and pyhton)

split hazel
#

sucks when a free library developed by maintainers in free time don't update their code quick enough

brave garnet
#

Yea...

quartz kindle
#

why would you use both js and py

earnest phoenix
#

Haven't they implemented it on the master branch

brave garnet
#

Because main is made in py and d.py isnt updated so i need to split it up?

quartz kindle
#

no?

#

so what if it isnt updated

brave garnet
#

Docs old and code old

quartz kindle
#

just code it yourself and use the raw methods

brave garnet
#

Bro... weeks of work...

earnest phoenix
#

Or use the bleeding edge version

quartz kindle
#

not really?

brave garnet
#

?

#

what a bleeding edge?

quartz kindle
#

i mean i implemented buttons using discord.js's raw events in an hour

heavy marsh
brave garnet
#

This, but in dpy?

quartz kindle
#

dpy also has raw events

lament rock
#

fork the lib

#

or if it supports loading arbitrary code, do that I guess

earnest phoenix
devout vapor
#

i have a question: i'm currently trying to filter out farming bot servers that invited my bot because i wanted to get it verified and i know that sometimes its being flagged as "inorganic growth".

is there a way for me to kNOW which servers are farming bot servers? 🤔 i googled and most people said to look out for human to bot ratio but i have a lot of friends who have personal servers where they keep their stuffs so its like one person and maybe 5 to 10 bots.

So is there any other way for me to know or look out for? 🤔

lament rock
#

No definite way unless the bot count heavily outweighs the count of users. There is no way to do this though unless you have either of the privileged intents to either have all members sent on GUILD_CREATE or you send a get guild members payload
which you can then use to filter through the members and get counts of bots an users

devout vapor
#

oh yikes, okay okay, thank you!! :3

bitter turret
#

Hello

brave garnet
#

Hi

brave garnet
lyric mountain
#

threads are still on beta, I doubt any library will add on stable release yet

brave garnet
#

Ik but...

lyric mountain
#

they usually wait for official docs to be released

cinder patio
#

detritus maybe

brave garnet
#

Ah, OK.

cinder patio
#

There are no official docs for threads yet?

brave garnet
#

They are

#

But d.py is always a snail

cinder patio
#

same for most libs though

brave garnet
#

Yea...

cinder patio
#

except detritus 🤭

brave garnet
#

?!

cinder patio
#

Erwin must've entered into my accounr again, ignore that 🙃

brave garnet
#

?

#

Selfbot?

#

???!!!

earnest phoenix
brave garnet
#

Working... They're busy swearing in general, not working on docs...

earnest phoenix
#

I've never been in that server and the API references for threads are there, so ¯\_(ツ)_/¯

modest maple
#

v2 has had this for over a month or so now

brave garnet
#

OK. Nvm. I just noticed that search is case sensitive :'D

novel oar
#

It's open beta tho

lyric mountain
#

thanos beta actually

brave garnet
#

?

earnest phoenix
earnest phoenix
brave garnet
#

? I was looking at these supported for my bot...

#

Means that if i imported only discord it can use beta?

earnest phoenix
#

Don't get ya

brave garnet
#

?

#

My imports:

import  discord
from discord.ext import commands

Will this beta work on this ?

novel oar
#

Well as long as you have discord.py 2.0 installed yeah

#

You should use venv btw if you do that

earnest phoenix
#

Don't see breaking changes on that, best check it yourself ig

brave garnet
#

I didn't installed anything. I use replit

novel oar
#

oof

#

I think you can't use it on replit

brave garnet
#

:| meh

novel oar
#

You need to pip install a git repo

brave garnet
#

This is possible

earnest phoenix
#

What repl uses though? pyproject.toml? I guess it supports VCS links

brave garnet
#

There is just Linux

#

And I can do anything

#

So...

bitter turret
#

How do u get ur bot approved?

brave garnet
#

Normally. Waited

#

And got

bitter turret
#

Did u wait for so long?

brave garnet
#

About a week

bitter turret
#

Ok bro

#

Tnx

brave garnet
#

Uw! ;)

earnest phoenix
#

Guys can i ask for a favor

tulip ledge
#

Dont ask to ask

vapid reef
rocky hearth
#

I want to define a property on bot in js like bot.favNum = 10, with help of jsdoc.
is it possible.?

#

I mean bcoz, favNum is any everywhere

errant flax
#

u can always define a property on an object

lyric mountain
#

just declare a public constant somewhere

errant flax
#

or cant u

lyric mountain
#

if that value doesn't change

quartz kindle
#

jsdoc shouldnt control you like typescript does

#

its just documentation, not enforcement

rocky hearth
#

I just want the intellisence, on other files

quartz kindle
#

why not use typescript declarations then?

rocky hearth
#

I can't, I want my project to be at beginner level. I'm teaching js to my freinds

lyric mountain
#

use public constants for immutable values

cinder patio
#

Is bot a function parameter

lyric mountain
#

probably the client itself

rocky hearth
#

nope, bot is instance of the Client

eternal osprey
#

and i need canvas for that projectt

cinder patio
rocky hearth
#

yes
like, I want to access the favNum, (which I could currently, but no intellisence) by, message.client.favNum

cinder patio
#
/**
  @param {require("discord.js").Client} bot
*/

Try this

#

The syntax may be a little different

quartz kindle
#

i dont think thats what they are talking about

cinder patio
#

They want intellisense right?

quartz kindle
#

how did you jsdoc your client?

rocky hearth
quartz kindle
#

yes

cinder patio
#
/**
  @param {import("discord.js").Client} bot
*/

This is correct ^^^

#

try it

#

put that above the function declaration

errant flax
#

whats "jsdoc"

lyric mountain
#

javadoc but js

wary flame
errant flax
cinder patio
#

but he said bot is a function parameter

#

well then

#

is message a function parameter? If it is then do

wary flame
#
/**
* @param {import("discord.js").Message & {client: import("discord.js").Client}} message
cinder patio
#
/**
  @param {import("discord.js").Message} bot
*/
lyric mountain
wary flame
#

Oh nvm

#

Do what @GoogleFeud#8793 said

rocky hearth
#
const bot = new Client()
bot.commands = new Map()

Here, I want my intellisence to know about the commands exists on client

Even if I do message.client.commands.

wary flame
#

Create a custom client class extending discordjs.Client

#

Then jsdoc the custom client class for command function params

cinder patio
#

ya

rocky hearth
#

hmmm, then extending the Client wont even require jsdoc then.

cinder patio
#

but message.client will be the old client

eternal osprey
#

Anyone that knows how i can install canvas on heroku? It keeps erroring out for me.

cinder patio
#

not "old" but the instance without the commands prop

eternal osprey
#

owwh

eternal osprey
earnest phoenix
#

I need 25k probot credit and iam giving it back anyone can do this massege me in private pls

quartz kindle
#

you have to create JSdocs for everything and then chain them together

wary flame
#

Canvas install requires root perms

cinder patio
quartz kindle
#

example

earnest phoenix
lyric mountain
#

not probot's

earnest phoenix
#

I can add you to server with probit and send to me?

wary flame
#

No-

#

Ask in probots server

#

This is not the place

earnest phoenix
#

Ok thanks

quartz kindle
#
 /**
 * @typedef {object & import("discord.js").Client} Bot
 * @property {number} favNum
 */

 /**
 * @typedef {import("discord.js").Message} Message
 * @property {Bot} client
 */
``` something like this
#

not sure how inheritance works in JSdoc

wary flame
#

Just use typescript

quartz kindle
#

they said they cant

wary flame
#

Oh must've missed that sorry

rocky hearth
#

ok lemme try that, rq

quartz kindle
#

you have to create a typedef for your custom properties that extends or includes the client

#

then a typedef for your messages that includes the modified client

#

because im pretty sure adding to an existing jsdoc will not change all instances of that jsdoc everywhere

#

so you'd need to create new jsdocs for everything in your inheritance chain

#

jsdoc is very limited

#

its only good for writing descriptions basically

#

for actual types use ts

rocky hearth
#

I think I hv to live without intellisence

tulip ledge
#

Is there a way to get the png of an emoji?

quartz kindle
#

you can use ts declarations without actually using typescript

errant flax
#

how do i generate a Snowflake in js?

vivid fulcrum
#

what for

wary flame
#

Snowflakes are just number strings of certain length

quartz kindle
#

discord.js? they have a snowflake generation util

vivid fulcrum
quartz kindle
tulip ledge
#

Also what would be the best way to use an image generated by canvas as an embed image

tulip ledge
quartz kindle
#

get their url

errant flax
quartz kindle
#

yes

errant flax
#

how e_looks

tulip ledge