iamgojoof6eyes commited on
Commit
18c86d3
Β·
1 Parent(s): 2abd373

Looks fine

Browse files
Files changed (1) hide show
  1. Powers/plugins/info.py +59 -58
Powers/plugins/info.py CHANGED
@@ -14,30 +14,6 @@ from Powers.utils.chat_type import c_type
14
 
15
  gban_db=GBan()
16
 
17
- escape = "\n"
18
- empty = " "
19
-
20
- bold = lambda x: f"**{x}:** "
21
- bold_ul = lambda x: f"**--{x}:**-- "
22
-
23
- single_func = lambda x: f"`{x}`{escape}"
24
-
25
-
26
- def change(
27
- title: str,
28
- body: dict,
29
- indent: int = 2,
30
- underline: bool = False,
31
- ) -> str:
32
- text = (bold_ul(title) + escape) if underline else bold(title) + escape
33
-
34
- for key, value in body.items():
35
- text += (
36
- indent * empty
37
- + bold(key)
38
- + ((value[0] + escape) if isinstance(value, list) else single_func(value))
39
- )
40
- return text
41
 
42
 
43
  async def user_info(c: Gojo, user, already=False):
@@ -52,6 +28,7 @@ async def user_info(c: Gojo, user, already=False):
52
 
53
  if not user.first_name:
54
  return ["Deleted account", None]
 
55
  gbanned, reason_gban = gban_db.get_gban(user)
56
  if gbanned:
57
  gban=True
@@ -63,8 +40,11 @@ async def user_info(c: Gojo, user, already=False):
63
  user_id = user.id
64
  username = user.username
65
  first_name = user.first_name
 
66
  mention = user.mention(f"{first_name}")
67
  dc_id = user.dc_id
 
 
68
  photo_id = user.photo.big_file_id if user.photo else None
69
  is_support = user_id in SUPPORT_STAFF
70
  if user_id in SUPPORT_STAFF:
@@ -78,7 +58,6 @@ async def user_info(c: Gojo, user, already=False):
78
  omp = "Hmmm.......Who is that again?"
79
  is_bot = user.is_bot
80
  is_fake = user.is_fake
81
-
82
  status = user.status
83
 
84
 
@@ -101,22 +80,29 @@ async def user_info(c: Gojo, user, already=False):
101
  else:
102
  last_date = "User is currently online"
103
 
104
- body = {
105
- "ID": user_id,
106
- "DC": dc_id,
107
- "Name": [first_name],
108
- "Username": [("@" + username) if username else "NA"],
109
- "Mention": [mention],
110
- "Support": is_support,
111
- "Support user type": [omp],
112
- "Bot" : is_bot,
113
- "Gbanned": gban,
114
- "Gban reason":[reason],
115
- "Fake" : is_fake,
116
- "Last seen" : [last_date],
117
- }
118
- caption = change("User info", body)
119
- return [caption, photo_id]
 
 
 
 
 
 
 
120
 
121
 
122
  async def chat_info(c: Gojo, chat, already=False):
@@ -131,26 +117,41 @@ async def chat_info(c: Gojo, chat, already=False):
131
  description = chat.description
132
  members = chat.members_count
133
  is_restricted = chat.is_restricted
134
- link = f"[Link](t.me/{username})" if username else None
 
 
 
 
135
  dc_id = chat.dc_id
136
  photo_id = chat.photo.big_file_id if chat.photo else None
137
  can_save = chat.has_protected_content
138
- body = {
139
- "ID": chat_id,
140
- "DC": dc_id,
141
- "Type": type_,
142
- "Name": [title],
143
- "Username": [("@" + username) if username else None],
144
- "Mention": [link],
145
- "Members": members,
146
- "Scam": is_scam,
147
- "Fake" : is_fake,
148
- "Can save content" : can_save,
149
- "Restricted": is_restricted,
150
- "Description": [description],
151
- }
152
- caption = change("Chat info", body)
153
- return [caption, photo_id]
 
 
 
 
 
 
 
 
 
 
 
154
 
155
 
156
  @Gojo.on_message(command(["info","whois"]))
 
14
 
15
  gban_db=GBan()
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
 
19
  async def user_info(c: Gojo, user, already=False):
 
28
 
29
  if not user.first_name:
30
  return ["Deleted account", None]
31
+
32
  gbanned, reason_gban = gban_db.get_gban(user)
33
  if gbanned:
34
  gban=True
 
40
  user_id = user.id
41
  username = user.username
42
  first_name = user.first_name
43
+ last_name = user.last_name
44
  mention = user.mention(f"{first_name}")
45
  dc_id = user.dc_id
46
+ is_verified = user.is_verified
47
+ is_restricted = user.is_restricted
48
  photo_id = user.photo.big_file_id if user.photo else None
49
  is_support = user_id in SUPPORT_STAFF
50
  if user_id in SUPPORT_STAFF:
 
58
  omp = "Hmmm.......Who is that again?"
59
  is_bot = user.is_bot
60
  is_fake = user.is_fake
 
61
  status = user.status
62
 
63
 
 
80
  else:
81
  last_date = "User is currently online"
82
 
83
+ caption = f"""
84
+ <b><i><u>⚑ Extracted User info From Telegram ⚑</b></i></u>
85
+
86
+ <b>πŸ†”οΈ User ID</b>: <code>{user_id}</code>
87
+ <b>πŸ“Ž Link To Profile</b>: <a href='tg://user?id={user_id}'>Click HereπŸšͺ</a>
88
+ <b>πŸ—£οΈ Mention</b>: {mention}
89
+ <b>πŸ—£οΈ First Name</b>: <code>{first_name}</code>
90
+ <b>πŸ—£οΈ Second Name</b>: <code>{last_name}</code>
91
+ <b>πŸ” Username</b>: {("@" + username) if username else "NA"}
92
+ <b>πŸ₯Έ Support</b>: {is_support}
93
+ <b>πŸ€“ Support user type</b>: <code>{omp}</code>
94
+ <b>πŸ’£ Gbanned</b>: {gban}
95
+ <b>🀭 Gban reason</b>: <code>{reason}</code>
96
+ <b>🌐 DC ID</b>: {dc_id}
97
+ <b>🧐 RESTRICTED</b>: {is_restricted}
98
+ <b>βœ… VERIFIED</b>: {is_verified}
99
+ <b>🧐 FAKE</b> : {is_fake}
100
+ <b>πŸ€– BOT</b>: {is_bot}
101
+ <b>πŸ‘€ Last seen</b>: <code>{last_date}</code>
102
+
103
+ """
104
+
105
+ return caption, photo_id
106
 
107
 
108
  async def chat_info(c: Gojo, chat, already=False):
 
117
  description = chat.description
118
  members = chat.members_count
119
  is_restricted = chat.is_restricted
120
+ if is_restricted:
121
+ reasons = chat.restrictions
122
+ else:
123
+ reasons = "Chat is not restricted..."
124
+ invite_link = chat.invite_link
125
  dc_id = chat.dc_id
126
  photo_id = chat.photo.big_file_id if chat.photo else None
127
  can_save = chat.has_protected_content
128
+ sticker_set = chat.sticker_set_name
129
+ linked_chat = chat.linked_chat
130
+ reactions = chat.available_reactions
131
+
132
+ caption = f"""
133
+ πŸ”° <b>CHAT INFO</b> πŸ”°
134
+
135
+ <b>πŸ†” ID</b>: <code>{chat_id}</code>
136
+ <b>πŸš€ Chat Title</b>: {title}
137
+ <b>✨ Chat Type</b>: {type_}
138
+ <b>🌐 DataCentre ID</b>: {dc_id}
139
+ <b> Username</b>: {("@" + username) if username else "NA"}
140
+ <b>🧐 Scam</b>: {is_scam}
141
+ <b>🀨 Fake</b>: {is_fake}
142
+ <b> Restricted</b>: {is_restricted}
143
+ <b> Reasons</b>: {reasons}
144
+ <b>πŸ‘¨πŸΏβ€πŸ’» Description: <code>{description}</code>
145
+ <b>πŸ‘ͺ Total members</b>: {members}
146
+ <b>πŸ“Ž Link to the chat</b>: <a href={invite_link}>Click HereπŸšͺ</a>
147
+ <b>🚫 Can Save Content</b>: {can_save}
148
+ <b>πŸ˜‹ Sticker set</b>: {sticker_set}
149
+ <b> Linked Chat</b>: {linked_chat if linked_chat else "Not Linked"}
150
+ <b> Reactions</b>: {reactions}
151
+
152
+ """
153
+
154
+ return caption, photo_id
155
 
156
 
157
  @Gojo.on_message(command(["info","whois"]))