-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathapp.py
More file actions
276 lines (236 loc) ยท 11.2 KB
/
app.py
File metadata and controls
276 lines (236 loc) ยท 11.2 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
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
from truecallerpy import search_phonenumber
from pyrogram import Client, filters, enums, errors
from pyrogram.errors import UserNotParticipant
from pyrogram.errors.exceptions.flood_420 import FloodWait
from pyrogram.types import Message, InlineKeyboardButton, InlineKeyboardMarkup, CallbackQuery
from database import add_user, add_group, all_users, all_groups, users, remove_user
import asyncio, random
from configs import cfg
bot = Client(
"trucaller",
api_id=cfg.API_ID,
api_hash=cfg.API_HASH,
bot_token=cfg.BOT_TOKEN
)
OWNER_ID = cfg.SUDO
CHID = cfg.CHID
LOG_ID = cfg.LOGCHID
cc = cfg.API
async def numchk(n: str, x):
try:
if len(n) == 12:
if n.startswith("+94"):
number = n[3:]
else:
number = "Invalid Number"
elif len(n) == 10:
if n.startswith("0"):
number = n[1:]
else:
number = "Invalid Number"
elif len(n) == 9:
number = n
else:
number = "Invalid Number"
except Exception as e:
number = "Invalid Number"
await bot.send_message(LOG_ID,f"**Error**\n\n`{e}`")
return await getinfo(number, x)
#______________________________________________________________
sendtxt = """
<b><u>๐พ Founded Information's โโ</u></b>
<b>ยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยป</b>
<b>๐โโ๏ธโโผ Name :-</b> <code>{}</code>
<b>๐ โโผ Number :- </b> <code>{}</code>
<b>๐โ๐จ โโผ Number Type :-</b> <code>{}</code>
<b>๐ฎ โโผ Countrycode :-</b> <code>{}</code>
<b>๐ถ โโผ ISP :-</b> <code>{}</code>
<b>โณโโผ TimeZone :-</b> <code>{}</code>
<b>Social Accounts โคธโคธ</b>
<b><i>โ๏ธ Telegram Link :-</i> <a href={}>Click Here</a></b>
<b><i>โ๏ธ Whatsapp Link :-</i> <a href={}>Click Here</a></b>
<b>ยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยปยป</b>
<b><spoiler>๐ฅ Powered By @Taprobane_LK ยฉ๏ธ| @TheTruecaller_Bot ๐ค</spoiler></b>
"""
async def getinfo(num : int,x):
try:
if num == "Invalid Number":
await x.edit_text("**๐ซ Invalid number!**")
else:
lel = int(num)
try:
r = search_phonenumber(str(lel), 'LK' ,cc )
await x.edit_text(sendtxt.format(r['data'][0]['name'],r['data'][0]['phones'][0]['nationalFormat'],r['data'][0]['phones'][0]['numberType'],r['data'][0]['phones'][0]['countryCode'],r['data'][0]['phones'][0]['carrier'],r['data'][0]['addresses'][0]['timeZone'],f"t.me/{r['data'][0]['phones'][0]['e164Format']}",f"wa.me/{r['data'][0]['phones'][0]['e164Format']}"),disable_web_page_preview=True, parse_mode=enums.ParseMode.HTML)
except Exception as e:
await x.edit_text("**๐คทโโ๏ธ Not in Truecaller Database. ๐คทโโ๏ธ**")
await bot.send_message(LOG_ID,f"**#Error**\n\n`{e}`")
print(e)
except Exception as e:
await x.edit_text("**๐ซ Invalid number!**")
await bot.send_message(LOG_ID,f"**#Error**\n\n`{e}`")
@bot.on_message(filters.command("start"))
async def stsrt(_, m : Message):
try:
await bot.get_chat_member(CHID, m.from_user.id)
if m.chat.type == enums.ChatType.PRIVATE:
keyboard = InlineKeyboardMarkup(
[
[
InlineKeyboardButton("๐ฏ Update Channel", url="https://t.me/Taprobane_Lk"),
InlineKeyboardButton("๐ฌ Support", url="https://t.me/TaprobaneChat")
]
]
)
k = add_user(m.from_user.id)
if k == "444":
print('lol')
else:
await bot.send_message(LOG_ID, m.from_user.first_name +" Is started Your Bot!")
await m.reply_photo(photo='https://telegra.ph/file/2f61421c348c1ec42fde7.jpg',caption=
f"""**
๐ Hello {m.from_user.mention}!
I'm Simple Unknown call information gather bot.
you can check any Sri Lankan ๐ฑ๐ฐ mobile number informations from me.
Features:- โโ
๐ซ Find unknown numbers owner name and other details.
๐ฎ Get Social Account links.
๐ฏ 24/7 hours active.
โ๏ธ Hosted on Heroku.
๐พ To see how it works just send /help command.
๐ก Other Countries will add soon.
||๐ฅ Powered By @Taprobane_LK ยฉ๏ธ | @TheTruecaller_Bot ๐ค||**""", reply_markup=keyboard)
elif m.chat.type == enums.ChatType.GROUP or enums.ChatType.SUPERGROUP:
keyboar = InlineKeyboardMarkup(
[
[
InlineKeyboardButton("๐โโ๏ธ Start me private ๐โโ๏ธ", url="https://t.me/TheTruecaller_Bot?start=start")
]
]
)
add_group(m.chat.id)
await m.reply_text("**๐ฆ Hello {}!\nstart me private to use me.**".format(m.from_user.first_name), reply_markup=keyboar)
print(m.from_user.first_name +" Is started Your Bot!")
except UserNotParticipant:
key = InlineKeyboardMarkup(
[
[
InlineKeyboardButton("๐ Check Again ๐", "chk")
]
]
)
await m.reply_text("**๐งAccess Denied!๐ง\n\nPlease Join @{} to use me.If you joined click check again button to confirm.**".format("Taprobane_LK"), reply_markup=key)
except Exception as e:
print(e)
@bot.on_message(filters.text &filters.private & ~filters.command(['start','help', 'users', 'fcast', 'bcast']))
async def main(_, m : Message):
text = m.text.replace(" ", "")
x = await m.reply_text("**__โก๏ธ processing...**__")
await numchk(text, x)
@bot.on_message(filters.command("help"))
async def help(_, m : Message):
await m.reply_text("**โ ๏ธCurrently Available only for Sri Lankan Numbers.โ ๏ธ\nJust send target phone number to lookup informations.\n\nโ
Available formats:-\n - +9471โนโนโนโนโนโนโน\n - 071โนโนโนโนโนโนโน\n - 71โนโนโนโนโนโนโน\n\n๐ Ex:- `+94715607964`\n\n๐โโ๏ธ If you Need help please send message to __@TaprobaneChat.__\n\n||๐ฅ Powered By @Taprobane_LK ยฉ๏ธ | @TheTruecaller_Bot ๐ค||**")
@bot.on_callback_query(filters.regex("chk"))
async def chk(_, cb : CallbackQuery):
try:
await bot.get_chat_member(CHID, cb.from_user.id)
if cb.message.chat.type == enums.ChatType.PRIVATE:
keyboard = InlineKeyboardMarkup(
[
[
InlineKeyboardButton("๐ฏ Update Channel", url="https://t.me/Taprobane_Lk"),
InlineKeyboardButton("๐ฌ Support", url="https://t.me/TaprobaneChat")
]
]
)
c = add_user(cb.from_user.id)
await cb.message.edit(
f"""**
๐ Hello {cb.from_user.mention}!
I'm Simple Unknown call information gather bot.
you can check any Sri Lankan ๐ฑ๐ฐ mobile number informations from me.
๐ง Features:-
๐ซ Find unknown numbers owner name and other details.
๐พ Get Social Account links.
๐ฏ 24/7 hours active.
๐ฆ Hosted on Heroku.
๐ชฉTo see how it works just send /help command.
๐ก Other Countries will add soon.
||๐ฅ Powered By @Taprobane_LK ยฉ๏ธ | @TheTruecaller_Bot ๐ค||**""", reply_markup=keyboard)
if c == "444":
print('lol')
else:
await bot.send_message(LOG_ID, cb.from_user.first_name +" Is started Your Bot!")
print(cb.from_user.first_name +" Is started Your Bot!")
except UserNotParticipant:
await cb.answer("๐
โโ๏ธ You are not joined to channel join and try again. ๐
โโ๏ธ")
#โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ info โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
@bot.on_message(filters.command("users") & filters.user(OWNER_ID))
async def dbtool(_, m : Message):
xx = all_users()
x = all_groups()
tot = int(xx + x)
await m.reply_text(text=f"""
๐ Chats Stats ๐
๐โโ๏ธ Users : `{xx}`
๐ฅ Groups : `{x}`
๐ง Total users & groups : `{tot}` """)
#โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Broadcast โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
@bot.on_message(filters.command("bcast") & filters.user(OWNER_ID))
async def bcast(_, m : Message):
allusers = users
lel = await m.reply_text("`โก๏ธ Processing...`")
success = 0
failed = 0
deactivated = 0
blocked = 0
for usrs in allusers.find():
try:
userid = usrs["user_id"]
#print(int(userid))
if m.command[0] == "bcast":
await m.reply_to_message.copy(int(userid))
success +=1
except FloodWait as ex:
await asyncio.sleep(ex.value)
if m.command[0] == "bcast":
await m.reply_to_message.copy(int(userid))
except errors.InputUserDeactivated:
deactivated +=1
remove_user(userid)
except errors.UserIsBlocked:
blocked +=1
except Exception as e:
print(e)
failed +=1
await lel.edit(f"โ
Successfull to `{success}` users.\nโ Faild to `{failed}` users.\n๐พ Found `{blocked}` Blocked users \n๐ป Found `{deactivated}` Deactivated users.")
#โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Broadcast Forward โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
@bot.on_message(filters.command("fcast") & filters.user(OWNER_ID))
async def fcast(_, m : Message):
allusers = users
lel = await m.reply_text("`โก๏ธ Processing...`")
success = 0
failed = 0
deactivated = 0
blocked = 0
for usrs in allusers.find():
try:
userid = usrs["user_id"]
#print(int(userid))
if m.command[0] == "fcast":
await m.reply_to_message.forward(int(userid))
success +=1
except FloodWait as ex:
await asyncio.sleep(ex.value)
if m.command[0] == "fcast":
await m.reply_to_message.forward(int(userid))
except errors.InputUserDeactivated:
deactivated +=1
remove_user(userid)
except errors.UserIsBlocked:
blocked +=1
except Exception as e:
print(e)
failed +=1
await lel.edit(f"โ
Successfull to `{success}` users.\nโ Faild to `{failed}` users.\n๐พ Found `{blocked}` Blocked users \n๐ป Found `{deactivated}` Deactivated users.")
print("I'm Alive Now")
bot.run()