Captain Ezio commited on
Commit
b8484bd
·
2 Parent(s): d90dabe 2f3f4e3
Files changed (1) hide show
  1. Powers/plugins/info.py +10 -19
Powers/plugins/info.py CHANGED
@@ -1,5 +1,4 @@
1
  import os
2
- from asyncio import sleep
3
  from pyrogram import enums
4
  from datetime import datetime
5
  from traceback import format_exc
@@ -205,14 +204,11 @@ async def info_func(c: Gojo, message: Message):
205
  return await m.edit(str(e))
206
 
207
  if not photo_id:
208
- await m.delete()
209
- sleep(2)
210
- return await message.reply_text(info_caption, disable_web_page_preview=True)
211
- photo = await c.download_media(photo_id)
212
 
213
- await m.delete()
214
- sleep(2)
215
  await message.reply_photo(photo, caption=info_caption, quote=False)
 
216
  os.remove(photo)
217
  LOGGER.info(
218
  f"{message.from_user.id} fetched user info of user {user_name} in {m.chat.id}"
@@ -230,12 +226,10 @@ async def chat_info_func(c: Gojo, message: Message):
230
  chat = splited[1]
231
 
232
  try:
233
- chat = int(chat)
234
- except (ValueError, Exception) as ef:
235
- if "invalid literal for int() with base 10:" in str(ef):
236
- chat = str(chat)
237
- else:
238
- return await message.reply_text(f"Got and exception {e}\n**Usage:**/chinfo [USERNAME|ID]")
239
 
240
  m = await message.reply_text(
241
  f"Fetching chat info of chat **{message.chat.title}**....."
@@ -243,18 +237,15 @@ async def chat_info_func(c: Gojo, message: Message):
243
 
244
  info_caption, photo_id = await chat_info(c, chat=chat)
245
  if not photo_id:
246
- await m.delete()
247
- sleep(2)
248
- return await message.reply_text(info_caption, disable_web_page_preview=True)
249
 
250
- photo = await c.download_media(photo_id)
251
- await m.delete()
252
- sleep(2)
253
  await message.reply_photo(photo, caption=info_caption, quote=False)
254
  LOGGER.info(
255
  f"{message.from_user.id} fetched chat info of chat {chat} in {message.chat.id}"
256
  )
257
 
 
258
  os.remove(photo)
259
  except Exception as e:
260
  await message.reply_text(text=e)
 
1
  import os
 
2
  from pyrogram import enums
3
  from datetime import datetime
4
  from traceback import format_exc
 
204
  return await m.edit(str(e))
205
 
206
  if not photo_id:
207
+ return await m.edit(info_caption, disable_web_page_preview=True)
208
+ photo = await Gojo.download_media(photo_id)
 
 
209
 
 
 
210
  await message.reply_photo(photo, caption=info_caption, quote=False)
211
+ await m.delete()
212
  os.remove(photo)
213
  LOGGER.info(
214
  f"{message.from_user.id} fetched user info of user {user_name} in {m.chat.id}"
 
226
  chat = splited[1]
227
 
228
  try:
229
+ if chat.isnumeric():
230
+ chat = int(chat)
231
+ except Exception as e:
232
+ return await message.reply_text(f"Got and exception {e}\n**Usage:**/chinfo [USERNAME|ID]")
 
 
233
 
234
  m = await message.reply_text(
235
  f"Fetching chat info of chat **{message.chat.title}**....."
 
237
 
238
  info_caption, photo_id = await chat_info(c, chat=chat)
239
  if not photo_id:
240
+ return await m.edit(info_caption, disable_web_page_preview=True)
 
 
241
 
242
+ photo = await Gojo.download_media(photo_id)
 
 
243
  await message.reply_photo(photo, caption=info_caption, quote=False)
244
  LOGGER.info(
245
  f"{message.from_user.id} fetched chat info of chat {chat} in {message.chat.id}"
246
  )
247
 
248
+ await m.delete()
249
  os.remove(photo)
250
  except Exception as e:
251
  await message.reply_text(text=e)