iamgojoof6eyes commited on
Commit
9969375
·
1 Parent(s): 73b7e0a

Looks good

Browse files
Files changed (1) hide show
  1. Powers/plugins/info.py +12 -9
Powers/plugins/info.py CHANGED
@@ -142,19 +142,22 @@ async def info_func(c: Gojo, message: Message):
142
  await message.reply_text("You are not providing proper arguments.......**Usage:**/info [USERNAME|ID]....Example /info @iamgojoof6eyes")
143
  await message.stop_propagation()
144
 
145
- try:
146
- user, _ , _= await extract_user(c , message)
147
- except Exception as e:
148
- return await message.reply_text(f"Got an error while running extract_user function error is {e}.....Give this message in supoort group")
 
 
 
149
 
150
  if not user:
151
  message.reply_text("Can't find user to fetch info!")
152
 
153
- m = await message.reply_text(f"Fetching user info of user {user}...")
154
 
155
  try:
156
  info_caption, photo_id = await user_info(user)
157
- LOGGER.info(f"{message.from_user.id} tried to fetch user info of user {user} in {m.chat.id}")
158
  except Exception as e:
159
  LOGGER.error(e)
160
  LOGGER.error(format_exc())
@@ -167,7 +170,7 @@ async def info_func(c: Gojo, message: Message):
167
  await message.reply_photo(photo, caption=info_caption, quote=False)
168
  await m.delete()
169
  os.remove(photo)
170
- LOGGER.info(f"{message.from_user.id} fetched user info of user {user} in {m.chat.id}")
171
 
172
 
173
 
@@ -176,7 +179,7 @@ async def chat_info_func(_, message: Message):
176
  splited = message.text.split()
177
  try:
178
  if len(splited) == 1:
179
- return await message.reply_text("I can't fetch nothing......")
180
 
181
  elif len(splited) > 2:
182
  return await message.reply_text(
@@ -195,7 +198,7 @@ async def chat_info_func(_, message: Message):
195
 
196
  photo = await Gojo.download_media(photo_id)
197
  await message.reply_photo(photo, caption=info_caption, quote=False)
198
- LOGGER.info(f"{message.from_user.id} fetched chat info of user {chat} in {m.chat.id}")
199
 
200
  await m.delete()
201
  os.remove(photo)
 
142
  await message.reply_text("You are not providing proper arguments.......**Usage:**/info [USERNAME|ID]....Example /info @iamgojoof6eyes")
143
  await message.stop_propagation()
144
 
145
+ if m.reply_to_message and not m.reply_to_message.from_user:
146
+ user = message.reply_to_message.from_user.id
147
+ else:
148
+ try:
149
+ user, _ , _= await extract_user(c , message)
150
+ except Exception as e:
151
+ return await message.reply_text(f"Got an error while running extract_user function error is {e}.....Give this message in supoort group")
152
 
153
  if not user:
154
  message.reply_text("Can't find user to fetch info!")
155
 
156
+ m = await message.reply_text(f"Fetching user info of user {user.username}...")
157
 
158
  try:
159
  info_caption, photo_id = await user_info(user)
160
+ LOGGER.info(f"{message.from_user.id} tried to fetch user info of user {user.username} in {m.chat.id}")
161
  except Exception as e:
162
  LOGGER.error(e)
163
  LOGGER.error(format_exc())
 
170
  await message.reply_photo(photo, caption=info_caption, quote=False)
171
  await m.delete()
172
  os.remove(photo)
173
+ LOGGER.info(f"{message.from_user.id} fetched user info of user {user.username} in {m.chat.id}")
174
 
175
 
176
 
 
179
  splited = message.text.split()
180
  try:
181
  if len(splited) == 1:
182
+ chat = message.chat.id
183
 
184
  elif len(splited) > 2:
185
  return await message.reply_text(
 
198
 
199
  photo = await Gojo.download_media(photo_id)
200
  await message.reply_photo(photo, caption=info_caption, quote=False)
201
+ LOGGER.info(f"{message.from_user.id} fetched chat info of chat {chat.title} in {m.chat.id}")
202
 
203
  await m.delete()
204
  os.remove(photo)