Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. import botogram
  2. import random
  3.  
  4. bot = botogram.create("API-KEY")
  5.  
  6.  
  7. @bot.command("random")
  8. def random_command(chat, minimum: int = 0, maximum: int = 100):
  9. """Get a random number between <code>minimum</code> and <code>maximum</code>."""
  10. try:
  11. chat.send(str(random.randint(minimum, maximum)))
  12. except (TypeError, ValueError):
  13. chat.send("Invalid values.")
  14.  
  15.  
  16. @bot.command("hello")
  17. def hello_world(chat):
  18. """Say hello to the world!"""
  19. chat.send("Hello world!")
  20.  
  21.  
  22. @bot.command("say_hello")
  23. def say_hello(chat, args):
  24. """Say hello to a group of people. If no person is provided, it will just say hello."""
  25. if args:
  26. chat.send("Hello " + ", ".join(args) + "!")
  27. else:
  28. chat.send("Hello!")
  29.  
  30.  
  31. if __name__ == "__main__":
  32. bot.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement