-
Notifications
You must be signed in to change notification settings - Fork 570
/
start.py
151 lines (136 loc) · 6.05 KB
/
start.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
from time import time
from datetime import datetime
from config import BOT_USERNAME, BOT_NAME, ASSISTANT_NAME, OWNER_NAME, UPDATES_CHANNEL, GROUP_SUPPORT
from helpers.filters import command
from pyrogram import Client, filters, emoji
from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton
from helpers.decorators import authorized_users_only
START_TIME = datetime.utcnow()
START_TIME_ISO = START_TIME.replace(microsecond=0).isoformat()
TIME_DURATION_UNITS = (
('week', 60 * 60 * 24 * 7),
('day', 60 * 60 * 24),
('hour', 60 * 60),
('min', 60),
('sec', 1)
)
async def _human_time_duration(seconds):
if seconds == 0:
return 'inf'
parts = []
for unit, div in TIME_DURATION_UNITS:
amount, seconds = divmod(int(seconds), div)
if amount > 0:
parts.append('{} {}{}'
.format(amount, unit, "" if amount == 1 else "s"))
return ', '.join(parts)
@Client.on_message(command("start") & filters.private & ~filters.edited)
async def start_(client: Client, message: Message):
await message.reply_text(
f"""<b>✨ **Welcome {message.from_user.first_name}** \n
💭 **[{BOT_NAME}](https://t.me/{BOT_USERNAME}) 𝗮𝗹𝗹𝗼𝘄 𝘆𝗼𝘂 𝘁𝗼 𝗽𝗹𝗮𝘆 𝗺𝘂𝘀𝗶𝗰 𝗼𝗻 𝗴𝗿𝗼𝘂𝗽𝘀 𝘁𝗵𝗿𝗼𝘂𝗴𝗵 𝘁𝗵𝗲 𝗻𝗲𝘄 𝗧𝗲𝗹𝗲𝗴𝗿𝗮𝗺'𝘀 𝘃𝗼𝗶𝗰𝗲 𝗰𝗵𝗮𝘁𝘀!**
💡 **𝗙𝗶𝗻𝗱 𝗼𝘂𝘁 𝗮𝗹𝗹 𝘁𝗵𝗲 𝗕𝗼𝘁'𝘀 𝗰𝗼𝗺𝗺𝗮𝗻𝗱𝘀 𝗮𝗻𝗱 𝗵𝗼𝘄 𝘁𝗵𝗲𝘆 𝘄𝗼𝗿𝗸 𝗯𝘆 𝗰𝗹𝗶𝗰𝗸𝗶𝗻𝗴 𝗼𝗻 𝘁𝗵𝗲 » 📚 𝗖𝗼𝗺𝗺𝗮𝗻𝗱𝘀 𝗯𝘂𝘁𝘁𝗼𝗻!**
❓ **𝗙𝗼𝗿 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻 𝗮𝗯𝗼𝘂𝘁 𝗮𝗹𝗹 𝗳𝗲𝗮𝘁𝘂𝗿𝗲 𝗼𝗳 𝘁𝗵𝗶𝘀 𝗯𝗼𝘁, 𝗷𝘂𝘀𝘁 𝘁𝘆𝗽𝗲 /help**
</b>""",
reply_markup=InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
"➕ Add me to Group ➕", url=f"https://t.me/{BOT_USERNAME}?startgroup=true")
],[
InlineKeyboardButton(
"📚 Commands", url="https://telegra.ph/mizu-music-08-04-2"
),
InlineKeyboardButton(
"💝 Donate", url=f"https://t.me/{OWNER_NAME}")
],[
InlineKeyboardButton(
"👥 Official Group", url=f"https://t.me/{GROUP_SUPPORT}"
),
InlineKeyboardButton(
"📣 Official Channel", url=f"https://t.me/{UPDATES_CHANNEL}")
],[
InlineKeyboardButton(
"🌐 Wiki's Page", url="https://github.com/levina-lab/veezmusic/wiki/Veez-Music-Wiki's")
],[
InlineKeyboardButton(
"💬 Ask For Help", url="https://t.me/veezcenterbot"
)
]
]
),
disable_web_page_preview=True
)
@Client.on_message(command(["start", f"start@{BOT_USERNAME}"]) & filters.group & ~filters.edited)
async def start(client: Client, message: Message):
current_time = datetime.utcnow()
uptime_sec = (current_time - START_TIME).total_seconds()
uptime = await _human_time_duration(int(uptime_sec))
await message.reply_text(
f"""✅ **bot is running**\n<b>💠 **uptime:**</b> `{uptime}`""",
reply_markup=InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
"✨ Group", url=f"https://t.me/{GROUP_SUPPORT}"
),
InlineKeyboardButton(
"📣 Channel", url=f"https://t.me/{UPDATES_CHANNEL}"
)
]
]
)
)
@Client.on_message(command("help") & filters.private & ~filters.edited)
async def help(client: Client, message: Message):
await message.reply_text(
f"""<b>Hello {message.from_user.first_name}✨
\n👥 **command for all users:**
\n/play (song name) - To play the song you requested from youtube
/playlist - To show the list of all music for streaming
/current - To show the song in streaming
/song (song name) - To download song from youtube
/search (video name) - To search video from youtube detailed
/vsong (video name) - To download video from youtube detailed
\n👷🏻♂️ **command for admins:**
\n/player - Open music player settings panel
/pause - Pause the music streaming
/resume - Resume the music was paused
/skip - For skip to the next song
/end - For stop music streaming
/userbotjoin - To invite the assistant for join to your group
/reload - For refresh the admin list
</b>""",
reply_markup=InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
"✨ Group", url=f"https://t.me/{GROUP_SUPPORT}"
),
InlineKeyboardButton(
"📣 Channel", url=f"https://t.me/{UPDATES_CHANNEL}"
)
]
]
)
)
@Client.on_message(command(["ping", f"ping@{BOT_USERNAME}"]) & ~filters.edited)
async def ping_pong(client: Client, m: Message):
start = time()
m_reply = await m.reply_text("pinging...")
delta_ping = time() - start
await m_reply.edit_text(
f"{emoji.PING_PONG} `PONG!!`\n"
f"⚡️ `{delta_ping * 1000:.3f} ms`"
)
@Client.on_message(command(["uptime", f"uptime@{BOT_USERNAME}"]) & ~filters.edited)
@authorized_users_only
async def get_uptime(client: Client, m: Message):
current_time = datetime.utcnow()
uptime_sec = (current_time - START_TIME).total_seconds()
uptime = await _human_time_duration(int(uptime_sec))
await m.reply_text(
f"{emoji.ROBOT} bot status:\n"
f"• **uptime:** `{uptime}`\n"
f"• **start time:** `{START_TIME_ISO}`"
)