wop commited on
Commit
a3f6c44
·
verified ·
1 Parent(s): a936ad9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -11
app.py CHANGED
@@ -50,19 +50,18 @@ async def on_ready():
50
  print("------")
51
 
52
 
53
- @bot.event
54
  async def on_member_join(member):
55
- for channel in member.guild.text_channels:
56
- if channel.permissions_for(member.guild.me).send_messages:
57
- await channel.send(f"Welcome {member.mention} to our server!")
58
- break
59
-
 
 
 
 
 
60
 
61
- @bot.event
62
- async def on_message(message):
63
- if message.channel.id == 1210559547874222083 and not message.author.bot:
64
- await message.channel.send(f"Hello {message.author.mention}!")
65
- await bot.process_commands(message)
66
 
67
 
68
  # running in thread
 
50
  print("------")
51
 
52
 
 
53
  async def on_member_join(member):
54
+ guild = member.guild
55
+ # Check if the channel with the specific ID exists in the guild
56
+ welcome_channel = guild.get_channel(1210559547874222083)
57
+ if welcome_channel:
58
+ if welcome_channel.permissions_for(guild.me).send_messages:
59
+ await welcome_channel.send(f"Welcome {member.mention} to our server!")
60
+ else:
61
+ print(f"Bot doesn't have permission to send messages in {welcome_channel.name}.")
62
+ else:
63
+ print("Welcome channel not found.")
64
 
 
 
 
 
 
65
 
66
 
67
  # running in thread