Baritone AI pathfinder

Baritone AI pathfinder

72.7k Downloads

Discord Updates

265866 opened this issue ยท 7 comments

commented

Describe your suggestion

Same as desktop notifications but sends to discord webhook

Settings

#set discordNotifications (true/false)
#set webhook (webhook link)
#set discordChannelID (channel id you want it to be added to)

Context

some people leave their PC running and aren't at their desktop to receive notifications

Final checklist

  • I know how to properly use check boxes
  • I have not used any OwO's or UwU's in this issue.
commented

Almost forgot about this issue.
Baritone now has callbacks for all logging, so other mods can provide the discord notifications.
To do so they need some method that accepts a String and sends it on discord, lets call it sendToDiscord and put it into a class called DiscordHelper and then they can send the discord messages either instead of or in addition to the normal desktop notifications, using one of these lines:

BaritoneAPI.getSettings().notifier.value = DiscordHelper::sendToDiscord; // replace notification handler
BaritoneAPI.getSettings().notifier.value = BaritoneAPI.getSettings().notifier.value.andThen(DiscordHelper::sendToDiscord); // add new handler without removing the old one
commented

Maybe just a (hidden) notifications setting like logger so one can easily write an add-on that sends notifications to any platform?

commented

Maybe just a (hidden) notifications setting like logger so one can easily write an add-on that sends notifications to any platform?

I'm not entirely sure how that'd work, correct me if I'm wrong, but don't different platforms work differently? I mean if that would work that would be amazing but I'm just not entirely sure how that work haha

commented

There would just be a setting accessible from java only with type Consumer<String,Boolean>.
A mod can then simply place it's own function there and do whatever it wants to the message (e.g. send it to discord or just modify it before forwarding to the previously set notification logger)

commented

Maybe just a (hidden) notifications setting like logger so one can easily write an add-on that sends notifications to any platform?

I'm not entirely sure how that'd work, correct me if I'm wrong, but don't different platforms work differently? I mean if that would work that would be amazing but I'm just not entirely sure how that work haha

I think what he means is that baritone implements some sort of thing that gives other mods acces to read the last notification(s) that baritone sent, so that other mod creators can use it to make a mod that posts it to the platform they want.
So, baritone makes the last notification(s) readable for other mods, and other mod developers can read it and do anything they want with it.

commented

I like the idea!

commented

I already tried implementing this, but NotificationHelper is a non-api class (which imo is correct), and to use NotificationHelper#notify as the default notification callback I have to access it from the api. Should I just move baritone.utils.NotificationHelper to baritone.api.utils.NotificationHelper or does someone know another clean(er) solution?