Titan/discordbot/titanembeds/poststats.py

24 lines
950 B
Python
Raw Normal View History

2018-01-05 10:21:25 +01:00
import aiohttp
2018-01-06 10:59:04 +01:00
import json
2018-01-05 10:21:25 +01:00
class DiscordBotsOrg(): # https://discordbots.org
def __init__(self, client_id, token):
self.url = "https://discordbots.org/api/bots/{}/stats".format(client_id)
self.token = token
async def post(self, count):
headers = {"Authorization": self.token}
payload = {"server_count": count}
async with aiohttp.ClientSession() as aioclient:
2018-01-06 10:59:04 +01:00
await aioclient.post(self.url, data=payload, headers=headers)
class BotsDiscordPw(): # https://bots.discord.pw/
def __init__(self, client_id, token):
self.url = "https://bots.discord.pw/api/bots/{}/stats".format(client_id)
self.token = token
async def post(self, count):
headers = {"Authorization": self.token}
payload = {"server_count": count}
async with aiohttp.ClientSession() as aioclient:
t = await aioclient.post(self.url, json=payload, headers=headers)