Compare commits
No commits in common. "main" and "0.1.0" have entirely different histories.
@ -1,48 +0,0 @@
|
|||||||
name: ci
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- "*"
|
|
||||||
tags:
|
|
||||||
- "*"
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- "main"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
docker:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container:
|
|
||||||
image: catthehacker/ubuntu:act-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Docker meta
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: |
|
|
||||||
git.sebclem.fr/${{ gitea.repository }}
|
|
||||||
tags: |
|
|
||||||
type=ref,event=branch
|
|
||||||
type=ref,event=pr
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
|
|
||||||
- name: Login to registry
|
|
||||||
if: github.ref_type == 'tag'
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: git.sebclem.fr
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: ${{ github.ref_type == 'tag' }}
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
@ -1,5 +1,5 @@
|
|||||||
# For more information, please refer to https://aka.ms/vscode-docker-python
|
# For more information, please refer to https://aka.ms/vscode-docker-python
|
||||||
FROM python:3.13-alpine
|
FROM python:3.10-slim
|
||||||
|
|
||||||
# Keeps Python from generating .pyc files in the container
|
# Keeps Python from generating .pyc files in the container
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1
|
ENV PYTHONDONTWRITEBYTECODE=1
|
||||||
@ -7,8 +7,6 @@ ENV PYTHONDONTWRITEBYTECODE=1
|
|||||||
# Turns off buffering for easier container logging
|
# Turns off buffering for easier container logging
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
RUN apk add build-base
|
|
||||||
|
|
||||||
# Install pip requirements
|
# Install pip requirements
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN python -m pip install -r requirements.txt
|
RUN python -m pip install -r requirements.txt
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
||||||
"extends": [
|
|
||||||
"config:recommended"
|
|
||||||
],
|
|
||||||
"commitMessagePrefix": ":arrow_up:"
|
|
||||||
|
|
||||||
}
|
|
@ -1,21 +1,2 @@
|
|||||||
pixivpy3==3.7.5
|
pixivpy3
|
||||||
discord.py==2.4.0
|
discord.py
|
||||||
|
|
||||||
# Freeze
|
|
||||||
aiohttp==3.10.10
|
|
||||||
aiosignal==1.3.1
|
|
||||||
async-timeout==5.0.1
|
|
||||||
attrs==24.2.0
|
|
||||||
certifi==2024.8.30
|
|
||||||
charset-normalizer==3.4.0
|
|
||||||
cloudscraper==1.2.71
|
|
||||||
frozenlist==1.5.0
|
|
||||||
idna==3.10
|
|
||||||
isort==5.13.2
|
|
||||||
multidict==6.1.0
|
|
||||||
pyparsing==3.2.0
|
|
||||||
requests==2.32.3
|
|
||||||
requests-toolbelt==1.0.0
|
|
||||||
typing_extensions==4.12.2
|
|
||||||
urllib3==2.2.3
|
|
||||||
yarl==1.17.1
|
|
@ -9,14 +9,7 @@ IMAGE_NBR_LIMIT = 10
|
|||||||
DEFAULT_UPLOAD_SIZE_LIMIT = 209715200
|
DEFAULT_UPLOAD_SIZE_LIMIT = 209715200
|
||||||
|
|
||||||
|
|
||||||
async def send_message(
|
async def send_message(message: discord.Message, files, tmp_dir: str, muted: bool):
|
||||||
message: discord.Message,
|
|
||||||
files,
|
|
||||||
tmp_dir: str,
|
|
||||||
muted: bool,
|
|
||||||
title: str,
|
|
||||||
art_author: str,
|
|
||||||
):
|
|
||||||
to_send_files = []
|
to_send_files = []
|
||||||
for file in files:
|
for file in files:
|
||||||
joined = os.path.join(tmp_dir, file)
|
joined = os.path.join(tmp_dir, file)
|
||||||
@ -39,8 +32,7 @@ async def send_message(
|
|||||||
to_send_files = to_send_files[1:]
|
to_send_files = to_send_files[1:]
|
||||||
elif first:
|
elif first:
|
||||||
await message.reply(
|
await message.reply(
|
||||||
files=splited_file,
|
files=splited_file, content=(TIPS_MESSAGE if not muted else None)
|
||||||
content=f"**{title}** by `{art_author}` {chr(10) + TIPS_MESSAGE if not muted else ''}",
|
|
||||||
)
|
)
|
||||||
first = False
|
first = False
|
||||||
else:
|
else:
|
||||||
|
13
src/main.py
13
src/main.py
@ -59,7 +59,7 @@ async def pixivprev(interaction: discord.Interaction, url: str):
|
|||||||
loop = asyncio.get_running_loop()
|
loop = asyncio.get_running_loop()
|
||||||
data = await loop.run_in_executor(
|
data = await loop.run_in_executor(
|
||||||
None,
|
None,
|
||||||
pixiv_api.download_pixiv_images,
|
pixiv_api.dowload_pixiv_images,
|
||||||
int(match.group("id")),
|
int(match.group("id")),
|
||||||
tmp_dir,
|
tmp_dir,
|
||||||
REFRESH_TOKEN,
|
REFRESH_TOKEN,
|
||||||
@ -95,7 +95,7 @@ async def pixiv_preview(interaction: discord.Interaction, message: discord.Messa
|
|||||||
loop = asyncio.get_running_loop()
|
loop = asyncio.get_running_loop()
|
||||||
data = await loop.run_in_executor(
|
data = await loop.run_in_executor(
|
||||||
None,
|
None,
|
||||||
pixiv_api.download_pixiv_images,
|
pixiv_api.dowload_pixiv_images,
|
||||||
int(match.group("id")),
|
int(match.group("id")),
|
||||||
tmp_dir,
|
tmp_dir,
|
||||||
REFRESH_TOKEN,
|
REFRESH_TOKEN,
|
||||||
@ -116,7 +116,7 @@ async def pixiv_preview(interaction: discord.Interaction, message: discord.Messa
|
|||||||
title=title,
|
title=title,
|
||||||
art_author=author,
|
art_author=author,
|
||||||
url=match.group("url"),
|
url=match.group("url"),
|
||||||
author=message.author,
|
author=interaction.user,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
@ -140,22 +140,19 @@ async def on_message(message: discord.Message):
|
|||||||
loop = asyncio.get_running_loop()
|
loop = asyncio.get_running_loop()
|
||||||
data = await loop.run_in_executor(
|
data = await loop.run_in_executor(
|
||||||
None,
|
None,
|
||||||
pixiv_api.download_pixiv_images,
|
pixiv_api.dowload_pixiv_images,
|
||||||
int(match.group("id")),
|
int(match.group("id")),
|
||||||
tmp_dir,
|
tmp_dir,
|
||||||
REFRESH_TOKEN,
|
REFRESH_TOKEN,
|
||||||
)
|
)
|
||||||
if data is None:
|
if data is None:
|
||||||
return
|
return
|
||||||
(title, author) = data
|
|
||||||
files = os.listdir(tmp_dir)
|
files = os.listdir(tmp_dir)
|
||||||
files.sort()
|
files.sort()
|
||||||
# await send_message.send_message_with_embed(
|
# await send_message.send_message_with_embed(
|
||||||
# message, files, title, tmp_dir, match.group("url")
|
# message, files, title, tmp_dir, match.group("url")
|
||||||
# )
|
# )
|
||||||
await discord_tools.message.send_message(
|
await discord_tools.message.send_message(message, files, tmp_dir, muted)
|
||||||
message, files, tmp_dir, muted, title, author
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
client.run(DISCORD_TOKEN)
|
client.run(DISCORD_TOKEN)
|
||||||
|
@ -13,7 +13,7 @@ if max_thread_num > 10:
|
|||||||
max_thread_num = 10
|
max_thread_num = 10
|
||||||
|
|
||||||
|
|
||||||
def download_pixiv_images(
|
def dowload_pixiv_images(
|
||||||
illust_id: int,
|
illust_id: int,
|
||||||
dest_folder: str,
|
dest_folder: str,
|
||||||
refresh_token: str,
|
refresh_token: str,
|
||||||
|
Loading…
Reference in New Issue
Block a user