Advertisement
Guest User

Untitled

a guest
Jul 4th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Button:
  2.     def __init__(self):
  3.        self.posts_cb: CallbackData = CallbackData('post', 'id', 'action')
  4.  
  5.     def button_all(self,text_button: str, callback: str) -> InlineKeyboardMarkup:
  6.         inline_btn = InlineKeyboardButton(text=text_button, callback_data=self.posts_cb.new(action=callback))
  7.         inline_kb = InlineKeyboardMarkup().add(inline_btn)
  8.         return inline_kb
  9.  
  10.     def proxy(list_proxy: list) -> InlineKeyboardMarkup:
  11.         inline_kb = InlineKeyboardMarkup()
  12.         for i in list_proxy:
  13.             s: str = i.replace("socks5://", "")
  14.            server, port = s.split(":")
  15.            link_beta: str = f"https://t.me/proxy?server={server}&port={port}"
  16.            inline_kb.add(InlineKeyboardButton(server, url=link_beta))
  17.        return inline_kb
  18.  
  19.    def butoons(self,text: list, call_back: list)-> InlineKeyboardMarkup:
  20.        inline_kb: InlineKeyboardMarkup = InlineKeyboardMarkup()
  21.        for val, i in enumerate(text):
  22.            inb = InlineKeyboardButton(text=i, callback_data=self.posts_cb.new(action=call_back[i]))
  23.            inline_kb.add(inb)
  24.        return inline_kb
  25.  
  26.    def edit_proxy(self,text_button: str,proxy:str, callback: str="proxy") -> InlineKeyboardMarkup:
  27.        """
  28.  
  29.        :type callback: object
  30.        """
  31.        print(1)
  32.        proxy=proxy.replace("socks5://", "")
  33.         print(2)
  34.         server, port = proxy.split(":")
  35.  
  36.         inline_btn = InlineKeyboardButton(text=text_button, callback_data=self.posts_cb.new(action=callback))
  37.         print(3)
  38.         link_beta: str = f"https://t.me/proxy?server={server}&port={port}"
  39.         print(4)
  40.         inline_kb = InlineKeyboardMarkup()
  41.         print(5)
  42.         inline_kb.add(InlineKeyboardButton(text="proxy for you", url=link_beta))
  43.         print(6)
  44.         inline_kb.add(inline_btn)
  45.  
  46.         return inline_kb
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement