-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
How to use hooks with slack-ruby-bot #154
Comments
There's lots of detail in https://github.com/slack-ruby/slack-ruby-bot#hooks. You need to get hold of the server instance, then do PongBot.instance.on(:presence_change, ->(client, data) { ... }) I'll close this for now, but feel free to add more questions! |
@dblock first of all, thanks so much for writing this gem! As a noob to ruby, it's not clear how to "get hold of the server instance" from inside my It would be nice if some common hooks could be defined alongside class MyBot < SlackRubyBot::Bot
command 'ping' do |client, data|
client.say(text: 'pong', channel: data.channel)
end
hello do |client, data|
...
end
# or
hook 'hello' do |client, data|
...
end
end |
I agree. Please try to contribute! I opened #211 |
I have started making a bot for attendance where a user will be marked as present as soon as his presence_change attribute for slack RTM is active and exit when this is away. I want to implement a web hook for this event. I am currently using rails as the framework in which I have the following code
Can some one kindly guide me as to how to implement hooks for this purpose and also how to add custom functionality for this gem. I am new to adding custom functionality to gems and how to make use of the existing libraries.
Help appreciated.
:)
The text was updated successfully, but these errors were encountered: