Captain Ezio commited on
Commit
2657b6b
·
1 Parent(s): 2707517

Minor changes in `info` plugin

Browse files
Files changed (1) hide show
  1. Powers/plugins/info.py +10 -6
Powers/plugins/info.py CHANGED
@@ -195,6 +195,7 @@ async def info_func(c: Gojo, message: Message):
195
 
196
  try:
197
  info_caption, photo_id = await user_info(c, user=user)
 
198
  LOGGER.info(
199
  f"{message.from_user.id} tried to fetch user info of user {message.from_user.id} in {message.chat.id}"
200
  )
@@ -205,7 +206,7 @@ async def info_func(c: Gojo, message: Message):
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()
@@ -226,20 +227,23 @@ async def chat_info_func(c: Gojo, message: Message):
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}**....."
236
  )
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}"
 
195
 
196
  try:
197
  info_caption, photo_id = await user_info(c, user=user)
198
+ photo_id = str(photo_id)
199
  LOGGER.info(
200
  f"{message.from_user.id} tried to fetch user info of user {message.from_user.id} in {message.chat.id}"
201
  )
 
206
 
207
  if not photo_id:
208
  return await m.edit(info_caption, disable_web_page_preview=True)
209
+ photo = await c.download_media(photo_id)
210
 
211
  await message.reply_photo(photo, caption=info_caption, quote=False)
212
  await m.delete()
 
227
  chat = splited[1]
228
 
229
  try:
230
+ user_found = int(user_found)
231
+ except (ValueError, Exception) as ef:
232
+ if "invalid literal for int() with base 10:" in str(ef):
233
+ user_found = str(user_found)
234
+ else:
235
+ return await message.reply_text(f"Got and exception {e}\n**Usage:**/chinfo [USERNAME|ID]")
236
 
237
  m = await message.reply_text(
238
  f"Fetching chat info of chat **{message.chat.title}**....."
239
  )
240
 
241
  info_caption, photo_id = await chat_info(c, chat=chat)
242
+ photo_id = str(photo_id)
243
  if not photo_id:
244
  return await m.edit(info_caption, disable_web_page_preview=True)
245
 
246
+ photo = await c.download_media(photo_id)
247
  await message.reply_photo(photo, caption=info_caption, quote=False)
248
  LOGGER.info(
249
  f"{message.from_user.id} fetched chat info of chat {chat} in {message.chat.id}"