title: python: telegram bots command parameters
body: <p>i am developing a telegram bot.
  there are commands and in my case it's 
  <code>/leaderboard</code></p>
  
  <p>commands can have parameters (basically anything following the command).</p>
  
  <p>i would like to add a parameter int for a page and an int param for category. they both are optional.</p>
  
  <p>i was wondering to do something like:</p>
  
  <p><code>/leaderboard {page} {category}</code></p>
  
  <p>so i can do:</p>
  
  <p><code>page, category = text.split(" ")</code></p>
  
  <p>since both are optional my problem is: how can i get rid of the problem that i don't know if the first arg is referred to page or category (in case page is not specified and left as optional). Because if the user doesn't specify the page, the category takes the first place.</p>
  
  <p>i would like to make it userfriendly.</p>
  
  <p>i was thinking something like:</p>
  
  <p><code>/leaderboard page={int} categ={int}</code></p>
  
  <p>and then</p>
  
  <pre><code>for arg in text.split(" "):
      if arg.startswith("page"):
          page = arg.split("=")[1]
      elif arg.startswith("categ"):
          categ = arg.split("=")[1]
  </code></pre>
  
  <p>i just wrote the code here so it may be wrong, but i am more worried about the concept to use, not if in the code.
  So i ask if you have solutions better than these. Thanks in advance.</p>