├── Procfile
├── requirements.txt
├── configs.py
├── database.py
├── README.md
├── app.json
└── app.py
/Procfile:
--------------------------------------------------------------------------------
1 | worker: python3 app.py
2 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | pyrogram
2 | TgCrypto
3 | Truecallerpy
4 | pymongo[srv]
--------------------------------------------------------------------------------
/configs.py:
--------------------------------------------------------------------------------
1 | from os import path, getenv
2 |
3 | class Config:
4 | API_ID = int(getenv("API_ID", "0112234"))
5 | API_HASH = getenv("API_HASH", "abcdefg")
6 | BOT_TOKEN = getenv("BOT_TOKEN", "1234567891:AdDfgFRFVVfDEhdhyjjvjjftSEW")
7 | CHID = int(getenv("CHID", "-1000112234"))
8 | SUDO = list(map(int, getenv("SUDO").split()))
9 | MONGO_URI = getenv("MONGO_URI", "")
10 | LOGCHID = int(getenv("LOGCHID", "-1000112234"))
11 | API = getenv("API", "abcdefu67-8dgdg")
12 | cfg = Config()
13 |
--------------------------------------------------------------------------------
/database.py:
--------------------------------------------------------------------------------
1 | from pymongo import MongoClient
2 | from configs import cfg
3 |
4 | client = MongoClient(cfg.MONGO_URI)
5 |
6 | users = client['main']['users']
7 | groups = client['main']['groups']
8 |
9 | def already_db(user_id):
10 | user = users.find_one({"user_id" : str(user_id)})
11 | if not user:
12 | return False
13 | return True
14 |
15 | def already_dbg(chat_id):
16 | group = groups.find_one({"chat_id" : str(chat_id)})
17 | if not group:
18 | return False
19 | return True
20 |
21 | def add_user(user_id):
22 | in_db = already_db(user_id)
23 | if in_db:
24 | return "444"
25 | return users.insert_one({"user_id": str(user_id)})
26 |
27 | def remove_user(user_id):
28 | in_db = already_db(user_id)
29 | if not in_db:
30 | return
31 | return users.delete_one({"user_id": str(user_id)})
32 |
33 | def add_group(chat_id):
34 | in_db = already_dbg(chat_id)
35 | if in_db:
36 | return
37 | return groups.insert_one({"chat_id": str(chat_id)})
38 |
39 | def all_users():
40 | user = users.find({})
41 | usrs = len(list(user))
42 | return usrs
43 |
44 | def all_groups():
45 | group = groups.find({})
46 | grps = len(list(group))
47 | return grps
48 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # The TrueCaller Bot
2 | 👾 Hey I can find information from phone number. Easy to use and simple.
3 |
4 | ## 🚀 Demo Bot
5 | - [@TheTrueCallerBot](https://t.me/TheTrueCaller_Bot)
6 |
7 |
〽️ Deploy Me
8 |
9 | 📌 Deploy to Heroku
10 |
11 |
12 |
13 |
14 |
15 | ## 🏷 Environment Variables
16 | - `API_ID` - Your Telegram API ID.Get it [Here](my.telegram.org)
17 | - `API_HASH` - Your Telegram API HASH.Get it [Here](my.telegram.org)
18 | - `BOT_TOKEN` - Your Bot Token. Get it from [Here](https://t.me/BotFather)
19 | - `CHID` - Your Force subscribe channel id Get it from @MissRose_Bot
20 | - `SUDO` - bot owners Id/ ids ( for broadcast and stats cmds). for multiple use space.
21 | - `API` - ypu must download truecaller app and log with phone number. get it from truecallerapp click 3 dots on top of right corner > settings > privacy center > download my data. after downloaded open .json file and find Instalation { "id" : "....
22 | your api key is in after "id" : .
23 |
24 | ### 💫 Credits
25 | - [Me](https://github.com/ImDenuwan) for Nothing 😅
26 |
27 | # Note
28 | this is not final bot and updates upcomming. you can create pull requests. bcz currently i don't have time to update.
29 |
30 |
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "truecaller Bot",
3 | "description": "I can find phone number informations.",
4 | "repository": "https://github.com/ImDenuwan/truecaller-Bot",
5 | "logo":"https://telegra.ph/file/2f61421c348c1ec42fde7.jpg",
6 | "keywords": [
7 | "Bot",
8 | "Telegram ",
9 | "Pyrogram "
10 | ],
11 |
12 | "env": {
13 | "API_ID": {
14 | "description": "Enter your API_ID, get it from my.telegram.org/apps",
15 | "required": true
16 | },
17 | "API_HASH": {
18 | "description": "Enter your API_HASH, get it from my.telegram.org/apps",
19 | "required": true
20 | },
21 | "BOT_TOKEN": {
22 | "description": "Enter your Bot token, get it from @BotFather",
23 | "required": true
24 | },
25 | "CHID": {
26 | "description": "Enter your Force Subscribe channel ID",
27 | "required": true
28 | },
29 | "LOGCHID": {
30 | "description": "Enter your log chnl id",
31 | "required": true
32 | },
33 | "API": {
34 | "description": "Enter your API",
35 | "required": true
36 | },
37 | "SUDO": {
38 | "description": "Enter Bot Owners IDS",
39 | "required": true
40 | }
41 |
42 | },
43 |
44 | "formation": {
45 | "worker": {
46 | "quantity": 1,
47 | "size": "free"
48 | }
49 | },
50 | "buildpacks": [
51 | {
52 | "url": "heroku/python"
53 | }
54 | ]
55 | }
56 |
--------------------------------------------------------------------------------
/app.py:
--------------------------------------------------------------------------------
1 | from truecallerpy import search_phonenumber
2 | from pyrogram import Client, filters, enums, errors
3 | from pyrogram.errors import UserNotParticipant
4 | from pyrogram.errors.exceptions.flood_420 import FloodWait
5 | from pyrogram.types import Message, InlineKeyboardButton, InlineKeyboardMarkup, CallbackQuery
6 | from database import add_user, add_group, all_users, all_groups, users, remove_user
7 | import asyncio, random
8 | from configs import cfg
9 |
10 | bot = Client(
11 | "trucaller",
12 | api_id=cfg.API_ID,
13 | api_hash=cfg.API_HASH,
14 | bot_token=cfg.BOT_TOKEN
15 | )
16 | OWNER_ID = cfg.SUDO
17 | CHID = cfg.CHID
18 | LOG_ID = cfg.LOGCHID
19 | cc = cfg.API
20 |
21 | async def numchk(n: str, x):
22 | try:
23 | if len(n) == 12:
24 | if n.startswith("+94"):
25 | number = n[3:]
26 | else:
27 | number = "Invalid Number"
28 | elif len(n) == 10:
29 | if n.startswith("0"):
30 | number = n[1:]
31 | else:
32 | number = "Invalid Number"
33 | elif len(n) == 9:
34 | number = n
35 | else:
36 | number = "Invalid Number"
37 | except Exception as e:
38 | number = "Invalid Number"
39 | await bot.send_message(LOG_ID,f"**Error**\n\n`{e}`")
40 | return await getinfo(number, x)
41 |
42 | #______________________________________________________________
43 |
44 | sendtxt = """
45 | 👾 Founded Information's ✓✓
46 |
47 | »»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
48 |
49 | 💁♂️┎╼ Name :- {}
50 |
51 | 📞 ├╼ Number :- {}
52 |
53 | 👁🗨 ├╼ Number Type :- {}
54 |
55 | 📮 ├╼ Countrycode :- {}
56 |
57 | 📶 ├╼ ISP :- {}
58 |
59 | ⏳┖╼ TimeZone :- {}
60 |
61 | Social Accounts ⤸⤸
62 | ☘️ Telegram Link :- Click Here
63 | ☘️ Whatsapp Link :- Click Here
64 |
65 | »»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
66 |
67 | 🔥 Powered By @Taprobane_LK ©️| @TheTruecaller_Bot 🤖
68 |
69 | """
70 |
71 | async def getinfo(num : int,x):
72 | try:
73 | if num == "Invalid Number":
74 | await x.edit_text("**🫠 Invalid number!**")
75 | else:
76 | lel = int(num)
77 | try:
78 | r = search_phonenumber(str(lel), 'LK' ,cc )
79 | 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)
80 | except Exception as e:
81 | await x.edit_text("**🤷♂️ Not in Truecaller Database. 🤷♂️**")
82 | await bot.send_message(LOG_ID,f"**#Error**\n\n`{e}`")
83 | print(e)
84 | except Exception as e:
85 | await x.edit_text("**🫠 Invalid number!**")
86 | await bot.send_message(LOG_ID,f"**#Error**\n\n`{e}`")
87 |
88 | @bot.on_message(filters.command("start"))
89 | async def stsrt(_, m : Message):
90 | try:
91 | await bot.get_chat_member(CHID, m.from_user.id)
92 | if m.chat.type == enums.ChatType.PRIVATE:
93 | keyboard = InlineKeyboardMarkup(
94 | [
95 | [
96 | InlineKeyboardButton("🗯 Update Channel", url="https://t.me/Taprobane_Lk"),
97 | InlineKeyboardButton("💬 Support", url="https://t.me/TaprobaneChat")
98 | ]
99 | ]
100 | )
101 | k = add_user(m.from_user.id)
102 | if k == "444":
103 | print('lol')
104 | else:
105 | await bot.send_message(LOG_ID, m.from_user.first_name +" Is started Your Bot!")
106 | await m.reply_photo(photo='https://telegra.ph/file/2f61421c348c1ec42fde7.jpg',caption=
107 | f"""**
108 | 👋 Hello {m.from_user.mention}!
109 |
110 | I'm Simple Unknown call information gather bot.
111 | you can check any Sri Lankan 🇱🇰 mobile number informations from me.
112 |
113 | Features:- ⚕⚕
114 | 💫 Find unknown numbers owner name and other details.
115 | 📮 Get Social Account links.
116 | 🎯 24/7 hours active.
117 | ☘️ Hosted on Heroku.
118 |
119 | 👾 To see how it works just send /help command.
120 |
121 | 🎡 Other Countries will add soon.
122 |
123 | ||🔥 Powered By @Taprobane_LK ©️ | @TheTruecaller_Bot 🤖||**""", reply_markup=keyboard)
124 | elif m.chat.type == enums.ChatType.GROUP or enums.ChatType.SUPERGROUP:
125 | keyboar = InlineKeyboardMarkup(
126 | [
127 | [
128 | InlineKeyboardButton("💁♂️ Start me private 💁♂️", url="https://t.me/TheTruecaller_Bot?start=start")
129 | ]
130 | ]
131 | )
132 | add_group(m.chat.id)
133 | await m.reply_text("**🦊 Hello {}!\nstart me private to use me.**".format(m.from_user.first_name), reply_markup=keyboar)
134 | print(m.from_user.first_name +" Is started Your Bot!")
135 |
136 | except UserNotParticipant:
137 | key = InlineKeyboardMarkup(
138 | [
139 | [
140 | InlineKeyboardButton("🍀 Check Again 🍀", "chk")
141 | ]
142 | ]
143 | )
144 | 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)
145 | except Exception as e:
146 | print(e)
147 |
148 | @bot.on_message(filters.text &filters.private & ~filters.command(['start','help', 'users', 'fcast', 'bcast']))
149 | async def main(_, m : Message):
150 | text = m.text.replace(" ", "")
151 | x = await m.reply_text("**__⚡️ processing...**__")
152 | await numchk(text, x)
153 |
154 | @bot.on_message(filters.command("help"))
155 | async def help(_, m : Message):
156 | 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 🤖||**")
157 |
158 | @bot.on_callback_query(filters.regex("chk"))
159 | async def chk(_, cb : CallbackQuery):
160 | try:
161 | await bot.get_chat_member(CHID, cb.from_user.id)
162 | if cb.message.chat.type == enums.ChatType.PRIVATE:
163 | keyboard = InlineKeyboardMarkup(
164 | [
165 | [
166 | InlineKeyboardButton("🗯 Update Channel", url="https://t.me/Taprobane_Lk"),
167 | InlineKeyboardButton("💬 Support", url="https://t.me/TaprobaneChat")
168 | ]
169 | ]
170 | )
171 | c = add_user(cb.from_user.id)
172 | await cb.message.edit(
173 | f"""**
174 | 👋 Hello {cb.from_user.mention}!
175 |
176 | I'm Simple Unknown call information gather bot.
177 | you can check any Sri Lankan 🇱🇰 mobile number informations from me.
178 |
179 | 🧜 Features:-
180 | 💫 Find unknown numbers owner name and other details.
181 | 👾 Get Social Account links.
182 | 🎯 24/7 hours active.
183 | 📦 Hosted on Heroku.
184 |
185 | 🪩To see how it works just send /help command.
186 |
187 | 🎡 Other Countries will add soon.
188 |
189 | ||🔥 Powered By @Taprobane_LK ©️ | @TheTruecaller_Bot 🤖||**""", reply_markup=keyboard)
190 |
191 | if c == "444":
192 | print('lol')
193 | else:
194 | await bot.send_message(LOG_ID, cb.from_user.first_name +" Is started Your Bot!")
195 | print(cb.from_user.first_name +" Is started Your Bot!")
196 | except UserNotParticipant:
197 | await cb.answer("🙅♂️ You are not joined to channel join and try again. 🙅♂️")
198 | #━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ info ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
199 |
200 | @bot.on_message(filters.command("users") & filters.user(OWNER_ID))
201 | async def dbtool(_, m : Message):
202 | xx = all_users()
203 | x = all_groups()
204 | tot = int(xx + x)
205 | await m.reply_text(text=f"""
206 | 🍀 Chats Stats 🍀
207 | 🙋♂️ Users : `{xx}`
208 | 👥 Groups : `{x}`
209 | 🚧 Total users & groups : `{tot}` """)
210 |
211 | #━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Broadcast ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
212 |
213 | @bot.on_message(filters.command("bcast") & filters.user(OWNER_ID))
214 | async def bcast(_, m : Message):
215 | allusers = users
216 | lel = await m.reply_text("`⚡️ Processing...`")
217 | success = 0
218 | failed = 0
219 | deactivated = 0
220 | blocked = 0
221 | for usrs in allusers.find():
222 | try:
223 | userid = usrs["user_id"]
224 | #print(int(userid))
225 | if m.command[0] == "bcast":
226 | await m.reply_to_message.copy(int(userid))
227 | success +=1
228 | except FloodWait as ex:
229 | await asyncio.sleep(ex.value)
230 | if m.command[0] == "bcast":
231 | await m.reply_to_message.copy(int(userid))
232 | except errors.InputUserDeactivated:
233 | deactivated +=1
234 | remove_user(userid)
235 | except errors.UserIsBlocked:
236 | blocked +=1
237 | except Exception as e:
238 | print(e)
239 | failed +=1
240 |
241 | await lel.edit(f"✅Successfull to `{success}` users.\n❌ Faild to `{failed}` users.\n👾 Found `{blocked}` Blocked users \n👻 Found `{deactivated}` Deactivated users.")
242 |
243 | #━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Broadcast Forward ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
244 |
245 | @bot.on_message(filters.command("fcast") & filters.user(OWNER_ID))
246 | async def fcast(_, m : Message):
247 | allusers = users
248 | lel = await m.reply_text("`⚡️ Processing...`")
249 | success = 0
250 | failed = 0
251 | deactivated = 0
252 | blocked = 0
253 | for usrs in allusers.find():
254 | try:
255 | userid = usrs["user_id"]
256 | #print(int(userid))
257 | if m.command[0] == "fcast":
258 | await m.reply_to_message.forward(int(userid))
259 | success +=1
260 | except FloodWait as ex:
261 | await asyncio.sleep(ex.value)
262 | if m.command[0] == "fcast":
263 | await m.reply_to_message.forward(int(userid))
264 | except errors.InputUserDeactivated:
265 | deactivated +=1
266 | remove_user(userid)
267 | except errors.UserIsBlocked:
268 | blocked +=1
269 | except Exception as e:
270 | print(e)
271 | failed +=1
272 |
273 | await lel.edit(f"✅Successfull to `{success}` users.\n❌ Faild to `{failed}` users.\n👾 Found `{blocked}` Blocked users \n👻 Found `{deactivated}` Deactivated users.")
274 |
275 | print("I'm Alive Now")
276 | bot.run()
277 |
--------------------------------------------------------------------------------