Skip to content

Repository files navigation

pyscord-storage | Uptime Robot status Uptime Robot ratio (30 days)

Because paying for actual file storage is for people with money. Why use S3, GCS, or literally any purpose-built storage service when you can just... use Discord? A chat app. For teenagers. As your CDN.

You're welcome.

Refresh Expired URL

Discord, in its infinite wisdom, decided that CDN URLs should expire. Because nothing says "reliable file hosting" like links that stop working. Anyway, here's how you unfail them:

https://bypass-discord.animemoe.us/DISCORD_FILE_URL_HERE
https://bypass-discord.animemoe.us/https://media.discordapp.net/attachments/858938620425404426/1478701777837621259/animemoeus-waifu.jpg

Groundbreaking infrastructure, truly.

Installation

Shockingly straightforward:

pip install pyscord-storage

Congratulations. You are now a cloud architect.

Usage

Upload a local file, like a person who has completely given up on conventional DevOps:

import pyscord_storage

result = pyscord_storage.upload_from_file("path/to/your.file")

print(result)

Or, if you're feeling extra chaotic, make the backend fetch a file from a URL for you:

import pyscord_storage

result = pyscord_storage.upload_from_url(
    "https://github.com/animemoeus/pyscord-storage/raw/master/tests/temp/takagi.png",
)

print(result)

Both functions return a dict. You're not getting a proper SDK response object. This is Discord storage. Manage your expectations accordingly.

CLI

For those who prefer their existential dread served directly in the terminal:

uv tool install pyscord-storage

If pyscord-storage still isn't found after installing, run uv tool update-shell and restart your shell — uv tool install shims aren't always on $PATH by default.

# Upload a local file
pyscord-storage file path/to/your.file

# Upload from a remote URL
pyscord-storage url https://example.com/your.file

On success, it prints the URL. On failure, it prints the error to stderr and exits with code 1. Professional.

Async Support

Yes, we also have async versions — because if you're going to do something ridiculous, you might as well do it non-blockingly.

import asyncio
import pyscord_storage


async def main():
    result = await pyscord_storage.async_upload_from_file("path/to/your.file")
    print(result)


asyncio.run(main())
import asyncio
import pyscord_storage


async def main():
    result = await pyscord_storage.async_upload_from_url(
        "https://github.com/animemoeus/pyscord-storage/raw/master/tests/temp/takagi.png",
    )
    print(result)


asyncio.run(main())

About

  • Max upload file size is 8MB 25MB — an upgrade celebrated with an enthusiasm that says a lot about the alternatives we were previously working with.
  • There are two CDN domains: media.discordapp.net and cdn.discordapp.com. Click here for the explanation you didn't ask for but definitely need.
  • There's also a proxy_url thing. Here's more than you wanted to know about it.
  • Discord CDN links expire. As in, your files disappear. More details here, in case you'd like to really sit with that fact before deploying to production.

Increase Upload Limit

Here's the part where I tell you that to get more storage out of a chat app, you need to pay to "boost" a Discord server. No, I'm not joking.

Development

uv sync
uv run pytest
uv run ruff check .
uv run pre-commit install

Example Implementations

These are real. Deployed. In the wild.

Packages

Used by

Contributors

Languages