Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose useful utility functions #2

Open
3 tasks
omnidan opened this issue Feb 23, 2016 · 0 comments
Open
3 tasks

expose useful utility functions #2

omnidan opened this issue Feb 23, 2016 · 0 comments
Labels

Comments

@omnidan
Copy link
Member

omnidan commented Feb 23, 2016

e.g. we could expose:

export const callAndReply = (unsubscribe, text) =>
  (e, reply) => {
    unsubscribe()
    reply(text)
  }

export const justReply = (text) => (e, reply) => reply(text)

and then use it in plugins:

import { callAndReply, justReply } from 'coffea-bot'

export default function example (networks) {
  let enabled = true

  return {
    'disable': callAndReply(() => enabled = false, 'Disabled example.'),
    'enable': callAndReply(() => enabled = true, 'Enabled example.'),
    'default': justReply('Usage: /example disable|enable')
  }
}

  • decide: should this be a separate repository?
  • document in README.md
  • implement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant