이게 맞나

This commit is contained in:
imnyang 2025-05-02 23:09:57 +09:00
commit 1786b77f3c
7 changed files with 18 additions and 19 deletions

View file

@ -1,16 +1,16 @@
FROM python:3.12 FROM python:3.12
# Setup System
RUN sed -i 's@deb.debian.org@ftp.kaist.ac.kr@g' /etc/apt/sources.list.d/debian.sources RUN sed -i 's@deb.debian.org@ftp.kaist.ac.kr@g' /etc/apt/sources.list.d/debian.sources
RUN pip install --upgrade pip
RUN apt update -y && apt upgrade -y && apt install -y cron
# Setup Crontab # Setup Crontab
WORKDIR /code WORKDIR /code
COPY crontab /code/crontab COPY crontab /code/crontab
COPY requirements.txt /code/requirements.txt COPY requirements.txt /code/requirements.txt
COPY app /code/app COPY app /code/app
RUN apt update && apt -y install cron
COPY crontab /etc/cron.d/crontab COPY crontab /etc/cron.d/crontab
RUN chmod 0644 /etc/cron.d/crontab RUN chmod 0644 /etc/cron.d/crontab
RUN echo "" >> /etc/cron.d/crontab # Ensure newline at end of file RUN echo "" >> /etc/cron.d/crontab # Ensure newline at end of file

View file

@ -13,7 +13,7 @@ with open('./config.json') as json_file:
cl = Client() cl = Client()
cl.set_proxy("socks5h://localhost:9999") #cl.set_proxy("socks5h://localhost:9999")
code = cl.totp_generate_code(INSTAGRAM_AUTH[2]) code = cl.totp_generate_code(INSTAGRAM_AUTH[2])
cl.login(INSTAGRAM_AUTH[0], INSTAGRAM_AUTH[1], verification_code=code) cl.login(INSTAGRAM_AUTH[0], INSTAGRAM_AUTH[1], verification_code=code)
cl.set_user_agent('Instagram 361.0.0.46.88 Android (35/15; 394dpi; 1084x2412; Nothing; A065; Pong; qcom; ko_KR_#u-fw-sun-mu-celsius; 674675147)') cl.set_user_agent('Instagram 361.0.0.46.88 Android (35/15; 394dpi; 1084x2412; Nothing; A065; Pong; qcom; ko_KR_#u-fw-sun-mu-celsius; 674675147)')

View file

@ -43,6 +43,8 @@ def 급식_칼로리_얻기(MLSV_YMD:str):
return 답장.json()['mealServiceDietInfo'][1]['row'][0]['CAL_INFO'] return 답장.json()['mealServiceDietInfo'][1]['row'][0]['CAL_INFO']
def 얻기(MLSV_YMD:str): def 얻기(MLSV_YMD:str):
if MLSV_YMD == "20250401":
return
print("집가고싶다발동") print("집가고싶다발동")
급식 = 급식_정보_얻기(MLSV_YMD) 급식 = 급식_정보_얻기(MLSV_YMD)
# print(f"{ROOT}/library/skeleton.png") # print(f"{ROOT}/library/skeleton.png")
@ -72,10 +74,10 @@ def 학사일정_얻기():
print("서코가고싶다발동") print("서코가고싶다발동")
오늘 = datetime.now() + timedelta(days=1) 오늘 = datetime.now() + timedelta(days=1)
print("오늘은 사실", 오늘, "이였다") print("오늘은 사실", 오늘, "이였다")
with open(f"{ROOT}/library/event/{오늘.strftime("%Y")}.json") as json_file: with open(f"{ROOT}/library/event/{오늘.strftime('%Y')}.json") as json_file:
json_data = json.load(json_file) json_data = json.load(json_file)
마지막_업데이트 = json_data["last_update"] 마지막_업데이트 = json_data["last_update"]
학사일정 = json_data["event"][str(오늘.strftime("%m"))] 학사일정 = json_data["event"][str(오늘.strftime('%m'))]
# print(f"{ROOT}/library/skeleton.png") # print(f"{ROOT}/library/skeleton.png")
사진 = Image.open(f"{ROOT}/library/skeleton_schoolevent.png") 사진 = Image.open(f"{ROOT}/library/skeleton_schoolevent.png")
@ -102,15 +104,15 @@ def 학사일정_얻기():
제목요소.text((75, 930 - i * 60), f"{date_text} : {일정['data']}", font=학사일정_폰트, anchor="ls", fill=(255, 255, 255)) 제목요소.text((75, 930 - i * 60), f"{date_text} : {일정['data']}", font=학사일정_폰트, anchor="ls", fill=(255, 255, 255))
세부요소 = ImageDraw.Draw(사진) 세부요소 = ImageDraw.Draw(사진)
세부요소.text((810, 80), f"{오늘.strftime("%Y")}{오늘.strftime("%m")}", font=세부_폰트, fill=(255, 255, 255)) 세부요소.text((810, 80), f"{오늘.strftime('%Y')}{오늘.strftime('%m')}", font=세부_폰트, fill=(255, 255, 255))
def 포맷팅된_날짜(날짜:str): def 포맷팅된_날짜(날짜:str):
return f"{날짜[:4]}{날짜[4:6]}{날짜[6:8]}" return f"{날짜[:4]}{날짜[4:6]}{날짜[6:8]}"
세부요소.text((591, 200), f"마지막 업데이트 : {포맷팅된_날짜(마지막_업데이트)}", font=세부_폰트, fill=(137, 202, 255)) 세부요소.text((591, 200), f"마지막 업데이트 : {포맷팅된_날짜(마지막_업데이트)}", font=세부_폰트, fill=(137, 202, 255))
사진.save(f'{ROOT}/temp/{오늘.strftime("%Y")}_{오늘.strftime("%m")}.png') 사진.save(f"{ROOT}/temp/{오늘.strftime('%Y')}_{오늘.strftime('%m')}.png")
print("🍲 | Meal Info Image Saved") print("🍲 | Meal Info Image Saved")
return f'{ROOT}/temp/{오늘.strftime("%Y")}_{오늘.strftime("%m")}.png' return f"{ROOT}/temp/{오늘.strftime('%Y')}_{오늘.strftime('%m')}.png"
def 스토리_얻기(MLSV_YMD:str): def 스토리_얻기(MLSV_YMD:str):
print("이건 왜?") print("이건 왜?")

View file

@ -21,7 +21,7 @@ else:
print("🍪 | Retrieving saved account information.") print("🍪 | Retrieving saved account information.")
cl = Client(json.load(open('./temp/auth/cookies.json'))) cl = Client(json.load(open('./temp/auth/cookies.json')))
cl.set_proxy("socks5h://localhost:9999") #cl.set_proxy("socks5h://localhost:9999")
print("🍪 | Account information was successfully retrieved.") print("🍪 | Account information was successfully retrieved.")
@ -42,7 +42,7 @@ if 내일.month != 오늘.month:
학사일정_경로 = lib.학사일정_얻기() 학사일정_경로 = lib.학사일정_얻기()
cl.photo_upload( cl.photo_upload(
학사일정_경로, 학사일정_경로,
caption=f"#인천상정중학교 #상정중학교 #학사일정 \n{내일.strftime("%Y")}{내일.strftime("%m")}월 학사일정", caption=f"#인천상정중학교 #상정중학교 #학사일정 \n{내일.strftime('%Y')}{내일.strftime('%m')}월 학사일정",
extra_data={'is_paid_partnership': False} extra_data={'is_paid_partnership': False}
) )
print("📆 | School Event Post Uploaded") print("📆 | School Event Post Uploaded")

View file

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
cd /root/today.isangjeong/app
# If doesn't have temp folder, create it # If doesn't have temp folder, create it
if [ ! -d "temp" ]; then if [ ! -d "temp" ]; then
@ -13,8 +14,6 @@ echo "Debug: User is $(whoami)" >> ./temp/debug.log
echo "Debug: Environment variables:" >> ./temp/debug.log echo "Debug: Environment variables:" >> ./temp/debug.log
env >> ./temp/debug.log env >> ./temp/debug.log
cd ${BOT_ROOT}
# If doesn't have temp/cookies.json, create it # If doesn't have temp/cookies.json, create it

View file

@ -1,13 +1,10 @@
#import library.lib as 라이브러리 import library.lib as 라이브러리
#라이브러리.얻기("20250307") #라이브러리.얻기("20250314")
#라이브러리.스토리_얻기("20250307") #라이브러리.스토리_얻기("20250307")
#라이브러리.얻기("20250306") #라이브러리.얻기("20250306")
#라이브러리.스토리_얻기("20250306") #라이브러리.스토리_얻기("20250306")
import library.lib as lib import library.lib as lib
lib.디스코드("20250304") lib.얻기("20250401")
lib.디스코드("20250305")
lib.디스코드("20250306")
lib.디스코드("20250307")

1
crontab-new Normal file
View file

@ -0,0 +1 @@
0 22 * * * /root/today.isangjeong/app/run.sh