Привет! Я строю бота. Описание тебе этого бота я сейчас дам, подробный промпт. Он…
- User
Привет! Я строю бота. Описание тебе этого бота я сейчас дам, подробный промпт. Он работает на английском языке полностью. И у него есть определенная логика проверки подписок, донатов и так далее. Бот создан для поддержки психологической, и человек не должен догадываться, что это бот. Но если спросит, то бот, конечно же, признается. Мне нужно, чтобы ты посмотрел JSON и добавил логику в ветвление. Там, где в ветвлении нет еще логики. Посмотри, пожалуйста, и добавь ее. Сделай так, как считаешь нужным, только добавляй по 2-3 нода, не больше. То есть, давай мне куски кода.
Full Technical Prompt for Workflow with Telegram Bot + Google Sheets + OpenAI + Subscription Management Context: You are building a Telegram bot named Olga, whose native language is English, but mainly communicates in Russian, supporting molecular cooking, nutrition, psychology, and subtle human interactions. The bot uses n8n workflow automation integrated with:
Telegram Trigger: receives messages from users. Google Sheets: user database storing subscription type, message counts, and user metadata. OpenAI GPT: generates natural, context-aware answers. Language Detection API: to detect user message language and inform about translation if needed. Subscription and limits management: tracks subscriptions (none, standard, premium), message usage limits, and handles donations. Workflow Logic and Steps:
- Receive user message from Telegram via Telegram Trigger node. Extract user info: Telegram chat ID, username, user id. Extract the text message content.
- Detect message language using Language Detection API. If message language is not Russian, bot adds a disclaimer: "I use a translator for communication, apologies if some inaccuracies appear."
- Check if user exists in Google Sheets Users database, using the chatId column lookup: If found, retrieve user data: subscriptionType, messagesUsed, subscription expiry, language, etc. If not found, automatically add new user with default values: subscriptionType = none messagesUsed = 0 Dates empty or initialized appropriately language = unknown or based on language detection result
- Process commands: If the message starts with / treat it as a command. Supported commands: /start, /help, /donate, /premium, /subscribe. Send predefined replies and buttons for these commands.
- Check user's subscription status and message usage limits: If subscription is premium, user has no message limit. If standard or none, enforce a message limit per month — configurable via a workflow variable TOKEN_LIMIT. If the user exceeded the allowed message count: Bot sends a message informing about limit reached. Shows buttons with subscription offers (Subscribe, Premium) and blocks regular conversation.
- If within limits: Generate a GPT prompt adding a base system prompt: "You are a 35-40 year old woman named Olga — a confectioner, interested in molecular cooking, emotionally and scientifically supportive, strictly no flirting or flattery." Include user's latest message in the prompt. Call OpenAI GPT node with the prepared prompt.
- Assistant