(text, markup=True)
| 239 | # Ask Doubt on telegram @KingVJ01 |
| 240 | |
| 241 | def parse_buttons(text, markup=True): |
| 242 | buttons = [] |
| 243 | for match in BTN_URL_REGEX.finditer(text): |
| 244 | n_escapes = 0 |
| 245 | to_check = match.start(1) - 1 |
| 246 | while to_check > 0 and text[to_check] == "\\": |
| 247 | n_escapes += 1 |
| 248 | to_check -= 1 |
| 249 | |
| 250 | if n_escapes % 2 == 0: |
| 251 | if bool(match.group(4)) and buttons: |
| 252 | buttons[-1].append(InlineKeyboardButton( |
| 253 | text=match.group(2), |
| 254 | url=match.group(3).replace(" ", ""))) |
| 255 | else: |
| 256 | buttons.append([InlineKeyboardButton( |
| 257 | text=match.group(2), |
| 258 | url=match.group(3).replace(" ", ""))]) |
| 259 | if markup and buttons: |
| 260 | buttons = InlineKeyboardMarkup(buttons) |
| 261 | return buttons if buttons else None |
| 262 | |
| 263 | # Don't Remove Credit Tg - @VJ_Botz |
| 264 | # Subscribe YouTube Channel For Amazing Bot https://youtube.com/@Tech_VJ |
no outgoing calls
no test coverage detected