Spaces:
Sleeping
Sleeping
Captain D. Ezio
commited on
Commit
·
c46aba9
1
Parent(s):
1fc1023
Update pin.py
Browse files- Powers/plugins/pin.py +3 -2
Powers/plugins/pin.py
CHANGED
@@ -70,13 +70,14 @@ async def pin_message(_, m: Message):
|
|
70 |
async def unpin_message(c: Gojo, m: Message):
|
71 |
try:
|
72 |
if m.reply_to_message:
|
73 |
-
await
|
74 |
LOGGER.info(
|
75 |
f"{m.from_user.id} unpinned msgid: {m.reply_to_message.id} in {m.chat.id}",
|
76 |
)
|
77 |
await m.reply_text(text="Unpinned last message.")
|
78 |
else:
|
79 |
-
await c.
|
|
|
80 |
await m.reply_text(text="Unpinned last pinned message!")
|
81 |
except ChatAdminRequired:
|
82 |
await m.reply_text(text="I'm not admin or I don't have rights.")
|
|
|
70 |
async def unpin_message(c: Gojo, m: Message):
|
71 |
try:
|
72 |
if m.reply_to_message:
|
73 |
+
await m.reply_to_message.unpin()
|
74 |
LOGGER.info(
|
75 |
f"{m.from_user.id} unpinned msgid: {m.reply_to_message.id} in {m.chat.id}",
|
76 |
)
|
77 |
await m.reply_text(text="Unpinned last message.")
|
78 |
else:
|
79 |
+
m_id = (await c.get_chat(m.chat.id)).pinned_message.id
|
80 |
+
await c.unpin_chat_message(m.chat.id,m_id)
|
81 |
await m.reply_text(text="Unpinned last pinned message!")
|
82 |
except ChatAdminRequired:
|
83 |
await m.reply_text(text="I'm not admin or I don't have rights.")
|