stvtermux 1.0.5__tar.gz → 1.0.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stvtermux
3
- Version: 1.0.5
3
+ Version: 1.0.7
4
4
  Requires-Dist: requests
5
5
  Dynamic: requires-dist
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="stvtermux",
5
- version="1.0.5",
5
+ version="1.0.7",
6
6
  packages=find_packages(),
7
7
  install_requires=["requests"],
8
8
  entry_points={
@@ -0,0 +1,30 @@
1
+ import os
2
+ import subprocess
3
+
4
+ def main():
5
+ # giao diện mở đầu
6
+ os.system("clear") # nếu bạn dùng Termux/Linux, trên Windows thì thay bằng cls
7
+ print("═" * 40)
8
+ print("🌐 CHÀO MỪNG BẠN ĐẾN VỚI STVTermux 🌐")
9
+ print("═" * 40)
10
+ print("👉 Vui lòng chọn chức năng:")
11
+ print("1️⃣ Nhóm Chat (nhom.py)")
12
+ print("2️⃣ Bot Tự Động (bot.py)")
13
+ print("0️⃣ Thoát")
14
+ print("═" * 40)
15
+
16
+ choice = input("➡️ Nhập lựa chọn: ")
17
+
18
+ if choice == "1":
19
+ module_path = os.path.join(os.path.dirname(__file__), "nhom.py")
20
+ subprocess.run(["python", module_path])
21
+ elif choice == "2":
22
+ module_path = os.path.join(os.path.dirname(__file__), "bot.py")
23
+ subprocess.run(["python", module_path])
24
+ elif choice == "0":
25
+ print("👋 Tạm biệt!")
26
+ else:
27
+ print("❌ Lựa chọn không hợp lệ!")
28
+
29
+ if __name__ == "__main__":
30
+ main()
@@ -0,0 +1,53 @@
1
+ import requests
2
+ import json
3
+ import threading
4
+ import time
5
+ import os
6
+ import sys
7
+
8
+ FIREBASE_URL = "https://sever-login-ae5cc-default-rtdb.firebaseio.com/chatnhom.json"
9
+
10
+ def listen_messages():
11
+ last_seen = None
12
+ while True:
13
+ try:
14
+ res = requests.get(FIREBASE_URL)
15
+ if res.status_code == 200:
16
+ data = res.json() or {}
17
+ sorted_msgs = sorted(data.items(), key=lambda x: x[0])
18
+ for k, v in sorted_msgs:
19
+ if last_seen is None or k > last_seen:
20
+ print(f"\n💬 {v.get('name')}: {v.get('msg')}")
21
+ last_seen = k
22
+ except Exception:
23
+ pass
24
+ time.sleep(2)
25
+
26
+ def send_message(name):
27
+ while True:
28
+ msg = input("")
29
+ if msg.strip() == "":
30
+ continue
31
+ data = {"name": name, "msg": msg}
32
+ try:
33
+ requests.post(FIREBASE_URL, data=json.dumps(data))
34
+ except Exception:
35
+ print("❌ Lỗi gửi tin nhắn!")
36
+
37
+ def main():
38
+ os.system("clear")
39
+ print("══════════════════════════════════════")
40
+ print("🌐 CHAT NHÓM STVTermux (Realtime) 🌐")
41
+ print("══════════════════════════════════════")
42
+
43
+ # 👉 lấy tên từ sys.argv (username đã login)
44
+ name = sys.argv[1] if len(sys.argv) > 1 else "Ẩn danh"
45
+
46
+ t = threading.Thread(target=listen_messages, daemon=True)
47
+ t.start()
48
+
49
+ print(f"✨ {name}, bắt đầu trò chuyện...")
50
+ send_message(name)
51
+
52
+ if __name__ == "__main__":
53
+ main()
@@ -1,5 +1,5 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stvtermux
3
- Version: 1.0.5
3
+ Version: 1.0.7
4
4
  Requires-Dist: requests
5
5
  Dynamic: requires-dist
@@ -5,6 +5,7 @@ stvtermux/__init__.py
5
5
  stvtermux/cli.py
6
6
  stvtermux/core.py
7
7
  stvtermux/index.py
8
+ stvtermux/nhom.py
8
9
  stvtermux.egg-info/PKG-INFO
9
10
  stvtermux.egg-info/SOURCES.txt
10
11
  stvtermux.egg-info/dependency_links.txt
@@ -1 +0,0 @@
1
- print("🎉 Xin chào! Bạn đã vào file in.py")
File without changes
File without changes
File without changes
File without changes
File without changes