Spaces:
Paused
Paused
Captain Ezio
commited on
Commit
·
8d824a2
1
Parent(s):
9e0dfb0
Looks good
Browse files
Powers/utils/kbhelpers.py
CHANGED
|
@@ -1,9 +1,11 @@
|
|
| 1 |
from re import findall
|
| 2 |
-
from pyrogram.types import InlineKeyboardButton as kb
|
| 3 |
from pykeyboard import InlineKeyboard
|
|
|
|
|
|
|
| 4 |
|
| 5 |
# CREDIT WILLIAM BUTCHER BOT
|
| 6 |
|
|
|
|
| 7 |
def is_url(text: str) -> bool:
|
| 8 |
regex = r"""(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]
|
| 9 |
[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(
|
|
@@ -11,6 +13,7 @@ def is_url(text: str) -> bool:
|
|
| 11 |
()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))""".strip()
|
| 12 |
return [x[0] for x in findall(regex, str(text))]
|
| 13 |
|
|
|
|
| 14 |
def keyboard(buttons_list, row_width: int = 2):
|
| 15 |
"""
|
| 16 |
Buttons builder, pass buttons in a list and it will
|
|
|
|
| 1 |
from re import findall
|
|
|
|
| 2 |
from pykeyboard import InlineKeyboard
|
| 3 |
+
from pyrogram.types import InlineKeyboardButton as kb
|
| 4 |
+
|
| 5 |
|
| 6 |
# CREDIT WILLIAM BUTCHER BOT
|
| 7 |
|
| 8 |
+
|
| 9 |
def is_url(text: str) -> bool:
|
| 10 |
regex = r"""(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]
|
| 11 |
[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(
|
|
|
|
| 13 |
()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))""".strip()
|
| 14 |
return [x[0] for x in findall(regex, str(text))]
|
| 15 |
|
| 16 |
+
|
| 17 |
def keyboard(buttons_list, row_width: int = 2):
|
| 18 |
"""
|
| 19 |
Buttons builder, pass buttons in a list and it will
|