send message if user is banned discord py

Solutions on MaxInterview for send message if user is banned discord py by the best coders in the world

showing results for - "send message if user is banned discord py"
Shelton
14 Nov 2019
1@commands.Cog.listener()
2async def on_member_remove(self, member):
3    channel = self.bot.get_channel(805991434330570793)
4    try:
5        banned = await member.guild.fetch_ban(member)
6    except discord.NotFound:
7        banned = False
8    if banned:
9        await channel.send(f"{member} was just banned from the server.")
10    else:
11        await channel.send(f"{member} just left the server.")
12