toowake

Windows 95 Generator

Apr 8th, 2023
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
  2. const { Configuration, OpenAIApi } = require('openai');
  3.  
  4. const configuration = new Configuration({
  5. apiKey: "Here your open ai key"})
  6.  
  7. const openai = new OpenAIApi(configuration);
  8.  
  9. module.exports = {
  10. data: new SlashCommandBuilder()
  11. .setName("windows95-key")
  12. .setDescription("Ask chatgpt a question")
  13. .setDMPermission(false),
  14. async execute(interaction) {
  15.  
  16.  
  17.  
  18. await interaction.deferReply();
  19.  
  20. const question = "Generate me 20 sets of strings in the form of xxxyy-OEM-NNNNNNN-zzzzz where xxx is day of year between 001 and 366 (for example, 192 = 10th of July) and yy is the year (for example, 94 = 1994). Your range is from the first date of 1995 to the last day of 2003. OEM must remain intact. The NNNNNNN segment consists of digits and must start with 2 zeroes. The rest of the numbers can be anything as long as their sum is divisible with no remainder. The last segment zzzzz should consist of random numbers, z representing a number.";
  21.  
  22. try {
  23. const res = await openai.createCompletion({
  24. model: 'text-davinci-003',
  25. max_tokens: 2048,
  26. temperature: 0.5,
  27. prompt: question
  28. })
  29.  
  30. const embed = new EmbedBuilder()
  31. .setColor("Blue")
  32. .setTitle(`Windows95 keys`)
  33. .setDescription(`\`\`\`${res.data.choices[0].text}\`\`\``)
  34.  
  35. await interaction.editReply({ embeds: [embed] });
  36.  
  37. } catch(e) {
  38. return await interaction.editReply({ content: `Request failed with status code **${e.response.status}**`, ephemeral: true })
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment