Upload 2 files
Browse files- Akeno/plugins/afk.py +186 -0
- Akeno/plugins/pmpermit.py +225 -0
Akeno/plugins/afk.py
ADDED
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import random
|
3 |
+
import time
|
4 |
+
|
5 |
+
from pyrogram import Client, filters
|
6 |
+
from pyrogram.enums import MessageMediaType
|
7 |
+
from pyrogram.types import Message
|
8 |
+
from pyrogram import Client as ren
|
9 |
+
|
10 |
+
from config import *
|
11 |
+
from Akeno.utils.database import db
|
12 |
+
from Akeno.utils.formatter import add_to_dict, get_from_dict, readable_time
|
13 |
+
from Akeno.utils.handler import Akeno, group_only
|
14 |
+
|
15 |
+
afk_quotes = [
|
16 |
+
"๐ถโโ๏ธ Taking a break, be back soon!",
|
17 |
+
"โณ AFK - Away From the Keyboard momentarily.",
|
18 |
+
"๐ Stepped away, but I'll return shortly.",
|
19 |
+
"๐ Gone for a moment, not forgotten.",
|
20 |
+
"๐ฟ Taking a breather, back in a bit.",
|
21 |
+
"๐ต Away for a while, feel free to leave a message!",
|
22 |
+
"โฐ On a short break, back shortly.",
|
23 |
+
"๐ Away from the screen, catching a breath.",
|
24 |
+
"๐ค Offline for a moment, but still here in spirit.",
|
25 |
+
"๐ Exploring the real world, back in a moment!",
|
26 |
+
"๐ต Taking a tea break, back shortly!",
|
27 |
+
"๐ Resting my keyboard, back after a short nap.",
|
28 |
+
"๐ถโโ๏ธ Stepping away for a moment of peace.",
|
29 |
+
"๐ต AFK but humming along, back shortly!",
|
30 |
+
"๐ Taking a sunshine break, back soon!",
|
31 |
+
"๐ Away, catching some waves of relaxation.",
|
32 |
+
"๐ช Temporarily closed, be back in a bit!",
|
33 |
+
"๐ธ Taking a moment to smell the digital roses.",
|
34 |
+
"๐ Stepped into the real world for a while.",
|
35 |
+
]
|
36 |
+
|
37 |
+
async def input_user(message: Message) -> str:
|
38 |
+
"""Get the input from the user"""
|
39 |
+
if len(message.command) < 2:
|
40 |
+
output = ""
|
41 |
+
else:
|
42 |
+
try:
|
43 |
+
output = message.text.split(" ", 1)[1].strip() or ""
|
44 |
+
except IndexError:
|
45 |
+
output = ""
|
46 |
+
return output
|
47 |
+
|
48 |
+
async def _log(client: Client, tag: str, text: str, file: str = None):
|
49 |
+
msg = f"**#{tag.upper()}**\n\n{text}"
|
50 |
+
try:
|
51 |
+
if file:
|
52 |
+
try:
|
53 |
+
await client.send_document(LOGGER_ID, file, caption=msg)
|
54 |
+
except:
|
55 |
+
await client.send_message(
|
56 |
+
"me",
|
57 |
+
msg,
|
58 |
+
disable_web_page_preview=True
|
59 |
+
)
|
60 |
+
else:
|
61 |
+
await client.send_message(
|
62 |
+
"me",
|
63 |
+
msg,
|
64 |
+
disable_web_page_preview=True
|
65 |
+
)
|
66 |
+
except Exception as e:
|
67 |
+
raise Exception(f"LogErr: {e}")
|
68 |
+
|
69 |
+
@Akeno(
|
70 |
+
~filters.scheduled & filters.command(["afk"]) & filters.me & ~filters.forwarded
|
71 |
+
)
|
72 |
+
async def afk(client: Client, message: Message):
|
73 |
+
if await db.is_afk(message.from_user.id):
|
74 |
+
return await message.reply_text("๐จ'๐ ๐บ๐
๐๐พ๐บ๐ฝ๐ ๐ ๐ฅ๐ช!")
|
75 |
+
media_type = None
|
76 |
+
media = None
|
77 |
+
if message.reply_to_message and message.reply_to_message.media:
|
78 |
+
if message.reply_to_message.media == MessageMediaType.ANIMATION:
|
79 |
+
media_type = "animation"
|
80 |
+
elif message.reply_to_message.media == MessageMediaType.AUDIO:
|
81 |
+
media_type = "audio"
|
82 |
+
elif message.reply_to_message.media == MessageMediaType.PHOTO:
|
83 |
+
media_type = "photo"
|
84 |
+
elif message.reply_to_message.media == MessageMediaType.STICKER:
|
85 |
+
media_type = "sticker"
|
86 |
+
elif message.reply_to_message.media == MessageMediaType.VIDEO:
|
87 |
+
media_type = "video"
|
88 |
+
elif message.reply_to_message.media == MessageMediaType.VOICE:
|
89 |
+
media_type = "voice"
|
90 |
+
media = await message.reply_to_message.forward(LOGGER_ID)
|
91 |
+
reason = await input_user(message)
|
92 |
+
reason = reason if reason else "Not specified"
|
93 |
+
await db.set_afk(
|
94 |
+
message.from_user.id,
|
95 |
+
reason,
|
96 |
+
media.id if media else None, media_type
|
97 |
+
)
|
98 |
+
await message.reply_text("๐ฆ๐๐๐๐ ๐ ๐ฅ๐ช! ๐ฒ๐พ๐พ ๐๐บ'๐
๐
๐
๐บ๐๐พ๐.")
|
99 |
+
status = await db.get_env(ENV_TEMPLATE.is_logger)
|
100 |
+
if status and status.lower() == "true":
|
101 |
+
await _log(
|
102 |
+
client,
|
103 |
+
tag="afk",
|
104 |
+
text=f"Going AFK! \n\n**Reason:** `{reason}`"
|
105 |
+
)
|
106 |
+
add_to_dict(AFK_CACHE, [message.from_user.id, message.chat.id])
|
107 |
+
|
108 |
+
@Akeno(filters.incoming & ~filters.bot & ~filters.service)
|
109 |
+
async def afk_watch(client: Client, message: Message):
|
110 |
+
afk_data = await db.get_afk(client.me.id)
|
111 |
+
if not afk_data:
|
112 |
+
return
|
113 |
+
|
114 |
+
if message.from_user.id == afk_data["user_id"]:
|
115 |
+
return
|
116 |
+
|
117 |
+
if message.chat.type in group_only:
|
118 |
+
if not message.mentioned:
|
119 |
+
return
|
120 |
+
|
121 |
+
afk_time = readable_time(round(time.time() - afk_data["time"]))
|
122 |
+
caption = f"**{random.choice(afk_quotes)}**\n\n**๐ซ ๐ฑ๐พ๐บ๐๐๐:** {afk_data['reason']}\n**โฐ ๐ ๐ฅ๐ช ๐ฅ๐๐๐:** `{afk_time}`"
|
123 |
+
|
124 |
+
if afk_data["media_type"] == "animation":
|
125 |
+
media = await client.get_messages("me", afk_data["media"])
|
126 |
+
sent = await client.send_animation(
|
127 |
+
message.chat.id, media.animation.file_id, caption, True
|
128 |
+
)
|
129 |
+
|
130 |
+
elif afk_data["media_type"] in ["audio", "photo", "video", "voice"]:
|
131 |
+
sent = await client.copy_message(
|
132 |
+
message.chat.id,
|
133 |
+
"me",
|
134 |
+
afk_data["media"],
|
135 |
+
caption,
|
136 |
+
reply_to_message_id=message.id,
|
137 |
+
)
|
138 |
+
|
139 |
+
elif afk_data["media_type"] == "sticker":
|
140 |
+
media = await client.get_messages("me", afk_data["media"])
|
141 |
+
await client.download_media(media, "afk.png")
|
142 |
+
sent = await message.reply_photo("afk.png", caption=caption)
|
143 |
+
os.remove("afk.png")
|
144 |
+
|
145 |
+
else:
|
146 |
+
sent = await message.reply_text(caption)
|
147 |
+
link = message.link if message.chat.type in group_only else "No DM Link"
|
148 |
+
status = await db.get_env(ENV_TEMPLATE.is_logger)
|
149 |
+
if status and status.lower() == "true":
|
150 |
+
await _log(
|
151 |
+
client,
|
152 |
+
tag="afk",
|
153 |
+
text=f"{message.from_user.mention} mentioned you when you were AFK! \n\n**Link:** {link}"
|
154 |
+
)
|
155 |
+
try:
|
156 |
+
data = get_from_dict(AFK_CACHE, [afk_data["user_id"], message.chat.id])
|
157 |
+
if data:
|
158 |
+
await client.delete_messages(message.chat.id, data)
|
159 |
+
add_to_dict(AFK_CACHE, [afk_data["user_id"], message.chat.id], sent.id)
|
160 |
+
except KeyError:
|
161 |
+
add_to_dict(AFK_CACHE, [afk_data["user_id"], message.chat.id], sent.id)
|
162 |
+
|
163 |
+
@Akeno(filters.outgoing, group=2)
|
164 |
+
async def remove_afk(_, message: Message):
|
165 |
+
if not message.from_user:
|
166 |
+
return
|
167 |
+
if await db.is_afk(message.from_user.id):
|
168 |
+
if "afk" in message.text:
|
169 |
+
return
|
170 |
+
|
171 |
+
data = await db.get_afk(message.from_user.id)
|
172 |
+
total_afk_time = readable_time(round(time.time() - data["time"]))
|
173 |
+
|
174 |
+
x = await message.reply_text(
|
175 |
+
f"**๐ก๐บ๐ผ๐ ๐๐ ๐๐๐๐๐๐บ๐
๐๐๐๐
๐ฝ! \n\nโ Was away for:** `{total_afk_time}`"
|
176 |
+
)
|
177 |
+
await message.delete()
|
178 |
+
|
179 |
+
await db.rm_afk(message.from_user.id)
|
180 |
+
status = await db.get_env(ENV_TEMPLATE.is_logger)
|
181 |
+
if status and status.lower() == "true":
|
182 |
+
await _log(
|
183 |
+
client,
|
184 |
+
tag="afk",
|
185 |
+
text=f"Returned from AFK! \n\n**Time:** `{total_afk_time}`\n**Link:** {x.link}"
|
186 |
+
)
|
Akeno/plugins/pmpermit.py
ADDED
@@ -0,0 +1,225 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import random
|
2 |
+
|
3 |
+
from pyrogram import Client, filters
|
4 |
+
from pyrogram.enums import ChatType
|
5 |
+
from pyrogram.types import Message
|
6 |
+
|
7 |
+
from config import ENV_TEMPLATE, CMD_HANDLER
|
8 |
+
from Akeno.utils.database import db
|
9 |
+
from Akeno.utils.handler import Akeno
|
10 |
+
|
11 |
+
blocked_messages = [
|
12 |
+
"๐ค User has entered the silent zone.",
|
13 |
+
"๐ป Message blocked. Ghost mode activated.",
|
14 |
+
"๐๏ธ Sorry, the user is on vacation in Blockland.",
|
15 |
+
"๐ซ Message blocked. Time for a digital forcefield.",
|
16 |
+
"๐ท User temporarily ejected from my DM.",
|
17 |
+
"๐ Blocking vibes only. Silence in progress.",
|
18 |
+
"๐ Shhh... message blocked for tranquility.",
|
19 |
+
"๐ท Access denied. User in the digital timeout corner.",
|
20 |
+
"โ User temporarily MIA from the conversation.",
|
21 |
+
"๐ Message blocked. Secret mission engaged.",
|
22 |
+
]
|
23 |
+
unblocked_messages = [
|
24 |
+
"๐ Welcome back! Digital barrier lifted.",
|
25 |
+
"๐ Unblocked! Get ready for a flood of messages.",
|
26 |
+
"๐๏ธ User released from message jail. Freedom at last!",
|
27 |
+
"๐ Breaking the silence!.",
|
28 |
+
"๐ฌ User back on the radar. Messages unlocked!",
|
29 |
+
"๐ Soaring back into the conversation!",
|
30 |
+
"๐ Reconnecting user to the chat matrix.",
|
31 |
+
"๐ Unblocking for an influx of communication!",
|
32 |
+
"๐ Launching user back into the message cosmos!",
|
33 |
+
"๐๏ธ Unblocked and ready for the conversation spotlight!",
|
34 |
+
]
|
35 |
+
|
36 |
+
WARNS = {}
|
37 |
+
PREV_MESSAGE = {}
|
38 |
+
|
39 |
+
async def input_user(message: Message) -> str:
|
40 |
+
"""Get the input from the user"""
|
41 |
+
if len(message.command) < 2:
|
42 |
+
output = ""
|
43 |
+
else:
|
44 |
+
try:
|
45 |
+
output = message.text.split(" ", 1)[1].strip() or ""
|
46 |
+
except IndexError:
|
47 |
+
output = ""
|
48 |
+
return output
|
49 |
+
|
50 |
+
@Akeno(
|
51 |
+
~filters.scheduled & filters.command(["allow", "approve", "a"], CMD_HANDLER) & filters.me & ~filters.forwarded
|
52 |
+
)
|
53 |
+
async def allow_pm(client: Client, message: Message):
|
54 |
+
if len(message.command) > 1:
|
55 |
+
try:
|
56 |
+
user = await client.get_users(message.command[1])
|
57 |
+
user_id = user.id
|
58 |
+
user_mention = user.mention
|
59 |
+
except Exception as e:
|
60 |
+
return await message.reply_text(str(e))
|
61 |
+
elif message.chat.type == ChatType.PRIVATE:
|
62 |
+
user_id = message.chat.id
|
63 |
+
user_mention = message.chat.first_name or message.chat.title
|
64 |
+
elif message.reply_to_message:
|
65 |
+
user_id = message.reply_to_message.from_user.id
|
66 |
+
user_mention = message.reply_to_message.from_user.mention
|
67 |
+
else:
|
68 |
+
return await message.reply_text(
|
69 |
+
"`Reply to a user or give their id/username`"
|
70 |
+
)
|
71 |
+
if user_id == client.me.id:
|
72 |
+
return await message.reply_text("`I can't allow myself`")
|
73 |
+
if await db.is_pmpermit(client.me.id, user_id):
|
74 |
+
return await message.reply_text("`User is already allowed to pm!`")
|
75 |
+
await db.add_pmpermit(client.me.id, user_id)
|
76 |
+
await message.reply_text(f"**Allowed:** {user_mention}")
|
77 |
+
|
78 |
+
@Akeno(
|
79 |
+
~filters.scheduled & filters.command(["disallow", "disapprove", "d"], CMD_HANDLER) & filters.me & ~filters.forwarded
|
80 |
+
)
|
81 |
+
async def disallow_pm(client: Client, message: Message):
|
82 |
+
if len(message.command) > 1:
|
83 |
+
try:
|
84 |
+
user = await client.get_users(message.command[1])
|
85 |
+
user_id = user.id
|
86 |
+
user_mention = user.mention
|
87 |
+
except Exception as e:
|
88 |
+
return await message.reply_text(f"`{e}`")
|
89 |
+
elif message.chat.type == ChatType.PRIVATE:
|
90 |
+
user_id = message.chat.id
|
91 |
+
user_mention = message.chat.first_name or message.chat.title
|
92 |
+
elif message.reply_to_message:
|
93 |
+
user_id = message.reply_to_message.from_user.id
|
94 |
+
user_mention = message.reply_to_message.from_user.mention
|
95 |
+
else:
|
96 |
+
return await message.reply_text(
|
97 |
+
"`Reply to a user or give their id/username`"
|
98 |
+
)
|
99 |
+
|
100 |
+
if user_id == client.me.id:
|
101 |
+
return await message.reply_text("`I can't disallow myself`")
|
102 |
+
|
103 |
+
if not await db.is_pmpermit(client.me.id, user_id):
|
104 |
+
return await message.reply_text("`User is not allowed to pm!`")
|
105 |
+
await db.rm_pmpermit(client.me.id, user_id)
|
106 |
+
await message.reply_text(
|
107 |
+
f"** Disallowed:** {user_mention}"
|
108 |
+
)
|
109 |
+
|
110 |
+
@Akeno(
|
111 |
+
~filters.scheduled & filters.command(["allowlist", "approvelist"], CMD_HANDLER) & filters.me & ~filters.forwarded
|
112 |
+
)
|
113 |
+
async def allowlist(client: Client, message: Message):
|
114 |
+
x = await message.reply_text("`Fetching allowlist...`")
|
115 |
+
users = await db.get_all_pmpermits(client.me.id)
|
116 |
+
if not users:
|
117 |
+
return await x.edit("`No users allowed to pm!`")
|
118 |
+
|
119 |
+
text = "**๐ ๐ ๐๐๐๐๐๐พ๐ฝ ๐ด๐๐พ๐'๐ ๐ซ๐๐๐:**\n\n"
|
120 |
+
for user in users:
|
121 |
+
try:
|
122 |
+
name = (await client.get_users(user["user"])).first_name
|
123 |
+
text += f"{name} (`{user['user']}`) | {user['date']}\n"
|
124 |
+
except:
|
125 |
+
text += f"Unkown Peer (`{user['user']}`) | {user['date']}\n"
|
126 |
+
|
127 |
+
await x.edit(text)
|
128 |
+
|
129 |
+
@Akeno(
|
130 |
+
~filters.scheduled & filters.command(["pmpermit"], CMD_HANDLER) & filters.me & ~filters.forwarded
|
131 |
+
)
|
132 |
+
async def set_pmpermit(_, message: Message):
|
133 |
+
if len(message.command) < 2:
|
134 |
+
status = await db.get_env(ENV_TEMPLATE.pmpermit)
|
135 |
+
text = "Enabled" if status else "Disabled"
|
136 |
+
return await message.reply_text(
|
137 |
+
f"**Current PM Permit Setting:** `{text}`\n\nTo change the setting give either `on` or `off` as argument.",
|
138 |
+
)
|
139 |
+
cmd = message.command[1].lower().strip()
|
140 |
+
if cmd == "on":
|
141 |
+
await db.set_env(ENV_TEMPLATE.pmpermit, True)
|
142 |
+
await message.reply_text("**PM Permit Enabled!**")
|
143 |
+
elif cmd == "off":
|
144 |
+
await db.set_env(ENV_TEMPLATE.pmpermit, False)
|
145 |
+
await message.reply_text("**PM Permit Disabled!**")
|
146 |
+
else:
|
147 |
+
await message.reply_text("**Invalid Argument!**")
|
148 |
+
|
149 |
+
@Akeno(filters.outgoing & filters.private & ~filters.bot)
|
150 |
+
async def handler_outgoing_pm(client: Client, message: Message):
|
151 |
+
if message.chat.id == 777000:
|
152 |
+
return
|
153 |
+
|
154 |
+
if not await db.get_env(ENV_TEMPLATE.pmpermit):
|
155 |
+
return
|
156 |
+
|
157 |
+
if not await db.is_pmpermit(client.me.id, message.chat.id):
|
158 |
+
await db.add_pmpermit(client.me.id, message.chat.id)
|
159 |
+
x = await message.reply_text("Approving ...")
|
160 |
+
await x.edit_text(
|
161 |
+
f"**Auto-Approved Outgoing PM:** {message.chat.first_name}",
|
162 |
+
)
|
163 |
+
|
164 |
+
|
165 |
+
@Akeno(filters.incoming & filters.private & ~filters.bot & ~filters.service)
|
166 |
+
async def handle_incoming_pm(client: Client, message: Message):
|
167 |
+
if message.from_user.id == 1191668125:
|
168 |
+
return
|
169 |
+
if message.from_user.id == 777000:
|
170 |
+
return
|
171 |
+
if not await db.get_env(ENV_TEMPLATE.pmpermit):
|
172 |
+
return
|
173 |
+
if await db.is_pmpermit(client.me.id, message.from_user.id):
|
174 |
+
return
|
175 |
+
if message.from_user.id == 1191668125:
|
176 |
+
return
|
177 |
+
max_spam = await db.get_env(ENV_TEMPLATE.pm_max_spam)
|
178 |
+
max_spam = int(max_spam) if max_spam else 3
|
179 |
+
warns = WARNS.get(client.me.id, {}).get(message.from_user.id, max_spam)
|
180 |
+
if warns <= 0:
|
181 |
+
await client.block_user(message.from_user.id)
|
182 |
+
WARNS[client.me.id] = {message.from_user.id: max_spam}
|
183 |
+
return await client.send_message(
|
184 |
+
message.from_user.id,
|
185 |
+
f"**๐ค๐๐๐๐๐ ๐๐ฟ ๐๐๐๐ ๐๐๐บ๐๐๐๐๐ ๐๐พ๐๐พ! ๐ก๐
๐๐ผ๐๐๐๐ ๐๐๐ ๐ฟ๐๐๐ ๐ฏ๐ฌ ๐๐๐๐๐
๐ฟ๐๐๐๐๐พ๐ ๐๐๐๐๐ผ๐พ.**",
|
186 |
+
)
|
187 |
+
pm_msg = f"Tiktok ๐๐ ๐๐๐๐ฎ๐ซ๐ข๐ญ๐ฒ!\n\n"
|
188 |
+
custom_pmmsg = await db.get_env(ENV_TEMPLATE.custom_pmpermit)
|
189 |
+
if custom_pmmsg:
|
190 |
+
pm_msg += f"{custom_pmmsg}\n**๐ธ๐๐ ๐๐บ๐๐พ {warns} ๐๐บ๐๐๐๐๐๐ ๐
๐พ๐ฟ๐!**"
|
191 |
+
else:
|
192 |
+
pm_msg += f"**๐ง๐พ๐
๐
๐ {message.from_user.mention}!**\n๐ณ๐๐๐ ๐๐ ๐บ๐ ๐บ๐๐๐๐๐บ๐๐พ๐ฝ ๐๐พ๐๐๐บ๐๐พ ๐บ๐๐ฝ ๐๐๐ ๐บ๐๐พ ๐๐พ๐๐๐พ๐๐๐พ๐ฝ ๐๐๐ ๐๐ ๐๐๐บ๐ ๐๐พ๐๐๐บ๐๐พ๐ ๐๐พ๐๐พ! \n**๐ธ๐๐ ๐๐บ๐๐พ {warns} ๐๐บ๐๐๐๐๐๐ ๐
๐พ๐ฟ๐!**"
|
193 |
+
try:
|
194 |
+
pm_pic = await db.get_env(ENV_TEMPLATE.pmpermit_pic)
|
195 |
+
if pm_pic and pm_pic.endswith(".mp4"):
|
196 |
+
msg = await client.send_video(
|
197 |
+
message.from_user.id,
|
198 |
+
pm_pic,
|
199 |
+
pm_msg,
|
200 |
+
)
|
201 |
+
elif pm_pic:
|
202 |
+
msg = await client.send_photo(
|
203 |
+
message.from_user.id,
|
204 |
+
pm_pic,
|
205 |
+
pm_msg,
|
206 |
+
)
|
207 |
+
else:
|
208 |
+
msg = await client.send_message(
|
209 |
+
message.from_user.id,
|
210 |
+
pm_msg,
|
211 |
+
disable_web_page_preview=True,
|
212 |
+
)
|
213 |
+
except:
|
214 |
+
msg = await client.send_message(
|
215 |
+
message.from_user.id,
|
216 |
+
pm_msg,
|
217 |
+
disable_web_page_preview=True,
|
218 |
+
)
|
219 |
+
|
220 |
+
prev_msg = PREV_MESSAGE.get(client.me.id, {}).get(message.from_user.id, None)
|
221 |
+
if prev_msg:
|
222 |
+
await prev_msg.delete()
|
223 |
+
|
224 |
+
PREV_MESSAGE[client.me.id] = {message.from_user.id: msg}
|
225 |
+
WARNS[client.me.id] = {message.from_user.id: warns - 1}
|