-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- fix(dependencies): pin numpy version to 1.26.4 - feat: add chat exporter - fix(Dockerfile): prevent caching - typo fix - bug: fix UserResponse model - Add *.pem to .gitignore - Update README.md
- Loading branch information
Showing
10 changed files
with
142 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ | |
**/__pycache__ | ||
**/venv | ||
**/.idea | ||
**/.vscode | ||
**/*.pem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Host github.com | ||
User git | ||
HostName github.com | ||
Port 22 | ||
StrictHostKeyChecking no | ||
UserKnownHostsFile=/dev/null | ||
IdentityFile ~/.ssh/privkey.pem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,14 @@ | ||
FROM python:3.10 | ||
|
||
RUN wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb \ | ||
-O packages-microsoft-prod.deb \ | ||
&& dpkg -i packages-microsoft-prod.deb \ | ||
&& rm packages-microsoft-prod.deb | ||
|
||
RUN apt-get update && apt-get install -y dotnet-sdk-8.0 \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY requirements.txt . | ||
|
||
RUN pip3 install -r requirements.txt && \ | ||
|
@@ -13,6 +22,22 @@ WORKDIR /eruditus | |
RUN useradd -m user && \ | ||
chown -R user:user . | ||
|
||
COPY .ssh /home/user/.ssh/ | ||
COPY chat_exporter /usr/bin/ | ||
RUN chmod a+x /usr/bin/chat_exporter && \ | ||
chown -R user:user /home/user | ||
|
||
USER user | ||
|
||
# Prevent caching the subsequent "git clone" layer. | ||
# https://github.com/moby/moby/issues/1996#issuecomment-1152463036 | ||
ADD http://date.jsontest.com /etc/builddate | ||
RUN git clone https://github.com/hfz1337/DiscordChatExporter ~/DiscordChatExporter | ||
|
||
ARG [email protected]:username/repo | ||
|
||
RUN git clone $CHATLOGS_REPO ~/chatlogs | ||
RUN git config --global user.email "eruditus@localhost" && \ | ||
git config --global user.name "eruditus" | ||
|
||
ENTRYPOINT ["python3", "-u", "eruditus.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
if [[ $# -lt 2 ]]; then | ||
echo "Usage: $0 <channel_file> <output_dirname>" | ||
exit 1 | ||
fi | ||
|
||
CHANNELS_FILE="$1" | ||
OUTPUT_DIR="/home/user/chatlogs/static/$2" | ||
|
||
# Ensure output directory exists | ||
mkdir -p "$OUTPUT_DIR" | ||
|
||
# Load the bot token | ||
export $(cat /eruditus/.env | grep 'DISCORD_TOKEN' | xargs) | ||
|
||
# Export the chat logs | ||
cd ~/DiscordChatExporter | ||
dotnet run --project DiscordChatExporter.Cli export \ | ||
--token "$DISCORD_TOKEN" \ | ||
--file "$CHANNELS_FILE" \ | ||
--output "$OUTPUT_DIR" | ||
|
||
# Commit & push | ||
cd ~/chatlogs | ||
git add . && git commit -m "Export operation ($(date))" | ||
git push origin main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
discord==2.2.0 | ||
numpy==1.26.4 | ||
pydantic==2.3 | ||
markdownify==0.11.6 | ||
matplotlib==3.6.3 | ||
|