🚀 Create a Chat GPT Bot in Discord (with GPT-4)

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ส.ค. 2023
  • 🚀 Create a Chat GPT Bot in Discord (with GPT-4)
    Here’s how you can make a Chat GPT like Discord bot (with support for GPT-4) that works in multiple channels!
    🧠 Resources
    Source code (private): / underctrl
    Node.js: nodejs.org
    Visual Studio Code: code.visualstudio.com
    Username regex: msg.author.username.replace(/\s+/g, '_').replace(/[^\w\s]/gi, '');
    🌐 Important links
    Newsletter: devnotes.underctrl.io
    Discord: discord.underctrl.io
    Github: github.com/notunderctrl
    Patreon: / underctrl
    Buy me a coffee (one-time donation): buymeacoffee.com/underctrl
    Thanks for watching! 💜

ความคิดเห็น • 141

  • @UnderCtrl
    @UnderCtrl  11 หลายเดือนก่อน +9

    If you'd like to learn how to host your Discord bot, I have a tutorial on that: th-cam.com/video/f7KjJQVcogY/w-d-xo.html

    • @denzelcanvas5223
      @denzelcanvas5223 10 หลายเดือนก่อน

      how to add langchain with knowledge base please

    • @jakuba6298
      @jakuba6298 9 หลายเดือนก่อน +1

      its not working anymore right?

  • @itsYovez
    @itsYovez 5 หลายเดือนก่อน +2

    Holy this tutorial is awesome. It's crazy how well you explain everything, and it all just works.

  • @galaxyexe_
    @galaxyexe_ 9 หลายเดือนก่อน +1

    dude this is the first one that worked and ive been looking for months! THANK YOU

  • @kripo_se
    @kripo_se 7 หลายเดือนก่อน +2

    That's the only tutorial that worked for me so well, Thank u so much U ARE A LEGEND !!!

  • @omarezeldin4620
    @omarezeldin4620 11 หลายเดือนก่อน +10

    You are a legend, quite strange to be the best to explain discordJS v14 on TH-cam but just having 4k subs. I guess you need to make TH-cam a new algorithm for that.

    • @UnderCtrl
      @UnderCtrl  11 หลายเดือนก่อน +1

      🙏

  • @sleyerpato
    @sleyerpato 10 หลายเดือนก่อน +4

    Man, you did a great job in this tutorial. Now I just need to dive a little deeper to make the experience more personalized. Thank you.

    • @morelytrends7597
      @morelytrends7597 6 หลายเดือนก่อน +1

      Hey man! Did you find a way to make this more personalised? Thanks & Happy New year!

  • @dndieihrjeirnevtctcjwic
    @dndieihrjeirnevtctcjwic 11 หลายเดือนก่อน +1

    Under Ctrl you're such a great dev!

  • @user-fj5wt6vu3u
    @user-fj5wt6vu3u 11 หลายเดือนก่อน

    Love your vids bro you make the bot from the start showing everything

  • @jesuscries7426
    @jesuscries7426 10 หลายเดือนก่อน +9

    one thing you missed, add a name to your bot sa every user call that name and the bot will response directly to that user

  • @silentbob1236
    @silentbob1236 7 หลายเดือนก่อน

    Very cool! thank you for the solid tutorial!

  • @d4663r
    @d4663r 2 หลายเดือนก่อน

    thumbs up for the video! It helped me accomplish the integration. Thank you!

  • @being.saksham
    @being.saksham 11 หลายเดือนก่อน +1

    Really awesome video. 😃

  • @altifyx_
    @altifyx_ 11 หลายเดือนก่อน +1

    Love this tutorial ❤

  • @vyvy093
    @vyvy093 3 หลายเดือนก่อน +3

    for those who got an error with "error is not defined" => we just deleted that line in the script and it works. Hopefully it works for you as well!

  • @alex_turing
    @alex_turing 10 หลายเดือนก่อน +4

    It's important to be aware that gpt4 charges more for each token than gpt3.5 turbo does. A lot more in fact. So if you want your bot to be used for simple communication purposes there is no reason to use gpt4.

  • @ShocoShow
    @ShocoShow 8 หลายเดือนก่อน +6

    Got to 12:19, where I send a "hello" message in the channel and get no response from the bot, and the error message is not displayed. I can't understand what the reason is!

    • @loren8888
      @loren8888 4 หลายเดือนก่อน

      Same!!! Sorry I couldn't help but hopefully this comment moves up.

    • @musiccritic8467
      @musiccritic8467 3 หลายเดือนก่อน

      You need to load up your chat gpt account with credits! I had the same issue

  • @glitchphobia1
    @glitchphobia1 11 หลายเดือนก่อน

    Nice vid

  • @AquaKaiko
    @AquaKaiko 10 หลายเดือนก่อน +1

    Thank you for the nice tutorial! Is it possible to let this bot join a discord call and include TTS?

  • @axeptzion
    @axeptzion 10 หลายเดือนก่อน

    Thanks

  • @Krizerion
    @Krizerion 6 หลายเดือนก่อน +3

    Hey man, great video! Wanted to ask, how can we adjust the bot to use custom GPT Assistant that I "fed" with my own json data?

    • @julesflechet
      @julesflechet 2 หลายเดือนก่อน

      Hi man, have you found a solution ? I am facing the same problem rn, thanks in advance

  • @InstantlyEdits
    @InstantlyEdits 11 หลายเดือนก่อน

    insane

  • @deleteduser8861
    @deleteduser8861 2 หลายเดือนก่อน

    when restarting the bot i have the error that says The OPENAI_API_KEY environment variable is missing or empty, i had put OPENAI_KEY in my .env file already but it still remain the same, pls help.

  • @Stat201atUTK
    @Stat201atUTK 10 หลายเดือนก่อน +4

    Thank you for making this tutorial. You explain the code excellently well. If anyone is trying to get the bot to limit messages to only 2,000 characters, the following works:
    message.reply(response.choices[0].message.content.substring(0, 2000));
    PRO: node.js doesn't crash
    CON: The message is cut off.
    I'd like to figure out a way to return a text file if the message is longer than 2000 characters.

    • @UnderCtrl
      @UnderCtrl  10 หลายเดือนก่อน +4

      Appreciate the kind words!
      In this video I have shown near the end how to split a long result into multiple responses to avoid the bot from crashing while still sending the full response to the user.
      About your approach, even though it works, here's why I wouldn't recommend it:
      - Extra message length is cut off which is just a waste of OpenAI tokens (as you've mentioned as well)
      - Your model won't have enough context on uncompleted text.
      - Sending back as a text file will require extra configuration to not only send back, but also for the model to read from.
      However, if you'd like to stick to your approach, one way you could send the response back as a text file is by converting the response to a buffer and then sending it back using the AttachmentBuilder class in discord.js.
      // example snippet
      const response = "This will be your response from OpenAI";
      const buffer = Buffer.from(response);
      const attachment = new AttachmentBuilder().setFile(buffer, 'response.txt');
      await message.channel.send({ files: [attachment] });

  • @sc2america
    @sc2america 8 หลายเดือนก่อน +4

    @UnderCtrl Got to 12:19 where I message "hello" in the channel and get no response from the bot, and no error message displayed. Any idea what I might be missing? have been troubleshooting for hours, bot it online and code updated

    • @Karaxhi90
      @Karaxhi90 7 หลายเดือนก่อน +3

      I am also going through the same problem my code is not working and I dont know why

    • @lyentsoo
      @lyentsoo 4 หลายเดือนก่อน

      im pretty sure your openai key was incorrect

  • @iMegawalle
    @iMegawalle 14 วันที่ผ่านมา +1

    Is there a way I could import an entire custom personality to the bot? I would like it to have a memory of information I give it.

  • @Kazzran
    @Kazzran 9 หลายเดือนก่อน

    Great video, I was able to get a bot up and running! Is there a way to make it able to reply to DMs?

  • @buli03
    @buli03 10 หลายเดือนก่อน +1

    openai api that is no longer open, i didnt even get to use it and my 18$ exzpired 3months ago :(

  • @Streetw1s3r
    @Streetw1s3r 6 หลายเดือนก่อน

    I'd like to add a character personality and memory to the bot, any chance of a follow up tutorial for a simpleton like me?

  • @user-ng3sm2hg8z
    @user-ng3sm2hg8z 9 หลายเดือนก่อน +2

    hello ,i have followed the instructions but at 12:18 when restarting the bot i have the error that says The OPENAI_API_KEY environment variable is missing or empty, i had put OPENAI_KEY in my .env file already but it still remain the same, pls help.

    • @HarshalGaikwadcheekunikku
      @HarshalGaikwadcheekunikku 6 หลายเดือนก่อน +1

      Make sure you installed dotenv with `npm install dotenv` AND (more importantly) wrote `require("dotenv/config")` at the top of your index.js file.

  • @KenanIDK
    @KenanIDK 10 หลายเดือนก่อน +1

    W

  • @buddybeast6287
    @buddybeast6287 7 หลายเดือนก่อน +2

    Hi! I'm currently at 6:23 When I type the node index.js command, it says code:'TokenInvalid' is there anyway to fix this?

    • @izayusedwards9965
      @izayusedwards9965 5 หลายเดือนก่อน

      does your .env file have your bots token? if it does then look at your client.login(process.env.TOKEN) I had this same issue because i just replaced my token with process.env.token and left the ' things you need to remove them

  • @sachinb8469
    @sachinb8469 10 หลายเดือนก่อน

    Hi can you post a tutorial about chatgpt bot trained on our data, according to open ai recently posted blog post,

  • @Radio-PTM
    @Radio-PTM 11 หลายเดือนก่อน

    What about the api?? We need gpt 4 unlimited api usage.. I already have even image generator.. gpt 3.5 unlimited usage and gpt4 but limited usage..

  • @LULDaLa
    @LULDaLa 6 หลายเดือนก่อน

    Thank you very much! My research can proceed well because of your video!

    • @UnderCtrl
      @UnderCtrl  6 หลายเดือนก่อน +2

      Glad the video was helpful. Thanks a lot for the “super thanks”! ❤️ (weird name choice youtube)

    • @wish-56
      @wish-56 6 หลายเดือนก่อน

      Do your server have the bot ​@@UnderCtrl

  • @RainDropBlopper
    @RainDropBlopper 4 หลายเดือนก่อน

    anyone knows how to code the bot in the way that he o ly repsonds and reacts when you directly @ him in a chat? like clyde did the chat bot from discord before the took him down

  • @Pluto0th
    @Pluto0th 2 หลายเดือนก่อน

    If I created a GPT 4 with customized data (Knowledge), then how could I integrate it into discord? Is it possible and how?

  • @minecraftexpertstudios7368
    @minecraftexpertstudios7368 7 หลายเดือนก่อน

    Is it just text responses, or images too?

  • @Swifty-00
    @Swifty-00 2 หลายเดือนก่อน +1

    Cannot get past 18:27 with out getting this error.
    node:events:497
    throw er; // Unhandled 'error' event
    ^
    ReferenceError: prevMessages is not defined
    at Client. (X:\vs projects\gptbot\index.js:40:5)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    Emitted 'error' event on Client instance at:
    at emitUnhandledRejectionOrErr (node:events:402:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:84:21)

    • @I_Am_Flash08
      @I_Am_Flash08 หลายเดือนก่อน

      you forgot to initialize the variable prevMessages most probably
      just check if you wrote the line
      let prevMessages=[ ];

  • @tkrpe
    @tkrpe 10 หลายเดือนก่อน +2

    does it also support gpt-3?

  • @sulloobby6574
    @sulloobby6574 7 หลายเดือนก่อน

    what if u put my own token in there? Would it make it selfbot?

  • @user-ex7lh9ge7l
    @user-ex7lh9ge7l 11 หลายเดือนก่อน

    Hey UC, can u show me how to add another languages to the bot ?

  • @RainDropBlopper
    @RainDropBlopper วันที่ผ่านมา

    I think this video needs an update as since a few days I always get the message that there are Api issues, I generated a new API and it still doesn't work, OpenAI must have changed something

  • @JohnQ85
    @JohnQ85 5 หลายเดือนก่อน

    Can you have the bot search a website for the question and respond back with a formulated answer?

  • @idanbenyair
    @idanbenyair 9 หลายเดือนก่อน

    Im getting this error: "SyntaxError: await is only valid in async functions and the top level bodies of modules"

    • @HarshalGaikwadcheekunikku
      @HarshalGaikwadcheekunikku 6 หลายเดือนก่อน

      This error means that you are running a line of code with 'await'. This only works with async functions which return a promise. You can make the entire message event listener async by writing async before declaring the (message) parameter. Demonstration:
      client.on('messageCreate', (message) => {
      // your code goes here
      })
      The important part is that your event listener has async before declaring your parameter to make the entire function async, thus allowing you to use the 'await' keyword. Hopefully this helps!

  • @Boyga_Official
    @Boyga_Official 5 หลายเดือนก่อน

    my bot thinks that everything I say is inappropriate :(

  • @tusharsingh9208
    @tusharsingh9208 3 หลายเดือนก่อน +1

    I changed 3 accounts but still getting error 429, while registering the new phone number with new gmail for api key there is always a pop up saying "this number is already associated with different account." Like seriously!! I am literally using a new number and it says that number already exist.

    • @YummyTumTum
      @YummyTumTum 2 หลายเดือนก่อน

      Paying for chat gpt plus is different than paying for the API service which is for developers to be able to use the api, make sure you are paying for that too, im 90% that aslong as you pay once for it you are allowed to use chat gpt 4 in projects forever like this guy says in the video, hope you figured out the problem by now

  • @chezares
    @chezares 9 หลายเดือนก่อน +1

    I can't figure out the error 5:33
    SyntaxError: Identifier 'Client' has already been declared

    • @narajulya
      @narajulya 5 หลายเดือนก่อน +1

      I have same error ...

    • @fynnt076
      @fynnt076 2 หลายเดือนก่อน

      ​@@narajulyameans you have const Client, but it should be const client without a capital C. Client is defined by Discord.js

  • @mzboindio7540
    @mzboindio7540 5 หลายเดือนก่อน

    under ctrl, can you help me? when i write node index.js it says "SyntaxError: Identifier 'client' has already been declared"

    • @lyentsoo
      @lyentsoo 4 หลายเดือนก่อน

      it's been 'declared'

  • @abhijeetgaming8848
    @abhijeetgaming8848 11 หลายเดือนก่อน

    Hi sir I want help from you to create a command please

  • @Hamzslice
    @Hamzslice 5 หลายเดือนก่อน +1

    Basic question here how did you move the line of code at 11:53 ?

    • @loren8888
      @loren8888 4 หลายเดือนก่อน

      That's what I wanna know. He changed something and didn't show us what he did!

    • @fynnt076
      @fynnt076 2 หลายเดือนก่อน

      ​@@loren8888 probably the "Prettier" extention

  • @hypersonichive
    @hypersonichive 11 หลายเดือนก่อน +1

    when i did node index.js it didnt work any solution ???

    • @lyentsoo
      @lyentsoo 4 หลายเดือนก่อน

      install it

  • @zauce1627
    @zauce1627 8 หลายเดือนก่อน

    hi ,i made a discord ai chat bot using python and openai api key(about 6 months ago,didnt watch the whole video cus i dont know much js and never leant) so my question is do you need to buy OpenAI subscription in order to work or you can do this with a free Api key ?

    • @UnderCtrl
      @UnderCtrl  8 หลายเดือนก่อน +1

      When creating an OpenAI account, you usually get $5 worth of free credit, but it doesn't work on GPT-4 unfortunately. You'll have to switch to a pay-as-you-go plan in order to get that to work.

    • @zauce1627
      @zauce1627 8 หลายเดือนก่อน

      ohoo okay ,thank you for the response tho! i made the bot for fun so its fine .@@UnderCtrl

  • @jardinebautista3285
    @jardinebautista3285 5 หลายเดือนก่อน

    Do you need to run the script every time to make it work on Discord? Please advise. Thank you!

    • @Quizma-de
      @Quizma-de 4 หลายเดือนก่อน

      same question

  • @MrYTThor
    @MrYTThor 6 หลายเดือนก่อน

    There is only one last step missing. How do i use my own trained chatGPT bot? Is there a way to use the link? Because i think the openAI API can't generate a token for it...

    • @kjohns0
      @kjohns0 6 หลายเดือนก่อน

      If you figure this out, let me know !!! Would love to figure out how to insert a custom one that has been trained

  • @user-rq9tb3vg2n
    @user-rq9tb3vg2n 8 หลายเดือนก่อน

    when I started it, it said Emitted 'error' event on Client instance at:
    at emitUnhandledRejectionOrErr (node:events:394:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:84:21)

  • @MustardGamings
    @MustardGamings 10 หลายเดือนก่อน

    hey is it possible to make the model not just gpt-3.5-turbo i have other 3.5 models how do i incorporate that?

    • @UnderCtrl
      @UnderCtrl  10 หลายเดือนก่อน +2

      Do you mean a custom trained model? If so, you can use the model name you get in your email after your model has finished training (e.g. ft:gpt-3.5-turbo-0613:personal::7f9g2) instead of "gpt-3.5-turbo".

    • @MustardGamings
      @MustardGamings 10 หลายเดือนก่อน

      @@UnderCtrl thank also one more thing how do i make so others cant abuse it for content policy so i dont get banned?

  • @moonwatcher1425
    @moonwatcher1425 8 หลายเดือนก่อน

    It doesnt work
    When i type node -v it just doesnt recognize it

    • @andressstyle6390
      @andressstyle6390 7 หลายเดือนก่อน

      you need to set node.js as environment variable

  • @itszubariel
    @itszubariel 9 หลายเดือนก่อน

    doesn't work like every other code in this yt channel

  • @user-el8cv6zo1e
    @user-el8cv6zo1e 10 หลายเดือนก่อน

    When I try ping from the discord its not getting picked up on the terminal. Any ideas?

    • @alesandra1794
      @alesandra1794 8 หลายเดือนก่อน

      same issue here. Anybody has some insight?

  • @janatv-comandwatch
    @janatv-comandwatch 6 หลายเดือนก่อน +1

    Best model for role.playing?

    • @UnderCtrl
      @UnderCtrl  6 หลายเดือนก่อน

      I’m sure you can use either one just fine. What primarily matters is the instructions you give your bot if you want it to behave a certain way.

  • @jesperakapoppe
    @jesperakapoppe 4 หลายเดือนก่อน

    Now i had tried for 3 hours. and see if i could sort it out but still getting the 496 error
    throw er; // Unhandled 'error' event
    ^
    ReferenceError: CHANELS is not defined
    something you know about?

    • @fynnt076
      @fynnt076 2 หลายเดือนก่อน

      Chanels?

  • @yurralex
    @yurralex 6 หลายเดือนก่อน

    If i type in "node index.js" nothing happens?

    • @harris342
      @harris342 4 หลายเดือนก่อน

      same. have you solved the problem

    • @lefye_
      @lefye_ 3 หลายเดือนก่อน

      did you save your code then run it?

  • @LouisSchwabe
    @LouisSchwabe 6 หลายเดือนก่อน

    bot name not found error

  • @12.faizassanwiratama2
    @12.faizassanwiratama2 5 หลายเดือนก่อน

    Woww, this so good. Can it online for 24/7 ?? Or this need an host and running on discord js pterodactyl software??

    • @UnderCtrl
      @UnderCtrl  5 หลายเดือนก่อน

      You can keep it online 24/7 by hosting it. I have a bot hosting tutorial: th-cam.com/video/f7KjJQVcogY/w-d-xo.html

  • @user-jm6kj2ru6j
    @user-jm6kj2ru6j 19 วันที่ผ่านมา

    i need to buy api?

  • @pixelmonmmo1248
    @pixelmonmmo1248 10 หลายเดือนก่อน

    Please friend, can you give us the code ?

  • @Sunikaa
    @Sunikaa 8 หลายเดือนก่อน

    i would be happier if we got spoon fed ☠

  • @imstraightyt
    @imstraightyt 5 หลายเดือนก่อน

    how can I make this bot online forever

    • @UnderCtrl
      @UnderCtrl  5 หลายเดือนก่อน

      You'd have to host your bot on a server that stays up 24/7. I've made a tutorial on this: th-cam.com/video/f7KjJQVcogY/w-d-xo.html

    • @inv5isible
      @inv5isible 5 หลายเดือนก่อน

      @@UnderCtrl i am experiencing a issue that i do not get ping message in terminal. what is your discord?

  • @Nam-wl7xp
    @Nam-wl7xp 4 หลายเดือนก่อน

    who have the code ?

  • @deBird_daBest
    @deBird_daBest 11 หลายเดือนก่อน

    5th

  • @nirgs
    @nirgs 11 หลายเดือนก่อน

    Is it necessary to pay for it? If it is, is there any free version?

    • @UnderCtrl
      @UnderCtrl  11 หลายเดือนก่อน

      I believe when signing up for OpenAI you get $5 worth of free credit. You should keep in mind that it won't work for the GPT-4 model since that requires you to have paid OpenAI at least once if I remember correctly. You can however used GPT3.5 Turbo just fine.

    • @ShadiSoufan
      @ShadiSoufan 9 หลายเดือนก่อน

      @UnderCtrl would we implement gpt3.5 turbo any differently or are we only swapping out one line?

    • @etsw
      @etsw 5 หลายเดือนก่อน

      even for 3.5 turbo, you need to pay. otherwise you will get "insufficient_quota" error.

  • @HunterLawson_GameDev
    @HunterLawson_GameDev 7 หลายเดือนก่อน

    Is it possible to have the bot use a custom GPT?

    • @MrYTThor
      @MrYTThor 6 หลายเดือนก่อน

      Did you found anything? Would love to try the same.

    • @HunterLawson_GameDev
      @HunterLawson_GameDev 6 หลายเดือนก่อน +2

      @@MrYTThor Yes I did! Good luck funding it! lol jk. So what you want to do is use an OpenAI Assistant instead of a custom GPT. They are virtually the same but have different user interfaces and API
      This video walked me through the process. You'll be able to build off of it pretty easily.
      th-cam.com/video/5TU_wOC0dmw/w-d-xo.htmlsi=Wb9WHHoK1LLPUEci
      Good luck!

    • @MrYTThor
      @MrYTThor 6 หลายเดือนก่อน +1

      @@HunterLawson_GameDev thanks a lot. I found out about assistants but I almost give up because the ai keeps forgetting stuff. I have a txt with a background story, but after a few chats, it forgets it. I managed to find out that I have to store all the data in a table and there does my knowledge stops.but I hope yours will do as you hope for. Thank you and good luck 🤞🏻

  • @mr.guardianmodz9608
    @mr.guardianmodz9608 11 หลายเดือนก่อน

    First one ?

    • @UnderCtrl
      @UnderCtrl  11 หลายเดือนก่อน

      yes

  • @ClickMeez
    @ClickMeez 10 หลายเดือนก่อน

    IS it 100% free?

    • @UnderCtrl
      @UnderCtrl  10 หลายเดือนก่อน +1

      Nope. You have to pay for the API

    • @10ensura
      @10ensura 9 หลายเดือนก่อน +1

      damn thats why mine isn't works@@UnderCtrl

  • @jakuba6298
    @jakuba6298 9 หลายเดือนก่อน

    dont waste your time not working erorr

    • @UnderCtrl
      @UnderCtrl  9 หลายเดือนก่อน +1

      "not working error"
      Very helpful 🤝

    • @jakuba6298
      @jakuba6298 9 หลายเดือนก่อน

      @@UnderCtrl yea i do step by step and not working only waste time

    • @UnderCtrl
      @UnderCtrl  9 หลายเดือนก่อน +1

      ​@@jakuba6298 this video is not for people who don't know the basics of JS

    • @cilvania
      @cilvania 8 หลายเดือนก่อน

      @@UnderCtrl got 429 error, said it exceeded my current quota, do i really need to pay for it or is there any fix

    • @UnderCtrl
      @UnderCtrl  8 หลายเดือนก่อน +1

      @@cilvania you have to pay for it unfortunately

  • @thatrobtonnoun
    @thatrobtonnoun 4 หลายเดือนก่อน +1

    i get this error: PS C:\Users\...\Desktop\AT> node index.js
    C:\Users\...\Desktop\A\index.js:5
    const Client = new Client({
    ^
    SyntaxError: Identifier 'Client' has already been declared
    at internalCompileFunction (node:internal/vm:77:18)
    at wrapSafe (node:internal/modules/cjs/loader:1288:20)
    at Module._compile (node:internal/modules/cjs/loader:1340:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49
    Node.js v20.11.1
    PS C:\Users\eriks\Desktop\ASPHIX CHAT> node index.js
    C:\Users\eriks\Desktop\ASPHIX CHAT\index.js:5
    const Client = new Client({
    ^
    SyntaxError: Identifier 'Client' has already been declared
    at internalCompileFunction (node:internal/vm:77:18)
    at wrapSafe (node:internal/modules/cjs/loader:1288:20)
    at Module._compile (node:internal/modules/cjs/loader:1340:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49
    Node.js v20.11.1
    pls fix 😭
    idrk how to

  • @ShowNoRespect-
    @ShowNoRespect- 11 หลายเดือนก่อน

    it says this error for me at 5:31
    Error:
    C:\Users\MyName\OneDrive\Computer\Bot(maybe bots)
    ode_modules\discord.js\src\client\Client.js:214
    if (!token || typeof token !== 'string') throw new DiscordjsError(ErrorCodes.TokenInvalid);
    ^
    Error [TokenInvalid]: An invalid token was provided.
    at Client.login (C:\Users\MyName\OneDrive\Computer\Bot(maybe bots)
    ode_modules\discord.js\src\client\Client.js:214:52)
    at Object. (C:\Users\Edvards\OneDrive\Dators\Bot(maybe bots)\index.js:13:8)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Module._load (node:internal/modules/cjs/loader:972:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47 {
    code: 'TokenInvalid'
    }
    Please help.

    • @ShowNoRespect-
      @ShowNoRespect- 11 หลายเดือนก่อน

      Oh nvm i fixed it i didnt save the .env heh

    • @XlllJason
      @XlllJason 4 หลายเดือนก่อน

      @@ShowNoRespect- thx i thought i had done that already but apparently i didnt either

  • @Samuel-th4yd
    @Samuel-th4yd 4 หลายเดือนก่อน

    G:\chatgpt\index.js:16
    const openai = new openAI({
    ^
    TypeError: openAI is not a constructor
    at Object. (G:\chatgpt\index.js:16:16)
    at Module._compile (node:internal/modules/cjs/loader:1368:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
    at Module.load (node:internal/modules/cjs/loader:1205:32)
    at Module._load (node:internal/modules/cjs/loader:1021:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:142:12)
    at node:internal/main/run_main_module:28:49
    Anyone help with this error?

    • @Samuel-th4yd
      @Samuel-th4yd 4 หลายเดือนก่อน

      the arrow is pointing under n in new

    • @faintful4897
      @faintful4897 3 หลายเดือนก่อน

      It's `new OpenAI` not `new openAI`

  • @ambitiouslabs
    @ambitiouslabs 5 หลายเดือนก่อน

    You're talented! We should work together. Can I email you?

    • @UnderCtrl
      @UnderCtrl  5 หลายเดือนก่อน

      Thanks. You can reach out to me at avraj@underctrl.io