Skip to content

Instantly share code, notes, and snippets.

@infideleraser
Created March 22, 2019 17:33
Show Gist options
  • Save infideleraser/7d41b08c5643d7bc621561e068d73501 to your computer and use it in GitHub Desktop.
Save infideleraser/7d41b08c5643d7bc621561e068d73501 to your computer and use it in GitHub Desktop.
@commands.Cog.listener()
async def on_member_join(self, member):
if member.guild.id is 554843544372903947:
if member.bot:
embed = discord.Embed(title=f"BOT {member.name}#{member.discriminator}", color=0x009933)
embed.add_field(name=f"Creation Date", value=f" {member.created_at.strftime('%B %d, %Y')}", inline=True)
embed.add_field(name=f"Join Date", value=f" {member.joined_at.strftime('%B %d, %Y')}", inline=True)
embed.set_author(name="Bot Joined", icon_url=member.avatar_url)
# embed.set_image(url=member.avatar_url)
try:
channel = discord.utils.get(member.guild.channels, name="join-leave-spam")
await channel.send(embed=embed)
role = discord.utils.get(member.guild.roles, name="bots")
await member.add_roles(role)
except:
channel = discord.utils.get(member.guild.channels, name="general")
await channel.send(embed=embed)
role = discord.utils.get(member.guild.roles, name="bots")
await member.add_roles(role)
else:
embed = discord.Embed(title=f"{member.name}#{member.discriminator}", color=0x009933)
embed.add_field(name=f"Creation Date", value=f" {member.created_at.strftime('%B %d, %Y')}", inline=True)
embed.add_field(name=f"Join Date", value=f" {member.joined_at.strftime('%B %d, %Y')}", inline=True)
embed.set_author(name="Member Joined", icon_url=member.avatar_url)
try:
channel = discord.utils.get(member.guild.channels, name="join-leave-spam")
await channel.send(embed=embed)
role = discord.utils.get(member.guild.roles, name="Shields")
await member.add_roles(role)
except:
channel = discord.utils.get(member.guild.channels, name="general")
await channel.send(embed=embed)
role = discord.utils.get(member.guild.roles, name="Shields")
await member.add_roles(role)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment