GithubHelp home page GithubHelp logo

Comments (11)

bnfinet avatar bnfinet commented on July 28, 2024

see PR #99

from bot.

sochotnicky avatar sochotnicky commented on July 28, 2024

You could make a plugin that would set up webhook receiver which would populate internal queue and periodic command that would check internal queue and possibly post message?

from bot.

fabioxgn avatar fabioxgn commented on July 28, 2024

@sochotnicky I think that the way to go is to create a new kind of command that would return a struct with a message chan and a done chan, then you would write on this chan upon receiving a message on the webhook, something like the CmdV3 works, but with 2 chans instead of just one for done: https://github.com/go-chat-bot/bot/blob/master/cmd.go#L96

This way the bot could start a goroutine that would pool this chan waiting for new messages from the webhook.

Something like:

type WebhookCmdResult struct {	
  Data chan struct {
    Message string
    Channel string
  }
  Done    chan bool
}

from bot.

sochotnicky avatar sochotnicky commented on July 28, 2024

Yeah that approach would certainly be cleaner overall. My proposal was more about a way to do it without changing the bot, but direct bot support for this approach would be nicer. I wouldn't call it "WebhookCmdResult" - maybe something like MessageStreamCmdResult with the register method called RegisterMessageStreamCommand? Or something of the sort that's not directly tied to "webhook" since I assume it could be used in different contexts?

from bot.

bnfinet avatar bnfinet commented on July 28, 2024

Thanks for considering the issue and the technicalities.

If I want to notify irc://freenode.net/#go-bots but not any of the other platforms including irc://ourprivate.com/#inhouse? Is there a spot where the adapter/bot exposes a struct which includes network name?

Or how about reacting to irc://freenode.net by notifying a channel on irc://our private.com/#inhouse

Somewhat of an aside but related, my next itch to scratch is persistent storage which rubs up against a number of these same issues.

from bot.

bnfinet avatar bnfinet commented on July 28, 2024

@sochotnicky @fabioxgn would love to get your feedback on #101 - thanks much!

from bot.

fabioxgn avatar fabioxgn commented on July 28, 2024

Hi @bnfinet I think I'll have some time this weekend to take a look at it, thanks for the contribution.

from bot.

bnfinet avatar bnfinet commented on July 28, 2024

@sochotnicky @fabioxgn Happy New Year!

Do you have any time that you could spare to reviewing my PR? I have a few other features which I'd be happy to submit PRs for but it doesn't make sense to me to submit those until #101 is cleared.

Thanks much!

from bot.

fabioxgn avatar fabioxgn commented on July 28, 2024

@bnfinet sorry for the delay, I was hoping to test your changes locally for a more detailed review, but I don't think I'll have the spare time for that soon. For now I've reviewed your PR and just pointed out some documentation and forgotten comments issues, can you please fix those? Then I'll merge your PR. Thanks.

from bot.

bnfinet avatar bnfinet commented on July 28, 2024

Thanks much @fabioxgn for the review and feedback. I've incorporated those changes you've suggested with the exception of the defer nsMap.Unlock() which when implemented causes the tests to fail. Not quite sure why that's the case but I'm going to hold off on that for now.

Do let me know if there's anything else.

from bot.

fabioxgn avatar fabioxgn commented on July 28, 2024

@bnfinet thanks, I've merged you PR.

from bot.

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.