Skip to content

Commit 1faede8

Browse files
committed
migrate to bucky
1 parent 888aad7 commit 1faede8

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

nephthys/utils/litterbox.py renamed to nephthys/utils/bucky.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
import logging
2-
from typing import Literal
32

43
import aiohttp
54

65
from nephthys.utils.env import env
76

87

9-
async def upload_litter(
8+
async def upload_file(
109
file: bytes,
1110
filename: str,
12-
expiry: Literal["1h", "12h", "24h", "72h"],
1311
content_type: str,
1412
) -> str | None:
15-
api = "https://litterbox.catbox.moe/resources/internals/api.php"
13+
api = "https://bucky.hackclub.com"
1614
data = aiohttp.FormData()
17-
data.add_field("reqtype", "fileupload")
18-
data.add_field("fileToUpload", file, filename=filename, content_type=content_type)
19-
data.add_field("time", expiry)
15+
data.add_field("file", file, filename=filename, content_type=content_type)
2016
async with env.session.post(api, data=data) as resp:
2117
if resp.status != 200:
2218
logging.error(

nephthys/views/home/components/ticket_status_pie.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
import numpy as np
77

8+
from nephthys.utils.bucky import upload_file
89
from nephthys.utils.env import env
910
from nephthys.utils.graphs.pie import generate_pie_chart
10-
from nephthys.utils.litterbox import upload_litter
1111
from nephthys.utils.time import is_day
1212
from prisma.enums import TicketStatus
1313

@@ -82,7 +82,7 @@ async def get_ticket_status_pie_chart(
8282
if raw:
8383
return b.getvalue()
8484

85-
url = await upload_litter(
85+
url = await upload_file(
8686
file=b.getvalue(),
8787
filename="ticket_status.png",
8888
expiry="1h",

0 commit comments

Comments
 (0)