feat(telegram): add /blu and /oficial commands and main menu
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import crypto from "crypto";
|
||||
import type { QuoteType } from "../../generated/prisma/client";
|
||||
import { logger } from "../../lib/logger";
|
||||
import { prisma } from "../../lib/prisma";
|
||||
import { getBot, getBotUsername } from "../../lib/telegram";
|
||||
@@ -209,7 +210,7 @@ export async function checkAndNotifyBelo(): Promise<void> {
|
||||
});
|
||||
}
|
||||
|
||||
export interface BeloQuoteStatus {
|
||||
export interface QuoteStatus {
|
||||
buy: number;
|
||||
sell: number;
|
||||
timeStamp: Date;
|
||||
@@ -220,9 +221,11 @@ export interface BeloQuoteStatus {
|
||||
progressPercentage: number | null;
|
||||
}
|
||||
|
||||
export async function getBeloQuoteStatus(): Promise<BeloQuoteStatus | null> {
|
||||
export async function getQuoteStatus(
|
||||
type: QuoteType,
|
||||
): Promise<QuoteStatus | null> {
|
||||
const currentQuote = await prisma.quote.findFirst({
|
||||
where: { type: "BELO" },
|
||||
where: { type },
|
||||
orderBy: { timeStamp: "desc" },
|
||||
});
|
||||
if (!currentQuote) return null;
|
||||
@@ -241,7 +244,7 @@ export async function getBeloQuoteStatus(): Promise<BeloQuoteStatus | null> {
|
||||
|
||||
const agg = await prisma.quoteHistory.aggregate({
|
||||
where: {
|
||||
type: "BELO",
|
||||
type,
|
||||
timeStamp: { gte: todayStart },
|
||||
},
|
||||
_min: { buy: true, sell: true },
|
||||
|
||||
Reference in New Issue
Block a user