import discord from discord.ext import commands from discord import app_commands class Welcome(commands.Cog): def __init__(self, bot: commands.Bot): self.bot = bot @commands.Cog.listener() async def on_member_join(self, member: discord.Member): """Wird ausgelöst, wenn ein neues Mitglied dem Server beitritt.""" guild = member.guild welcome_channel = guild.system_channel if welcome_channel is not None: embed = discord.Embed( title=f"Willkommen auf {guild.name}!", description=f"Hallo {member.mention}, wir freuen uns, dich hier zu sehen! Schau dich doch mal um.", color=discord.Color.green() ) embed.set_thumbnail(url=member.avatar.url if member.avatar else member.default_avatar.url) embed.set_footer(text=f"Du bist das {guild.member_count}. Mitglied!") await welcome_channel.send(embed=embed) async def setup(bot: commands.Bot): await bot.add_cog(Welcome(bot))