IISHKO: Telegram bot, Mini App and gateway
checks / pytest (push) Has been cancelled
checks / moderation (push) Has been cancelled
checks / node (push) Has been cancelled

Initial public release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-30 21:51:30 +03:00
co-authored by Claude Opus 5.5
commit 0ee6fb843b
179 changed files with 59173 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
import { Composer } from "grammy";
import type { Ctx } from "../ctx.js";
export const start = new Composer<Ctx>();
start.command("start", async (ctx) => {
const uid = ctx.from!.id;
const refRaw = ctx.match;
const ref = typeof refRaw === "string" && /^\d+$/.test(refRaw) ? Number(refRaw) : null;
const existing = ctx.deps.db.prepare("SELECT uid FROM users WHERE uid = ?").get(uid);
if (!existing) {
ctx.deps.db
.prepare("INSERT INTO users (uid, username, referred_by, quota) VALUES (?,?,?,?)")
.run(uid, ctx.from?.username ?? null, ref && ref !== uid ? ref : null, ctx.deps.config.userQuota);
ctx.deps.db
.prepare("INSERT INTO ledger (uid, delta, reason) VALUES (?,?,?)")
.run(uid, ctx.deps.config.userQuota, "welcome");
}
await ctx.reply(
[
"🤖 *иишко* — бесплатный доступ к нейросетям через Telegram.",
"",
"Просто напиши сообщение — отвечу. Команды:",
"/key — твой API-ключ",
"/balance — баланс иишек",
"/model — сменить модель",
].join("\n"),
{ parse_mode: "Markdown" },
);
});
start.command("balance", async (ctx) => {
const usd = ctx.deps.economy.usdBalance(ctx.from!.id);
await ctx.reply(`💰 Баланс: $${usd.toFixed(2)} (${(usd * 500_000).toFixed(0)} иишек)`);
});