RealTime Action (Server)

This commit is contained in:
2025-07-04 17:36:56 +03:30
parent a62b65b41c
commit da4d1a39da
7 changed files with 369 additions and 22 deletions
@@ -1,6 +1,5 @@
package org.to.telegramfinalproject.Client;
import org.json.JSONObject;
import java.io.BufferedReader;
@@ -46,7 +45,9 @@ public class IncomingMessageListener implements Runnable {
case "new_message", "message_edited", "message_deleted",
"user_status_changed", "added_to_group", "added_to_channel",
"update_group_or_channel", "chat_deleted",
"blocked_by_user", "unblocked_by_user", "message_seen" -> true;
"blocked_by_user", "unblocked_by_user", "message_seen",
"removed_from_group", "removed_from_channel",
"became_admin", "removed_admin" -> true;
default -> false;
};
}
@@ -111,6 +112,22 @@ public class IncomingMessageListener implements Runnable {
System.out.println("Seen at: " + msg.getString("seen_at"));
}
case "removed_from_group" -> {
System.out.println("\n🚫 You were removed from group: " + msg.getString("chat_id"));
}
case "removed_from_channel" -> {
System.out.println("\n🚫 You were removed from channel: " + msg.getString("chat_id"));
}
case "became_admin" -> {
System.out.println("\n⭐ You are now an admin in: " + msg.getString("chat_name"));
}
case "removed_admin" -> {
System.out.println("\n⚠️ You are no longer an admin in: " + msg.getString("chat_name"));
}
default -> {
System.out.println("\n❓ Unknown real-time action: " + action);
}