Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -50,17 +50,9 @@ async def on_ready():
|
|
50 |
print("------")
|
51 |
|
52 |
|
|
|
53 |
async def on_member_join(member):
|
54 |
-
|
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 |
# running in thread
|
@@ -74,8 +66,6 @@ def run_bot():
|
|
74 |
|
75 |
threading.Thread(target=run_bot).start()
|
76 |
|
77 |
-
bot.add_listener(on_member_join, name="on_member_join")
|
78 |
-
|
79 |
event.wait()
|
80 |
|
81 |
if not DISCORD_TOKEN:
|
|
|
50 |
print("------")
|
51 |
|
52 |
|
53 |
+
@client.event
|
54 |
async def on_member_join(member):
|
55 |
+
await member.send('Private message')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
|
58 |
# running in thread
|
|
|
66 |
|
67 |
threading.Thread(target=run_bot).start()
|
68 |
|
|
|
|
|
69 |
event.wait()
|
70 |
|
71 |
if not DISCORD_TOKEN:
|