Lokathor/dice-bot-rs

Update to randomize-rs 2.x?

Closed this issue · 8 comments

Should we update to randomize-rs 2.x? I know you wrote that library too, but it seems randomize-rs 1.0.0 will not be maintained further, which is a bad idea for a critical part of this bot that -- at least in theory -- could have bugs caused by the implementation of randomize-rs 1.0.0.

Trying to get away from a JS Discord roll bot that has extremely poor "randomization" and often looks ridiculously bias even in small samples.

hmm, well all the versions of randomize are equally quality in terms of the randomization distribution. The biggest problem, and reason for the version churn, was coming up with an API that feels right to use.

honestly I wasn't aware that anyone else was using the bot XD

I've started using the bot instead of the NodeJS-based "rollbot" that uses Mersenne Twister because PCG is so much better (faster, better randomness). I like it! 👍

I've added a series of commits that suit my own needs here. If you want any PRs, let me know and I'll submit them, or you can cherry pick. https://github.com/allquixotic/dice-bot-rs/commits/master

Warning: I have no idea how to code in Rust yet. This is my first serious Rust code and I'm still learning.

ah ha! Well, this is one of my most messy projects because every time I add a command I just put it in as fast as possible and never go back to clean anything up.

If you'd like to try some PRs into this repo I can review them and such.

Two things:

  • Serenity version 0.6 and later (which contains many useful bug fixes) has dropped command! builder syntax, and they're not continuing to maintain and fix bugs (or protocol deviations in Discord server-side) in the 0.5.x series. So upgrading to Serenity 0.6 or later will be very important for continued support of this bot.
  • I'd really like to upgrade to randomize-rs 2.x but I don't understand the new API enough to port the old to the new.

Hmm, well thankfully this is a good chance for me to put 3.0.0-rcWhatever to the test.

I'll have a look at a serenity upgrade later today.

Oh yeah, and if you upgrade your box to OpenSSL 1.1.1 or later (even without recompiling dice-bot-rs), it will break the bot. There's a pinned issue on how to get a workaround without upgrading Serenity by using a patch for rust-openssl, but the "real" fix is to use Serenity 0.6.x. This bit me today, because Ubuntu 18.04 pushed a stable release update to OpenSSL 1.1.1c.

I tried to upgrade to Serenity 0.6.x, but I ended up commenting out a ton of your code and just using the dice command, but after I got it to compile, it wouldn't even recognize that I was sending it any commands. So I'm not sure what I was doing wrong there. I don't have anything patch-worthy because it's literally broken right now.

For the interim, I'm keeping my bot online by using the patch in the Serenity pinned issue about OpenSSL to keep using Serenity 0.5.14 with dice-bot-rs.

PR started: #10

updated to randomize 3 in latest version (dice-bot 0.5)