You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please describe the problem you are having in as much detail as possible:
When trying to handle the messageReactionAdd event, the client is inaccessible from the MessageReaction type.
client is being set using Object.assign so I can see it exists, although the type is missing this definition.
Include a reproducible code sample here, if possible:
@Injectable()exportclassBotService{constructor(
@Inject(discordConfig.KEY)privatereadonlyconfig: ConfigType<typeofdiscordConfig>,privatereadonlymoduleRef: ModuleRef,privatereadonlydiscord: DiscordClient,privatereadonlylogger: Logger){}// ...asyncstart(): Promise<string>{// this.discord.on('ready', this.isReady);// this.discord.on('message', this.handleMessage);this.discord.on('messageReactionAdd',this.handleMessageReactionAdd);returnthis.discord.login(this.config.key);}handleMessageReactionAdd=async(reaction: MessageReaction,user: User): Promise<void>=>{try{constguild=reaction.client.guilds.cache.get(this.config.guildId);// ^ this is the type error ☹️ (my current work around is this.discord, but not ideal)constrole=guild.roles.cache.get(this.config.memberRoleId);await(newGuildMemberRoleManager(guild.member(user))).add(role);this.logger.log(`user ${user.tag} accepted the community rules`);}catch(e){this.logger.error(e.message);}}// ...}
Further details:
discord.js version: ^12.4.1
Node.js version: 14.12.0
Operating system: Linux
Priority this issue should have – Low (Tho, I'm happy to do PR)
Relevant client options:
partials: none
gateway intents: none
other: none
I have also tested the issue on latest master, commit hash:
The text was updated successfully, but these errors were encountered:
Please describe the problem you are having in as much detail as possible:
When trying to handle the
messageReactionAdd
event, the client is inaccessible from theMessageReaction
type.client
is being set usingObject.assign
so I can see it exists, although the type is missing this definition.Include a reproducible code sample here, if possible:
Further details:
Relevant client options:
The text was updated successfully, but these errors were encountered: