Captain Ezio commited on
Commit
6adc97f
·
1 Parent(s): fac74eb

Update info.py

Browse files
Files changed (1) hide show
  1. Powers/plugins/info.py +28 -2
Powers/plugins/info.py CHANGED
@@ -9,6 +9,32 @@ from Powers.bot_class import Gojo
9
  from Powers.utils.custom_filters import command
10
 
11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  async def user_info(user, already=False):
13
  if not already:
14
  user = await Gojo.get_users(user)
@@ -50,7 +76,7 @@ async def user_info(user, already=False):
50
  "Status" : status,
51
  "Last seen" : [last_date],
52
  }
53
- caption = body
54
  return [caption, photo_id]
55
 
56
 
@@ -84,7 +110,7 @@ async def chat_info(chat, already=False):
84
  "Restricted": is_restricted,
85
  "Description": [description],
86
  }
87
- caption = body
88
  return [caption, photo_id]
89
 
90
 
 
9
  from Powers.utils.custom_filters import command
10
 
11
 
12
+ escape = "\n"
13
+ empty = " "
14
+
15
+ bold = lambda x: f"**{x}:** "
16
+ bold_ul = lambda x: f"**--{x}:**-- "
17
+
18
+ single_func = lambda x: f"`{x}`{escape}"
19
+
20
+
21
+ def change(
22
+ title: str,
23
+ body: dict,
24
+ indent: int = 2,
25
+ underline: bool = False,
26
+ ) -> str:
27
+ text = (bold_ul(title) + escape) if underline else bold(title) + escape
28
+
29
+ for key, value in body.items():
30
+ text += (
31
+ indent * empty
32
+ + bold(key)
33
+ + ((value[0] + escape) if isinstance(value, list) else single_func(value))
34
+ )
35
+ return text
36
+
37
+
38
  async def user_info(user, already=False):
39
  if not already:
40
  user = await Gojo.get_users(user)
 
76
  "Status" : status,
77
  "Last seen" : [last_date],
78
  }
79
+ caption = change("User info", body)
80
  return [caption, photo_id]
81
 
82
 
 
110
  "Restricted": is_restricted,
111
  "Description": [description],
112
  }
113
+ caption = change("Chat info", body)
114
  return [caption, photo_id]
115
 
116