forked from sharath28-cloud/OpenUserBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsangmata.py
More file actions
45 lines (41 loc) · 1.56 KB
/
sangmata.py
File metadata and controls
45 lines (41 loc) · 1.56 KB
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
#Port to userbot by @KeselekPermen69
import datetime
from telethon import events
from telethon.errors.rpcerrorlist import YouBlockedUserError
from telethon.tl.functions.account import UpdateNotifySettingsRequest
from userbot.events import register
from userbot import bot, CMD_HELP
@register(outgoing=True, pattern="^.sg(?: |$)(.*)")
async def _(event):
if event.fwd_from:
return
if not event.reply_to_msg_id:
await event.edit("`Reply to any user message.`")
return
reply_message = await event.get_reply_message()
if not reply_message.text:
await event.edit("```reply to text message```")
return
chat = "@SangMataInfo_bot"
sender = reply_message.sender
if reply_message.sender.bot:
await event.edit("`Reply to actual users message.`")
return
await event.edit("`Processing`")
async with bot.conversation(chat) as conv:
try:
response = conv.wait_event(events.NewMessage(incoming=True,from_users=461843263))
await bot.forward_messages(chat, reply_message)
response = await response
except YouBlockedUserError:
await event.reply("`Please unblock @sangmatainfo_bot and try again`")
return
if response.text.startswith("Forward"):
await event.edit("`can you kindly disable your forward privacy settings for good?`")
else:
await event.edit(f"{response.message.message}")
CMD_HELP.update({
"sangmata":
".sg \
\nUsage: View user history.\n"
})