Answers for "send message if user is banned discord.py"

0

send message if user is banned discord.py

@commands.Cog.listener()
async def on_member_remove(self, member):
    channel = self.bot.get_channel(805991434330570793)
    try:
        banned = await member.guild.fetch_ban(member)
    except discord.NotFound:
        banned = False
    if banned:
        await channel.send(f"{member} was just banned from the server.")
    else:
        await channel.send(f"{member} just left the server.")
Posted by: Guest on September-29-2021

Code answers related to "send message if user is banned discord.py"

Python Answers by Framework

Browse Popular Code Answers by Language