SDClowen / RSBot

A Silkroad Online Open Source Bot
GNU Affero General Public License v3.0
125 stars 110 forks source link

[Feature request] external notification plugin (over ntfy.sh) #739

Open sn4dy opened 10 months ago

sn4dy commented 10 months ago

ntfy.sh is a service that allows you to receive custom notifications to the devices it supports from anywhere. like this bot, it is open source, so you can use it on your own server if you want. I use this platform to get notifications from different tools. I would like to have a plugin that I can optionally choose for all events like character leveled up, rare item collected, etc.

sn4dy commented 10 months ago

@SDClowen if you don't have time for this, I can work on it although I don't have much experience. I saw that events are not called with an enum, it would be good for me if I could have a list of events. In addition, you can guide me to make the part of saving the changes made in the plugin suitable for the project. regards.

ngoedde commented 10 months ago

Hello, there isn't a complete overview for all events. But you can find them by searching for "EventManager.FireEvent" / "EventManager.SubscribeEvent". The names/locations will tell you when the event is fired. You may want to checkout the existing plugins first. There's no existing system you could use for your notifications so you will defnitely need to subscribe to the events on your own and then execute your notification logic.

Actually I like your idea but as you've already guessed we don't have time for this so I'm looking forward to your contribution 👍

sn4dy commented 10 months ago

Hi Niklas Thank you for the information. I've been wanting to contribute to this project, and with this plugin I'll be able to make a start. But I'm having some difficulties because I'm not familiar with this ecosystem at all. I thought of copying an existing plugin and making the changes through it, but I couldn't do it. If you make this start for me, I'd like to continue with the other parts.

BaroDevelopment commented 10 months ago

Why don't u send what you want to Discord using a webhook? That's just a few lines of code

sn4dy commented 10 months ago

In the same way, you can handle it with a few lines of code. Everyone prefers to use some tools in their own way.

BaroDevelopment commented 10 months ago

What exactly do you want to send as notification. Drops, unique spawns etc?

sn4dy commented 10 months ago

Yes, like these...

ngoedde commented 10 months ago

If you want to create a new plugin make sure that the following steps are done:

  1. Create a new .NET 6 library project to /Plugins
  2. Make sure that it's built into "Build\Plugins"
  3. Add RSBot.Core to the project dependency of your new plugin 3.1. Make sure to not copy "RSBot.Core.dll" to your output directory.
  4. Add a new class that implements IPlugin from the core.

Done. See existing plugin's .csproj file for more info reg. the dependency and build directory.

sn4dy commented 10 months ago

Thank you, I will proceed with these steps.

ngoedde commented 10 months ago

You're welcome. If you have any questions you can PM me (@Wimbeam) in discord.

ngoedde commented 10 months ago

I've had a second thought about this. Actually you can place your changes into "RSBot.CommandCenter". Ther's even a tab in the UI "Notifications" already. So it's actually even intendet to be in there.

sn4dy commented 10 months ago

It seems like it would be easier to continue from there. I would have to learn how to both create the interface and save the settings when trying to do it as a separate plugin.

sn4dy commented 10 months ago

When the notification related stuff is there, it will be understood as being just for CommandCenter notifications. I think the general notification plugin makes more sense in context, when it's as a separate plugin.

sn4dy commented 10 months ago

This allows you to add multiple providers such as Discord. The user receives notifications from the platform they want.

sn4dy commented 10 months ago

Let me first add the notification part to CommandCenter, and then we can talk about making a separate plugin if you want.