You are browsing as a guest. Sign up (or log in) to start making projects!

MonkeyLogs538

  • 5 Devlogs
  • 21 Total hours

Self-hostable Discord bot for uploading Minecraft logs to an mclogs instance.

Ship #1

I was annoyed that people still upload plain log files in the support discord for my Minecraft mods, when I clearly say that using mclogs, a pastebin for minecraft logs with syntax highlighting and whatnot, makes debugging much easier. So I made a Discord bot to fix that! It detects logs sent as attachments by their name and uploads them to mclogs. It can also be added as a user application, which will allow using the `/upload-logs` command anywhere.

This is my first full project written in Kotlin (previously I've only used it for Gradle buildscripts), so there were some initial challenges with Kotlin syntax for things like lambdas and also how instead of static functions you have companion objects, but Kotlin's documentation is pretty good. What documentation wasn't so good though was Kord, the library I used for interacting with the Discord API. It required quite a bit of guesswork to figure out how it works and should be used, the Discord API docs made it a bit easier though at least.

I've set up a discord server with an instance of the bot running, which can be used to test it out. There are also self-hosting instructions on the readme.

  • 5 devlogs
  • 21h
Try project → See source code →
Open comments for this post

4h 32m 39s logged

Made it now packaged as a docker container, fixed some bugs and wrote a readme with instructions for self-hosting
Also now have an instance of it running on my homelab

Made it now packaged as a docker container, fixed some bugs and wrote a readme with instructions for self-hosting
Also now have an instance of it running on my homelab

Replying to @OffsetMonkey538

0
2
Open comments for this post

7h 3m 5s logged

Some changes over the past few days:

  • Multiple logs can be uploaded at once
  • Http requests and json parsing now done with kotlin’s own libraries instead of java HttpClient and Jankson. Kotlin serialization stuff is actually pretty great!
  • Errors aren’t silently ignored anymore and other logs added in the same batch can still be uploaded even when some fail.
  • Much less readable code, kotlin is great for that

Some changes over the past few days:

  • Multiple logs can be uploaded at once
  • Http requests and json parsing now done with kotlin’s own libraries instead of java HttpClient and Jankson. Kotlin serialization stuff is actually pretty great!
  • Errors aren’t silently ignored anymore and other logs added in the same batch can still be uploaded even when some fail.
  • Much less readable code, kotlin is great for that

Replying to @OffsetMonkey538

0
1
Open comments for this post

2h 49m 5s logged

Log files will now automatically be detected (current filter is any file ending in .log) and uploaded 🎉

Log files will now automatically be detected (current filter is any file ending in .log) and uploaded 🎉

Replying to @OffsetMonkey538

0
4
Open comments for this post

6h 2m 37s logged

I have now fully implemented the command for uploading a log. It now rejects binary files like images or videos, correctly reads when the file isn’t UTF8 formatted and allows deleting the uploaded log in case it was the wrong file or something.

I’ve found that Kotlin is actually really nice. I especially like how it allows writing such unreadable code that I can’t understand it even 5 minutes after writing it

I also spent an hour or so in termux on my phone (was bored on a bus) setting up an instance of mclogs on my homelab and the bot now allows setting a custom instance url as well.

Next step will be having it detect sent log files and automatically upload them

I have now fully implemented the command for uploading a log. It now rejects binary files like images or videos, correctly reads when the file isn’t UTF8 formatted and allows deleting the uploaded log in case it was the wrong file or something.

I’ve found that Kotlin is actually really nice. I especially like how it allows writing such unreadable code that I can’t understand it even 5 minutes after writing it

I also spent an hour or so in termux on my phone (was bored on a bus) setting up an instance of mclogs on my homelab and the bot now allows setting a custom instance url as well.

Next step will be having it detect sent log files and automatically upload them

Replying to @OffsetMonkey538

0
3
Open comments for this post

40m 19s logged

I really liked the nullability stuff Kotlin has when I was writing a multiloader/version convention plugin for my mods, so I decided to use Kotlin to get more familiar with it in general usage. I saw someone talking about the Kord library a while back, so I went with that.
Safe to say that I’m still quite unfamiliar with Kotlin’s syntax (using it in gradle buildscripts is much much simpler), and I couldn’t really find anything great on Kord other than the simple example usage https://github.com/kordlib/kord/tree/main/core , but it definitely is able to play ping-pong at the very least :D

I really liked the nullability stuff Kotlin has when I was writing a multiloader/version convention plugin for my mods, so I decided to use Kotlin to get more familiar with it in general usage. I saw someone talking about the Kord library a while back, so I went with that.
Safe to say that I’m still quite unfamiliar with Kotlin’s syntax (using it in gradle buildscripts is much much simpler), and I couldn’t really find anything great on Kord other than the simple example usage https://github.com/kordlib/kord/tree/main/core , but it definitely is able to play ping-pong at the very least :D

Replying to @OffsetMonkey538

0
13

Followers

Loading…