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

How to get DiscordJS Message in robot.hear() scripts? #7

Open
betaMFD opened this issue Jul 22, 2022 · 2 comments
Open

How to get DiscordJS Message in robot.hear() scripts? #7

betaMFD opened this issue Jul 22, 2022 · 2 comments

Comments

@betaMFD
Copy link
Contributor

betaMFD commented Jul 22, 2022

Is the DiscordJS Message easily accessible somehow from a robot.hear() or robot.respond() script?

I "cheated" on my fork and just saved it raw to the robot robot.discordJsMessage = message in onmessage so I can access it easily but that doesn't feel very clean or correct. But I'm using it constantly because all the good features are in the DiscordJS Message.

@msudol
Copy link
Owner

msudol commented Jul 29, 2022

What do you mean exactly? Like take parts of the message and use them in the response?

@betaMFD
Copy link
Contributor Author

betaMFD commented Aug 1, 2022

While I'd be happy if it were set in the response, I want the DiscordJS Message object because it has a lot of DiscordJs functionality. So I don't want parts of it, I want the whole object. I can't see where I can get it right now without having the robot save it for me in the adapter's onmessage function, or forgoing robot.hear()/robot.respond() all together and using robot.client.on() which feels like I'm wasting the hubot infrastructure.

Does that make sense?

In the adapter's onmessage, I've tried just passing the DiscordJs Message object to @robot.receive instead of creating and passing the Hubot TextMessage object, but I end up with an error because the DiscordJs User object doesn't have the "room" in it.

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

2 participants