nothere990 commited on
Commit
426ff68
·
1 Parent(s): aa0d3b9

big update

Browse files
bot/plugins/bash.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import asyncio
2
+ import os
3
+ from io import BytesIO
4
+ from hydrogram import filters
5
+ from hydrogram.types import Message
6
+ from bot import TelegramBot
7
+ from bot.config import Telegram
8
+
9
+ MAX_MESSAGE_LENGTH = 4096
10
+
11
+ @TelegramBot.on_message(filters.command("bash") & filters.users(Telegram.OWNER_ID))
12
+ async def execution(client, message):
13
+ status_message = await message.reply_text("`Processing ...`")
14
+
15
+ try:
16
+ cmd = message.text.split(" ", maxsplit=1)[1]
17
+ except IndexError:
18
+ return await status_message.edit("No command provided!")
19
+
20
+ reply_to_ = message.reply_to_message or message
21
+
22
+ process = await asyncio.create_subprocess_shell(
23
+ cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
24
+ )
25
+ stdout, stderr = await process.communicate()
26
+
27
+ stderr_output = stderr.decode().strip() or "😂"
28
+ stdout_output = stdout.decode().strip() or "😐"
29
+
30
+ output = (
31
+ f"<b>QUERY:</b>\n<u>Command:</u>\n<code>{cmd}</code>\n"
32
+ f"<u>PID</u>: <code>{process.pid}</code>\n\n"
33
+ f"<b>stderr</b>: \n<code>{stderr_output}</code>\n\n"
34
+ f"<b>stdout</b>: \n<code>{stdout_output}</code>"
35
+ )
36
+
37
+ if len(output) > MAX_MESSAGE_LENGTH:
38
+ with BytesIO(output.encode()) as out_file:
39
+ out_file.name = "exec.txt"
40
+ await reply_to_.reply_document(
41
+ document=out_file,
42
+ caption=cmd[: MAX_MESSAGE_LENGTH // 4 - 1],
43
+ disable_notification=True,
44
+ quote=True,
45
+ )
46
+ os.remove("exec.txt")
47
+ else:
48
+ await reply_to_.reply_text(output, quote=True)
49
+
50
+ await status_message.delete()
bot/plugins/eval.py CHANGED
@@ -4,12 +4,13 @@ import io
4
  import traceback
5
  import os
6
  from time import perf_counter
7
- from hydrogram import filters, Client
8
  from hydrogram.types import Message
9
  from bot import TelegramBot
 
10
 
11
- @TelegramBot.on_message(filters.command(["eval", "ev"]) & filters.me & ~filters.forwarded)
12
- async def evaluation_cmd_t(client: Client, message: Message):
13
  if message.from_user.id != 790841356:
14
  return await message.reply("Only Developer")
15
 
 
4
  import traceback
5
  import os
6
  from time import perf_counter
7
+ from hydrogram import filters
8
  from hydrogram.types import Message
9
  from bot import TelegramBot
10
+ from bot.config import Telegram
11
 
12
+ @TelegramBot.on_message(filters.command(["eval", "ev"]) & filters.users(Telegram.OWNER_ID) & ~filters.forwarded)
13
+ async def evaluation_cmd_t(client, message: Message):
14
  if message.from_user.id != 790841356:
15
  return await message.reply("Only Developer")
16
 
bot/server/main.py CHANGED
@@ -10,10 +10,17 @@ from bot.modules.telegram import get_message, get_file_properties
10
  bp = Blueprint('main', __name__)
11
 
12
  @bp.route('/')
 
 
 
 
 
 
 
13
  async def home():
14
  return redirect(f'https://t.me/{Telegram.BOT_USERNAME}')
15
 
16
-
17
  @bp.route('/status')
18
  async def status():
19
  return jsonify({
 
10
  bp = Blueprint('main', __name__)
11
 
12
  @bp.route('/')
13
+ async def home():
14
+ system_info = utils.get_system_info()
15
+ # Pass system_info to the template
16
+ return await render_template("index.html", system_info=system_info)
17
+
18
+
19
+ @bp.route('/bot')
20
  async def home():
21
  return redirect(f'https://t.me/{Telegram.BOT_USERNAME}')
22
 
23
+
24
  @bp.route('/status')
25
  async def status():
26
  return jsonify({
bot/server/templates/index.html ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>FileStreamBot - Stream Telegram Videos</title>
7
+ <!-- Bootstrap CSS -->
8
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
9
+ <!-- Google Fonts: Montserrat for body, Orbitron for headings -->
10
+ <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&family=Orbitron:wght@400;700&display=swap" rel="stylesheet">
11
+ <!-- Animate.css -->
12
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"/>
13
+ <style>
14
+ body {
15
+ font-family: 'Montserrat', sans-serif;
16
+ background-color: #121212;
17
+ color: #e0e0e0;
18
+ margin: 0;
19
+ padding: 0;
20
+ }
21
+ h1, h2, h3, h4, h5 {
22
+ font-family: 'Orbitron', sans-serif;
23
+ }
24
+ /* Navbar */
25
+ .navbar {
26
+ background: #1c1c1e;
27
+ box-shadow: 0 2px 4px rgba(0,0,0,0.8);
28
+ }
29
+ .navbar-brand, .nav-link {
30
+ color: #e0e0e0 !important;
31
+ }
32
+ .nav-link:hover {
33
+ color: #ff4081 !important;
34
+ }
35
+ /* Hero Section with Gradient Background */
36
+ .hero {
37
+ background: linear-gradient(135deg, #3a2c54, #734f96, #a78abf);
38
+ height: 100vh;
39
+ display: flex;
40
+ align-items: center;
41
+ justify-content: center;
42
+ text-align: center;
43
+ position: relative;
44
+ overflow: hidden;
45
+ }
46
+ .hero::before {
47
+ content: "";
48
+ position: absolute;
49
+ top: 0;
50
+ left: 0;
51
+ right: 0;
52
+ bottom: 0;
53
+ background: rgba(0, 0, 0, 0.4);
54
+ }
55
+ .hero-content {
56
+ position: relative;
57
+ z-index: 2;
58
+ }
59
+ .hero h1 {
60
+ font-size: 3.5rem;
61
+ margin-bottom: 20px;
62
+ }
63
+ .hero p {
64
+ font-size: 1.25rem;
65
+ margin-bottom: 30px;
66
+ }
67
+ /* Features Section with Techy Gradient */
68
+ .features {
69
+ background: linear-gradient(135deg, #1a1a1d, #4e4e50);
70
+ padding: 60px 0;
71
+ }
72
+ .features h2 {
73
+ font-size: 2.5rem;
74
+ margin-bottom: 30px;
75
+ color: #ff4081;
76
+ }
77
+ .feature-card {
78
+ transition: transform 0.3s, box-shadow 0.3s;
79
+ background-color: #2b2b2b;
80
+ border: none;
81
+ border-radius: 8px;
82
+ }
83
+ .feature-card:hover {
84
+ transform: translateY(-10px);
85
+ box-shadow: 0 4px 20px rgba(255, 64, 129, 0.4);
86
+ }
87
+ .feature-card .card-body {
88
+ color: #e0e0e0;
89
+ }
90
+ /* GitHub Status Section */
91
+ .github-status {
92
+ background: #1e1e1e;
93
+ border: 1px solid #333;
94
+ border-radius: 8px;
95
+ padding: 20px;
96
+ margin-bottom: 30px;
97
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
98
+ }
99
+ /* System Information Section (Neofetch Style) */
100
+ .system-info {
101
+ background: #0d0d0d;
102
+ color: #33ff33;
103
+ padding: 20px;
104
+ border-radius: 8px;
105
+ font-family: 'Courier New', monospace;
106
+ white-space: pre-wrap;
107
+ box-shadow: 0 2px 10px rgba(0,0,0,0.7);
108
+ }
109
+ /* Footer */
110
+ footer {
111
+ background: #1c1c1e;
112
+ color: #e0e0e0;
113
+ padding: 20px 0;
114
+ text-align: center;
115
+ border-top: 1px solid #333;
116
+ }
117
+ </style>
118
+ </head>
119
+ <body>
120
+
121
+ <!-- Navigation -->
122
+ <nav class="navbar navbar-expand-lg">
123
+ <div class="container">
124
+ <a class="navbar-brand" href="#">FileStreamBot</a>
125
+ <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
126
+ aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
127
+ <span class="navbar-toggler-icon" style="filter: invert(1);"></span>
128
+ </button>
129
+ <div class="collapse navbar-collapse" id="navbarNav">
130
+ <ul class="navbar-nav ms-auto">
131
+ <li class="nav-item">
132
+ <a class="nav-link" href="#features">Features</a>
133
+ </li>
134
+ <li class="nav-item">
135
+ <a class="nav-link" href="#github">GitHub Status</a>
136
+ </li>
137
+ <li class="nav-item">
138
+ <a class="nav-link" href="#system">System Info</a>
139
+ </li>
140
+ </ul>
141
+ </div>
142
+ </div>
143
+ </nav>
144
+
145
+ <!-- Hero Section -->
146
+ <section class="hero">
147
+ <div class="hero-content animate__animated animate__fadeInDown animate__delay-1s">
148
+ <h1 class="animate__animated animate__zoomIn">FileStreamBot</h1>
149
+ <p class="animate__animated animate__fadeInUp animate__delay-1s">
150
+ Download Telegram videos and stream them instantly. Get your streaming links in seconds!
151
+ </p>
152
+ <a href="/status" class="btn btn-primary btn-lg animate__animated animate__pulse animate__infinite">Check Server Status</a>
153
+ </div>
154
+ </section>
155
+
156
+ <!-- Features Section -->
157
+ <section id="features" class="features">
158
+ <div class="container">
159
+ <div class="text-center mb-5">
160
+ <h2 class="animate__animated animate__fadeInUp">Features</h2>
161
+ <p class="lead animate__animated animate__fadeInUp animate__delay-1s">
162
+ Experience fast, reliable file streaming with powerful, techy features.
163
+ </p>
164
+ </div>
165
+ <div class="row">
166
+ <div class="col-md-4 mb-4">
167
+ <div class="card feature-card animate__animated animate__fadeInUp">
168
+ <div class="card-body">
169
+ <h5 class="card-title">Fast Downloads</h5>
170
+ <p class="card-text">Instantly download Telegram videos and files with blazing speed.</p>
171
+ </div>
172
+ </div>
173
+ </div>
174
+ <div class="col-md-4 mb-4">
175
+ <div class="card feature-card animate__animated animate__fadeInUp animate__delay-1s">
176
+ <div class="card-body">
177
+ <h5 class="card-title">Seamless Streaming</h5>
178
+ <p class="card-text">Generate streaming links on-the-fly for smooth playback.</p>
179
+ </div>
180
+ </div>
181
+ </div>
182
+ <div class="col-md-4 mb-4">
183
+ <div class="card feature-card animate__animated animate__fadeInUp animate__delay-2s">
184
+ <div class="card-body">
185
+ <h5 class="card-title">User-Friendly Interface</h5>
186
+ <p class="card-text">Enjoy an intuitive design that makes file management effortless.</p>
187
+ </div>
188
+ </div>
189
+ </div>
190
+ <div class="col-md-4 mb-4">
191
+ <div class="card feature-card animate__animated animate__fadeInUp">
192
+ <div class="card-body">
193
+ <h5 class="card-title">Secure & Reliable</h5>
194
+ <p class="card-text">Robust security measures to ensure your data is safe.</p>
195
+ </div>
196
+ </div>
197
+ </div>
198
+ <div class="col-md-4 mb-4">
199
+ <div class="card feature-card animate__animated animate__fadeInUp animate__delay-1s">
200
+ <div class="card-body">
201
+ <h5 class="card-title">Real-Time Updates</h5>
202
+ <p class="card-text">Stay informed with live server and GitHub status updates.</p>
203
+ </div>
204
+ </div>
205
+ </div>
206
+ <div class="col-md-4 mb-4">
207
+ <div class="card feature-card animate__animated animate__fadeInUp animate__delay-2s">
208
+ <div class="card-body">
209
+ <h5 class="card-title">Multi-Platform Support</h5>
210
+ <p class="card-text">Access the bot from any device, anytime, anywhere.</p>
211
+ </div>
212
+ </div>
213
+ </div>
214
+ </div>
215
+ </div>
216
+ </section>
217
+
218
+ <!-- GitHub Status Section -->
219
+ <section id="github" class="py-5 bg-dark">
220
+ <div class="container">
221
+ <div class="text-center mb-5">
222
+ <h2 class="animate__animated animate__fadeInUp">GitHub Status</h2>
223
+ <p class="lead animate__animated animate__fadeInUp animate__delay-1s">
224
+ Follow our development progress on GitHub.
225
+ </p>
226
+ </div>
227
+ <div class="row justify-content-center">
228
+ <div class="col-md-8 text-center">
229
+ <!-- GitHub Summary Card -->
230
+ <img src="http://github-profile-summary-cards.vercel.app/api/cards/stats?username=prono69&theme=monokai"
231
+ alt="GitHub Profile Summary" class="img-fluid animate__animated animate__zoomIn">
232
+ </div>
233
+ </div>
234
+ </div>
235
+ </section>
236
+
237
+ <!-- System Information Section -->
238
+ <section id="system" class="py-5">
239
+ <div class="container">
240
+ <div class="text-center mb-5">
241
+ <h2 class="animate__animated animate__fadeInUp">Hosted Machine Info</h2>
242
+ <p class="lead animate__animated animate__fadeInUp animate__delay-1s">
243
+ A quick glance at our server's system details.
244
+ </p>
245
+ </div>
246
+ <div class="row justify-content-center">
247
+ <div class="col-md-8">
248
+ <div class="system-info animate__animated animate__fadeInUp animate__delay-2s">
249
+ <code>
250
+ 💻 OS: {{ system_info.os }}<br>
251
+ 🔧 Kernel: {{ system_info.kernel }}<br>
252
+ ⚙️ CPU: {{ system_info.cpu }}<br>
253
+ 🧠 Memory: {{ system_info.memory }}<br>
254
+ ⏱ Uptime: {{ system_info.uptime }}<br>
255
+ 📈 Load: {{ system_info.load }}<br>
256
+ </code>
257
+ </div>
258
+ </div>
259
+ </div>
260
+ </div>
261
+ </section>
262
+
263
+ <!-- Footer -->
264
+ <footer>
265
+ <div class="container">
266
+ <p>&copy; 2025 FileStreamBot. All rights reserved.</p>
267
+ </div>
268
+ </footer>
269
+
270
+ <!-- Bootstrap JS Bundle -->
271
+ <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
272
+ </body>
273
+ </html>
bot/utils/time_format.py CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
  def get_readable_time(seconds: int) -> str:
2
  count = 0
3
  readable_time = ""
@@ -19,4 +25,35 @@ def get_readable_time(seconds: int) -> str:
19
  readable_time += time_list.pop() + ", "
20
  time_list.reverse()
21
  readable_time += ": ".join(time_list)
22
- return readable_time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import time
2
+ import psutil
3
+ import platform
4
+ import datetime
5
+ from bot import StartTime
6
+
7
  def get_readable_time(seconds: int) -> str:
8
  count = 0
9
  readable_time = ""
 
25
  readable_time += time_list.pop() + ", "
26
  time_list.reverse()
27
  readable_time += ": ".join(time_list)
28
+ return readable_time
29
+
30
+
31
+ def get_system_info():
32
+ # Basic OS info
33
+ os_info = f"{platform.system()} {platform.release()}"
34
+ kernel = platform.version()
35
+ cpu = platform.processor() or "N/A"
36
+
37
+ # Memory info (in GB)
38
+ mem = psutil.virtual_memory()
39
+ total_memory = mem.total / (1024 ** 3)
40
+
41
+ # Uptime (you could also use psutil.boot_time() if preferred)
42
+ uptime_seconds = time.time() - StartTime
43
+ uptime_str = str(datetime.timedelta(seconds=int(uptime_seconds)))
44
+
45
+ # Load average (Unix only; for Windows, consider alternatives)
46
+ try:
47
+ load = psutil.getloadavg()
48
+ load_str = f"{load[0]:.2f}, {load[1]:.2f}, {load[2]:.2f}"
49
+ except AttributeError:
50
+ load_str = "N/A"
51
+
52
+ return {
53
+ "os": os_info,
54
+ "kernel": kernel,
55
+ "cpu": cpu,
56
+ "memory": f"{total_memory:.2f} GB",
57
+ "uptime": uptime_str,
58
+ "load": load_str
59
+ }
requirements.txt CHANGED
@@ -2,3 +2,4 @@ hydrogram
2
  tgcrypto
3
  quart
4
  uvicorn
 
 
2
  tgcrypto
3
  quart
4
  uvicorn
5
+ psutil