├── Procfile ├── README.md ├── requirements.txt └── welcome.py /Procfile: -------------------------------------------------------------------------------- 1 | worker: python welcome.py 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Welcome Bot 2 | A simple bot that welcomes member that joins your server 3 | 4 | # Note 5 | This is a simple code made w/discord.py rewrite that welcomes new members. You can edit this and change the message also. If you find any errors just pull up an issue. Star this repository if this helped you. 6 | Made by techguy940 7 | Discord- Just for fun#4278 8 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | discord.py 2 | -------------------------------------------------------------------------------- /welcome.py: -------------------------------------------------------------------------------- 1 | BOT_PREFIX = "Your Bot's Prefix Here" 2 | BOT_TOKEN = "Your Bot Token Here" 3 | WELCOME_CHANNEL_ID = Welcome Channel ID Here #Put it without " " Ex - 620498262436347905 4 | LEAVE_CHANNEL_ID = Leave Channel ID Here #Put it without " " Ex - 620363449879052624 5 | 6 | import discord 7 | from discord.ext import commands 8 | 9 | bot = commands.Bot(command_prefix=BOT_PREFIX, intents=discord.Intents.all()) 10 | 11 | @bot.event 12 | async def on_ready(): 13 | print("Logged in as", bot.user.name) 14 | 15 | @bot.event 16 | async def on_member_join(member): 17 | try: 18 | channel = bot.get_channel(WELCOME_CHANNEL_ID) 19 | try: 20 | embed = discord.Embed(colour=discord.Colour.green()) 21 | embed.set_author(name=member.name, icon_url=member.avatar.url) 22 | embed.add_field(name="Welcome" ,value=f"**Hey,{member.mention}! Welcome to {member.guild.name}\nI hope you enjoy your stay here!\nThanks for joining**", inline=False) 23 | embed.set_thumbnail(url=member.guild.icon.url) 24 | await channel.send(embed=embed) 25 | except Exception as e: 26 | raise e 27 | except Exception as e: 28 | raise e 29 | 30 | @bot.event 31 | async def on_member_remove(member): 32 | try: 33 | channel = bot.get_channel(LEAVE_CHANNEL_ID) 34 | try: 35 | embed = discord.Embed(colour=discord.Colour.red()) 36 | embed.set_author(name=member.name, icon_url=member.avatar.url) 37 | embed.add_field(name="Good Bye", value=f"**{member.mention} just left us.**", inline=False) 38 | embed.set_thumbnail(url=member.guild.icon_url) 39 | await channel.send(embed=embed) 40 | except Exception as e: 41 | raise e 42 | except Exception as e: 43 | raise e 44 | 45 | bot.run(BOT_TOKEN) 46 | 47 | --------------------------------------------------------------------------------