Browse Source

Bot - Formatting

pull/14/head
DrBot7 3 years ago
parent
commit
003605e0d0
  1. 9
      bot.py

9
bot.py

@ -48,8 +48,8 @@ async def on_message(message):
# Binflop # Binflop
if len(message.attachments) > 0: if len(message.attachments) > 0:
if message.attachments[0].url.endswith(
('.png', '.jpg', '.jpeg', '.mp4', '.mov', '.avi', '.gif', '.image')) == False:
if not message.attachments[0].url.endswith(
('.png', '.jpg', '.jpeg', '.mp4', '.mov', '.avi', '.gif', '.image')):
download = message.attachments[0].url download = message.attachments[0].url
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
async with session.get(download, allow_redirects=True) as r: async with session.get(download, allow_redirects=True) as r:
@ -157,10 +157,10 @@ async def updater():
i += 1 i += 1
already_exists = False already_exists = False
for server2 in modified_servers['servers']: for server2 in modified_servers['servers']:
if already_exists == False:
if not already_exists:
if server['attributes']['uuid'] == server2['uuid']: if server['attributes']['uuid'] == server2['uuid']:
already_exists = True already_exists = True
if already_exists == False:
if not already_exists:
headers = { headers = {
'Accept': 'application/json', 'Accept': 'application/json',
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -175,7 +175,6 @@ async def updater():
server['attributes']['feature_limits']['databases']) + ', "allocations": ' + str( server['attributes']['feature_limits']['databases']) + ', "allocations": ' + str(
server['attributes']['feature_limits']['allocations']) + ', "backups": 3 } }' server['attributes']['feature_limits']['allocations']) + ', "backups": 3 } }'
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
async with session.patch('https://panel.birdflop.com/api/application/servers/' + str(server['attributes']['id']) + '/build', headers=headers, data=data) as response: async with session.patch('https://panel.birdflop.com/api/application/servers/' + str(server['attributes']['id']) + '/build', headers=headers, data=data) as response:
if response.status == 200: if response.status == 200:

Loading…
Cancel
Save