Shortened Usernames, readability on mobiles

Ive shortened the /stats Output to make it readable on mobiles better:

Shortened /stats counts columns to User, Messages, %
added a maximum length of 15 to the df['User'], if more it gets shortened and appended by "..."
pull/23/head
hndrk-themer 2023-04-18 11:12:31 +02:00 zatwierdzone przez GitHub
rodzic 1f658bb391
commit 6899c5899e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 2 dodań i 0 usunięć

Wyświetl plik

@ -201,6 +201,8 @@ class StatsRunner(object):
else:
df.columns = ['User', 'Messages', '%']
df['User'] = df['User'].str.replace(r'[^\x00-\x7F]|[@]', "", regex=True) # Drop emoji and @
df['User'] = df['User'].astype(str) # convert to string if necessary
df['User'] = df['User'].apply(lambda x: x[:15] + "..." if len(x) > 15 else x) # truncate and append "..."
text = df.iloc[:n].to_string(index=False, header=True, float_format=lambda x: f"{x:.1f}")