Beeminder Forum

What would you like to see in a Discord Bot for Beeminder?

I got my feet wet with writing a Discord bot in Scala and am entertaining the idea of making one for Beeminder purposes (the holidays are nearing and I need excuses to get away from annoying relatives, crying babies and most importantly: terrible Christmas carols).

It could tell everyone in the channel how much longer you will be unavailable based on your eep day time based goals.
It could tell whomever is asking how many of your goals are still due for today.
It could tell people when was the last time you logged a datapoint.
Stuff like this.

What’s your ideas?

2 Likes

Love it! Of course there’s beeminder.com/slack if any of that functionality seems worth porting to Discord. Related question: how portable will your Discord bot be? Easy to port to Slack? Google Hangouts? (I’d sure love an easy way to make Hangouts bots.)

The thing I’m most pining for is a better tockbot…

I think the most practical thing, something @mary and I have been talking about, is a way to keep your time till next derailment always in your ambient awareness.

2 Likes

Portable to Hangouts? Why? Hangouts is dead.
Slack? Likely to be straightforward. They share many features. I don’t have any personal use for Slack though. Not anymore. I use it at work and they sure aren’t interested in Beeminder.
So not exactly highest priority for me. But I’d help.
Right now I encode the rules using pattern matching.
This is a complex example showing the bot reacting when

  • its name was mentioned and
  • the message contains “high five” or “highfive” (case insensitive).

It then

  • high fives the author,
  • followed by an enthusiastic Yeah! and
  • lastly adds a :raised_hands: reaction to the message.

It also handles the case of it being a webhook and not a regular user that wants to high five. You never know.

case MessageCreate(msg, _) if botWasMentionedIn(msg) && messageContainsAnyOf(msg)("high five", "highfive") => msg.authorUser match {
  case Some(author) =>
    runMany(List(
      Reply to msg withText f"_high fives ${author.mentionNick}%s_",
      Reply to msg withText "Yeah!"),
      CreateReaction(msg.channelId, msg.id, "🙌"))
    .map(_=>())
  case None =>
    println("A webhook wants to high five, how odd!")
    runMany(Seq.empty)
}

Thanks to akka this is all reactive and non blocking and whatnot.

I do have an idea of making a bot version of the shame nun of Game of Thrones where it will publicly call you out in your discord channel if you just keep chatting instead of doing your goals (on an eep day). It could add shame nun gifs, add little bell emoji reactions, … And just arbitrarily comment on what you say with “shouldn’t you be working on $goalName” instead?.

Same as above¹, just written using for-comprehensions for various reasons, one of them being that AckCord’s docs (the library I am using) do employ this style as well.

case MessageCreate(msg, _) if botWasMentionedIn(msg) && messageContainsAnyOf(msg)("high five", "highfive") =>
  for {
    author <- optionPure(msg.authorUser)
    _      <- runMany(List(
                Reply to msg withText f"_high fives ${author.mentionNick}%s_",
                Reply to msg withText "Yeah!",
                CreateReaction(msg.channelId, msg.id, "🙌")))
  } yield ()

¹ For the purpose of this example