What time is it?

Today, right now, if you go look at my profile, you'll see this:

A discord profile screenshot, taken from the members list on the right side, with the status of "it's 5:11PM for me right now"

You may wonder how it works, or if you can do it yourself. Before I get to that, I'd like to tell the story of how I got here, and how my status has changed over the years.

My very first live status thing was written in I think NodeJS, and it used a Discord application that said "I am working on..." or something like that. It was a button slideshow sort of thing, that showed my various projects, rotating every 15s or so. It used a legitimate client that ran on an install of Linux Mint. Eventually I got tired of that, not just because it was a resource hog, but because I didn't want to use a desktop environment on what should be a server.

I soon came up with the time status idea. I used the discord.js-selfbot-v13 library, I think. It worked by using the "watching" status, which I made into "watching the time. It's X:XX for me". I really wished that it could just be "it's X:XX for me", but I don't think the selfbot library I was using at the time supported that. Either that or I just couldn't figure it out. This worked very well for a long time, and I could use Node to make it work, which was wonderful.

One day, someone entered my DMs and started asking about how they could have my status. I asked them if they had a server or knew how to use node. Of course, they didn't. I had free time, and so I made a Flutter app that created the time status, given a token, using the nyxx-self library. I had an issue with the library, which I fixed and made a PR for which was later accepted.

Honestly, it looked great.

screenshot of discord time status app, with "discord time status" at the top, a box to enter your token in the middle, a button labelled "start... :rocket emoji:" below that, and a line at the bottom that said "Made with :heart emoji: by @9021007, written in Flutter"

Alas, all good things must come to an end. If you remember my previous blog post, Discord has a problem, you'll remember that Discord started randomly banning me. I now think that it might have been related to logging in with the selfbot library. I didn't even need to actually use it to send messages or anything for it to get picked up. Annoying.

I tried the discord time app I made earlier, and the library didn't work again. I checked to see if there were any newer versions of the library. There were not. In fact, the last commit was 6 months ago, made by me, fixing the bug I encountered while making the time status 🤦.

screenshot of GitHub repo page for nyxx-self, with an arrow pointing to profile picture of me, and an arrow pointing to the time since last commit, 6 months ago.

Anyway, using some websocket code from a friend, I was able to connect to the Discord websocket URL with minimal issues. From there, I was able to send custom websocket messages, including custom status messages. One thing led to another, and I finally have the status that I had wanted for a while. Plus, since I control the script, I don't share a client fingerprint with other people who use selfbots for malicious reasons. This means that Discord has no reason to automatically ban anyone using my fingerprint, and everyone lived happily ever after.

Usually, I'd follow up that line with "until...", but I've had zero issues so far. I'm not spamming people with my code, and a single request per minute isn't what I would consider to be spamming their API. I'm not going to open source the code this time, hopefully prolonging how long it takes for the method to break.

If you're looking for how to set a custom status, the websocket message is {"op":3,"d":{"status":"online","since":0,"activities":[{"name":"Custom Status","type":4,"state":"YOUR STATUS GOES HERE","emoji":null}],"afk":false}}, and the endpoint is wss://gateway.discord.gg/?v=9&encoding=json

Enjoy.