Captain Ezio commited on
Commit
c15d499
·
1 Parent(s): f0f9ad9

`message_id` changed to `.id`

Browse files
Powers/plugins/bans.py CHANGED
@@ -45,7 +45,7 @@ async def tban_usr(c: Gojo, m: Message):
45
  )
46
  await m.stop_propagation()
47
 
48
- r_id = m.reply_to_message.message_id if m.reply_to_message else m.message_id
49
 
50
  if m.reply_to_message and len(m.text.split()) >= 2:
51
  reason = m.text.split(None, 2)[1]
@@ -340,11 +340,11 @@ async def kick_usr(c: Gojo, m: Message):
340
  reason = None
341
 
342
  if m.reply_to_message:
343
- r_id = m.reply_to_message.message_id
344
  if len(m.text.split()) >= 2:
345
  reason = m.text.split(None, 1)[1]
346
  else:
347
- r_id = m.message_id
348
  if len(m.text.split()) >= 3:
349
  reason = m.text.split(None, 2)[2]
350
  try:
@@ -826,11 +826,11 @@ async def ban_usr(c: Gojo, m: Message):
826
 
827
  reason = None
828
  if m.reply_to_message:
829
- r_id = m.reply_to_message.message_id
830
  if len(m.text.split()) >= 2:
831
  reason = m.text.split(None, 1)[1]
832
  else:
833
- r_id = m.message_id
834
  if len(m.text.split()) >= 3:
835
  reason = m.text.split(None, 2)[2]
836
 
 
45
  )
46
  await m.stop_propagation()
47
 
48
+ r_id = m.reply_to_message.id if m.reply_to_message else m.id
49
 
50
  if m.reply_to_message and len(m.text.split()) >= 2:
51
  reason = m.text.split(None, 2)[1]
 
340
  reason = None
341
 
342
  if m.reply_to_message:
343
+ r_id = m.reply_to_message.id
344
  if len(m.text.split()) >= 2:
345
  reason = m.text.split(None, 1)[1]
346
  else:
347
+ r_id = m.id
348
  if len(m.text.split()) >= 3:
349
  reason = m.text.split(None, 2)[2]
350
  try:
 
826
 
827
  reason = None
828
  if m.reply_to_message:
829
+ r_id = m.reply_to_message.id
830
  if len(m.text.split()) >= 2:
831
  reason = m.text.split(None, 1)[1]
832
  else:
833
+ r_id = m.id
834
  if len(m.text.split()) >= 3:
835
  reason = m.text.split(None, 2)[2]
836
 
Powers/plugins/dev.py CHANGED
@@ -79,9 +79,9 @@ async def evaluate_code(c: Gojo, m: Message):
79
  sm = await m.reply_text("`Processing...`")
80
  cmd = m.text.split(None, maxsplit=1)[1]
81
 
82
- reply_to_id = m.message_id
83
  if m.reply_to_message:
84
- reply_to_id = m.reply_to_message.message_id
85
 
86
  old_stderr = sys.stderr
87
  old_stdout = sys.stdout
@@ -140,9 +140,9 @@ async def execution(_, m: Message):
140
  return
141
  sm = await m.reply_text("`Processing...`")
142
  cmd = m.text.split(maxsplit=1)[1]
143
- reply_to_id = m.message_id
144
  if m.reply_to_message:
145
- reply_to_id = m.reply_to_message.message_id
146
 
147
  process = await create_subprocess_shell(
148
  cmd,
 
79
  sm = await m.reply_text("`Processing...`")
80
  cmd = m.text.split(None, maxsplit=1)[1]
81
 
82
+ reply_to_id = m.id
83
  if m.reply_to_message:
84
+ reply_to_id = m.reply_to_message.id
85
 
86
  old_stderr = sys.stderr
87
  old_stdout = sys.stdout
 
140
  return
141
  sm = await m.reply_text("`Processing...`")
142
  cmd = m.text.split(maxsplit=1)[1]
143
+ reply_to_id = m.id
144
  if m.reply_to_message:
145
+ reply_to_id = m.reply_to_message.id
146
 
147
  process = await create_subprocess_shell(
148
  cmd,
Powers/plugins/filters.py CHANGED
@@ -250,7 +250,7 @@ async def send_filter_reply(c: Gojo, m: Message, trigger: str):
250
  m.chat.id,
251
  getfilter["fileid"],
252
  reply_markup=button,
253
- reply_to_message_id=m.message_id,
254
  )
255
  else:
256
  await (await send_cmd(c, msgtype))(
@@ -259,7 +259,7 @@ async def send_filter_reply(c: Gojo, m: Message, trigger: str):
259
  caption=textt,
260
  # parse_mode=enums.ParseMode.MARKDOWN,
261
  reply_markup=button,
262
- reply_to_message_id=m.message_id,
263
  )
264
  except Exception as ef:
265
  await m.reply_text(f"Error in filters: {ef}")
 
250
  m.chat.id,
251
  getfilter["fileid"],
252
  reply_markup=button,
253
+ reply_to_message_id=m.id,
254
  )
255
  else:
256
  await (await send_cmd(c, msgtype))(
 
259
  caption=textt,
260
  # parse_mode=enums.ParseMode.MARKDOWN,
261
  reply_markup=button,
262
+ reply_to_message_id=m.id,
263
  )
264
  except Exception as ef:
265
  await m.reply_text(f"Error in filters: {ef}")
Powers/plugins/greetings.py CHANGED
@@ -308,7 +308,7 @@ async def member_has_joined(c: Gojo, member: ChatMemberUpdated):
308
  disable_web_page_preview=True,
309
  )
310
  if jj:
311
- db.set_cleanwlcm_id(int(jj.message_id))
312
  except RPCError as e:
313
  print(e)
314
  return
@@ -374,7 +374,7 @@ async def member_has_left(c: Gojo, member: ChatMemberUpdated):
374
  disable_web_page_preview=True,
375
  )
376
  if ooo:
377
- db.set_cleangoodbye_id(int(ooo.message_id))
378
  return
379
  except RPCError as e:
380
  print(e)
 
308
  disable_web_page_preview=True,
309
  )
310
  if jj:
311
+ db.set_cleanwlcm_id(int(jj.id))
312
  except RPCError as e:
313
  print(e)
314
  return
 
374
  disable_web_page_preview=True,
375
  )
376
  if ooo:
377
+ db.set_cleangoodbye_id(int(ooo.id))
378
  return
379
  except RPCError as e:
380
  print(e)
Powers/plugins/muting.py CHANGED
@@ -52,7 +52,7 @@ async def tmute_usr(c: Gojo, m: Message):
52
  await m.reply_text(text="This user is an admin, I cannot mute them!")
53
  return
54
 
55
- r_id = m.reply_to_message.message_id if m.reply_to_message else m.message_id
56
 
57
  if m.reply_to_message and len(m.text.split()) >= 2:
58
  reason = m.text.split(None, 2)[1]
@@ -319,11 +319,11 @@ async def mute_usr(c: Gojo, m: Message):
319
 
320
  reason = None
321
  if m.reply_to_message:
322
- r_id = m.reply_to_message.message_id
323
  if len(m.text.split()) >= 2:
324
  reason = m.text.split(None, 1)[1]
325
  else:
326
- r_id = m.message_id
327
  if len(m.text.split()) >= 3:
328
  reason = m.text.split(None, 2)[2]
329
  try:
 
52
  await m.reply_text(text="This user is an admin, I cannot mute them!")
53
  return
54
 
55
+ r_id = m.reply_to_message.id if m.reply_to_message else m.id
56
 
57
  if m.reply_to_message and len(m.text.split()) >= 2:
58
  reason = m.text.split(None, 2)[1]
 
319
 
320
  reason = None
321
  if m.reply_to_message:
322
+ r_id = m.reply_to_message.id
323
  if len(m.text.split()) >= 2:
324
  reason = m.text.split(None, 1)[1]
325
  else:
326
+ r_id = m.id
327
  if len(m.text.split()) >= 3:
328
  reason = m.text.split(None, 2)[2]
329
  try:
Powers/plugins/notes.py CHANGED
@@ -210,7 +210,7 @@ async def get_raw_note(c: Gojo, m: Message, note: str):
210
  return
211
 
212
  getnotes = db.get_note(m.chat.id, note)
213
- msg_id = m.reply_to_message.message_id if m.reply_to_message else m.message_id
214
 
215
  msgtype = getnotes["msgtype"]
216
  if not getnotes:
@@ -328,7 +328,7 @@ async def local_notes(_, m: Message):
328
  await m.reply_text(f"There are no notes in <b>{m.chat.title}</b>.")
329
  return
330
 
331
- msg_id = m.reply_to_message.message_id if m.reply_to_message else m.message_id
332
 
333
  curr_pref = db_settings.get_privatenotes(m.chat.id)
334
  if curr_pref:
 
210
  return
211
 
212
  getnotes = db.get_note(m.chat.id, note)
213
+ msg_id = m.reply_to_message.id if m.reply_to_message else m.id
214
 
215
  msgtype = getnotes["msgtype"]
216
  if not getnotes:
 
328
  await m.reply_text(f"There are no notes in <b>{m.chat.title}</b>.")
329
  return
330
 
331
+ msg_id = m.reply_to_message.id if m.reply_to_message else m.id
332
 
333
  curr_pref = db_settings.get_privatenotes(m.chat.id)
334
  if curr_pref:
Powers/plugins/pin.py CHANGED
@@ -24,20 +24,20 @@ async def pin_message(_, m: Message):
24
  disable_notification=disable_notification,
25
  )
26
  LOGGER.info(
27
- f"{m.from_user.id} pinned msgid-{m.reply_to_message.message_id} in {m.chat.id}",
28
  )
29
 
30
  if m.chat.username:
31
  # If chat has a username, use this format
32
  link_chat_id = m.chat.username
33
  message_link = (
34
- f"https://t.me/{link_chat_id}/{m.reply_to_message.message_id}"
35
  )
36
  elif (str(m.chat.id)).startswith("-100"):
37
  # If chat does not have a username, use this
38
  link_chat_id = (str(m.chat.id)).replace("-100", "")
39
  message_link = (
40
- f"https://t.me/c/{link_chat_id}/{m.reply_to_message.message_id}"
41
  )
42
  await m.reply_text(
43
  text=f"I have Pinned [this message]({message_link})!",
@@ -65,9 +65,9 @@ async def pin_message(_, m: Message):
65
  async def unpin_message(c: Gojo, m: Message):
66
  try:
67
  if m.reply_to_message:
68
- await c.unpin_chat_message(m.chat.id, m.reply_to_message.message_id)
69
  LOGGER.info(
70
- f"{m.from_user.id} unpinned msgid: {m.reply_to_message.message_id} in {m.chat.id}",
71
  )
72
  await m.reply_text(text="Unpinned last message.")
73
  else:
@@ -163,10 +163,10 @@ async def anti_channel_pin(_, m: Message):
163
  async def pinned_message(c: Gojo, m: Message):
164
  chat_title = m.chat.title
165
  chat = await c.get_chat(chat_id=m.chat.id)
166
- msg_id = m.reply_to_message.message_id if m.reply_to_message else m.message_id
167
 
168
  if chat.pinned_message:
169
- pinned_id = chat.pinned_message.message_id
170
  if m.chat.username:
171
  link_chat_id = m.chat.username
172
  message_link = f"https://t.me/{link_chat_id}/{pinned_id}"
 
24
  disable_notification=disable_notification,
25
  )
26
  LOGGER.info(
27
+ f"{m.from_user.id} pinned msgid-{m.reply_to_message.id} in {m.chat.id}",
28
  )
29
 
30
  if m.chat.username:
31
  # If chat has a username, use this format
32
  link_chat_id = m.chat.username
33
  message_link = (
34
+ f"https://t.me/{link_chat_id}/{m.reply_to_message.id}"
35
  )
36
  elif (str(m.chat.id)).startswith("-100"):
37
  # If chat does not have a username, use this
38
  link_chat_id = (str(m.chat.id)).replace("-100", "")
39
  message_link = (
40
+ f"https://t.me/c/{link_chat_id}/{m.reply_to_message.id}"
41
  )
42
  await m.reply_text(
43
  text=f"I have Pinned [this message]({message_link})!",
 
65
  async def unpin_message(c: Gojo, m: Message):
66
  try:
67
  if m.reply_to_message:
68
+ await c.unpin_chat_message(m.chat.id, m.reply_to_message.id)
69
  LOGGER.info(
70
+ f"{m.from_user.id} unpinned msgid: {m.reply_to_message.id} in {m.chat.id}",
71
  )
72
  await m.reply_text(text="Unpinned last message.")
73
  else:
 
163
  async def pinned_message(c: Gojo, m: Message):
164
  chat_title = m.chat.title
165
  chat = await c.get_chat(chat_id=m.chat.id)
166
+ msg_id = m.reply_to_message.id if m.reply_to_message else m.id
167
 
168
  if chat.pinned_message:
169
+ pinned_id = chat.pinned_message.id
170
  if m.chat.username:
171
  link_chat_id = m.chat.username
172
  message_link = f"https://t.me/{link_chat_id}/{pinned_id}"
Powers/plugins/purge.py CHANGED
@@ -15,7 +15,7 @@ async def purge(c: Gojo, m: Message):
15
  return
16
 
17
  if m.reply_to_message:
18
- message_ids = list(range(m.reply_to_message.message_id, m.message_id))
19
 
20
  def divide_chunks(l: list, n: int = 100):
21
  for i in range(0, len(l), n):
@@ -108,7 +108,7 @@ async def del_msg(c: Gojo, m: Message):
108
  await m.delete()
109
  await c.delete_messages(
110
  chat_id=m.chat.id,
111
- message_ids=m.reply_to_message.message_id,
112
  )
113
  else:
114
  await m.reply_text(text="What do you wanna delete?")
 
15
  return
16
 
17
  if m.reply_to_message:
18
+ message_ids = list(range(m.reply_to_message.id, m.id))
19
 
20
  def divide_chunks(l: list, n: int = 100):
21
  for i in range(0, len(l), n):
 
108
  await m.delete()
109
  await c.delete_messages(
110
  chat_id=m.chat.id,
111
+ message_ids=m.reply_to_message.id,
112
  )
113
  else:
114
  await m.reply_text(text="What do you wanna delete?")
Powers/plugins/report.py CHANGED
@@ -75,7 +75,7 @@ async def report_watcher(c: Gojo, m: Message):
75
  db = Reporting(m.chat.id)
76
 
77
  if (m.chat and m.reply_to_message) and (db.get_settings()):
78
- reported_msg_id = m.reply_to_message.message_id
79
  reported_user = m.reply_to_message.from_user
80
  chat_name = m.chat.title or m.chat.username
81
  admin_list = await c.get_chat_members(m.chat.id, filter=cmf.ADMINISTRATORS)
@@ -125,7 +125,7 @@ async def report_watcher(c: Gojo, m: Message):
125
  )
126
 
127
  LOGGER.info(
128
- f"{m.from_user.id} reported msgid-{m.reply_to_message.message_id} to admins in {m.chat.id}",
129
  )
130
  await m.reply_text(
131
  (
 
75
  db = Reporting(m.chat.id)
76
 
77
  if (m.chat and m.reply_to_message) and (db.get_settings()):
78
+ reported_msg_id = m.reply_to_message.id
79
  reported_user = m.reply_to_message.from_user
80
  chat_name = m.chat.title or m.chat.username
81
  admin_list = await c.get_chat_members(m.chat.id, filter=cmf.ADMINISTRATORS)
 
125
  )
126
 
127
  LOGGER.info(
128
+ f"{m.from_user.id} reported msgid-{m.reply_to_message.id} to admins in {m.chat.id}",
129
  )
130
  await m.reply_text(
131
  (
Powers/plugins/rules.py CHANGED
@@ -11,7 +11,7 @@ from Powers.utils.custom_filters import command, admin_filter
11
  @Gojo.on_message(command("rules") & filters.group)
12
  async def get_rules(_, m: Message):
13
  db = Rules(m.chat.id)
14
- msg_id = m.reply_to_message.message_id if m.reply_to_message else m.message_id
15
 
16
  rules = db.get_rules()
17
  LOGGER.info(f"{m.from_user.id} fetched rules in {m.chat.id}")
 
11
  @Gojo.on_message(command("rules") & filters.group)
12
  async def get_rules(_, m: Message):
13
  db = Rules(m.chat.id)
14
+ msg_id = m.reply_to_message.id if m.reply_to_message else m.id
15
 
16
  rules = db.get_rules()
17
  LOGGER.info(f"{m.from_user.id} fetched rules in {m.chat.id}")
Powers/plugins/warns.py CHANGED
@@ -21,13 +21,13 @@ from pyrogram.types import (
21
  )
22
  async def warn(c: Gojo, m: Message):
23
  if m.reply_to_message:
24
- r_id = m.reply_to_message.message_id
25
  if len(m.text.split()) >= 2:
26
  reason = m.text.split(None, 1)[1]
27
  else:
28
  reason = None
29
  elif not m.reply_to_message:
30
- r_id = m.message_id
31
  if len(m.text.split()) >= 3:
32
  reason = m.text.split(None, 2)[2]
33
  else:
 
21
  )
22
  async def warn(c: Gojo, m: Message):
23
  if m.reply_to_message:
24
+ r_id = m.reply_to_message.id
25
  if len(m.text.split()) >= 2:
26
  reason = m.text.split(None, 1)[1]
27
  else:
28
  reason = None
29
  elif not m.reply_to_message:
30
+ r_id = m.id
31
  if len(m.text.split()) >= 3:
32
  reason = m.text.split(None, 2)[2]
33
  else:
Powers/plugins/watchers.py CHANGED
@@ -24,15 +24,15 @@ gban_db = GBan()
24
  @Gojo.on_message(filters.linked_channel)
25
  async def antichanpin_cleanlinked(c: Gojo, m: Message):
26
  try:
27
- msg_id = m.message_id
28
  pins_db = Pins(m.chat.id)
29
  curr = pins_db.get_settings()
30
  if curr["antichannelpin"]:
31
  await c.unpin_chat_message(chat_id=m.chat.id, message_id=msg_id)
32
- LOGGER.info(f"AntiChannelPin: msgid-{m.message_id} unpinned in {m.chat.id}")
33
  if curr["cleanlinked"]:
34
  await c.delete_messages(m.chat.id, msg_id)
35
- LOGGER.info(f"CleanLinked: msgid-{m.message_id} cleaned in {m.chat.id}")
36
  except ChatAdminRequired:
37
  await m.reply_text(
38
  "Disabled antichannelpin as I don't have enough admin rights!",
@@ -182,7 +182,7 @@ async def gban_watcher(c: Gojo, m: Message):
182
  if _banned:
183
  try:
184
  await m.chat.ban_member(m.from_user.id)
185
- await m.delete(m.message_id) # Delete users message!
186
  user_gbanned = await mention_html(m.from_user.first_name, m.from_user.id)
187
  await m.reply_text(
188
  text=f"""This user ({user_gbanned}) has been banned globally!
 
24
  @Gojo.on_message(filters.linked_channel)
25
  async def antichanpin_cleanlinked(c: Gojo, m: Message):
26
  try:
27
+ msg_id = m.id
28
  pins_db = Pins(m.chat.id)
29
  curr = pins_db.get_settings()
30
  if curr["antichannelpin"]:
31
  await c.unpin_chat_message(chat_id=m.chat.id, message_id=msg_id)
32
+ LOGGER.info(f"AntiChannelPin: msgid-{m.id} unpinned in {m.chat.id}")
33
  if curr["cleanlinked"]:
34
  await c.delete_messages(m.chat.id, msg_id)
35
+ LOGGER.info(f"CleanLinked: msgid-{m.id} cleaned in {m.chat.id}")
36
  except ChatAdminRequired:
37
  await m.reply_text(
38
  "Disabled antichannelpin as I don't have enough admin rights!",
 
182
  if _banned:
183
  try:
184
  await m.chat.ban_member(m.from_user.id)
185
+ await m.delete(m.id) # Delete users message!
186
  user_gbanned = await mention_html(m.from_user.first_name, m.from_user.id)
187
  await m.reply_text(
188
  text=f"""This user ({user_gbanned}) has been banned globally!