Coder Social home page Coder Social logo

Comments (6)

nikoksr avatar nikoksr commented on May 14, 2024

Hey @kaptinlin, thanks for sharing your idea/problem.

Have you considered using separate notify instances? For example like this:

// Notifier for receiver 1
service1, _ := telegram.New("")
service1.AddReceivers(-1234567890)

n1 := notify.NewWithServices(service1)
_ = n1.Send(context.Background(), "Hello", "The message to fooReceiver")


// Notifier for receiver 2
service2, _ := telegram.New("")
service2.AddReceivers(-9876543210)

n2 := notify.NewWithServices(service2)
_ = n2.Send(context.Background(), "Hello", "The message to barReceiver")

I can see that your solution would add more flexibility but I want to consider other solutions first before agreeing or declining your idea. Would my example solve your problem?

from notify.

kaptinlin avatar kaptinlin commented on May 14, 2024

@nikoksr yes, it can works.
I was look for a way not initialize the service when send to different receivers.

from notify.

rafimuhammad01 avatar rafimuhammad01 commented on May 14, 2024

hi @nikoksr @kaptinlin has this feature been implemented? I think I want to start contributing by solving this issue, would you mind?

from notify.

kaptinlin avatar kaptinlin commented on May 14, 2024

nope, if you can contribute that would be awesome

from notify.

nikoksr avatar nikoksr commented on May 14, 2024

@rafimuhammad01 welcome to the project. I appreciate your willingness to support the project! We'd all be excited for your contributions in any way, shape or form.

@kaptinlin could you please clarify why this feature would be beneficial for the project? This seems like a subtle pattern change and I don't want to accept changes that unnecessarily change Notify's usage patterns. Actually, this is a major pattern change due to the introduction of the Receiver type, which we'd need to individually implement for every service respectively.

Also, I'm not happy with the linguistic choice here. Keeping in mind that chained methods should sound as close as possible to an actual english sentence, the signature is not logically sound. Notify to <receiver> send <message> is not exactly gramatically correct. Something like Notify send <message> to <receiver> would be cleaner. Obviously this does not work, since the Send() method returns an error type and thus does not allow for further method chaining.

To summarize, I'd more than happily accept your guys' idea and contribution but we need a clear explanation of what problem this exactly solves, plus, the signature has to change. I'm not okay with notify.To(...).Send(...).

cc @svaloumas

from notify.

nikoksr avatar nikoksr commented on May 14, 2024

Closing until further notice.

from notify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.