diff --git a/bot/commands/keyboard/chat_gpt.js b/bot/commands/keyboard/chat_gpt.js index 7288e48..6260a91 100644 --- a/bot/commands/keyboard/chat_gpt.js +++ b/bot/commands/keyboard/chat_gpt.js @@ -71,7 +71,7 @@ export const keyboardChatGPT = async (bot, msg) => { { modeGPT: modesChatGPT[i].code }, { where: { chat_id: chatId } } ).then(async res => { - // TODO: отправить сообщение приветствие + // TODO: если это премиум то нужно менять на нужную модель чата в заголовке await bot.editMessageText( `ChatGPT 3.5 – ${t(character(modesChatGPT[i].code)?.name)}\n${t(character(modesChatGPT[i].code)?.welcome)}`, { diff --git a/bot/commands/keyboard/dalle.js b/bot/commands/keyboard/dalle.js index 9034ff4..e090ff7 100644 --- a/bot/commands/keyboard/dalle.js +++ b/bot/commands/keyboard/dalle.js @@ -25,7 +25,7 @@ export const keyboardDalle = async (bot, msg) => { reply_markup: { inline_keyboard: [ [{ text: t('keyboard_buy_subscription'), callback_data: `buy_subscription_M_${chatId}` }], - [{ text: t('exit_key'), callback_data: `${COMMAND_GPT}_M_${chatId}` }] + [{ text: t('exit_to_gpt'), callback_data: `${COMMAND_GPT}_M_${chatId}` }] ] } } @@ -46,7 +46,7 @@ export const keyboardDalle = async (bot, msg) => { eventEmitter.on(`buy_subscription_M_${chatId}`, async function() { eventEmitter.removeAllListeners() - return keyboardMyAccount(bot, msg, accountMessage, keyboardDalle) + return keyboardMyAccount(bot, msg, accountMessage, keyboardDalle, null, 'buy') }) eventEmitter.on(`${COMMAND_GPT}_M_${chatId}`, function() { diff --git a/bot/commands/keyboard/my_account.js b/bot/commands/keyboard/my_account.js index a6a29b5..f6333b6 100644 --- a/bot/commands/keyboard/my_account.js +++ b/bot/commands/keyboard/my_account.js @@ -14,7 +14,7 @@ import { createStartKeyboardForReplyMarkup } from '../../utils/createStartKeyboa dotenv.config({ path: '../.env' }) -export const keyboardMyAccount = async (bot, msg, prevMessageForEdit, prevLevel, changeDescription) => { +export const keyboardMyAccount = async (bot, msg, prevMessageForEdit, prevLevel, changeDescription, setPrices) => { const t = await ct(msg) let accountMessage const { id: chatId } = msg.chat @@ -220,14 +220,26 @@ Payok - оплачивайте следующими способами: } }).then(res => { clearTimeout(timeout) - bot.editMessageText( - changeDescription ? changeDescription : t('account', { tokens: numberWithSpaces(tokens), paid_days }), - { - message_id: accountMessage.message_id, - chat_id: chatId, - ...firstLevel.options - } - ).catch(err => console.log(err)) + + if (setPrices) { + bot.editMessageText( + buyLevel.message, + { + message_id: accountMessage.message_id, + chat_id: chatId, + ...buyLevel.options + } + ).catch(err => console.log(err)) + } else { + bot.editMessageText( + changeDescription ? changeDescription : t('account', { tokens: numberWithSpaces(tokens), paid_days }), + { + message_id: accountMessage.message_id, + chat_id: chatId, + ...firstLevel.options + } + ).catch(err => console.log(err)) + } }) }, prevMessageForEdit ? 0 : 1500, accountMessage) } catch (error) { diff --git a/bot/commands/keyboard/quiz.js b/bot/commands/keyboard/quiz.js index 05dbebc..725ebe7 100644 --- a/bot/commands/keyboard/quiz.js +++ b/bot/commands/keyboard/quiz.js @@ -250,6 +250,5 @@ export const keyboardQuiz = async (bot, msg, isDescription) => { eventEmitter.emit(callbackQuery.data) bot.answerCallbackQuery(callbackQuery.id, 'quiz', false) eventEmitter.removeAllListeners() - // TODO: исправить баг. запуск нескольких игр одновременно }) } diff --git a/bot/commands/modes/chatGPT.js b/bot/commands/modes/chatGPT.js index 53319a3..5ef8ac2 100644 --- a/bot/commands/modes/chatGPT.js +++ b/bot/commands/modes/chatGPT.js @@ -41,7 +41,6 @@ export const modeChatGPT = async (bot, msg, qweryOptions) => { ctx = await JSON.parse(response.dataValues.comment) }) - // TODO: Запоминать контекст беседы пользователя или всегда начинать новый чат ctx ??= INITIAL_SESSION console.log('🔺ctx', ctx.messages.length) diff --git a/bot/commands/modes/midjourney.js b/bot/commands/modes/midjourney.js index 66802bc..1cf0f11 100644 --- a/bot/commands/modes/midjourney.js +++ b/bot/commands/modes/midjourney.js @@ -1,7 +1,7 @@ import { Midjourney } from 'midjourney' import { saveAndSendPhoto, saveAndSendPreloaderPhoto } from '../../utils/saveAndSendPhoto.js' import { loaderOn } from '../../utils/loader.js' -import { REQUEST_TYPES } from '../../constants/index.js' +import { REQUEST_TYPES, TYPE_RESPONSE_MJ } from '../../constants/index.js' import { upscale } from './midjourney/upscale.js' import events from 'events' import { variation } from './midjourney/variation.js' diff --git a/bot/db/models/subscriber.model.js b/bot/db/models/subscriber.model.js index ea92cfd..7c37e9c 100644 --- a/bot/db/models/subscriber.model.js +++ b/bot/db/models/subscriber.model.js @@ -33,7 +33,7 @@ export default (sequelize, DataTypes) => { }, tokens: { type: DataTypes.DOUBLE, - defaultValue: 10000, + defaultValue: 20000, }, paid_days: { type: DataTypes.DOUBLE,