-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_actions.py
201 lines (183 loc) · 6.7 KB
/
fake_actions.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# -*- coding: utf-8 -*-
# Module author: @ftgmodulesbyfl1yd, @GovnoCodules
from asyncio import sleep
from random import randint
from telethon import functions
from .. import loader, utils
@loader.tds
class FakeMod(loader.Module):
"""Imitates your actions"""
strings = {"name": "Fake Actions"}
async def typecmd(self, message):
"""Imitates typing"""
activity_time = utils.get_args(message)
await message.delete()
if activity_time:
try:
async with message.client.action(message.chat_id, "typing"):
await sleep(int(activity_time[0]))
except BaseException:
return
else:
try:
async with message.client.action(message.chat_id, "typing"):
await sleep(randint(30, 60))
except BaseException:
return
async def voicecmd(self, message):
"""Imitates sending voices"""
activity_time = utils.get_args(message)
await message.delete()
if activity_time:
try:
async with message.client.action(message.chat_id, "voice"):
await sleep(int(activity_time[0]))
except BaseException:
return
else:
try:
async with message.client.action(message.chat_id, "voice"):
await sleep(randint(30, 60))
except BaseException:
return
async def gamecmd(self, message):
"""Imitates your game activity"""
activity_time = utils.get_args(message)
await message.delete()
if activity_time:
try:
async with message.client.action(message.chat_id, "game"):
await sleep(int(activity_time[0]))
except BaseException:
return
else:
try:
async with message.client.action(message.chat_id, "game"):
await sleep(randint(30, 60))
except BaseException:
return
async def videocmd(self, message):
"""Imitates sending video"""
activity_time = utils.get_args(message)
await message.delete()
if activity_time:
try:
async with message.client.action(message.chat_id, "video"):
await sleep(int(activity_time[0]))
except BaseException:
return
else:
try:
async with message.client.action(message.chat_id, "video"):
await sleep(randint(30, 60))
except BaseException:
return
async def photocmd(self, message):
"""Imitates sending photo"""
activity_time = utils.get_args(message)
await message.delete()
if activity_time:
try:
async with message.client.action(message.chat_id, "photo"):
await sleep(int(activity_time[0]))
except BaseException:
return
else:
try:
async with message.client.action(message.chat_id, "photo"):
await sleep(randint(30, 60))
except BaseException:
return
async def documentcmd(self, message):
"""Imitates sending document"""
activity_time = utils.get_args(message)
await message.delete()
if activity_time:
try:
async with message.client.action(message.chat_id, "document"):
await sleep(int(activity_time[0]))
except BaseException:
return
else:
try:
async with message.client.action(message.chat_id, "document"):
await sleep(randint(30, 60))
except BaseException:
return
async def locationcmd(self, message):
"""Imitates sending location"""
activity_time = utils.get_args(message)
await message.delete()
if activity_time:
try:
async with message.client.action(message.chat_id, "location"):
await sleep(int(activity_time[0]))
except BaseException:
return
else:
try:
async with message.client.action(message.chat_id, "location"):
await sleep(randint(30, 60))
except BaseException:
return
async def recordvideocmd(self, message):
"""Imitates recording video"""
activity_time = utils.get_args(message)
await message.delete()
if activity_time:
try:
async with message.client.action(message.chat_id, "record-video"):
await sleep(int(activity_time[0]))
except BaseException:
return
else:
try:
async with message.client.action(message.chat_id, "record-video"):
await sleep(randint(30, 60))
except BaseException:
return
async def recordvoicecmd(self, message):
"""Imitates recording voice"""
activity_time = utils.get_args(message)
await message.delete()
if activity_time:
try:
async with message.client.action(message.chat_id, "record-audio"):
await sleep(int(activity_time[0]))
except BaseException:
return
else:
try:
async with message.client.action(message.chat_id, "record-audio"):
await sleep(randint(30, 60))
except BaseException:
return
async def recordroundcmd(self, message):
"""Imitates recording round video"""
activity_time = utils.get_args(message)
await message.delete()
if activity_time:
try:
async with message.client.action(message.chat_id, "record-round"):
await sleep(int(activity_time[0]))
except BaseException:
return
else:
try:
async with message.client.action(message.chat_id, "record-round"):
await sleep(randint(30, 60))
except BaseException:
return
async def scrncmd(self, message):
"""Screenshot notification (Only PM)"""
a = 1
r = utils.get_args(message)
if r and r[0].isdigit():
a = int(r[0])
for _ in range(a):
await message.client(
functions.messages.SendScreenshotNotificationRequest(
peer=message.to_id, reply_to_msg_id=message.id
)
)
await message.delete()