Hello ,I need some Help about listeners in sapphire framework

any one have a working example of ("guildMemberAdd") , a bot that welcome user when they join the server . The problem is like it can't detect that event , i do not know way
No description
Solution:
you're assigning the event GUILD_MEMBER_AVAILABLE, that's a different event from guildMemberAdd https://discord.js.org/docs/packages/discord.js/14.14.1/Client:Class#guildMemberAdd
Jump to solution
9 Replies
Solution
Favna
Favna9mo ago
you're assigning the event GUILD_MEMBER_AVAILABLE, that's a different event from guildMemberAdd https://discord.js.org/docs/packages/discord.js/14.14.1/Client:Class#guildMemberAdd
Favna
Favna9mo ago
Also please do not post in multiple channels ( #framework-development and here and DMing me)
-_-العربي الفصيح-_-
Sorry for the multiple post , Yeah i changed it to (Events.Events.GuildMemberAdd) and it worked ! But it worked until i added , this in the index.ts :
client.on(Events.ClientReady , () => {});
client.on(Events.ClientReady , () => {});
I am not sure why ?! but when i did it worked , and all the other listeners worked fine
Favna
Favna9mo ago
That shouldn't matter. You must've changed something else as well. Either way, there is no reason to add that because you can just add a reay listener to the listeners directory. Also I have no idea how you're importing sapphire but it should be Events.GuildMemberAdd, not Events.Events.GuildMemberAdd. Assuming you write import { Events } from '@sapphire/framework'
-_-العربي الفصيح-_-
What do you mean by
you can just add a reay listener to the listeners directory
you can just add a reay listener to the listeners directory
can you show me an example Ops i was meaning Events.GuildMemberAdd not Events.Events.GuildMemberAdd haha
Favna
Favna9mo ago
Add a listener file and call it ready.ts or specify event: Events.ClientReady. Also explained here https://sapphirejs.dev/docs/Guide/listeners/what-are-listeners-and-how-do-they-work
Sapphire Framework
What are listeners and how do they work? | Sapphire
Listeners are classes that contain logic that will be ran whenever a given event occurs.
-_-العربي الفصيح-_-
Oh ! yeah i did it , ready event works fine , but other events do not work , until i add an empty function in the index.tx : like this:
client.on(Events.GuildMemberAdd, ()=>{});
client.on(Events.GuildMemberAdd, ()=>{});
Favna
Favna9mo ago
Well that isn't necessary at all. No idea what you have in your setup that it is. I can't see your code unless you share it. Look at the guide for examples / generate a bot template with the CLI and copy over work so far / look at open source bots (/tag bots with @Spinel )
-_-العربي الفصيح-_-
Okey thanks for the help. I will generate the template using the cli . And then I will see if the problem is solved
Want results from more Discord servers?
Add your server