File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -145,16 +145,18 @@ async def create_embed(post: Post):
145145 profile_pic_file = File (io .BytesIO (profile_pic_bytes ), "profile_pic.webp" )
146146
147147 # 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- )
148+ post_caption = post .caption
149+ if post_caption is str :
150+ post_caption = re .sub (
151+ r"#([a-zA-Z0-9]+\b)" ,
152+ r"[#\1](https://www.instagram.com/explore/tags/\1)" ,
153+ post_caption ,
154+ )
155+ post_caption = re .sub (
156+ r"@([a-zA-Z0-9_]+\b)" ,
157+ r"[@\1](https://www.instagram.com/\1)" ,
158+ post_caption ,
159+ )
158160
159161 embed = Embed (
160162 color = 13500529 ,
You can’t perform that action at this time.
0 commit comments