Will I learn Machine Learning?
No, this article will not teach you machine learning, but, this will teach you how to make your own AI-Chatbot using Random Stuff Api.
But what’s the point of doing so?
Not every application/software/website has an AI-powered chatbot to help you kill your boredom. You can implement this AI chatbot in any mobile application, any Discord bot, any WhatsApp bot, any Facebook bot, any Social Media bot, any website, any desktop application, and much more…
Damn, can I make it using [x] coding language?
Finally, it's the time…
Steps involved in making your own ai-chatbot
1. Reading the Documentation
Now, this might not sound like a really important step but believe me, it sure is. Reading documentation helps you understand how the API/module works
Links for the documentation for Random Stuff Api -
Version 5 (Recommended)
Version5 is the latest version and is recommended. This is what we are going to cover up in this article
Version4 is the second-latest version of RSA but it lacks a lot of features that are present in Version5
I honestly don’t know why anyone would wanna use this version as this was one of the worse versions ever.
2. Setting up the coding environment
Oh, now we talkin’. Make sure to do the following things (In-order of course)
1. Initiate your project in any language you desire.
2. Launch your favorite IDE
3. Add a file
and boom! we are ready to get into the real coding.
3. Getting the input from the user
We first want to receive input from the user i.e a message user will send which will then be sent to the API to get an appropriate response.
There are various ways you can get user input(s) like -
1. input() method in python
2. readline package in nodeJS
and much more….
4. Basics of fetching the response from API
As mentioned in the docs, you have to make a GET request to the API
The Base URL is https://api.pgamerx.com/v5/ai, but we have to add few parameters i.e message and server. Also there are some others which we may wanna add for full customisation. So our Base URL becomes https://api.pgamerx.com/v5/ai?message=user_message&server=main
We have to send our API key as Authorization in the header. API key can be obtained for free at This Page
5. Actually fetching the response
For other languages — Check this website
Fetching API in NodeJS
(We are going to use node-fetch package for this)
Fetching API in Python
(We are going to use request package for this)
6. Other questions
If you need support with anything else, you can check out Random Stuff Api’s official Discord server for support