Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Button:
- def __init__(self):
- self.posts_cb: CallbackData = CallbackData('post', 'id', 'action')
- def button_all(self,text_button: str, callback: str) -> InlineKeyboardMarkup:
- inline_btn = InlineKeyboardButton(text=text_button, callback_data=self.posts_cb.new(action=callback))
- inline_kb = InlineKeyboardMarkup().add(inline_btn)
- return inline_kb
- def proxy(list_proxy: list) -> InlineKeyboardMarkup:
- inline_kb = InlineKeyboardMarkup()
- for i in list_proxy:
- s: str = i.replace("socks5://", "")
- server, port = s.split(":")
- link_beta: str = f"https://t.me/proxy?server={server}&port={port}"
- inline_kb.add(InlineKeyboardButton(server, url=link_beta))
- return inline_kb
- def butoons(self,text: list, call_back: list)-> InlineKeyboardMarkup:
- inline_kb: InlineKeyboardMarkup = InlineKeyboardMarkup()
- for val, i in enumerate(text):
- inb = InlineKeyboardButton(text=i, callback_data=self.posts_cb.new(action=call_back[i]))
- inline_kb.add(inb)
- return inline_kb
- def edit_proxy(self,text_button: str,proxy:str, callback: str="proxy") -> InlineKeyboardMarkup:
- """
- :type callback: object
- """
- print(1)
- proxy=proxy.replace("socks5://", "")
- print(2)
- server, port = proxy.split(":")
- inline_btn = InlineKeyboardButton(text=text_button, callback_data=self.posts_cb.new(action=callback))
- print(3)
- link_beta: str = f"https://t.me/proxy?server={server}&port={port}"
- print(4)
- inline_kb = InlineKeyboardMarkup()
- print(5)
- inline_kb.add(InlineKeyboardButton(text="proxy for you", url=link_beta))
- print(6)
- inline_kb.add(inline_btn)
- return inline_kb
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement