Advertisement
Alexquickdraw

Pastebin function for chatango bots.

Oct 4th, 2016
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. #Function to post content to pastebin.
  2. #If you got an account: http://pastebin.com/api to find your DEV Key
  3. #Written in python 3.4.2
  4. #By Hardware@Chatango
  5.  
  6. def paste(title, content):  
  7.     Pastebin_devkey = 'YOUR DEV KEY'
  8.     Pastebin_url_post = 'http://pastebin.com/api/api_post.php'
  9.     pastebin_vars = dict(
  10.         api_option='paste',
  11.         api_dev_key=Pastebin_devkey,
  12.         api_paste_name=title,
  13.         api_paste_code=content,
  14.         api_paste_expire_date = "10M"
  15.        
  16.     return urllib.request.urlopen(Pastebin_url_post, urllib.parse.urlencode(pastebin_vars).encode('utf8')).read()
  17.  
  18.  
  19. #########################
  20. #for newbies using ch.py#
  21. #########################
  22. room.message(paste("mypastetitle","PasteContent"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement