Compare commits
2
Commits
4c1244de88
...
53627cc4c2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53627cc4c2 | ||
|
|
67f9995152 |
No files matched your search
@@ -7,7 +7,7 @@ text chunking, timestamp helpers, interactive await-prompts, and a limit-safe se
|
|||||||
## Install
|
## Install
|
||||||
|
|
||||||
```
|
```
|
||||||
dpy_commons @ git+ssh://git@git.rethinkstudios.io/rethink-public/dpy_commons.git@v1.0.0
|
dpy_commons @ git+ssh://git@git.rethinkstudios.io/rethink-public/dpy_commons.git@v1.0.1
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "dpy_commons"
|
name = "dpy_commons"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
description = "Shared discord.py utilities — message/embed parsing, limit-fitting, link extraction, chunking, timestamps, await-prompts, limit-safe send. Config-free, installable."
|
description = "Shared discord.py utilities — message/embed parsing, limit-fitting, link extraction, chunking, timestamps, await-prompts, limit-safe send. Config-free, installable."
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import re
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Optional, Sequence
|
from typing import Optional, Sequence
|
||||||
|
|
||||||
|
from discord.utils import format_dt
|
||||||
|
|
||||||
from .limits import MSG_LIMIT
|
from .limits import MSG_LIMIT
|
||||||
|
|
||||||
_ELLIPSIS = "…"
|
_ELLIPSIS = "…"
|
||||||
@@ -108,9 +110,7 @@ def discord_timestamp(dt: datetime, style: str = "f") -> str:
|
|||||||
aware dt if the source is UTC; raises ValueError on an invalid style (one of t/T/d/D/f/F/R)"""
|
aware dt if the source is UTC; raises ValueError on an invalid style (one of t/T/d/D/f/F/R)"""
|
||||||
if style not in _TIMESTAMP_STYLES:
|
if style not in _TIMESTAMP_STYLES:
|
||||||
raise ValueError(f"invalid timestamp style '{style}'; expected one of {_TIMESTAMP_STYLES}")
|
raise ValueError(f"invalid timestamp style '{style}'; expected one of {_TIMESTAMP_STYLES}")
|
||||||
if dt.tzinfo is None:
|
return format_dt(dt, style)
|
||||||
dt = dt.astimezone()
|
|
||||||
return f"<t:{int(dt.timestamp())}:{style}>"
|
|
||||||
|
|
||||||
|
|
||||||
def humanize_delta(seconds: float) -> str:
|
def humanize_delta(seconds: float) -> str:
|
||||||
|
|||||||
Reference in new issue
Block a user