chore: auto-commit from dashboard
This commit is contained in:
@@ -148,6 +148,15 @@ def create_bot(config: Config) -> discord.Client:
|
||||
"**Reminders**",
|
||||
"`/remind <time> <text> [date]` — Create reminder",
|
||||
"",
|
||||
"**Financiar (roa2web)**",
|
||||
"`/sold [firma]` — Sold casă + bancă",
|
||||
"`/trezorerie [firma]` — Detaliu pe conturi",
|
||||
"`/facturi [firma]` — Facturi neîncasate (top sold)",
|
||||
"`/firme [nume]` — Listă firme roa2web",
|
||||
"",
|
||||
"**Vremea**",
|
||||
"`/vremea [oras]` — Vremea curentă (implicit Constanța)",
|
||||
"",
|
||||
"**Git**",
|
||||
"`/commit [message]` — Commit all changes",
|
||||
"`/push` — Push to remote",
|
||||
@@ -564,6 +573,50 @@ def create_bot(config: Config) -> discord.Client:
|
||||
result = await asyncio.to_thread(fast_dispatch, "remind", args)
|
||||
await interaction.followup.send(result, ephemeral=True)
|
||||
|
||||
# --- Financiar (roa2web) ---
|
||||
|
||||
@tree.command(name="sold", description="Sold casă + bancă (roa2web)")
|
||||
@app_commands.describe(firma="Cod sau nume firmă (implicit: Romfast)")
|
||||
async def sold_cmd(interaction: discord.Interaction, firma: str | None = None) -> None:
|
||||
await interaction.response.defer(ephemeral=True)
|
||||
args = firma.split() if firma else []
|
||||
result = await asyncio.to_thread(fast_dispatch, "sold", args)
|
||||
await interaction.followup.send(result, ephemeral=True)
|
||||
|
||||
@tree.command(name="trezorerie", description="Trezorerie detaliată pe conturi (roa2web)")
|
||||
@app_commands.describe(firma="Cod sau nume firmă (implicit: Romfast)")
|
||||
async def trezorerie_cmd(interaction: discord.Interaction, firma: str | None = None) -> None:
|
||||
await interaction.response.defer(ephemeral=True)
|
||||
args = firma.split() if firma else []
|
||||
result = await asyncio.to_thread(fast_dispatch, "trezorerie", args)
|
||||
await interaction.followup.send(result, ephemeral=True)
|
||||
|
||||
@tree.command(name="facturi", description="Facturi neîncasate, top după sold (roa2web)")
|
||||
@app_commands.describe(firma="Cod sau nume firmă (implicit: Romfast)")
|
||||
async def facturi_cmd(interaction: discord.Interaction, firma: str | None = None) -> None:
|
||||
await interaction.response.defer(ephemeral=True)
|
||||
args = firma.split() if firma else []
|
||||
result = await asyncio.to_thread(fast_dispatch, "facturi", args)
|
||||
await interaction.followup.send(result, ephemeral=True)
|
||||
|
||||
@tree.command(name="firme", description="Listă firme roa2web, opțional filtrate după nume")
|
||||
@app_commands.describe(nume="Filtru după nume (opțional)")
|
||||
async def firme_cmd(interaction: discord.Interaction, nume: str | None = None) -> None:
|
||||
await interaction.response.defer()
|
||||
args = nume.split() if nume else []
|
||||
result = await asyncio.to_thread(fast_dispatch, "firme", args)
|
||||
await interaction.followup.send(result)
|
||||
|
||||
# --- Vremea ---
|
||||
|
||||
@tree.command(name="vremea", description="Vremea curentă (implicit Constanța)")
|
||||
@app_commands.describe(oras="Oraș (opțional, implicit Constanța)")
|
||||
async def vremea_cmd(interaction: discord.Interaction, oras: str | None = None) -> None:
|
||||
await interaction.response.defer()
|
||||
args = oras.split() if oras else []
|
||||
result = await asyncio.to_thread(fast_dispatch, "vremea", args)
|
||||
await interaction.followup.send(result)
|
||||
|
||||
# --- Git commands ---
|
||||
|
||||
@tree.command(name="commit", description="Git commit all changes")
|
||||
@@ -776,9 +829,9 @@ def create_bot(config: Config) -> discord.Client:
|
||||
if cost > 0:
|
||||
tokens_line += f" | ${cost:.4f}"
|
||||
|
||||
# Context window usage
|
||||
# Context window usage (Sonnet/Opus: 1M, Haiku: 200K)
|
||||
ctx = session.get("context_tokens", 0)
|
||||
max_ctx = 200_000
|
||||
max_ctx = 200_000 if model == "haiku" else 1_000_000
|
||||
pct = round(ctx / max_ctx * 100) if ctx else 0
|
||||
context_line = f"Context: {_fmt_tokens(ctx)}/{_fmt_tokens(max_ctx)} ({pct}%)"
|
||||
|
||||
@@ -1155,10 +1208,13 @@ def create_bot(config: Config) -> discord.Client:
|
||||
|
||||
@client.event
|
||||
async def on_ready() -> None:
|
||||
# Sync to each guild instantly, then global (global can take up to 1h)
|
||||
# Sync guild-scoped copies instantly, then clear+sync the global
|
||||
# scope so it stays empty — leaving both registered makes every
|
||||
# command show up twice in Discord's autocomplete UI.
|
||||
for guild in client.guilds:
|
||||
tree.copy_global_to(guild=guild)
|
||||
await tree.sync(guild=guild)
|
||||
tree.clear_commands(guild=None)
|
||||
await tree.sync()
|
||||
scheduler = getattr(client, "scheduler", None)
|
||||
if scheduler is not None:
|
||||
|
||||
Reference in New Issue
Block a user