Skip to content

Instantly share code, notes, and snippets.

@x0x8x
Last active December 22, 2020 14:18
Show Gist options
  • Save x0x8x/141faa6dc1a43660abad96fce47f9e73 to your computer and use it in GitHub Desktop.
Save x0x8x/141faa6dc1a43660abad96fce47f9e73 to your computer and use it in GitHub Desktop.
Will count all users messages of the specific group and print sorted out from most talked to none with an λ
group = 'telethonchat'
print(
(
(
lambda c: (
lambda ts: "\n".join(
f"{t} messages from {u}" for t, u in sorted(ts, key=lambda t: -t[0])
)
)(
(
client.get_messages(c, from_user=u).total,
f"{u.first_name}, {u.last_name}, {u.username or u.id}",
)
for u in client.iter_participants(c)
if not u.deleted
)
)(group)
).replace(" None,", "")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment