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

Access slack data #16

Open
cehoffman opened this issue Mar 28, 2018 · 4 comments
Open

Access slack data #16

cehoffman opened this issue Mar 28, 2018 · 4 comments

Comments

@cehoffman
Copy link

Since the adapter is a genserver, it would be handy if it could respond to queries for information about users, channels, etc. that is being stored in the state object.

@scrogson
Copy link
Member

@cehoffman can you please provide an example (code) of how you would want to use this?

@cehoffman
Copy link
Author

cehoffman commented Mar 28, 2018

How I would want to do this might be something like this from a pure mechanics. It could be wrapped up in nicer helpers inside the hear and respond blocks or maybe the adapter is easier to reach from within the responder than having to query the robot.

user =
  :global.whereis_name("myrobot")
  |> GenServer.call({:adapater, Hedwig.Adapter.Slack})
  |> GenServer.call({:lookup_user, "US231234AS"})
# user now holds the details of the above user id as kept in the users map

Similar genserver calls for :lookup_channel and other metadata kept in the state.

@electricshaman
Copy link

@scrogson Is this information currently stored anywhere? I could see a definite need for this.

@electricshaman
Copy link

Nevermind, I found it by poking around :observer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants