<commit_before>#encoding:utf-8

# Some utils can be useful.
from utils import get_url


# Write here subreddit name. Like this one for /r/jokes.
subreddit = 'jokes'
# This is for your public telegram channel.
t_channel = '@r_jokes'


def send_post(submission, r2t):
    # Check what is inside this submission.
    what, _, _ = get_url(submission)

    # If inside is something but not text
    # then we do not need this submission.
    if what != 'text':
        False

    # To read more about dealing with reddit submission please
    # visit https://praw.readthedocs.io/.
    title = submission.title
    punchline = submission.selftext
    link = submission.short_link
    text = '{title}\n\n{body}\n\n{link}\n{channel}'.format(
            title=title, body=punchline, link=link, channel=t_channel)

    # To read more about sending massages to telegram please
    # visit https://github.com/nickoala/telepot/tree/master/examples/simple
    # with simple examples, or visit doc page: http://telepot.readthedocs.io/.
    r2t.send_text(text, disable_web_page_preview=True)

    # Return True, if this submission is suitable for sending and was sent,
    # if not – return False.
    return True<commit_msg>A little more minor improvements on @r_jokes. ;)<commit_after>#encoding:utf-8

# Some utils can be useful.
from utils import get_url


# Write here subreddit name. Like this one for /r/jokes.
subreddit = 'jokes'
# This is for your public telegram channel.
t_channel = '@r_jokes'


def send_post(submission, r2t):
    # Check what is inside this submission.
    what, _, _ = get_url(submission)

    # If inside is something but not text
    # then we do not need this submission.
    if what != 'text':
        False

    # To read more about dealing with reddit submission please
    # visit https://praw.readthedocs.io/.
    title = submission.title
    punchline = submission.selftext
    link = submission.short_link
    text = '{title}\n\n{body}\n\n{link}\n{channel}'.format(
            title=title, body=punchline, link=link, channel=t_channel)

    # Long jokes are weired.
    if len(text) > 3456:
        return False

    # To read more about sending massages to telegram please
    # visit https://github.com/nickoala/telepot/tree/master/examples/simple
    # with simple examples, or visit doc page: http://telepot.readthedocs.io/.
    r2t.send_text(text, disable_web_page_preview=True)

    # Return True, if this submission is suitable for sending and was sent,
    # if not – return False.
    return True
{'fraction_non_alphanumeric': 0.09482418016594231, 'fraction_numerical': 0.0039510075069142635, 'mean_word_length': 3.1508196721311474, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2606953', 'n_tokens_mistral': 788, 'n_tokens_neox': 776, 'n_words': 259}