From b25e4cfdca00ffb889659c8cd233970841ed25d6 Mon Sep 17 00:00:00 2001 From: Boyan Date: Tue, 26 Apr 2022 12:12:47 +0300 Subject: [PATCH] first commit --- main.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..1a313c5 --- /dev/null +++ b/main.py @@ -0,0 +1,22 @@ +import discord +import requests +from config import TOKEN +from time import sleep +bot = discord.Client() + +@bot.event +async def on_ready(): + print(f'{bot.user} has connected to Discord!') + channel = bot.get_channel(968428874268565516) # Gets channel from internal cache + emplist = [] + while True: + r = requests.get("https://www.sshxl.nl/api/v1/offering/filters?ContingentId=9cf71a6e-5917-4227-8542-8a9821e282d2&DemographicId=d60a9752-8e1e-44e9-850b-8fd0de628005&MainPeriodId=8cfc9ef2-57b9-4193-8595-5e3ec2dbfd27",verify=False).json() + interest = r["RentalPeriods"] + if interest not in emplist: + emplist.append(interest) + await channel.send("New entry to the page!!!") # Sends message to channel + embed=discord.Embed(title=f"{interest[0].keys()}", description=f"{interest[0].values()}", color=0xFF5733) + await channel.send(embed=embed) + sleep(3600) + +bot.run(TOKEN)