File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -144,15 +144,17 @@ async def create_embed(post: Post):
144144 post_image_file = File (io .BytesIO (post_image_bytes ), "post_image.webp" )
145145 profile_pic_file = File (io .BytesIO (profile_pic_bytes ), "profile_pic.webp" )
146146
147- # Replace hashtags with clickable links
148- if post .caption is None :
149- post_caption = ""
150- else :
151- post_caption = re .sub (
152- r"#([a-zA-Z0-9]+\b)" ,
153- r"[#\1](https://www.instagram.com/explore/tags/\1)" ,
154- post .caption ,
155- )
147+ # Format the post caption with clickable links for mentions and hashtags
148+ post_caption = re .sub (
149+ r"#([a-zA-Z0-9]+\b)" ,
150+ r"[#\1](https://www.instagram.com/explore/tags/\1)" ,
151+ post .caption ,
152+ )
153+ post_caption = re .sub (
154+ r"@([a-zA-Z0-9_]+\b)" ,
155+ r"[@\1](https://www.instagram.com/\1)" ,
156+ post_caption ,
157+ )
156158
157159 embed = Embed (
158160 color = 13500529 ,
You can’t perform that action at this time.
0 commit comments