If you'd like to learn how to host your Discord bot, I have a tutorial on that: kzbin.info/www/bejne/nGium32Hi8iinbs
@denzelcanvas5223 Жыл бұрын
how to add langchain with knowledge base please
@jakuba6298 Жыл бұрын
its not working anymore right?
@Soraflo715 күн бұрын
Exceptional, what I love is that, you aren't just sharing the code, but explain everything, and that's so useful when we want to adapt everything!
@vyvy0937 ай бұрын
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!
@omarezeldin4620 Жыл бұрын
You are a legend, quite strange to be the best to explain discordJS v14 on KZbin but just having 4k subs. I guess you need to make KZbin a new algorithm for that.
@UnderCtrl Жыл бұрын
🙏
@jesuscries7426 Жыл бұрын
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
@Random-e2z3 ай бұрын
Where should you add the name of the bot?
@itsYovez9 ай бұрын
Holy this tutorial is awesome. It's crazy how well you explain everything, and it all just works.
@angelinespacequeen88892 ай бұрын
Thanks so much for this video! I ignored your caution about not knowing the basics of JS and I was still able to figure it out (after quite a time, mind you, but I did it.) I think that goes to show how excellent your descriptions are. I am so excited to keep learning! Thank you!
@sleyerpato Жыл бұрын
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.
@morelytrends759711 ай бұрын
Hey man! Did you find a way to make this more personalised? Thanks & Happy New year!
@galaxyexe_ Жыл бұрын
dude this is the first one that worked and ive been looking for months! THANK YOU
@alex_turing Жыл бұрын
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 Жыл бұрын
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!
@lunagardvonbingen8 ай бұрын
Same!!! Sorry I couldn't help but hopefully this comment moves up.
@musiccritic84677 ай бұрын
You need to load up your chat gpt account with credits! I had the same issue
@kripo_se11 ай бұрын
That's the only tutorial that worked for me so well, Thank u so much U ARE A LEGEND !!!
@hxndrikk_4 ай бұрын
i got everytime an error when i try to type something and the bot dont respond after 12:14
@iMegawalle4 ай бұрын
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.
@op12studio3 ай бұрын
I know this is an old video but it all still works. great job I am going to try and create a more persistent memory for it using some sort of vector database.
@Krizerion10 ай бұрын
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?
@julesflechet6 ай бұрын
Hi man, have you found a solution ? I am facing the same problem rn, thanks in advance
@sc2america Жыл бұрын
@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
@Karaxhi9011 ай бұрын
I am also going through the same problem my code is not working and I dont know why
@lyentsoo9 ай бұрын
im pretty sure your openai key was incorrect
@RainDropBlopper4 ай бұрын
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
@JJDAYZSERVERS-MODSАй бұрын
Just done this 🔥🔥🔥 I’m new to coding a few months deep it’s becoming my life 🤣 Thanks awesome tutorial easy would like to add features I’ll use the bot to help 🎉🎉
@dndieihrjeirnevtctcjwic Жыл бұрын
Under Ctrl you're such a great dev!
@gabrielntvАй бұрын
Great tutorial, thanks.
@RansomRoleplay Жыл бұрын
Love your vids bro you make the bot from the start showing everything
@d4663r7 ай бұрын
thumbs up for the video! It helped me accomplish the integration. Thank you!
@Streetw1s3r10 ай бұрын
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?
@Swifty-006 ай бұрын
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_Flash085 ай бұрын
you forgot to initialize the variable prevMessages most probably just check if you wrote the line let prevMessages=[ ];
@JulianTseng-d5z Жыл бұрын
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.
@HarshalGaikwadcheekunikku11 ай бұрын
Make sure you installed dotenv with `npm install dotenv` AND (more importantly) wrote `require("dotenv/config")` at the top of your index.js file.
@Hamzslice10 ай бұрын
Basic question here how did you move the line of code at 11:53 ?
@lunagardvonbingen8 ай бұрын
That's what I wanna know. He changed something and didn't show us what he did!
@fynnt0766 ай бұрын
@@lunagardvonbingen probably the "Prettier" extention
@buddybeast628711 ай бұрын
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?
@izayusedwards996510 ай бұрын
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
@Stat201atUTK Жыл бұрын
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 Жыл бұрын
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] });
@AquaKaiko Жыл бұрын
Thank you for the nice tutorial! Is it possible to let this bot join a discord call and include TTS?
@jardinebautista32859 ай бұрын
Do you need to run the script every time to make it work on Discord? Please advise. Thank you!
@Quizma-de8 ай бұрын
same question
@chezares Жыл бұрын
I can't figure out the error 5:33 SyntaxError: Identifier 'Client' has already been declared
@narajulya9 ай бұрын
I have same error ...
@fynnt0766 ай бұрын
@@narajulyameans you have const Client, but it should be const client without a capital C. Client is defined by Discord.js
@deleteduser88616 ай бұрын
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.
@silentbob1236 Жыл бұрын
Very cool! thank you for the solid tutorial!
@buli03 Жыл бұрын
openai api that is no longer open, i didnt even get to use it and my 18$ exzpired 3months ago :(
@being.saksham Жыл бұрын
Really awesome video. 😃
@janatv-comandwatch10 ай бұрын
Best model for role.playing?
@UnderCtrl10 ай бұрын
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.
@JohnQ859 ай бұрын
Can you have the bot search a website for the question and respond back with a formulated answer?
@minecraftexpertstudios736811 ай бұрын
Is it just text responses, or images too?
@jasoncoller54083 ай бұрын
"Private application cannot have a default authorization link" When you uncheck Public
@tusharsingh92088 ай бұрын
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.
@YummyTumTum6 ай бұрын
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
@Kazzran Жыл бұрын
Great video, I was able to get a bot up and running! Is there a way to make it able to reply to DMs?
@sachinb8469 Жыл бұрын
Hi can you post a tutorial about chatgpt bot trained on our data, according to open ai recently posted blog post,
@sulloobby657411 ай бұрын
what if u put my own token in there? Would it make it selfbot?
@altifyx_ Жыл бұрын
Love this tutorial ❤
@Pluto0th6 ай бұрын
If I created a GPT 4 with customized data (Knowledge), then how could I integrate it into discord? Is it possible and how?
@zauce1627 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
ohoo okay ,thank you for the response tho! i made the bot for fun so its fine .@@UnderCtrl
@tkrpe Жыл бұрын
does it also support gpt-3?
@Boyga_Official9 ай бұрын
my bot thinks that everything I say is inappropriate :(
@HuyĐỗ-v8g Жыл бұрын
Hey UC, can u show me how to add another languages to the bot ?
@mzboindio754010 ай бұрын
under ctrl, can you help me? when i write node index.js it says "SyntaxError: Identifier 'client' has already been declared"
@lyentsoo9 ай бұрын
it's been 'declared'
@RainDropBlopper8 ай бұрын
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
@idanbenyair Жыл бұрын
Im getting this error: "SyntaxError: await is only valid in async functions and the top level bodies of modules"
@HarshalGaikwadcheekunikku11 ай бұрын
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!
@LULDaLa10 ай бұрын
Thank you very much! My research can proceed well because of your video!
@UnderCtrl10 ай бұрын
Glad the video was helpful. Thanks a lot for the “super thanks”! ❤️ (weird name choice youtube)
@MrYTThor10 ай бұрын
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...
@kjohns010 ай бұрын
If you figure this out, let me know !!! Would love to figure out how to insert a custom one that has been trained
@12.faizassanwiratama29 ай бұрын
Woww, this so good. Can it online for 24/7 ?? Or this need an host and running on discord js pterodactyl software??
@UnderCtrl9 ай бұрын
You can keep it online 24/7 by hosting it. I have a bot hosting tutorial: kzbin.info/www/bejne/nGium32Hi8iinbs
@moonwatcher1425 Жыл бұрын
It doesnt work When i type node -v it just doesnt recognize it
@andressstyle6390 Жыл бұрын
you need to set node.js as environment variable
@MustardGamings Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
@@UnderCtrl thank also one more thing how do i make so others cant abuse it for content policy so i dont get banned?
@hypersonichive Жыл бұрын
when i did node index.js it didnt work any solution ???
@lyentsoo9 ай бұрын
install it
@Radio-PTM Жыл бұрын
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..
@thatrobtonnoun9 ай бұрын
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
@jesperakapoppe8 ай бұрын
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?
@fynnt0766 ай бұрын
Chanels?
@abhijeetgaming8848 Жыл бұрын
Hi sir I want help from you to create a command please
@Augustus-t6z Жыл бұрын
When I try ping from the discord its not getting picked up on the terminal. Any ideas?
@alesandra1794 Жыл бұрын
same issue here. Anybody has some insight?
@maheerhuq67083 ай бұрын
Can I do this in Python?
@banannabeaver2 ай бұрын
It doesnt give me the url
@apeirophobia0 Жыл бұрын
Nice vid
@itzubariel Жыл бұрын
doesn't work like every other code in this yt channel
@axeptzion Жыл бұрын
Thanks
@codexastartes1487 Жыл бұрын
Please friend, can you give us the code ?
@NaymeIslam-r2l4 ай бұрын
i need to buy api?
@LouisSchwabe10 ай бұрын
bot name not found error
@imstraightyt9 ай бұрын
how can I make this bot online forever
@UnderCtrl9 ай бұрын
You'd have to host your bot on a server that stays up 24/7. I've made a tutorial on this: kzbin.info/www/bejne/nGium32Hi8iinbs
@inv5isible9 ай бұрын
@@UnderCtrl i am experiencing a issue that i do not get ping message in terminal. what is your discord?
@NUSPEE-w3i Жыл бұрын
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)
@larshmallow_86674 ай бұрын
does this mean free unlimited gpt 4 ?
@dexyyliveАй бұрын
no lmao
@Nam-wl7xp9 ай бұрын
who have the code ?
@HunterLawson_GameDev11 ай бұрын
Is it possible to have the bot use a custom GPT?
@MrYTThor10 ай бұрын
Did you found anything? Would love to try the same.
@HunterLawson_GameDev10 ай бұрын
@@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. kzbin.info/www/bejne/a4W4kKqFeJWXo9ksi=Wb9WHHoK1LLPUEci Good luck!
@MrYTThor10 ай бұрын
@@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 🤞🏻
@InstantlyEdits Жыл бұрын
insane
@nirgs Жыл бұрын
Is it necessary to pay for it? If it is, is there any free version?
@UnderCtrl Жыл бұрын
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 Жыл бұрын
@UnderCtrl would we implement gpt3.5 turbo any differently or are we only swapping out one line?
@etsw9 ай бұрын
even for 3.5 turbo, you need to pay. otherwise you will get "insufficient_quota" error.
@kenanidk Жыл бұрын
W
@mr.guardianmodz9608 Жыл бұрын
First one ?
@UnderCtrl Жыл бұрын
yes
@deBird_daBest Жыл бұрын
5th
@Samuel-th4yd8 ай бұрын
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-th4yd8 ай бұрын
the arrow is pointing under n in new
@faintful48977 ай бұрын
It's `new OpenAI` not `new openAI`
@ShowNoRespect- Жыл бұрын
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- Жыл бұрын
Oh nvm i fixed it i didnt save the .env heh
@XlllJason8 ай бұрын
@@ShowNoRespect- thx i thought i had done that already but apparently i didnt either
@ambitiouslabs9 ай бұрын
You're talented! We should work together. Can I email you?
@UnderCtrl9 ай бұрын
Thanks. You can reach out to me at avraj@underctrl.io
@jakuba6298 Жыл бұрын
dont waste your time not working erorr
@UnderCtrl Жыл бұрын
"not working error" Very helpful 🤝
@jakuba6298 Жыл бұрын
@@UnderCtrl yea i do step by step and not working only waste time
@UnderCtrl Жыл бұрын
@@jakuba6298 this video is not for people who don't know the basics of JS
@cilvania Жыл бұрын
@@UnderCtrl got 429 error, said it exceeded my current quota, do i really need to pay for it or is there any fix