discordjs / discord.js

A powerful JavaScript library for interacting with the Discord API
https://discord.js.org
Apache License 2.0
25.36k stars 3.97k forks source link

Missing class 'Attachment' and functions of 'GuildMember' #3270

Closed MrShoopa closed 5 years ago

MrShoopa commented 5 years ago

Please describe the problem you are having in as much detail as possible: Rewriting my bot for TypeScript, I've noticed a few things were missing in the scripts of the package and the TS declarations (Even though they were included in the documentation):

Include a reproducible code sample here, if possible:

// 'member' in this context is a GuildMember instance 
// 'restricted_role_id' in this context is a string of an id

member.addRole(restricted_role_id)
                    .then(() => {
                        console.log(
                            `Adding ${member.displayName} to the role: ${restricted_role_id}`)
                    })

Further details:

iCrawl commented 5 years ago

Based on the commit you put in the discord.js version, I see no "Attachment" class. https://discord.js.org/#/docs/main/master (left hand side obviously)

And addRole does not exist on v12 either. https://discord.js.org/#/docs/main/master/search?q=addRole

What you are really looking for is how to convert your v11 code to v12 code, which is outlined here: https://github.com/discordjs/discord.js/wiki/Data-Stores