massive fixes
This commit is contained in:
11
dockerfile
Normal file
11
dockerfile
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
FROM python:3
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
COPY requirements.txt ./
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CMD [ "python", "./src/main.py" ]
|
||||||
BIN
requirements.txt
Normal file
BIN
requirements.txt
Normal file
Binary file not shown.
@@ -1,8 +1,9 @@
|
|||||||
import PaginatedView
|
from PaginatedView import PaginatedView
|
||||||
from CommitsSelectMenu import CommitSelectMenu
|
from CommitsSelectMenu import CommitSelectMenu
|
||||||
from typing import *
|
from typing import *
|
||||||
import datetime
|
import datetime
|
||||||
from discord.ui import Select, SelectOption
|
from discord.ui import Select
|
||||||
|
from discord import SelectOption
|
||||||
import discord
|
import discord
|
||||||
|
|
||||||
BRANCH = "main"
|
BRANCH = "main"
|
||||||
@@ -32,7 +33,7 @@ class CommitsPaginatedView(PaginatedView):
|
|||||||
msg = commit['commit']['message'].split('\n')[0][:80]
|
msg = commit['commit']['message'].split('\n')[0][:80]
|
||||||
author = commit['commit']['author']['name']
|
author = commit['commit']['author']['name']
|
||||||
sha = commit['sha'][:7]
|
sha = commit['sha'][:7]
|
||||||
date = datetime.fromisoformat(commit['commit']['committer']['date'].replace('Z', '+00:00'))
|
date = datetime.datetime.fromisoformat(commit['commit']['committer']['date'].replace('Z', '+00:00'))
|
||||||
|
|
||||||
embed.add_field(
|
embed.add_field(
|
||||||
name=f"{i+1}. `{sha}` by {author}",
|
name=f"{i+1}. `{sha}` by {author}",
|
||||||
@@ -2,7 +2,6 @@ import discord
|
|||||||
from typing import *
|
from typing import *
|
||||||
from discord.ui import *
|
from discord.ui import *
|
||||||
|
|
||||||
from main import create_commit_embed, fetch_commit_files
|
|
||||||
from CommitsActionView import CommitActionsView
|
from CommitsActionView import CommitActionsView
|
||||||
|
|
||||||
class CommitSelectMenu(Select):
|
class CommitSelectMenu(Select):
|
||||||
@@ -25,6 +24,7 @@ class CommitSelectMenu(Select):
|
|||||||
self.commits = commits
|
self.commits = commits
|
||||||
|
|
||||||
async def callback(self, interaction: discord.Interaction):
|
async def callback(self, interaction: discord.Interaction):
|
||||||
|
from main import create_commit_embed, fetch_commit_files
|
||||||
selected_idx = int(self.values[0])
|
selected_idx = int(self.values[0])
|
||||||
commit = self.commits[selected_idx]
|
commit = self.commits[selected_idx]
|
||||||
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
from discord.ui import *
|
from discord.ui import *
|
||||||
import discord
|
import discord
|
||||||
from typing import *
|
from typing import *
|
||||||
from main import show_file_diff
|
|
||||||
|
|
||||||
class FileBrowserSelect(Select):
|
class FileBrowserSelect(Select):
|
||||||
"""Dropdown for browsing files in a commit"""
|
"""Dropdown for browsing files in a commit"""
|
||||||
@@ -28,5 +27,6 @@ class FileBrowserSelect(Select):
|
|||||||
file_info = self.files[selected_idx]
|
file_info = self.files[selected_idx]
|
||||||
filename = file_info['filename']
|
filename = file_info['filename']
|
||||||
|
|
||||||
|
from main import show_file_diff
|
||||||
await show_file_diff(interaction, self.commit_sha, filename)
|
await show_file_diff(interaction, self.commit_sha, filename)
|
||||||
|
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
from discord.ui import *
|
from discord.ui import *
|
||||||
import discord
|
import discord
|
||||||
|
|
||||||
from main import search_commits
|
|
||||||
|
|
||||||
class SearchModal(Modal):
|
class SearchModal(Modal):
|
||||||
"""Modal for searching commits"""
|
"""Modal for searching commits"""
|
||||||
def __init__(self, search_type: str = "message"):
|
def __init__(self, search_type: str = "message"):
|
||||||
@@ -18,6 +16,7 @@ class SearchModal(Modal):
|
|||||||
self.add_item(self.search_term)
|
self.add_item(self.search_term)
|
||||||
|
|
||||||
async def on_submit(self, interaction: discord.Interaction):
|
async def on_submit(self, interaction: discord.Interaction):
|
||||||
|
from main import search_commits
|
||||||
await interaction.response.defer()
|
await interaction.response.defer()
|
||||||
await search_commits(interaction, self.search_type, self.search_term.value)
|
await search_commits(interaction, self.search_type, self.search_term.value)
|
||||||
|
|
||||||
@@ -222,8 +222,11 @@ async def show_commit_diff_interactive(interaction: discord.Interaction, commit_
|
|||||||
title=f"📊 Diff for commit `{matching_commit['sha'][:7]}`",
|
title=f"📊 Diff for commit `{matching_commit['sha'][:7]}`",
|
||||||
color=discord.Color.blue()
|
color=discord.Color.blue()
|
||||||
)
|
)
|
||||||
await interaction.followup.send(embed=embed, ephemeral=True)
|
try:
|
||||||
await interaction.followup.send(f"```diff\n{diff_text[:1800]}\n```", ephemeral=True)
|
await interaction.followup.send(embed=embed, ephemeral=True)
|
||||||
|
await interaction.followup.send(f"```diff\n{diff_text[:1800]}\n```", ephemeral=True)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"err at main.py with {e}")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
await interaction.followup.send(f"Error: {str(e)}", ephemeral=True)
|
await interaction.followup.send(f"Error: {str(e)}", ephemeral=True)
|
||||||
Reference in New Issue
Block a user