Fix mbc upload printing error on the first upload
This commit is contained in:
parent
66d227ecdb
commit
4fafdee3a8
1 changed files with 1 additions and 1 deletions
|
@ -41,7 +41,7 @@ async def upload_file(sess: aiohttp.ClientSession, file: IO, server: str) -> Non
|
||||||
url = (URL(server) / "_matrix/maubot/v1/plugins/upload").with_query({"allow_override": "true"})
|
url = (URL(server) / "_matrix/maubot/v1/plugins/upload").with_query({"allow_override": "true"})
|
||||||
headers = {"Content-Type": "application/zip"}
|
headers = {"Content-Type": "application/zip"}
|
||||||
async with sess.post(url, data=file, headers=headers) as resp:
|
async with sess.post(url, data=file, headers=headers) as resp:
|
||||||
if resp.status == 200:
|
if resp.status in (200, 201):
|
||||||
data = await resp.json()
|
data = await resp.json()
|
||||||
print(f"{Fore.GREEN}Plugin {Fore.CYAN}{data['id']} v{data['version']}{Fore.GREEN} "
|
print(f"{Fore.GREEN}Plugin {Fore.CYAN}{data['id']} v{data['version']}{Fore.GREEN} "
|
||||||
f"uploaded to {Fore.CYAN}{server}{Fore.GREEN} successfully.{Fore.RESET}")
|
f"uploaded to {Fore.CYAN}{server}{Fore.GREEN} successfully.{Fore.RESET}")
|
||||||
|
|
Loading…
Reference in a new issue