Skip to content

Commit 39bc6ff

Browse files
committed
use native discord timestamp instead of our homegrown ones
1 parent 3f3cbab commit 39bc6ff

File tree

3 files changed

+3
-14
lines changed

3 files changed

+3
-14
lines changed

bridger/cogs/mqtt.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os
22

3-
import arrow
43
from discord import Embed, Interaction, app_commands
54
from discord.ext import commands
65
from discord.utils import get
@@ -10,7 +9,6 @@
109
from bridger.log import logger
1110

1211
BRIDGER_ADMIN_ROLE = os.getenv("BRIDGER_ADMIN_ROLE", "Bridger Admin")
13-
TIMESTAMP_FORMAT = "h:mm:ss A ZZZ"
1412
QUERY_RECENT_PACKETS = """
1513
from(bucket: "meshtastic")
1614
|> range(start: -1h)
@@ -168,12 +166,10 @@ async def is_alive(self, ctx: Interaction, node_id: str):
168166
else:
169167
records = tables[0].records
170168
record = max(records, key=lambda r: r.values.get("_time"))
171-
time = arrow.get(record.values.get("_time")).to("local")
172-
time_human = time.humanize()
173-
time_stamp = time.format(TIMESTAMP_FORMAT)
169+
packet_time = int(record.values.get("_time").timestamp())
174170

175171
await ctx.response.send_message(
176-
f"Gateway **{gateway.node_hex_id}** is alive. We have received **{len(records)}** packets in the last hour. The most recent was received at **{time_stamp}** ({time_human})", # noqa: E501
172+
f"Gateway **{gateway.node_hex_id}** is alive. We have received **{len(records)}** packets in the last hour. The most recent was received at <t:{packet_time}> (<t:{packet_time}:R>)", # noqa: E501
177173
ephemeral=True,
178174
)
179175

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ dependencies = [
2020
"aiohttp",
2121
"aiomqtt",
2222
"aiocache",
23-
"arrow",
2423
"cryptography",
2524
"dataclasses-json",
2625
"discord.py",

requirements.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ aiomqtt==2.3.0
1717
# via bridger (pyproject.toml)
1818
aiosignal==1.3.2
1919
# via aiohttp
20-
arrow==1.3.0
21-
# via bridger (pyproject.toml)
2220
attrs==25.3.0
2321
# via aiohttp
2422
bleak==0.22.3
@@ -104,9 +102,7 @@ pytest-asyncio==0.26.0
104102
pytest-cov==6.0.0
105103
# via bridger (pyproject.toml)
106104
python-dateutil==2.9.0.post0
107-
# via
108-
# arrow
109-
# influxdb-client
105+
# via influxdb-client
110106
python-dotenv==1.1.0
111107
# via bridger (pyproject.toml)
112108
pyyaml==6.0.2
@@ -126,8 +122,6 @@ six==1.17.0
126122
# via python-dateutil
127123
tabulate==0.9.0
128124
# via meshtastic
129-
types-python-dateutil==2.9.0.20241206
130-
# via arrow
131125
typing-extensions==4.13.0
132126
# via
133127
# reactivex

0 commit comments

Comments
 (0)