diff --git a/src/commands/ask/ask.builder.ts b/src/commands/ask/ask.builder.ts index f11d2fb..2ac6f43 100644 --- a/src/commands/ask/ask.builder.ts +++ b/src/commands/ask/ask.builder.ts @@ -15,7 +15,16 @@ export const slashCommand: SlashCommandDefition = new SlashCommandBuilder() .setDescription(ask.options.prompt.description["en-US"]) .setDescriptionLocalizations(ask.options.prompt.description) .setRequired(true) - .setMaxLength(500)) + .setMaxLength(1000)) + .addStringOption(new SlashCommandStringOption() + .setName("model") + .setDescription(ask.options.model.description["en-US"]) + .setDescriptionLocalizations(ask.options.model.description) + .setRequired(false) + .addChoices( + { name: "GPT 3.5 Turbo", value: "gpt-3.5-turbo"}, + { name: "GPT 4", value: "gpt-4"} + )) .addStringOption(new SlashCommandStringOption() .setName("context") .setDescription(ask.options.context.description["en-US"]) diff --git a/src/commands/ask/ask.cmd.ts b/src/commands/ask/ask.cmd.ts index d0bef28..336897d 100644 --- a/src/commands/ask/ask.cmd.ts +++ b/src/commands/ask/ask.cmd.ts @@ -15,7 +15,7 @@ import { limitString, userWithId } from "$core/utils/function"; import { QuestionIncludeAll, getQuestion, newQuestion, updateQuestion } from "$core/utils/data/question"; import { getPrompt } from "@bottlycorp/prompts"; import { simpleButton, simpleEmbed } from "$core/utils/embed"; -import { buttonsBuilder, favoriteButton, qrCodeButton, regenerateButton, revealButton, usageButton } from "$core/utils/config/buttons"; +import { buttonsBuilder, favoriteButton, premiumButton, qrCodeButton, regenerateButton, revealButton, usageButton } from "$core/utils/config/buttons"; import { updateUser } from "$core/utils/data/user"; import { DayJS } from "$core/utils/day-js"; import { supabase } from "$core/utils/supabase"; @@ -28,10 +28,17 @@ import QRCode from "qrcode"; export const execute: CommandExecute = async(command, user) => { const web = command.options.getBoolean("web", false) ?? false; const context = command.options.getString("context", false) ?? ""; + const model = command.options.getString("model", false) ?? "gpt-3.5-turbo"; const channel = command.channel; const askedAt = DayJS().unix(); + if (model !== "gpt-3.5-turbo" && user.isPremium === false) { + const premiumEmbed = simpleEmbed(translate(command.locale, global.exec.orGetPremiumGPT4), "premium"); + command.editReply({ embeds: [premiumEmbed], components: [{ type: 1, components: [premiumButton(command)]}] }); + return; + } + const handleNotInTextChannel = (): void => { command.editReply(translate(command.locale, global.exec.notInATextChannel)); colors.error(userWithId(command.user) + " tried to ask a question while not being in a text channel (thread or text channel)"); @@ -86,7 +93,7 @@ export const execute: CommandExecute = async(command, user) => { const response = await openai.createChatCompletion({ messages, max_tokens: user.isPremium ? 3750 : 2500, - model: "gpt-3.5-turbo", + model: model || "gpt-3.5-turbo", user: `${command.user.id}-${command.guild?.id}` }); diff --git a/src/commands/ask/ask.config.ts b/src/commands/ask/ask.config.ts index def726e..7135159 100644 --- a/src/commands/ask/ask.config.ts +++ b/src/commands/ask/ask.config.ts @@ -29,6 +29,20 @@ export const ask = { de: "Die Frage, die an die künstliche Intelligenz gerichtet werden soll" } }, + model: { + name: { + "en-US": "model" + }, + description: { + "en-US": "The model to use to answer the question", + fr: "Le modèle à utiliser pour répondre à la question", + "pt-BR": "O modelo a ser usado para responder a pergunta", + ru: "Модель, которую нужно использовать для ответа на вопрос", + uk: "Модель, яку потрібно використовувати для відповіді на питання", + "es-ES": "El modelo a utilizar para responder a la pregunta", + de: "Das Modell, das zur Beantwortung der Frage verwendet werden soll" + } + }, context: { name: { "en-US": "context" diff --git a/src/commands/premium/premium.config.ts b/src/commands/premium/premium.config.ts index 4f2a82b..4e197f3 100644 --- a/src/commands/premium/premium.config.ts +++ b/src/commands/premium/premium.config.ts @@ -110,6 +110,7 @@ export const premium = { "en-US": [ "{emojiPremium} You are not a premium user.", "\n**What are the advantages ?**", + "• Use **GPT 4** and **GPT 4 (32k)** models instead of **GPT 3.5 Turbo** (You can still use GPT 3.5 Turbo)", "• You have 50 uses per day", "• You have priority access to support", "• You have 50% more writing power on your questions and discussions", @@ -125,6 +126,7 @@ export const premium = { fr: [ "{emojiPremium} Vous n'êtes pas un utilisateur premium.", "\n**Quels sont les avantages ?**", + "• Utilisez les modèles **GPT 4** et **GPT 4 (32k)** au lieu de **GPT 3.5 Turbo** (Vous pouvez toujours utiliser GPT 3.5 Turbo)", "• Vous avez 50 utilisations par jour", "• Vous avez un accès prioritaire au support", "• Vous avez 50% de puissance d'écriture en plus sur vos questions et discussions", @@ -140,6 +142,7 @@ export const premium = { "pt-BR": [ "{emojiPremium} Você não é um usuário premium.", "\n**Quais são as vantagens ?**", + "• Use os modelos **GPT 4** e **GPT 4 (32k)** em vez de **GPT 3.5 Turbo** (Você ainda pode usar o GPT 3.5 Turbo)", "• Você tem 50 usos por dia", "• Você tem acesso prioritário ao suporte", "• Você tem 50% a mais de poder de escrita em suas perguntas e discussões", @@ -155,6 +158,7 @@ export const premium = { ru: [ "{emojiPremium} Вы не являетесь премиум-пользователем.", "\n**Каковы преимущества ?**", + "• Используйте модели **GPT 4** и **GPT 4 (32k)** вместо **GPT 3.5 Turbo** (Вы все еще можете использовать GPT 3.5 Turbo)", "• У вас есть 50 использований в день", "• У вас есть приоритетный доступ к поддержке", "• У вас на 50% больше мощности записи в ваших вопросах и обсуждениях", @@ -170,6 +174,7 @@ export const premium = { uk: [ "{emojiPremium} Ви не є преміум-користувачем.", "\n**Які переваги ?**", + "• Використовуйте моделі **GPT 4** і **GPT 4 (32k)** замість **GPT 3.5 Turbo** (Ви все ще можете використовувати GPT 3.5 Turbo)", "• У вас є 50 використань на день", "• У вас є пріоритетний доступ до підтримки", "• У вас на 50% більше потужності запису в ваших питаннях та обговореннях", @@ -185,6 +190,7 @@ export const premium = { "es-ES": [ "{emojiPremium} No eres un usuario premium.", "\n**¿Cuáles son las ventajas ?**", + "• Use los modelos **GPT 4** y **GPT 4 (32k)** en lugar de **GPT 3.5 Turbo** (Todavía puede usar GPT 3.5 Turbo)", "• Tienes 50 usos por día", "• Tiene acceso prioritario al soporte", "• Tiene un 50% más de potencia de escritura en sus preguntas y discusiones", @@ -200,6 +206,7 @@ export const premium = { de: [ "{emojiPremium} Sie sind kein Premium-Benutzer.", "\n**Was sind die Vorteile ?**", + "• Verwenden Sie die Modelle **GPT 4** und **GPT 4 (32k)** anstelle von **GPT 3.5 Turbo** (Sie können immer noch GPT 3.5 Turbo verwenden)", "• Sie haben 50 Anwendungen pro Tag", "• Sie haben Prioritätszugang zum Support", "• Sie haben 50% mehr Schreibkraft bei Ihren Fragen und Diskussionen", diff --git a/src/utils/config/message/command/command.config.ts b/src/utils/config/message/command/command.config.ts index 2c32934..2052fa3 100644 --- a/src/utils/config/message/command/command.config.ts +++ b/src/utils/config/message/command/command.config.ts @@ -77,14 +77,23 @@ export const global = { ].join(" ") }, orGetPremium: { - fr: ":sparkles: Vous pouvez aussi devenir premium pour 5.00$/mois et augmenter votre nombre d'utilisation à 50/jour", "en-US": ":sparkles: You can also become premium for $5.00/month and increase your number of uses to 50/day", + fr: ":sparkles: Vous pouvez aussi devenir premium pour 5.00$/mois et augmenter votre nombre d'utilisation à 50/jour", "pt-BR": ":sparkles: Você também pode se tornar premium por $5.00/mês e aumentar seu número de usos para 50/dia", ru: ":sparkles: Вы также можете стать премиумом за 5,00$/месяц и увеличить количество использований до 50/день", uk: ":sparkles: Ви також можете стати преміумом за 5,00$/місяць і збільшити кількість використань до 50/день", "es-ES": ":sparkles: También puedes convertirte en premium por $5.00/mes y aumentar tu número de usos a 50/día", de: ":sparkles: Sie können auch für 5,00 $ / Monat Premium werden und Ihre Anzahl der Verwendungen auf 50 / Tag erhöhen" }, + orGetPremiumGPT4: { + "en-US": ":sparkles: The use of GPT 4 is reserved for premium members, you can become premium for $5.00/month", + fr: ":sparkles: L'utilisation de GPT 4 est réservée aux membres premium, vous pouvez devenir premium pour 5.00$/mois", + "pt-BR": ":sparkles: O uso do GPT 4 é reservado para membros premium, você pode se tornar premium por $5.00/mês", + ru: ":sparkles: Использование GPT 4 зарезервировано для премиум-пользователей, вы можете стать премиумом за 5,00$/месяц", + uk: ":sparkles: Використання GPT 4 зарезервовано для преміум-користувачів, ви можете стати преміумом за 5,00$/місяць", + "es-ES": ":sparkles: El uso de GPT 4 está reservado para miembros premium, puede convertirse en premium por $5.00/mes", + de: ":sparkles: Die Verwendung von GPT 4 ist Premium-Mitgliedern vorbehalten. Sie können für 5,00 $ / Monat Premium werden" + }, error: { "en-US": "An error occurred while executing the command: **{error}**", fr: "Une erreur s'est produite lors de l'exécution de la commande: **{error}**",