Jump to content

Procesul de fuziune va fi reluat din pacate. Detalii aici aici
Cele mai noi detalii de dupa fuziune aici

Sign in to follow this  

[PYTHON] Chatlog reader

Recommended Posts

import pyperclip, time, getpass
from os.path import getsize
from pathlib import Path

username = getpass.getuser()
path = Path('C:\\Users\\'+ username + '\\Documents\\GTA San Andreas User Files\\SAMP\\chatlog.txt')

if path.is_file():
    print(f"Heyy {username}")
    path = input('Chatlog directory path > ')

cuv_cap = {

     'virgin' : 'me',
     'Romania' : 'Bucuresti',
     'gay' : 'user88',
     'BMW' : 'i8',
     'ugbase' : 'nothin'

custom_pref = input('custom prefix[blank = no prefix]: ')

def chatEntry(custom_pref):
    if not custom_pref or custom_pref in ['no', 'nu', 'n'] :
        return None
    elif custom_pref:
        return custom_pref


def read_lines(path):
    if getsize(path) > 0:
        with open(path, 'r+') as chatlog:
            for line in chatlog:
                for cuv, cap in cuv_cap.items():
                    if cuv in line:
                        print(f"Key: [{cuv}] Value: [{cap}] --> PRINT{[cap]}")
                        pyperclip.copy(chatEntry(custom_pref) + " " + cap)

                    if cap in line:
                        print(f"Value: [{cap}] Key: [{cuv}] --> PRINT{[cuv]}")

                        pyperclip.copy(chatEntry(custom_pref) + " " + cuv)

while True:
    except PermissionError:
    except FileNotFoundError:
        raise Exception("PathError: Path(chatlog.txt) is WRONG")

Un simplu mod care iti citeste chatlog-ul si iti seteaza cuvantul in clipboard cand il gaseste in chat

merci @monday pentru niste optimizari

Share this post

Link to post
Share on other sites

Aolo franzelo, ce limbaj ti-ai gasit si tu sa faci programu asta, desi e unul relativ cautat, nu mi-a placut niciodata din simplul fapt ca nu pot sa-mi fac damblaua sa-mi pun paranteze, acuolade si punct si virgula =)), mna obisnuinta...

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.