99from utils .logger import discord_logger , logger
1010from utils .fs import list_py_files
1111from utils .models import fetch_and_log_models
12+ from utils .embed_utils import SafeEmbed
1213import traceback
1314
1415load_dotenv (override = True )
@@ -126,7 +127,7 @@ async def on_message(message) -> None:
126127 return
127128
128129 if bot .user in message .mentions and message .type is not discord .MessageType .reply :
129- embed = discord . Embed (
130+ embed = SafeEmbed (
130131 description = f"Hello, I am the Pollinations.ai Bot. I am here to help you with your AI needs. **To Generate Images click </pollinate:{ config .bot .commands ['pollinate_id' ]} > or </multi-pollinate:{ config .bot .commands ['multi_pollinate_id' ]} >, to Cross-Pollinate Images click </cross-pollinate:{ config .bot .commands ['cross_pollinate_id' ]} >, or type `/help` for more commands**." ,
131132 color = int (config .ui .colors .success , 16 ),
132133 )
@@ -212,7 +213,7 @@ async def on_command_error(ctx, error):
212213
213214 # Send error message to user
214215 await ctx .send (
215- embed = discord . Embed (
216+ embed = SafeEmbed (
216217 title = "Error" , description = str (error ), color = int (config .ui .colors .error , 16 )
217218 ),
218219 )
@@ -227,7 +228,7 @@ async def before_invoke(ctx) -> None:
227228@bot .command ()
228229async def ping (ctx ) -> None :
229230 try :
230- embed = discord . Embed (title = "Pong!" , color = int (config .ui .colors .success , 16 ))
231+ embed = SafeEmbed (title = "Pong!" , color = int (config .ui .colors .success , 16 ))
231232 message = await ctx .send (embed = embed )
232233
233234 end : float = time .perf_counter ()
@@ -256,10 +257,7 @@ async def ping(ctx) -> None:
256257 value = f"{ hours } hours { minutes } minutes { seconds } seconds" ,
257258 inline = False ,
258259 )
259- embed .set_footer (
260- text = f"Information requested by: { ctx .author .name } " ,
261- icon_url = ctx .author .avatar .url ,
262- )
260+ embed .set_user_footer_with_text (ctx , f"Information requested by: { ctx .author .name } " )
263261 embed .set_thumbnail (
264262 url = "https://uploads.poxipage.com/7q5iw7dwl5jc3zdjaergjhpat27tws8bkr9fgy45_938843265627717703-webp"
265263 )
@@ -274,7 +272,7 @@ async def ping(ctx) -> None:
274272 context = {"command" : "ping" },
275273 )
276274 await ctx .send (
277- embed = discord . Embed (
275+ embed = SafeEmbed (
278276 title = "Error" ,
279277 description = "An error occurred while processing the command." ,
280278 color = int (config .ui .colors .error , 16 ),
@@ -290,7 +288,7 @@ async def help(ctx) -> None:
290288 except AttributeError :
291289 profilePicture = config .bot .avatar_url
292290
293- embed = discord . Embed (
291+ embed = SafeEmbed (
294292 title = "Pollinations.ai Bot Commands" ,
295293 description = "Here is the list of the available commands:" ,
296294 color = int (config .ui .colors .success , 16 ),
@@ -300,27 +298,21 @@ async def help(ctx) -> None:
300298 for i in commands_ .keys ():
301299 embed .add_field (name = i , value = commands_ [i ], inline = False )
302300
303- embed .set_footer (
304- text = f"Information requested by: { ctx .author .name } " ,
305- icon_url = ctx .author .avatar .url ,
306- )
301+ embed .set_user_footer_with_text (ctx , f"Information requested by: { ctx .author .name } " )
307302
308303 await ctx .send (embed = embed )
309304
310305
311306@bot .hybrid_command (name = "invite" , description = "Invite the bot to your server" )
312307async def invite (ctx ) -> None :
313- embed = discord . Embed (
308+ embed = SafeEmbed (
314309 title = "Invite the bot to your server" ,
315310 url = config .ui .bot_invite_url ,
316311 description = "Click the link above to invite the bot to your server" ,
317312 color = int (config .ui .colors .success , 16 ),
318313 )
319314
320- embed .set_footer (
321- text = f"Information requested by: { ctx .author .name } " ,
322- icon_url = ctx .author .avatar .url ,
323- )
315+ embed .set_user_footer_with_text (ctx , f"Information requested by: { ctx .author .name } " )
324316
325317 await ctx .send (embed = embed )
326318
@@ -333,7 +325,7 @@ async def about(ctx) -> None:
333325 except AttributeError :
334326 profilePicture = config .bot .avatar_url
335327
336- embed = discord . Embed (
328+ embed = SafeEmbed (
337329 title = "About Pollinations.ai Bot 🙌" ,
338330 url = config .ui .api_provider_url ,
339331 description = "I am the official Pollinations.ai Bot. I can generate AI Images from your prompts ✨." ,
@@ -391,6 +383,8 @@ async def about(ctx) -> None:
391383 icon_url = config .ui .bot_creator_avatar ,
392384 )
393385
386+ embed .set_user_footer_with_text (ctx , f"Information requested by: { ctx .author .name } " )
387+
394388 await ctx .send (embed = embed )
395389
396390
@@ -402,7 +396,7 @@ async def models(ctx) -> None:
402396 except AttributeError :
403397 profilePicture = config .bot .avatar_url
404398
405- embed = discord . Embed (
399+ embed = SafeEmbed (
406400 title = "🤖 Available AI Models" ,
407401 description = "Here are all the AI models currently available for image generation:" ,
408402 color = int (config .ui .colors .success , 16 ),
@@ -450,12 +444,7 @@ async def models(ctx) -> None:
450444 inline = False ,
451445 )
452446
453- embed .set_footer (
454- text = f"Information requested by: { ctx .author .name } • Models last updated" ,
455- icon_url = ctx .author .avatar .url
456- if ctx .author .avatar
457- else ctx .author .default_avatar .url ,
458- )
447+ embed .set_user_footer_with_text (ctx , f"Information requested by: { ctx .author .name } • Models last updated" )
459448
460449 await ctx .send (embed = embed )
461450
0 commit comments