Removed unneeded clientsessions
This commit is contained in:
parent
ffadb4a634
commit
85e70c9a11
|
@ -15,8 +15,6 @@ class Deviantart:
|
|||
def __init__(self, bot):
|
||||
self.base_url = "https://www.deviantart.com/api/v1/oauth2/gallery/all"
|
||||
self.bot = bot
|
||||
self.headers = {"User-Agent": utils.user_agent}
|
||||
self.session = aiohttp.ClientSession()
|
||||
self.token = None
|
||||
self.params = None
|
||||
bot.loop.create_task(self.token_task())
|
||||
|
|
|
@ -42,8 +42,6 @@ def check_online(online_channels, channel):
|
|||
class Picarto:
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self.headers = {"User-Agent": utils.user_agent}
|
||||
self.session = aiohttp.ClientSession()
|
||||
|
||||
async def check_channels(self):
|
||||
await self.bot.wait_until_ready()
|
||||
|
|
|
@ -22,8 +22,6 @@ class Twitch:
|
|||
self.bot = bot
|
||||
self.key = utils.twitch_key
|
||||
self.params = {'client_id': self.key}
|
||||
self.headers = {"User-Agent": utils.user_agent,
|
||||
"Client-ID": self.key}
|
||||
|
||||
async def channel_online(self, channel: str):
|
||||
# Check a specific channel's data, and get the response in text format
|
||||
|
@ -122,10 +120,9 @@ class Twitch:
|
|||
result = result[0]
|
||||
url = result['twitch_url']
|
||||
user = re.search("(?<=twitch.tv/)(.*)", url).group(1)
|
||||
twitch_url = "https://api.twitch.tv/kraken/channels/{}?client_id={}".format(user, self.key)
|
||||
with aiohttp.ClientSession() as s:
|
||||
async with s.get(twitch_url) as response:
|
||||
data = await response.json()
|
||||
twitch_url = "https://api.twitch.tv/kraken/channels/{}".format(user)
|
||||
payload = {'client_id': self.key}
|
||||
data = await utils.request(twitch_url, payload=payload)
|
||||
|
||||
fmt = "Username: {}".format(data['display_name'])
|
||||
fmt += "\nStatus: {}".format(data['status'])
|
||||
|
|
|
@ -16,10 +16,10 @@ required_tables = {
|
|||
'motd': 'date',
|
||||
'overwatch': 'member_id',
|
||||
'picarto': 'member_id',
|
||||
'server_settings': 'guild_id',
|
||||
'server_settings': 'server_id',
|
||||
'raffles': 'id',
|
||||
'strawpolls': 'guild_id',
|
||||
'tags': 'guild_id',
|
||||
'strawpolls': 'server_id',
|
||||
'tags': 'server_id',
|
||||
'tictactoe': 'member_id',
|
||||
'twitch': 'member_id'
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue