<commit_before>import telegram as tg
import telegram.ext as tg_ext
import re
import datetime
import psutil


def info_meta(bot, update, args):
    commands = {
    	'user': info_user,
    	'chat': info_chat,
    	'message': info_message,
    	'full' : info_full
    }
    if args[0] in commands:
    	commands[args[0]](bot, update)


def escape_markdown(text):
    """Helper function to escape telegram markup symbols"""
    escape_chars = '\*_`\['
    return re.sub(r'([%s])' % escape_chars, r'\\\1', text)


def info(bot, update):
    user = update.message.reply_to_message.from_user
    timestamp = update.message.reply_to_message.date
    resp = []
    resp = addUserToResp(user, resp)
    resp.append('At {} UTC'.format(str(timestamp)))
    if update.message.reply_to_message.forward_from:
        resp.append('\nForwarded From:')
        addUserToResp(update.message.reply_to_message.forward_from, resp)
        forwardTimestamp = update.message.reply_to_message.forward_date
        resp.append('Originally sent at {} UTC'.format(forwardTimestamp))
    #if update.message.reply_to_message.forward_from_chat:
        #chan = update.message.reply_to_message.forward_from_chat
    resp = '\n'.join(resp)
    bot.send_message(update.message.chat_id, resp, parse_mode='Markdown')


def addUserToResp(user, resp):
    if user.username:
        resp.append(escape_markdown('@{}'.format(user.username)))
        resp.append('`{}`'.format(user.id))
        resp.append(escape_markdown('First: {}'.format(user.first_name)))
    if user.last_name:
    	resp.append(escape_markdown('Last: {}'.format(user.last_name)))
    return resp

def ping(bot, update):
    msgSent = update.message.date
    msgRecieved = datetime.datetime.now()
    pingTime = msgRecieved - msgSent <commit_msg>Fixed no username=no userinfo<commit_after>import telegram as tg
import telegram.ext as tg_ext
import re
import datetime
import psutil



def escape_markdown(text):
    """Helper function to escape telegram markup symbols"""
    escape_chars = '\*_`\['
    return re.sub(r'([%s])' % escape_chars, r'\\\1', text)


def info(bot, update):
    user = update.message.reply_to_message.from_user
    timestamp = update.message.reply_to_message.date
    resp = []
    resp = addUserToResp(user, resp)
    resp.append('At {} UTC'.format(str(timestamp)))
    if update.message.reply_to_message.forward_from:
        resp.append('\nForwarded From:')
        addUserToResp(update.message.reply_to_message.forward_from, resp)
        forwardTimestamp = update.message.reply_to_message.forward_date
        resp.append('Originally sent at {} UTC'.format(forwardTimestamp))
    #if update.message.reply_to_message.forward_from_chat:
        #chan = update.message.reply_to_message.forward_from_chat
    resp = '\n'.join(resp)
    bot.send_message(update.message.chat_id, resp, parse_mode='Markdown')


def addUserToResp(user, resp):
    if user.username:
        resp.append(escape_markdown('@{}'.format(user.username)))
    resp.append('`{}`'.format(user.id))
    resp.append(escape_markdown('First: {}'.format(user.first_name)))
    if user.last_name:
    	resp.append(escape_markdown('Last: {}'.format(user.last_name)))
    return resp

def ping(bot, update):
    msgSent = update.message.date
    msgRecieved = datetime.datetime.now()
    pingTime = msgRecieved - msgSent 
{'fraction_non_alphanumeric': 0.13293413173652693, 'fraction_numerical': 0.0011976047904191617, 'mean_word_length': 3.906020558002937, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '6211269', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1070, 'n_words': 198}