Skip to content

Commit

Permalink
Added delays when creating a bot due to Telegram blocking accounts as…
Browse files Browse the repository at this point in the history
… it considers the account a bot
  • Loading branch information
D4n13l3k00 authored Mar 27, 2024
1 parent 1255697 commit 3a99753
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions friendly-telegram/inline.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,10 +390,14 @@ async def _create_bot(self) -> None:
await m.delete()
await r.delete()

await asyncio.sleep(2)

# Set its name to user's name + GeekTG Userbot
m = await conv.send_message(f"🤖 GeekTG Userbot of {self._name}")
r = await conv.get_response()

await asyncio.sleep(2)

await m.delete()
await r.delete()

Expand All @@ -404,19 +408,25 @@ async def _create_bot(self) -> None:
m = await conv.send_message(username)
r = await conv.get_response()

await asyncio.sleep(2)

await m.delete()
await r.delete()

# Set bot profile pic
m = await conv.send_message("/setuserpic")
r = await conv.get_response()

await asyncio.sleep(2)

await m.delete()
await r.delete()

m = await conv.send_message(username)
r = await conv.get_response()

await asyncio.sleep(2)

await m.delete()
await r.delete()

Expand Down Expand Up @@ -474,6 +484,9 @@ async def _assert_token(
for row in r.reply_markup.rows:
for button in row.buttons:
if re.search(r"@geektg_[0-9a-zA-Z]{6}_bot", button.text, re.I):

await asyncio.sleep(2)

m = await conv.send_message(button.text)
r = await conv.get_response()

Expand All @@ -484,6 +497,8 @@ async def _assert_token(
m = await conv.send_message("/revoke")
r = await conv.get_response()

await asyncio.sleep(2)

await m.delete()
await r.delete()

Expand All @@ -504,55 +519,73 @@ async def _assert_token(
m = await conv.send_message("/setinline")
r = await conv.get_response()

await asyncio.sleep(2)

await m.delete()
await r.delete()

m = await conv.send_message(button.text)
r = await conv.get_response()

await asyncio.sleep(2)

await m.delete()
await r.delete()

m = await conv.send_message("GeekQuery")
r = await conv.get_response()

await asyncio.sleep(2)

await m.delete()
await r.delete()

m = await conv.send_message("/setinlinefeedback")
r = await conv.get_response()

await asyncio.sleep(2)

await m.delete()
await r.delete()

m = await conv.send_message(button.text)
r = await conv.get_response()

await asyncio.sleep(2)

await m.delete()
await r.delete()

m = await conv.send_message("Enabled")
r = await conv.get_response()

await asyncio.sleep(2)

await m.delete()
await r.delete()

# Set bot profile pic
m = await conv.send_message("/setuserpic")
r = await conv.get_response()

await asyncio.sleep(2)

await m.delete()
await r.delete()

m = await conv.send_message(button.text)
r = await conv.get_response()

await asyncio.sleep(2)

await m.delete()
await r.delete()

m = await conv.send_file(photo)
r = await conv.get_response()

await asyncio.sleep(2)

await m.delete()
await r.delete()

Expand Down

0 comments on commit 3a99753

Please sign in to comment.