fix invalid urls

This commit is contained in:
Enzo Nunes
2025-03-01 19:20:17 +00:00
parent 2e6a6f23c8
commit 7c38a708b4
2 changed files with 7 additions and 9 deletions

View File

@@ -69,6 +69,13 @@ async def picable(interaction: Interaction, owner: str, repository: str):
url = f"https://api.github.com/repos/{owner}/{repository}"
headers = {"Authorization": f"token {github_token}"}
response = requests.get(url, headers=headers)
if not response.status_code == 200:
await interaction.followup.send(
f"Invalid Repository. Please check the repository name and owner and try again. :x:"
)
return
response.raise_for_status()
repo_info = response.json()
repository_size_kb = repo_info["size"]