diff --git a/commands/message/fun/chat.js b/commands/message/fun/chat.js index c450022..6b2c12c 100644 --- a/commands/message/fun/chat.js +++ b/commands/message/fun/chat.js @@ -19,6 +19,7 @@ module.exports = { }, permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY], run: async (context, args) => { + if(!process.env.TESTING_SERVER_IDS.split(';').includes(context.guild.id)) return; context.triggerTyping(); if(!args.text) return editOrReply(context, {embeds:[createEmbed("warning", context, `Missing Parameter (text).`)]}) try{ diff --git a/commands/message/fun/disstrack.js b/commands/message/fun/disstrack.js new file mode 100644 index 0000000..9666176 --- /dev/null +++ b/commands/message/fun/disstrack.js @@ -0,0 +1,47 @@ +const { createEmbed } = require('../../../labscore/utils/embed') +const { format } = require('../../../labscore/utils/ansi') +const { editOrReply } = require('../../../labscore/utils/message') + +const superagent = require('superagent') +const { codeblock } = require('../../../labscore/utils/markdown') + +const { Permissions } = require("detritus-client/lib/constants"); + +module.exports = { + name: 'disstrack', + label: 'text', + metadata: { + description: `Talk to ChatGPT.\n\n<:bonzi:1138585089891106836> He will explore the Internet with you as your very own friend and sidekick! He can talk, walk, and joke like no other friend you've ever had!`, + description_short: 'Talk to ChatGPT.', + examples: ['chat How many otter species are there?'], + category: 'hidden', + usage: 'chat ' + }, + permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY], + run: async (context, args) => { + if(!process.env.TESTING_SERVER_IDS.split(';').includes(context.guild.id)) return; + context.triggerTyping(); + if(!args.text) return editOrReply(context, {embeds:[createEmbed("warning", context, `Missing Parameter (text).`)]}) + try{ + let res = await superagent.post(`${process.env.AI_SERVER}/openai`) + .set({ + Authorization: process.env.AI_SERVER_KEY + }) + .send({ + prompt: "Write a disstrack about the subject the user supplies. The disstrack should have at least two verses and a chorus.", + input: [args.text], + temperature: 0.6, + model: "CHATGPT" + }) + return editOrReply(context, {embeds:[createEmbed("default", context, { + description: codeblock("ansi", [res.body.output.substr(0, 2020)]), + footer: { + text: `This information may be inaccurate or biased • ${context.application.name}` + } + })]}) + }catch(e){ + console.log(e) + return editOrReply(context, {embeds:[createEmbed("error", context, `Unable to generate text.`)]}) + } + } +}; \ No newline at end of file