Reputation: 143
I'm trying to get the Channel ID of the Channel that the new user joins. I'm using Discord.py and discord.on_member_join()
however the only parameters it accepts is Member
which doesn't hold the Channel ID, at least I don't believe it does. This is important because I have a bot auto assigning roles based on the channel the user joins (aka which invite link they use)
Upvotes: 2
Views: 1373
Reputation: 1173
The only way I can see doing this is have the bot keep track of all the invite in the server and then when a user joins check which invite uses has increased by one and get the channel of that invite.
You can use the invites_from(server)
function to get a list of all the invites in the server. https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.invites_from
Invites have the .uses
property which will give you the number of times that invite has been used and you can use the .channel
property to get the channel the invite is for.
https://discordpy.readthedocs.io/en/latest/api.html#discord.Invite%20%22discord.Invite
Upvotes: 1