Metadata-Version: 2.4
Name: aiodc
Version: 1.0.331
Summary: A multitude of d.py extensions for your discord bot or user.
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: discord.py
Requires-Dist: curl-cffi
Dynamic: license-file

# aiodc

discord.py extensions: identify as a different Discord client, pull live client build numbers, and drive the display name font/effect API.

Python 3.9+. Depends on discord.py (master) and curl-cffi.

```bash
pip install aiodc
```

## Client identity

Importing `aiodc` patches `DiscordWebSocket.identify`, so your bot tells the gateway it's an iPhone by default. Pick another client before `bot.run()`:

```python
import aiodc

aiodc.mode("android")
```

| Mode | Identifies as |
|---|---|
| `"vr"` | Oculus VR client |
| `"ios"` | iPhone client |
| `"android"` | Android client |
| `"desktop"` | Windows desktop client |
| `"web"` | Chrome browser |

An unknown name raises `ValueError`. The patch sticks for every later IDENTIFY, reconnects included.

## Build numbers

`fetch(mode)` reports what Discord's clients currently run. `fetchs(...)` is the blocking twin that runs the event loop for you:

```python
from aiodc import fetch, fetchs

# sync, runs the loop for you
fetchs("web")      # "400123", scraped from the login page's JS bundles
fetchs("ios")      # "341.0", from Apple's App Store lookup API
fetchs("android")  # "341013", scraped from the apkcombo listing

# android can also give you the release version instead of the raw number
fetchs("android", version=True)             # "341.13"
fetchs("android", number=True, version=True)  # {"number": "341013", "version": "341.13"}

# async, for use inside a bot or running loop
await fetch("android", number=True)
```

Requests go through curl_cffi with a Chrome TLS fingerprint, so Discord sees a real browser. Two of the three sources are scraped pages; when markup changes or a request fails you get `None` back rather than an exception. Only a bad mode name raises.

## Display name fonts

Members can render their display name in custom fonts, effects, and colors per guild. This module calls that endpoint directly:

```python
from aiodc import Color, Effect, Font, apply, preset, reset

# any combo works: 1 to 5 colors, ints, or "#ff00ff"-style hex strings
await apply(
    guild,
    Font.ORBITRON,
    Effect.PRISM,
    ["#ff00ff", Color.GREEN, 65535, "#ffffff", 16777215],
)

# or use a shipped preset
await preset(guild, "orbitron-prism-rainbow")

# back to plain text
await reset(guild)
```

Input gets checked before anything hits the API: font IDs 1-16, effect IDs 1-8, gradient wants exactly 2 colors, prism 5, gummy 4. Bad input raises `ValidationError` and no request is sent.

Your bot needs to be in the guild and allowed to edit its own member profile there.

Eleven presets come bundled under `aiodc.PRESETS`, names like `sinistre-neon-white` and `playpen-gummy-pink-purple-cyan-gold`. List them yourself:

```python
from aiodc import PRESETS

print(*PRESETS, sep="\n")
```

Also exported: `hex_to_int`, `int_to_hex`, `validate_hex`, `validate_color`, `NameStyleError`.
