A long time ago, I created Gizmo. Gizmo was this AI discord bot, programmed in Python, that was able to interact with the user. After two weeks of Gizmo being around, my free OpenAI API key expired. This was kind of unexpected. I was able to use an AI program that TechWithAnirudh had created and that was the new AI. It wasn't as stable as OpenAI, but it did the job. Gizmo was hosted on Replit. It worked... sort of. I was pinging a Flask server connected to the bot to keep it alive and running, and this didn't work very well. Soon, Replit changed things about hosting, taking my bot offline. Along with the bot came down the AI I was using because that was also hosted on Replit.
Later on in life, I found out that Google had just released an AI of there own with a FREE API. Well... lucky for me, I have a Google account. I quickly took hold of that ability and ran some basic tests. The AI worked. I started making a new bot. I uploaded an icon that I thought would be changed soon, a small pig emoji, and probably named it something like “Test.” I created a small Python program, mainly some copy/pastes from Gizmo's program, pressed F5, and sent a message to my bot:
Great a bot that works! Of course, in the developer world, just because it works once, doesn’t mean it will work more. After chatting with it for a bit longer, it became apparent that it was indeed working. I next created a name. I asked it to create a name for itself… I didn’t like it at all. I thought for a while, and decided on “Jonah,” expecting to rename it some other time. After all, Gizmo went through all kind of names. My favorite was “HappyBot.”
Role-Training the bot was the next curve-ball. Unlike the OpenAI module, which had a small section where you could set the role of the AI, the Google AI module didn’t have this. Instead, I have a variable set up that is just a string as if someone was telling the bot what it was. I have that followed by “Here is what the user said: “ this is a pretty good alternative, but it isn’t perfect. Part of this role-training is mentioning that it can’t go over 1500 characters. Technically, Discord allows up to 2000, but the AI had a tendency to go over.
Next came the commands. Gizmo went through a series of commands. The first version was detecting if the first word was a command. If it wasn’t, then it will forward that to the AI. The second, and current version was official slash commands. I always strive to make my bot feel more official, so I felt really proud when I was able to get that figured out.
Finally, the one thing I had been working on for a while.…. hosting. You know how I mentioned that I spent a long time finding an alternative hosting method? Well it turns out I had one in my closet all along. I remembered that I had a Raspberry Pi. It was slow, but it didn’t get really hot, so I could plug it in and leave it. I created the code on my PC, but then uploaded it to my Raspberry Pi. I then drilled the Raspberry Pi into the wall in our garage, and now it sits there, running one program. Development from there was slow. I added some more slash commands, worked with Tiago Rangel to create the Jonah Website, but that has been about all that has happened.
A few funny things about Jonah:
It’s favorite food is slop/pork chops/bacon
He lies, and then lies about lying
It frequently chats the word “Oink,” which is to-be-expected, yet I find it still funny.
I occasionally go back to Jonah and add a new command, tweak some code, or just chat with the funny, piggy, AI bot.
— MilesWK
Links: