Captain Ezio commited on
Commit
5ec9c41
·
1 Parent(s): a6f22b8

fixed `parse_mode`

Browse files
Powers/plugins/bans.py CHANGED
@@ -3,6 +3,7 @@ from Powers.vars import Config
3
  from traceback import format_exc
4
  from Powers.bot_class import Gojo
5
  from pyrogram.filters import regex
 
6
  from Powers.utils.parser import mention_html
7
  from Powers.utils.string import extract_time
8
  from Powers.utils.extract_user import extract_user
@@ -107,7 +108,7 @@ async def tban_usr(c: Gojo, m: Message):
107
  animation=BAN_MEDIA,
108
  caption=txt,
109
  reply_markup=keyboard,
110
- parse_mode="html",
111
  )
112
  # await m.reply_text(txt, reply_markup=keyboard,
113
  # reply_to_message_id=r_id)
@@ -308,7 +309,7 @@ async def dtban_usr(c: Gojo, m: Message):
308
  animation=BAN_MEDIA,
309
  caption=txt,
310
  reply_markup=keyboard,
311
- parse_mode="html",
312
  )
313
  # await c.send_message(m.chat.id, txt, reply_markup=keyboard)
314
  except ChatAdminRequired:
@@ -394,7 +395,7 @@ async def kick_usr(c: Gojo, m: Message):
394
  reply_to_message_id=r_id,
395
  animation=KICK_MEDIA,
396
  caption=txt,
397
- parse_mode="html",
398
  )
399
  await m.chat.unban_member(user_id)
400
  except ChatAdminRequired:
@@ -539,7 +540,7 @@ async def dkick_usr(c: Gojo, m: Message):
539
  txt += f"\n<b>Reason</b>: {reason}" if reason else ""
540
  await c.send_message(m.chat.id, txt)
541
  await c.send_animation(
542
- chat_id=m.chat.id, animation=KICK_MEDIA, caption=txt, parse_mode="html"
543
  )
544
  await m.chat.unban_member(user_id)
545
  except ChatAdminRequired:
 
3
  from traceback import format_exc
4
  from Powers.bot_class import Gojo
5
  from pyrogram.filters import regex
6
+ from pyrogram import enums
7
  from Powers.utils.parser import mention_html
8
  from Powers.utils.string import extract_time
9
  from Powers.utils.extract_user import extract_user
 
108
  animation=BAN_MEDIA,
109
  caption=txt,
110
  reply_markup=keyboard,
111
+ parse_mode=enums.ParseMode.HTML,
112
  )
113
  # await m.reply_text(txt, reply_markup=keyboard,
114
  # reply_to_message_id=r_id)
 
309
  animation=BAN_MEDIA,
310
  caption=txt,
311
  reply_markup=keyboard,
312
+ parse_mode=enums.ParseMode.HTML,
313
  )
314
  # await c.send_message(m.chat.id, txt, reply_markup=keyboard)
315
  except ChatAdminRequired:
 
395
  reply_to_message_id=r_id,
396
  animation=KICK_MEDIA,
397
  caption=txt,
398
+ parse_mode=enums.ParseMode.HTML,
399
  )
400
  await m.chat.unban_member(user_id)
401
  except ChatAdminRequired:
 
540
  txt += f"\n<b>Reason</b>: {reason}" if reason else ""
541
  await c.send_message(m.chat.id, txt)
542
  await c.send_animation(
543
+ chat_id=m.chat.id, animation=KICK_MEDIA, caption=txt, parse_mode=enums.ParseMode.HTML
544
  )
545
  await m.chat.unban_member(user_id)
546
  except ChatAdminRequired:
Powers/plugins/filters.py CHANGED
@@ -1,5 +1,5 @@
1
  from secrets import choice
2
- from pyrogram import filters
3
  from traceback import format_exc
4
  from re import escape as re_escape
5
  from pyrogram.errors import RPCError
@@ -217,7 +217,7 @@ async def send_filter_reply(c: Gojo, m: Message, trigger: str):
217
  try:
218
  await m.reply_text(
219
  textt,
220
- # parse_mode="markdown",
221
  reply_markup=button,
222
  disable_web_page_preview=True,
223
  quote=True,
@@ -234,7 +234,7 @@ async def send_filter_reply(c: Gojo, m: Message, trigger: str):
234
  else:
235
  await m.reply_text(
236
  textt,
237
- # parse_mode="markdown",
238
  quote=True,
239
  disable_web_page_preview=True,
240
  )
@@ -257,7 +257,7 @@ async def send_filter_reply(c: Gojo, m: Message, trigger: str):
257
  m.chat.id,
258
  getfilter["fileid"],
259
  caption=textt,
260
- # parse_mode="markdown",
261
  reply_markup=button,
262
  reply_to_message_id=m.message_id,
263
  )
 
1
  from secrets import choice
2
+ from pyrogram import filters, enums
3
  from traceback import format_exc
4
  from re import escape as re_escape
5
  from pyrogram.errors import RPCError
 
217
  try:
218
  await m.reply_text(
219
  textt,
220
+ # parse_mode=enums.ParseMode.MARKDOWN,
221
  reply_markup=button,
222
  disable_web_page_preview=True,
223
  quote=True,
 
234
  else:
235
  await m.reply_text(
236
  textt,
237
+ # parse_mode=enums.ParseMode.MARKDOWN,
238
  quote=True,
239
  disable_web_page_preview=True,
240
  )
 
257
  m.chat.id,
258
  getfilter["fileid"],
259
  caption=textt,
260
+ # parse_mode=enums.ParseMode.MARKDOWN,
261
  reply_markup=button,
262
  reply_to_message_id=m.message_id,
263
  )
Powers/plugins/formatting.py CHANGED
@@ -1,5 +1,5 @@
1
  from Powers import LOGGER
2
- from pyrogram import filters
3
  from Powers.bot_class import Gojo
4
  from Powers.utils.kbhelpers import ikb
5
  from Powers.utils.custom_filters import command
@@ -60,7 +60,7 @@ async def get_formatting_info(_, q: CallbackQuery):
60
  <code>[button 3](buttonurl://example.com)</code>
61
  This will show button 1 and 2 on the same line, while 3 will be underneath.""",
62
  reply_markup=kb,
63
- parse_mode="html",
64
  )
65
  elif cmd == "fillings":
66
  await q.message.edit_text(
@@ -78,7 +78,7 @@ async def get_formatting_info(_, q: CallbackQuery):
78
  - <code>{id}</code>: The user's ID.
79
  - <code>{chatname}</code>: The chat's name.""",
80
  reply_markup=kb,
81
- parse_mode="html",
82
  )
83
  elif cmd == "random_content":
84
  await q.message.edit_text(
@@ -104,7 +104,7 @@ async def get_formatting_info(_, q: CallbackQuery):
104
  %%%
105
  Sup? <code>{first}</code>""",
106
  reply_markup=kb,
107
- parse_mode="html",
108
  )
109
 
110
  await q.answer()
 
1
  from Powers import LOGGER
2
+ from pyrogram import filters, enums
3
  from Powers.bot_class import Gojo
4
  from Powers.utils.kbhelpers import ikb
5
  from Powers.utils.custom_filters import command
 
60
  <code>[button 3](buttonurl://example.com)</code>
61
  This will show button 1 and 2 on the same line, while 3 will be underneath.""",
62
  reply_markup=kb,
63
+ parse_mode=enums.ParseMode.HTML,
64
  )
65
  elif cmd == "fillings":
66
  await q.message.edit_text(
 
78
  - <code>{id}</code>: The user's ID.
79
  - <code>{chatname}</code>: The chat's name.""",
80
  reply_markup=kb,
81
+ parse_mode=enums.ParseMode.HTML,
82
  )
83
  elif cmd == "random_content":
84
  await q.message.edit_text(
 
104
  %%%
105
  Sup? <code>{first}</code>""",
106
  reply_markup=kb,
107
+ parse_mode=enums.ParseMode.HTML,
108
  )
109
 
110
  await q.answer()
Powers/plugins/fun.py CHANGED
@@ -3,6 +3,7 @@ from random import choice
3
  from Powers.utils import extras
4
  from Powers.bot_class import Gojo
5
  from pyrogram.types import Message
 
6
  from Powers import LOGGER, DEV_USERS
7
  from pyrogram.errors import MessageTooLong
8
  from Powers.utils.custom_filters import command
@@ -27,7 +28,7 @@ async def fun_shout(_, m: Message):
27
  result[0] = text[0]
28
  result = "".join(result)
29
  msg = "```\n" + result + "```"
30
- await m.reply_text(msg, parse_mode="markdown")
31
  LOGGER.info(f"{m.from_user.id} shouted in {m.chat.id}")
32
  return
33
  except MessageTooLong as e:
 
3
  from Powers.utils import extras
4
  from Powers.bot_class import Gojo
5
  from pyrogram.types import Message
6
+ from pyrogram import enums
7
  from Powers import LOGGER, DEV_USERS
8
  from pyrogram.errors import MessageTooLong
9
  from Powers.utils.custom_filters import command
 
28
  result[0] = text[0]
29
  result = "".join(result)
30
  msg = "```\n" + result + "```"
31
+ await m.reply_text(msg, parse_mode=enums.ParseMode.MARKDOWN)
32
  LOGGER.info(f"{m.from_user.id} shouted in {m.chat.id}")
33
  return
34
  except MessageTooLong as e:
Powers/plugins/greetings.py CHANGED
@@ -1,7 +1,7 @@
1
  from html import escape
2
  from secrets import choice
3
  from Powers import DEV_USERS
4
- from pyrogram import filters
5
  from Powers.vars import Config
6
  from Powers.bot_class import Gojo
7
  from Powers.utils.chat_type import chattype
@@ -403,7 +403,7 @@ async def welcome(c: Gojo, m: Message):
403
  Welcome text in no formating:
404
  """,
405
  )
406
- await c.send_message(m.chat.id, text=oo, parse_mode=None)
407
  return
408
  if args[1].lower() == "on":
409
  db.set_current_welcome_settings(True)
@@ -448,7 +448,7 @@ async def goodbye(c: Gojo, m: Message):
448
  Goodbye text in no formating:
449
  """,
450
  )
451
- await c.send_message(m.chat.id, text=oo, parse_mode=None)
452
  return
453
  if args[1].lower() == "on":
454
  db.set_current_goodbye_settings(True)
 
1
  from html import escape
2
  from secrets import choice
3
  from Powers import DEV_USERS
4
+ from pyrogram import filters, enums
5
  from Powers.vars import Config
6
  from Powers.bot_class import Gojo
7
  from Powers.utils.chat_type import chattype
 
403
  Welcome text in no formating:
404
  """,
405
  )
406
+ await c.send_message(m.chat.id, text=oo, parse_mode=enums.ParseMode.DISABLED)
407
  return
408
  if args[1].lower() == "on":
409
  db.set_current_welcome_settings(True)
 
448
  Goodbye text in no formating:
449
  """,
450
  )
451
+ await c.send_message(m.chat.id, text=oo, parse_mode=enums.ParseMode.DISABLED)
452
  return
453
  if args[1].lower() == "on":
454
  db.set_current_goodbye_settings(True)
Powers/plugins/info.py CHANGED
@@ -124,7 +124,7 @@ async def user_info(c: Gojo, user, already=False):
124
  async def chat_info(c: Gojo, chat, already=False):
125
  if not already:
126
  chat = await c.get_chat(chat)
127
- online_mem = c.get_chat_online_count(chat)
128
  chat_id = chat.id
129
  username = chat.username
130
  total_bot, total_admin, total_bot_admin, total_banned = await count(c, chat)
 
124
  async def chat_info(c: Gojo, chat, already=False):
125
  if not already:
126
  chat = await c.get_chat(chat)
127
+ online_mem = await c.get_chat_online_count(chat)
128
  chat_id = chat.id
129
  username = chat.username
130
  total_bot, total_admin, total_bot_admin, total_banned = await count(c, chat)
Powers/plugins/notes.py CHANGED
@@ -1,6 +1,6 @@
1
  from Powers import LOGGER
2
  from secrets import choice
3
- from pyrogram import filters
4
  from Powers.vars import Config
5
  from traceback import format_exc
6
  from Powers.bot_class import Gojo
@@ -126,7 +126,7 @@ async def get_note_func(c: Gojo, m: Message, note_name, priv_notes_status):
126
  try:
127
  await reply_text(
128
  textt,
129
- # parse_mode="markdown",
130
  reply_markup=button,
131
  disable_web_page_preview=True,
132
  quote=True,
@@ -143,7 +143,7 @@ async def get_note_func(c: Gojo, m: Message, note_name, priv_notes_status):
143
  else:
144
  await reply_text(
145
  textt,
146
- # parse_mode="markdown",
147
  quote=True,
148
  disable_web_page_preview=True,
149
  )
@@ -166,7 +166,7 @@ async def get_note_func(c: Gojo, m: Message, note_name, priv_notes_status):
166
  m.chat.id,
167
  getnotes["fileid"],
168
  caption=textt,
169
- # parse_mode="markdown",
170
  reply_markup=button,
171
  reply_to_message_id=reply_msg_id,
172
  )
@@ -174,7 +174,7 @@ async def get_note_func(c: Gojo, m: Message, note_name, priv_notes_status):
174
  except RPCError as ef:
175
  await m.reply_text(
176
  textt,
177
- # parse_mode="markdown",
178
  reply_markup=button,
179
  disable_web_page_preview=True,
180
  reply_to_message_id=reply_msg_id,
@@ -187,7 +187,7 @@ async def get_note_func(c: Gojo, m: Message, note_name, priv_notes_status):
187
  m.chat.id,
188
  getnotes["fileid"],
189
  caption=textt,
190
- # parse_mode="markdown",
191
  reply_markup=button,
192
  reply_to_message_id=reply_msg_id,
193
  )
@@ -219,7 +219,7 @@ async def get_raw_note(c: Gojo, m: Message, note: str):
219
 
220
  if msgtype == Types.TEXT:
221
  teks = getnotes["note_value"]
222
- await m.reply_text(teks, parse_mode=None, reply_to_message_id=msg_id)
223
  elif msgtype in (
224
  Types.STICKER,
225
  Types.VIDEO_NOTE,
@@ -237,7 +237,7 @@ async def get_raw_note(c: Gojo, m: Message, note: str):
237
  m.chat.id,
238
  getnotes["fileid"],
239
  caption=teks,
240
- parse_mode=None,
241
  reply_to_message_id=msg_id,
242
  )
243
  LOGGER.info(
 
1
  from Powers import LOGGER
2
  from secrets import choice
3
+ from pyrogram import filters, enums
4
  from Powers.vars import Config
5
  from traceback import format_exc
6
  from Powers.bot_class import Gojo
 
126
  try:
127
  await reply_text(
128
  textt,
129
+ # parse_mode=enums.ParseMode.MARKDOWN,
130
  reply_markup=button,
131
  disable_web_page_preview=True,
132
  quote=True,
 
143
  else:
144
  await reply_text(
145
  textt,
146
+ # parse_mode=enums.ParseMode.MARKDOWN,
147
  quote=True,
148
  disable_web_page_preview=True,
149
  )
 
166
  m.chat.id,
167
  getnotes["fileid"],
168
  caption=textt,
169
+ # parse_mode=enums.ParseMode.MARKDOWN,
170
  reply_markup=button,
171
  reply_to_message_id=reply_msg_id,
172
  )
 
174
  except RPCError as ef:
175
  await m.reply_text(
176
  textt,
177
+ # parse_mode=enums.ParseMode.MARKDOWN,
178
  reply_markup=button,
179
  disable_web_page_preview=True,
180
  reply_to_message_id=reply_msg_id,
 
187
  m.chat.id,
188
  getnotes["fileid"],
189
  caption=textt,
190
+ # parse_mode=enums.ParseMode.MARKDOWN,
191
  reply_markup=button,
192
  reply_to_message_id=reply_msg_id,
193
  )
 
219
 
220
  if msgtype == Types.TEXT:
221
  teks = getnotes["note_value"]
222
+ await m.reply_text(teks, parse_mode=enums.ParseMode.DISABLED, reply_to_message_id=msg_id)
223
  elif msgtype in (
224
  Types.STICKER,
225
  Types.VIDEO_NOTE,
 
237
  m.chat.id,
238
  getnotes["fileid"],
239
  caption=teks,
240
+ parse_mode=enums.ParseMode.DISABLED,
241
  reply_to_message_id=msg_id,
242
  )
243
  LOGGER.info(
Powers/plugins/start.py CHANGED
@@ -8,6 +8,7 @@ from Powers.utils.extras import StartPic
8
  from Powers.utils.chat_type import chattype
9
  from Powers.utils.custom_filters import command
10
  from pyrogram.types import Message, CallbackQuery
 
11
  from pyrogram.errors import UserIsBlocked, QueryIdInvalid, MessageNotModified
12
  from Powers.utils.start_utils import (
13
  gen_cmds_kb, gen_start_kb, get_help_msg, get_private_note,
@@ -81,7 +82,7 @@ async def start(c: Gojo, m: Message):
81
  await m.reply_photo(
82
  photo=choice(StartPic),
83
  caption=help_msg,
84
- parse_mode="markdown",
85
  reply_markup=ikb(help_kb),
86
  quote=True,
87
  )
@@ -193,7 +194,7 @@ async def help_menu(_, m: Message):
193
  await m.reply_photo(
194
  photo=choice(StartPic),
195
  caption=help_msg,
196
- parse_mode="markdown",
197
  reply_markup=ikb(help_kb),
198
  quote=True,
199
  )
@@ -255,7 +256,7 @@ async def get_module_info(_, q: CallbackQuery):
255
  ]
256
  await q.edit_message_caption(
257
  caption=help_msg,
258
- parse_mode="markdown",
259
  reply_markup=ikb(help_kb),
260
  )
261
  await q.answer()
 
8
  from Powers.utils.chat_type import chattype
9
  from Powers.utils.custom_filters import command
10
  from pyrogram.types import Message, CallbackQuery
11
+ from pyrogram import enums
12
  from pyrogram.errors import UserIsBlocked, QueryIdInvalid, MessageNotModified
13
  from Powers.utils.start_utils import (
14
  gen_cmds_kb, gen_start_kb, get_help_msg, get_private_note,
 
82
  await m.reply_photo(
83
  photo=choice(StartPic),
84
  caption=help_msg,
85
+ parse_mode=enums.ParseMode.MARKDOWN,
86
  reply_markup=ikb(help_kb),
87
  quote=True,
88
  )
 
194
  await m.reply_photo(
195
  photo=choice(StartPic),
196
  caption=help_msg,
197
+ parse_mode=enums.ParseMode.MARKDOWN,
198
  reply_markup=ikb(help_kb),
199
  quote=True,
200
  )
 
256
  ]
257
  await q.edit_message_caption(
258
  caption=help_msg,
259
+ parse_mode=enums.ParseMode.MARKDOWN,
260
  reply_markup=ikb(help_kb),
261
  )
262
  await q.answer()
Powers/plugins/stats.py CHANGED
@@ -1,5 +1,6 @@
1
  from Powers.bot_class import Gojo
2
  from pyrogram.types import Message
 
3
  from Powers.database.pins_db import Pins
4
  from Powers.database.chats_db import Chats
5
  from Powers.database.rules_db import Rules
@@ -63,5 +64,5 @@ async def get_stats(_, m: Message):
63
  "<b>Action:</b>\n"
64
  f" <b>Del:</b> Applied in <code>{(dsbl.count_action_dis_all('del'))}</code> chats.\n"
65
  )
66
- await replymsg.edit_text(rply, parse_mode="html")
67
  return
 
1
  from Powers.bot_class import Gojo
2
  from pyrogram.types import Message
3
+ from pyrogram import enums
4
  from Powers.database.pins_db import Pins
5
  from Powers.database.chats_db import Chats
6
  from Powers.database.rules_db import Rules
 
64
  "<b>Action:</b>\n"
65
  f" <b>Del:</b> Applied in <code>{(dsbl.count_action_dis_all('del'))}</code> chats.\n"
66
  )
67
+ await replymsg.edit_text(rply, parse_mode=enums.ParseMode.HTML)
68
  return
Powers/plugins/utils.py CHANGED
@@ -4,7 +4,7 @@ from Powers import *
4
  from os import remove
5
  from io import BytesIO
6
  from tswift import Song
7
- from pyrogram import filters
8
  from wikipedia import summary
9
  from traceback import format_exc
10
  from Powers.bot_class import Gojo
@@ -37,10 +37,10 @@ async def wiki(_, m: Message):
37
  except DisambiguationError as de:
38
  return await m.reply_text(
39
  f"Disambiguated pages found! Adjust your query accordingly.\n<i>{de}</i>",
40
- parse_mode="html",
41
  )
42
  except PageError as pe:
43
- return await m.reply_text(f"<code>{pe}</code>", parse_mode="html")
44
  if res:
45
  result = f"<b>{search}</b>\n\n"
46
  result += f"<i>{res}</i>\n"
@@ -48,7 +48,7 @@ async def wiki(_, m: Message):
48
  try:
49
  return await m.reply_text(
50
  result,
51
- parse_mode="html",
52
  disable_web_page_preview=True,
53
  )
54
  except MessageTooLong:
@@ -57,7 +57,7 @@ async def wiki(_, m: Message):
57
  return await m.reply_document(
58
  document=f,
59
  quote=True,
60
- parse_mode="html",
61
  )
62
  await m.stop_propagation()
63
 
@@ -144,7 +144,7 @@ async def id_info(c: Gojo, m: Message):
144
  await m.reply_text(
145
  text=f"""Original Sender - {orig_sender} (<code>{orig_id}</code>)
146
  Forwarder - {fwd_sender} (<code>{fwd_id}</code>)""",
147
- parse_mode="HTML",
148
  )
149
  else:
150
  try:
@@ -158,7 +158,7 @@ async def id_info(c: Gojo, m: Message):
158
 
159
  await m.reply_text(
160
  f"{(await mention_html(user.first_name, user.id))}'s ID is <code>{user.id}</code>.",
161
- parse_mode="HTML",
162
  )
163
  elif chat_type == "private":
164
  await m.reply_text(text=f"Your ID is <code>{m.chat.id}</code>.")
@@ -175,7 +175,7 @@ async def get_gifid(_, m: Message):
175
  LOGGER.info(f"{m.from_user.id} used gifid cmd in {m.chat.id}")
176
  await m.reply_text(
177
  f"Gif ID:\n<code>{m.reply_to_message.animation.file_id}</code>",
178
- parse_mode="html",
179
  )
180
  else:
181
  await m.reply_text(text="Please reply to a gif to get it's ID.")
 
4
  from os import remove
5
  from io import BytesIO
6
  from tswift import Song
7
+ from pyrogram import filters, enums
8
  from wikipedia import summary
9
  from traceback import format_exc
10
  from Powers.bot_class import Gojo
 
37
  except DisambiguationError as de:
38
  return await m.reply_text(
39
  f"Disambiguated pages found! Adjust your query accordingly.\n<i>{de}</i>",
40
+ parse_mode=enums.ParseMode.HTML,
41
  )
42
  except PageError as pe:
43
+ return await m.reply_text(f"<code>{pe}</code>", parse_mode=enums.ParseMode.HTML)
44
  if res:
45
  result = f"<b>{search}</b>\n\n"
46
  result += f"<i>{res}</i>\n"
 
48
  try:
49
  return await m.reply_text(
50
  result,
51
+ parse_mode=enums.ParseMode.HTML,
52
  disable_web_page_preview=True,
53
  )
54
  except MessageTooLong:
 
57
  return await m.reply_document(
58
  document=f,
59
  quote=True,
60
+ parse_mode=enums.ParseMode.HTML,
61
  )
62
  await m.stop_propagation()
63
 
 
144
  await m.reply_text(
145
  text=f"""Original Sender - {orig_sender} (<code>{orig_id}</code>)
146
  Forwarder - {fwd_sender} (<code>{fwd_id}</code>)""",
147
+ parse_mode=enums.ParseMode.HTML,
148
  )
149
  else:
150
  try:
 
158
 
159
  await m.reply_text(
160
  f"{(await mention_html(user.first_name, user.id))}'s ID is <code>{user.id}</code>.",
161
+ parse_mode=enums.ParseMode.HTML,
162
  )
163
  elif chat_type == "private":
164
  await m.reply_text(text=f"Your ID is <code>{m.chat.id}</code>.")
 
175
  LOGGER.info(f"{m.from_user.id} used gifid cmd in {m.chat.id}")
176
  await m.reply_text(
177
  f"Gif ID:\n<code>{m.reply_to_message.animation.file_id}</code>",
178
+ parse_mode=enums.ParseMode.HTML,
179
  )
180
  else:
181
  await m.reply_text(text="Please reply to a gif to get it's ID.")