Просмотр исходного кода

Fix: until date in flood (#243)

* Fix

* Update functions.py
SI_NN_ER_LS 2 лет назад
Родитель
Сommit
0cc6ebd844
2 измененных файлов с 3 добавлено и 3 удалено
  1. 2 2
      wbb/modules/flood.py
  2. 1 1
      wbb/utils/functions.py

+ 2 - 2
wbb/modules/flood.py

@@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 SOFTWARE.
 """
 """
 from asyncio import get_running_loop, sleep
 from asyncio import get_running_loop, sleep
-from time import time
+from datetime import datetime, timedelta
 
 
 from pyrogram import filters
 from pyrogram import filters
 from pyrogram.types import (
 from pyrogram.types import (
@@ -100,7 +100,7 @@ async def flood_control_func(_, message: Message):
             await message.chat.restrict_member(
             await message.chat.restrict_member(
                 user_id,
                 user_id,
                 permissions=ChatPermissions(),
                 permissions=ChatPermissions(),
-                until_date=int(time() + 3600),
+                until_date=datetime.now() + timedelta(minutes=60),
             )
             )
         except Exception:
         except Exception:
             return
             return

+ 1 - 1
wbb/utils/functions.py

@@ -369,7 +369,7 @@ async def get_data_and_name(replied_message, message):
                 if replied_message.text
                 if replied_message.text
                 else replied_message.caption.markdown
                 else replied_message.caption.markdown
             )
             )
-            command = search(r'\[\'(.*?)\'(?:, \'(.*?)\')*\]', str(message.command)).group(1)
+            command = message.command[0]
             match = f"/{command} " + name
             match = f"/{command} " + name
             if not message.reply_to_message and message.text:
             if not message.reply_to_message and message.text:
                 if match == data:
                 if match == data: