Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- from discord.ext import commands
- from discord import app_commands
- import os
- import asyncio
- intents = discord.Intents.all()
- intents.members = True
- bot = commands.Bot(command_prefix=">",intents=intents)
- #tree = app_commands.CommandTree(client)
- asta_guild_id = 1030203387423236136
- # Cogs Setup
- async def load():
- for filename in os.listdir("./Cogs"):
- if filename.endswith(".py"):
- await bot.load_extension(f"Cogs.{filename[:-3]}")
- @bot.event
- async def on_connect():
- print("Bot has connected!")
- @bot.event
- async def on_ready():
- print("Bot is Ready!")
- #Welcome Message
- @bot.event
- async def on_member_join(member):
- avatar = member.avatar
- welc_channel = bot.get_channel(1030244468600885388)
- guild = bot.get_guild(asta_guild_id)
- embed=discord.Embed(title="",description=f"Hi {member.mention} and welcome to The Cat House. You are our {guild.member_count} member!\n\n Get yourself comfy and enjoy! :D",)
- embed.set_footer(text="Astartic's House", icon_url=guild.icon)
- embed.set_thumbnail(url=member.avatar)
- print(avatar)
- # embed.add_field(name=" ", value=f"Hi {member.mention} and welcome to The Cat House. You are our 35th member! Get yourself comfy and enjoy! :D", inline=False)
- await welc_channel.send(embed=embed)
- #Goodbye Message
- @bot.event
- async def on_member_remove(member):
- avatar = member.avatar
- welc_channel = bot.get_channel(1030244468600885388)
- guild = bot.get_guild(asta_guild_id)
- embed=discord.Embed(title="",description=f"It seems {member.name} has left us...\n\nWe now have {guild.member_count} members. :(")
- embed.set_footer(text="Astartic's House", icon_url=guild.icon)
- embed.set_thumbnail(url=member.avatar)
- print(avatar)
- # embed.add_field(name=" ", value=f"Hi {member.mention} and welcome to The Cat House. You are our 35th member! Get yourself comfy and enjoy! :D", inline=False)
- await welc_channel.send(embed=embed)
- async def main():
- await load()
- await bot.start("MY_TOKEN", reconnect=True)
- asyncio.run(main())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement