【发布时间】:2020-04-26 15:44:59
【问题描述】:
此机器人每 5 秒检查一次带有请求模块的网站 如果产品没有售罄。机器人必须向不和谐频道发送消息。 如果卖光了。 5 秒后再次检查
import discord
import requests
import re
import time
time.sleep(60)
client = discord.Client()
url = "https://wunder.com.tr/sneaker/adidas-sneaker/yeezy-boost-700-v3-H67799?gclid=CjwKCAjwnIr1BRAWEiwA6GpwNSZ5WT1GuFdTO1nXkwYLl__RXY0PZ6Atez4_ZYB-DSNEbzz3Z3swGRoCkAsQAvD_BwE"
a=1
b=2
@client.event
async def on_ready():
print("----------------------")
print("Logged In As")
print("Username: %s"%client.user.name)
print("ID: %s"%client.user.id)
print("----------------------")
@client.event
async def on_message(message):
id = client.get_guild(703666065040867391)
while a<b:
time.sleep(5)
req = requests.get(url)
if re.search('(?i)SOLD OUT',req.text):
print('Nike Fear of God Checked'+ i)
else:
await message.channel.send('Stokta Var')
print('Nike Fear of God Checked')
client.run('token')
【问题讨论】:
标签: python python-3.x request python-requests discord.py