Skip to content

Commit

Permalink
Правка строк
Browse files Browse the repository at this point in the history
  • Loading branch information
Schrodinger71 committed Jan 6, 2025
1 parent 6053d16 commit 8d9400b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions events/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,17 @@ async def get_github_link(repo_code, number):
comments_count = pr_data['comments']
embed.add_field(name="Комментарии 💬", value=comments_count, inline=True)

# Получаем информацию о количестве добавленных и удалённых строк
diffstat_url = f"{pr_url}/files"
diffstat_response = GLOBAL_SESSION.get(diffstat_url)
if diffstat_response.status_code == 200:
diffstat_data = diffstat_response.json()
added_lines = sum(file['additions'] for file in diffstat_data)
deleted_lines = sum(file['deletions'] for file in diffstat_data)
# Добавляем изменения строк в нужном формате
embed.add_field(name="Изменение строк 🔄", value=f"Добавлено: +{added_lines}\nУдалено: −{deleted_lines}", inline=True)


# Форматируем даты в более читаемый вид
created_at = datetime.strptime(pr_data['created_at'], "%Y-%m-%dT%H:%M:%SZ")
updated_at = datetime.strptime(pr_data['updated_at'], "%Y-%m-%dT%H:%M:%SZ")
Expand Down

0 comments on commit 8d9400b

Please sign in to comment.