MCPcopy Create free account
hub / github.com/VJBots/VJ-Forward-Bot / parse_buttons

Function parse_buttons

plugins/test.py:241–261  ·  view source on GitHub ↗
(text, markup=True)

Source from the content-addressed store, hash-verified

239# Ask Doubt on telegram @KingVJ01
240
241def 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

Callers 2

get_dataMethod · 0.85
settings_queryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected