crackwatch.com is currently down, and I'm unsure when it will come back up. I'll take a peek every now and then, and assuming they don't change too much, I'll make it work with the new site as well.
A bot which uses the websocket connection at crackwatch.com to query results.
Should work with no issues on any platform supported by Go.
Because
the other guys who were making one
thought it would be a good idea to
keep the source code closed, even though this is a trivial application.
In case anyone isn't aware, these bots are able to log any and all messages on
the channels they have access to, so it's imperative you run them yourselves.
It irritated me enough that I wrote this in a few hours, even though I have
no use for it.
Feel free to fork the repo and change it for your own usecase, just follow the
simple terms of the
ISC
license by making sure you keep an exact copy of the
LICENSE file in your repo.
In Discord, enter in the bot command (!crack
by default) followed by your
search term: !crack test
If there's multiple pages, enter the page number you'd like right after the bot
command: !crack2 test
go run . -token=<DiscordBotToken>
go build && ./CrackWatchDiscordBot -token=<DiscordBotToken>
Please be aware that this bot (or anyone else's) should NOT be trusted, as they
all have the ability to log any and all messages on the channels they have
access to. This is here only to demonstrate the functionality before running it
yourself.
https://discord.com/oauth2/authorize?client_id=741678700033998888&permissions=2048&scope=bot
- Create a new application at https://discord.com/developers/applications
- From the menu on the left, click on "Bot"
- Click on "Add Bot"
- Click on "Click to Reveal Token"
- Select the bot from https://discord.com/developers/applications
- Go to the following URL after replacing "CLIENT_ID" with your Client ID:
https://discord.com/oauth2/authorize?client_id=CLIENT_ID&permissions=2048&scope=bot
- I can't fathom many people using this application, so it doesn't reuse a
single websocket connection, and instead opens a new connection each query. If
you have an extremely high-traffic usecase for this, please ensure you respect
crackwatch.com by reusing a single connection. It may be easier to use nhooyr's
library if this is wanted, not too sure. - I was contemplating whether or not I wanted to use an embedded message when
there was only one result, but ultimately was against it since it would have
taken up a bunch of vertical messaging space where it wasn't necessary. Feel
free to fork it and add it to your own version, however. - If you're planning on supporting multiple guilds, you'll want to add a
command (as well as a data store) so users from guilds can change the bot
command prefix. I didn't do this for my own version because I don't want people
using it—I want them running their own.
Q: Why don't you use a tabwriter to align the columns for each result?
A: 1) Due to the nature of the need behind the search, your eyes wouldn't be
scanning to compare columns of different rows—you'd instead be looking for a
game's name (which is at the beginning of each row, sorted alphabetically),
then scanning to the right from there for more information about that game.
2) It would use up a lot more of Discord's allotted characters (2000 per
message), allowing far less information to be presented per message.