Fix for separate group permissions

Better to pop keys, I didn't want add one by one perm

Signed-off-by: Yasir Aris M <git@yasirdev.my.id>
This commit is contained in:
Yasir Aris M 2023-10-17 07:33:18 +07:00 committed by GitHub
parent bb58c41b9b
commit 2695875030
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -220,6 +220,8 @@ async def nightmode_handler(_, msg, strings):
if start_timestamp < now: if start_timestamp < now:
start_timestamp = start_timestamp + timedelta(days=1) start_timestamp = start_timestamp + timedelta(days=1)
end_time_stamp = start_timestamp + timedelta(seconds=int(lock_dur)) end_time_stamp = start_timestamp + timedelta(seconds=int(lock_dur))
del msg.chat.permissions.can_send_messages, msg.chat.permissions.can_send_media_messages, msg.chat.permissions.all_perms
perm = msg.chat.permissions
try: try:
# schedule to enable nightmode # schedule to enable nightmode
scheduler.add_job( scheduler.add_job(
@ -237,7 +239,7 @@ async def nightmode_handler(_, msg, strings):
scheduler.add_job( scheduler.add_job(
un_mute_chat, un_mute_chat,
"interval", "interval",
[chat_id, msg.chat.permissions], [chat_id, perm],
id=f"disable_nightmode_{chat_id}", id=f"disable_nightmode_{chat_id}",
days=1, days=1,
next_run_time=end_time_stamp, next_run_time=end_time_stamp,