nothere990 commited on
Commit
aa0d3b9
·
1 Parent(s): cb3f46f
bot/config.py CHANGED
@@ -15,6 +15,9 @@ class Server:
15
  BIND_ADDRESS = env.get("BIND_ADDRESS", "0.0.0.0")
16
  PORT = int(env.get("PORT", 7860))
17
 
 
 
 
18
  # LOGGING CONFIGURATION
19
  LOGGER_CONFIG_JSON = {
20
  'version': 1,
 
15
  BIND_ADDRESS = env.get("BIND_ADDRESS", "0.0.0.0")
16
  PORT = int(env.get("PORT", 7860))
17
 
18
+ # Suppose PICS is defined as a string of links separated by spaces:
19
+ PICS = env.get("PICS", "https://envs.sh/0Uw.jpg https://envs.sh/0Uq.jpg https://envs.sh/0U0.jpg https://envs.sh/0UW.jpg https://envs.sh/0UI.jpg https://telegra.ph/file/3d0fac76ab59a4ef83b3a.jpg https://i.imgur.com/byGIN5S.jpg https://telegra.ph/file/d9b391fa763286dea1c38.jpg")
20
+
21
  # LOGGING CONFIGURATION
22
  LOGGER_CONFIG_JSON = {
23
  'version': 1,
bot/modules/static.py CHANGED
@@ -1,12 +1,44 @@
1
- WelcomeText = \
2
- """\
3
- Hi **%(first_name)s**, send me a file to instantly generate file links.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
- **Commands:**
6
- /privacy - View bot's privacy policy.
7
- /log - Get bot's log file. (owner only)
8
- /help - Show this message.
9
- """
10
 
11
  PrivacyText = \
12
  """
 
1
+ WelcomeText = [
2
+ """\
3
+ 👋 **Hey %(first_name)s**, welcome!
4
+
5
+ 📤 **Send me a file** to instantly generate a file link.
6
+
7
+ ━━━━━━━━━━━━━━━━━━━
8
+ 🔹 **Commands:**
9
+ 🔹 /privacy - __View bot's privacy policy.__
10
+ 🔹 /log - __Get bot's log file.__ **__(Owner only)__**
11
+ 🔹 /help - __Show this message.__
12
+ ━━━━━━━━━━━━━━━━━━━
13
+ """,
14
+ """\
15
+ ╭━──◆ **Welcome, %(first_name)s!** ◆──━╮
16
+ 🚀 **Send me a file** to instantly generate a file link!
17
+ ╰━───────────────━╯
18
+
19
+ ✨ **Available Commands:**
20
+ 📜 /privacy - __View the bot's privacy policy.__
21
+ 📂 /log - __Get the bot's log file.__ **__(Owner only)__**
22
+ ℹ️ /help - __Show this message.__
23
+
24
+ 💠 **__Enjoy the seamless experience!__** 💠
25
+ """,
26
+ """\
27
+ 🚀 **Welcome, %(first_name)s!** 🚀
28
+
29
+ 📂 **__Send me a file to instantly generate a file link!__**
30
+
31
+ ━━━━━━━━━━━━━━━━━━
32
+ ✨ **Available Commands:**
33
+ 📜 /privacy - __View bot's privacy policy.__
34
+ 📂 /log - __Get the bot's log file.__ **__(Owner only)__**
35
+ ℹ️ /help - __Show this message.__
36
+ ━━━━━━━━━━━━━━━━━━
37
+
38
+ 💠 **__Enjoy the seamless experience!__** 💠
39
+ """
40
+ ]
41
 
 
 
 
 
 
42
 
43
  PrivacyText = \
44
  """
bot/plugins/commands.py CHANGED
@@ -1,18 +1,32 @@
 
1
  from hydrogram import filters
2
  from hydrogram.types import Message
3
  from bot import TelegramBot
4
- from bot.config import Telegram
5
  from bot.modules.static import *
6
  from bot.modules.decorators import verify_user
7
 
8
  @TelegramBot.on_message(filters.command(['start', 'help']) & filters.private)
9
  @verify_user
10
  async def start_command(_, msg: Message):
11
- await msg.reply(
12
- text = WelcomeText % {'first_name': msg.from_user.first_name},
13
- quote = True
14
- )
15
-
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  @TelegramBot.on_message(filters.command('privacy') & filters.private)
17
  @verify_user
18
  async def privacy_command(_, msg: Message):
 
1
+ import random
2
  from hydrogram import filters
3
  from hydrogram.types import Message
4
  from bot import TelegramBot
5
+ from bot.config import Telegram, PICS
6
  from bot.modules.static import *
7
  from bot.modules.decorators import verify_user
8
 
9
  @TelegramBot.on_message(filters.command(['start', 'help']) & filters.private)
10
  @verify_user
11
  async def start_command(_, msg: Message):
12
+ # Randomly select a photo link from PICS
13
+ pic = random.choice(PICS.split())
14
+ caption_text = random.choice(WelcomeText) % {'first_name': msg.from_user.first_name}
15
+
16
+ try:
17
+ await msg.reply_photo(
18
+ photo=pic,
19
+ caption=caption_text,
20
+ quote=True
21
+ )
22
+ except Exception:
23
+ # If sending the photo fails, just send the text message.
24
+ await msg.reply(
25
+ text=caption_text,
26
+ quote=True
27
+ )
28
+
29
+
30
  @TelegramBot.on_message(filters.command('privacy') & filters.private)
31
  @verify_user
32
  async def privacy_command(_, msg: Message):
bot/plugins/eval.py ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import asyncio
2
+ import sys
3
+ 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
+
16
+ status_message = await message.reply("__Processing eval pyrogram...__")
17
+ try:
18
+ cmd = message.text.split(" ", maxsplit=1)[1]
19
+ except IndexError:
20
+ return await status_message.edit("__No evaluate message!__")
21
+
22
+ old_stdout, old_stderr = sys.stdout, sys.stderr
23
+ sys.stdout, sys.stderr = io.StringIO(), io.StringIO()
24
+ stdout, stderr, exc = None, None, None
25
+
26
+ try:
27
+ await aexec(cmd, client, message)
28
+ except Exception:
29
+ exc = traceback.format_exc()
30
+
31
+ stdout, stderr = sys.stdout.getvalue(), sys.stderr.getvalue()
32
+ sys.stdout, sys.stderr = old_stdout, old_stderr
33
+
34
+ evaluation = exc or stderr or stdout or "Success"
35
+ final_output = f"**OUTPUT**:\n<pre language=''>{evaluation.strip()}</pre>"
36
+
37
+ if len(final_output) > 4096:
38
+ with open("eval.txt", "w", encoding="utf8") as out_file:
39
+ out_file.write(final_output)
40
+ await status_message.reply_document("eval.txt", caption=cmd[:1024], disable_notification=True)
41
+ os.remove("eval.txt")
42
+ await status_message.delete()
43
+ else:
44
+ await status_message.edit_text(final_output)
45
+
46
+ async def aexec(code, client, message):
47
+ exec(
48
+ """
49
+ async def __aexec(client, message):
50
+ import os
51
+ neo = message
52
+ message = event = neo = e
53
+ r = reply = message.reply_to_message
54
+ chat = message.chat.id
55
+ c = client
56
+ to_photo = message.reply_photo
57
+ to_video = message.reply_video
58
+ p = print
59
+ """ + "\n".join(f" {line}" for line in code.split("\n"))
60
+ )
61
+ return await locals()["__aexec"](client, message)