Skip to content

Commit

Permalink
Reddit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
amadejkastelic committed Nov 24, 2023
1 parent a603ed4 commit 3c0eeaa
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
5 changes: 0 additions & 5 deletions downloader/reddit.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ async def _hydrate_post(self, post: models.Post) -> bool:
content = ''
if submission.selftext:
content = f'\n\n{submission.selftext}'
if submission.url:
if content:
content += f'\n{submission.url}'
else:
content = f'\n\n{submission.url}'

post.url = self.url
post.author = submission.author
Expand Down
10 changes: 1 addition & 9 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import asyncio
import datetime
import io
import logging
import os
import random
Expand Down Expand Up @@ -71,14 +70,7 @@ async def _send_post(
try:
content = f'Here you go {author.mention} {random.choice(emoji)}.\n{str(post)}'
if len(content) > 2000:
if file:
content = content[:1997] + '...'
else:
content, _, fp = str(post).partition('📕 Description: ')
file = discord.File(
fp=io.BytesIO(fp.encode()),
filename='message.txt',
)
content = content[:1997] + '...'

return await channel.send(
content=content,
Expand Down

0 comments on commit 3c0eeaa

Please sign in to comment.