Captain Ezio commited on
Commit
6fefa14
·
1 Parent(s): ae78559

Update info.py

Browse files
Files changed (1) hide show
  1. Powers/plugins/info.py +29 -28
Powers/plugins/info.py CHANGED
@@ -97,34 +97,6 @@ async def user_info(user, already=False):
97
  caption = change("User info", body)
98
  return [caption, photo_id]
99
 
100
- @Gojo.on_message(command("info") & ~filters.edited)
101
- async def info_func(_, message: Message):
102
- if message.reply_to_message:
103
- user = message.reply_to_message.from_user.id
104
- elif not message.reply_to_message and len(message.command) == 1:
105
- user = message.from_user.id
106
- elif not message.reply_to_message and len(message.command) != 1:
107
- user = message.text.split(None, 1)[1]
108
-
109
- m = await message.reply_text(f"Fetching user info of user {user}...")
110
-
111
- try:
112
- info_caption, photo_id = await user_info(user)
113
- LOGGER.info(f"{message.from_user.id} tried to fetch user info of user {user} in {m.chat.id}")
114
- except Exception as e:
115
- LOGGER.error(e)
116
- LOGGER.error(format_exc())
117
- return await m.edit(str(e))
118
-
119
- if not photo_id:
120
- return await m.edit(info_caption, disable_web_page_preview=True)
121
- photo = await Gojo.download_media(photo_id)
122
-
123
- await message.reply_photo(photo, caption=info_caption, quote=False)
124
- await m.delete()
125
- os.remove(photo)
126
- LOGGER.info(f"{message.from_user.id} fetched user info of user {user} in {m.chat.id}")
127
-
128
 
129
  async def chat_info(chat, already=False):
130
  if not already:
@@ -160,6 +132,35 @@ async def chat_info(chat, already=False):
160
  return [caption, photo_id]
161
 
162
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
 
164
  @Gojo.on_message(command("chinfo") & ~filters.edited)
165
  async def chat_info_func(_, message: Message):
 
97
  caption = change("User info", body)
98
  return [caption, photo_id]
99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
 
101
  async def chat_info(chat, already=False):
102
  if not already:
 
132
  return [caption, photo_id]
133
 
134
 
135
+ @Gojo.on_message(command("info") & ~filters.edited)
136
+ async def info_func(_, message: Message):
137
+ if message.reply_to_message:
138
+ user = message.reply_to_message.from_user.id
139
+ elif not message.reply_to_message and len(message.command) == 1:
140
+ user = message.from_user.id
141
+ elif not message.reply_to_message and len(message.command) != 1:
142
+ user = message.text.split(None, 1)[1]
143
+
144
+ m = await message.reply_text(f"Fetching user info of user {user}...")
145
+
146
+ try:
147
+ info_caption, photo_id = await user_info(user)
148
+ LOGGER.info(f"{message.from_user.id} tried to fetch user info of user {user} in {m.chat.id}")
149
+ except Exception as e:
150
+ LOGGER.error(e)
151
+ LOGGER.error(format_exc())
152
+ return await m.edit(str(e))
153
+
154
+ if not photo_id:
155
+ return await m.edit(info_caption, disable_web_page_preview=True)
156
+ photo = await Gojo.download_media(photo_id)
157
+
158
+ await message.reply_photo(photo, caption=info_caption, quote=False)
159
+ await m.delete()
160
+ os.remove(photo)
161
+ LOGGER.info(f"{message.from_user.id} fetched user info of user {user} in {m.chat.id}")
162
+
163
+
164
 
165
  @Gojo.on_message(command("chinfo") & ~filters.edited)
166
  async def chat_info_func(_, message: Message):