Update Discord Bots API endpoint

This commit is contained in:
Noikoio 2018-12-07 21:17:44 -08:00
parent d658672006
commit 32ace2f19e

View file

@ -57,8 +57,8 @@ class WorldTime(discord.Client):
logPrint("Report", "Currently in {0} guild(s).".format(guildcount)) logPrint("Report", "Currently in {0} guild(s).".format(guildcount))
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
if authtoken != '': if authtoken != '':
rurl = "https://bots.discord.pw/api/bots/{}/stats".format(self.user.id) rurl = "https://discord.bots.gg/api/v1/bots/{}/stats".format(self.user.id)
rdata = { "server_count": guildcount } rdata = { "guildCount": guildcount }
rhead = { "Content-Type": "application/json", "Authorization": authtoken } rhead = { "Content-Type": "application/json", "Authorization": authtoken }
try: try:
await session.post(rurl, json=rdata, headers=rhead) await session.post(rurl, json=rdata, headers=rhead)
@ -67,4 +67,4 @@ class WorldTime(discord.Client):
logPrint("Report", "Discord Bots API report failed: {}".format(e)) logPrint("Report", "Discord Bots API report failed: {}".format(e))
except Exception as e: except Exception as e:
logPrint("Report", "Unknown error on Discord Bots API report.") logPrint("Report", "Unknown error on Discord Bots API report.")
await asyncio.sleep(21600) # Repeat once every six hours await asyncio.sleep(21600) # Repeat once every six hours