Commit 0fdae6cd authored by Adrien Simon's avatar Adrien Simon
Browse files

Ajout de la fonction lasttalk

parent ac2e28c1
......@@ -13,11 +13,11 @@ if __name__ == "__main__":
name = '.'
# choose action to do
choice = 0
while choice != 9:
while choice != 10:
if name == '.':
choice = 5
else :
choice = input("\n1 - Afficher les messages\n2 - Afficher les participants\n3 - Afficher les statistiques\n4 - Afficher les reactions\n5 - Changer de conversation\n6 - Nombre de messages supprimés\n7 - Classement des mots\n8 - Occurences d'un mot spécifique\n9 - Quitter l\'application\n")
choice = input("\n1 - Afficher les messages\n2 - Afficher les participants\n3 - Afficher les statistiques\n4 - Afficher les reactions\n5 - Changer de conversation\n6 - Nombre de messages supprimés\n7 - Classement des mots\n8 - Occurences d'un mot spécifique\n9 - Dernière parole d\'un membre\n10 - Quitter l\'application\n")
try:
choice = int(choice)
except ValueError:
......@@ -46,4 +46,6 @@ if __name__ == "__main__":
if choice == 7:
stats.countwords(data)
if choice == 8:
stats.countspecificword(data)
\ No newline at end of file
stats.countspecificword(data)
if choice == 9:
stats.lasttalk(data)
\ No newline at end of file
import decode
import users
def lasttalk(data):
messages = data["messages"]
last_msg = users.userdico(data)
for participant in last_msg:
for msg in messages:
if decode.string_decode(msg["sender_name"]) == participant:
last_msg[participant] = decode.timestamp_decode(msg["timestamp_ms"])
break
for participant in last_msg:
print(participant + " : " + str(last_msg[participant]))
def counttalk(data):
messages = data["messages"]
participants = users.userdico(data)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment