Advertisement
avramit

fxp gifbot

Mar 4th, 2018
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.46 KB | None | 0 0
  1. from fxplib import *
  2.  
  3. GIPHY_API_KEY = 'HqtsaYDnDy1WWlTeAYH0EbKpnFAyAMBv'
  4. FXP_USERNAME = 'TheSpammerMUI'
  5. FXP_PASSWORD = 'MUISPAMMER'
  6.  
  7.  
  8. def randomGif(q):
  9.     params = {
  10.         'api_key':GIPHY_API_KEY,
  11.         's':q,
  12.     }
  13.     r = requests.get('https://api.giphy.com/v1/gifs/translate', params=params)
  14.     return r.json()['data']['images']['fixed_height']['url']
  15.  
  16.  
  17. @FxpEvents.on('newthread')
  18. @FxpEvents.on('newcomment')
  19. def on_newboth_handle(fxpObj):
  20.     command, args = fxpObj.content.split(maxsplit=1)
  21.     if command == 'גיף' or command.lower() == 'gif':
  22.         print (args)
  23.         comment = '[IMG]%s[/IMG]' % randomGif(args)
  24.         cid = user.reply(fxpObj, comment, True)
  25.         if cid:
  26.             print ('[New comment] https://www.fxp.co.il/showthread.php?p=%s' % str(cid))
  27.  
  28. user = fxp(FXP_USERNAME, FXP_PASSWORD)
  29.  
  30. if user.login():
  31.     print ('[*] Login success - %s' % user.username)
  32.  
  33.     import time
  34.     live = user.livefxp.connect(debug=False)
  35.     #user.livefxp.socketIO.ws.on_message = None # Disable message parse
  36.     if live == False:
  37.         print ('[*] Error while creating live connection')
  38.     else:
  39.         user.livefxp.addForum(21)
  40.         user.livefxp.addForum(127)
  41.         user.livefxp.addForum(603)
  42.         user.livefxp.addForum(448)
  43.         user.livefxp.addForum(301)
  44.         user.livefxp.addForum(9274)
  45.         user.livefxp.addForum(550)
  46.         user.livefxp.addForum(359)
  47.         user.livefxp.addForum(364)
  48.         user.livefxp.addForum(67)
  49.         user.livefxp.addForum(716)
  50.         user.livefxp.addForum(124)
  51. else:
  52.     print ('[*] Login error')
  53.  
  54.  
  55. while True:
  56.     time.sleep(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement