Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. import requests
  2. import json
  3. import datetime
  4. import discord
  5. import os
  6. import time
  7. from discord.ext import commands
  8.  
  9. r = requests.get('https://www.antisocialsocialclub.com/products.json')
  10. products = json.loads((r.text))['products']
  11. date = datetime.datetime.today()
  12. timerugh = datetime.datetime.now()
  13. time2 = timerugh.strftime("%I:%M:%S")
  14. producturl = 'https://www.antisocialsocialclub.com/'
  15. # current = date.strftime("%Y-%m-11T00:56:30-04:00")
  16. current = date.strftime("%Y-%m-%dT" + time2 + "-12:00")
  17. print("time2" + " " + time2)
  18. print("current" + " " + current)
  19.  
  20.  
  21. token = 'NjMyMTA2ODE4NjA0MjM2ODEw.XaQweg.0ibxG1nB0IUFJI96YWat7yhsc8U'
  22. client = commands.Bot(command_prefix = '.')
  23.  
  24.  
  25. @client.event
  26. async def on_message(message):
  27. r = requests.get('https://www.dertbag.us/products.json?limit=10000000000000')
  28. products = json.loads((r.text))['products']
  29. date = datetime.datetime.today()
  30. timerugh = datetime.datetime.now()
  31. time2 = timerugh.strftime("%I:%M:%S")
  32. producturl = 'https://www.dertbag.us'
  33. # current = date.strftime("%Y-%m-11T00:56:30-04:00")
  34. current = date.strftime("%Y-%m-%dT" + time2 + "-12:00")
  35. channels = ['monitor']
  36.  
  37. if str(message.channel) in channels:
  38. if message.content.find("power on") != -1:
  39. print("bot on")
  40. await message.channel.send("on")
  41. r = requests.get('https://www.dertbag.us/products.json?limit=10000000000000')
  42. products = json.loads((r.text))['products']
  43. date = datetime.datetime.today()
  44. print('ASSC monitor')
  45. i = 0
  46. while i < 6:
  47.  
  48. timerugh = datetime.datetime.now()
  49. time2 = time.strftime("%I:%M:%S")
  50. for product in products:
  51. # print(product['updated_at'])
  52. # print(product['title'])
  53. restocktime = product['updated_at']
  54. producturl = 'https://www.dertbag.us/collections/home/products/' + product['handle']
  55.  
  56. timerugh = datetime.datetime.now()
  57. time2 = time.strftime("%I:%M:%S")
  58.  
  59. if time2 == timerugh.strftime("12:%M:%S"):
  60. time2 = timerugh.strftime("00:%M:%S")
  61. # print(time2 + " " + "time converted")
  62. current = date.strftime("%Y-%m-%dT" + time2 + "-04:00")
  63.  
  64. #print(time2)
  65. #print(current)
  66. if restocktime == current:
  67. await message.channel.send(product['title'] + " " + "Restocked At" + " " + current + " " + "on" + " " + producturl)
  68. time.sleep(1)
  69. elif message.content == "!current time":
  70. print("time shown")
  71.  
  72. await message.channel.send(current)
  73. client.run(token)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement