Update app.py
Browse files
app.py
CHANGED
@@ -147,8 +147,28 @@ async def on_ready():
|
|
147 |
|
148 |
@bot.event
|
149 |
async def on_member_join(member):
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
# Fetch a random Bible verse
|
153 |
bible_api_url = "https://labs.bible.org/api/?passage=random&type=json"
|
154 |
response = requests.get(bible_api_url)
|
@@ -158,12 +178,18 @@ async def on_member_join(member):
|
|
158 |
else:
|
159 |
passage = "Unable to fetch Bible verse"
|
160 |
|
161 |
-
# Create an embed
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
|
168 |
@bot.command()
|
169 |
async def search(ctx, *, query: str):
|
|
|
147 |
|
148 |
@bot.event
|
149 |
async def on_member_join(member):
|
150 |
+
# Fetch the channels by their IDs
|
151 |
+
channel_ids = [1210566384267034644, 1210987054658494477, 1210578060164866128]
|
152 |
+
channels_info = []
|
153 |
+
for channel_id in channel_ids:
|
154 |
+
channel = member.guild.get_channel(channel_id)
|
155 |
+
if channel:
|
156 |
+
channels_info.append(f"• {channel.name}: {channel.mention}")
|
157 |
|
158 |
+
# Prepare the message content
|
159 |
+
channels_message = "\n".join(channels_info)
|
160 |
+
message_content = (
|
161 |
+
f"Welcome to the server, {member.name}!\n\n"
|
162 |
+
f"Hope you have a great stay here, {member.mention}!\n\n"
|
163 |
+
f"Here are some channels you might find interesting:\n{channels_message}"
|
164 |
+
)
|
165 |
+
|
166 |
+
# Send a direct message to the user
|
167 |
+
try:
|
168 |
+
await member.send(message_content)
|
169 |
+
except discord.HTTPException:
|
170 |
+
print(f"Failed to send a DM to {member.name}")
|
171 |
+
|
172 |
# Fetch a random Bible verse
|
173 |
bible_api_url = "https://labs.bible.org/api/?passage=random&type=json"
|
174 |
response = requests.get(bible_api_url)
|
|
|
178 |
else:
|
179 |
passage = "Unable to fetch Bible verse"
|
180 |
|
181 |
+
# Create an embed for the welcome channel
|
182 |
+
welcome_channel = discord.utils.get(member.guild.channels, name="👋wellcome-goodbye")
|
183 |
+
if welcome_channel:
|
184 |
+
embed = discord.Embed(
|
185 |
+
title=f"Welcome to the server, {member.name}!",
|
186 |
+
description=f"Hope you have a great stay here, {member.mention}!",
|
187 |
+
color=discord.Color.blue()
|
188 |
+
)
|
189 |
+
embed.add_field(name="Random Bible Verse", value=passage, inline=False)
|
190 |
+
embed.set_footer(text="Created by Cosmos")
|
191 |
+
await welcome_channel.send(embed=embed)
|
192 |
+
|
193 |
|
194 |
@bot.command()
|
195 |
async def search(ctx, *, query: str):
|