You didn't think I will finish it in one blow, did you?
Nah, me neither. But I hoped.
Anyway, I'm now working on a different kind of game. See details here.
Eventually I plan to come back to this game.
20160204
20160112
A little break, again
...because it is almost expected.
So, what I did recently?
Cause I actually worked hard in this past 17 days or so. (That is, when I wasn't busy being depressed, or tired, or something like that.) Recently I found a link to a Discord server on some MBTI forum on reddit. (For those outside of the loop: reddit - social news site. MBTI - personality theory. Discord - a webapp / desktop app, kind of what the child of Steam and IRC would look like, with voice chat.) The folks over there are... wow, it is like I have found mah people. Seriously, a lot of them think just like me. I became addicted actually, because I enjoyed the convos so much. Now I don't find them so enjoyable anymore, but I still go there daily. (IDK if my expectations have altered, or the quality of convos went down, or both. Or neither.) Then I found out that there is a possibility to write bots. It works over an HTTP (for requests) / Websockets (for events) platform. So what does a programmer do in this case? Of course, he is trying to write a bot.
The others used Python, mainly (with discord.py), but me, being a Haskell guy, obviously wanted to do something in Haskell. Unfortunately, there is no Haskell API for Discord yet. So I had to roll up my own. It took me some time, but now, today, I got it working. A little description of the problems I faced (from the top of my head):
- Finding the correct libraries to work with. My libs of choice are: aeson (for working with JSON), lens, lens-aeson, websockets, wreq (for HTTP stuff), wuss (for secure Websockets) and privileged-concurrency (so that I can tell the difference between channels meant to be read-only and channels meant to be write-only).
- Finding out the API.
The HTML version: http://unofficial.discordapi.com/en/latest/
The actual doc, on github: https://github.com/DiscordAPI/docs
The HTML version: http://unofficial.discordapi.com/en/latest/
The actual doc, on github: https://github.com/DiscordAPI/docs
- ws:// vs. wss:// - Trying to connect to a secure ws server without the secure part just won't work, so I used Wuss, and its runSecureClient function to get websockets working.
- Wrong headers in POST requests - you gotta add the "Content-Type: application/json" to the headers. It has cost me days.
- And probably others, which I can't remember.
Now, I can write a bot that replies with "Hi" if someone says "Hey". I know, what a useful bot...
There is still a lot of work to do, but I will try to continue Kart of War as well - now, that the hardest part is behind me.
EDIT: Here is the link to the repo: https://github.com/gizmo-mk0/HsDiscord
There is still a lot of work to do, but I will try to continue Kart of War as well - now, that the hardest part is behind me.
EDIT: Here is the link to the repo: https://github.com/gizmo-mk0/HsDiscord
Subscribe to:
Posts (Atom)