Thu. Nov 21st, 2024
This entry is part 122 of 185 in the series Developer Blog

It’s been a bit of an odd week. Migraines were bad, but we managed to push through with some coding fun. Created three bots over the last two weeks.

The first is just a basic chatbot, with the normal simple commands. I used this with the pact book on node.js to familiarize myself a little with the node.js and twitch bots. It’s funny to think everyone thinks it’s new, but really they just made a GUI for the old IRC servers. They also made it stupid complicated to do anything by limiting it to node.js, but meh, with basics only needed for this particular bot it’s good enough.

The next bot I wrote in javascript on my local computer, and tested and had it all working. The tried to move it over to the glitch servers, and intergrate it into the node.js bots. Turns out that is a huge pain in the kester. Specifically node.js and it’s refusal to pass variables between functions, it’s more likely to pass down layers, than up. And then you have the issue with the http request/get/etc which does not release it’s variables for rawData, or body (basically the content you get in response to a basic AJAX request. Then it didn’t want to allow me to pass variables into it outside of the URL it’s to call. Eventually I found a pattern of calls that would work to produce the output I wanted. Then there’s the problem with the glitch server reloading things all the time, to conserver server resources. It means even if you have a bot account connected to the server, and your active and live, your bot can reload, if it reloads, your timer (for controling the server calls) is reset, and your code never excutes as expected. I think a dedicated VPS box is the only solution, which I’m not ready to deal with again yet. So that’s back burnered. It works, but not as I wanted.

Then we have last but not least the biggest pain in the but, and I only did it as an after thought. So in this one it needs to make multiple AJAX calls pulling users from a list, and then checking one of the twitch API’s to see if the user is live. Then if the user is live, it needs to build a final link that is posted at the end to the chat room, so that all the users can use the kadgar multi-channel viewing page to hang out with lots of artists at the same time. This is in conjunction with the glass artists all using a discord voice chat server so people can hear all the artists talking about their craft or hanging out and having fun. Sounds simple enough right? But no, remember that variable passing issues from before? And the fact that http module and sub-modules won’t release the data the Ajax call returns? That renders the concept of this almost impossible if your limited to node.js, and only the glitch server. Luckily we are not limited, and I have my server here at KidsHideAway. I used a php script here, to accept the AJAX call, it passes in the user list, then the php code uses curl to connect to the twitch API to determine if the users are active and if they are, it builds the link, and passes it back to the twitch bot. Then the bot jumps through so hops and posts the link in the chat room. It takes some time depending on how many users are being checked, the list is a little long. But it does work. BUT then we have the same issue with the server resetting, and timing being an issue. If we wanted it to kick off once every 30 minutes and update the link in chat, then we need a timer to work correctly. That’s apparently not possible, so I have it set to also work as a command.

It’s been a week. How was yours?

Series Navigation<< Devlog: 2019-09-28 Unreal Engine UE 4.23 Bug: Sprite Flickering – Less SpritesBricks and Paddle Game – day 5 >>
Kids Hide Away