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

[IMPROVEMENT] Make it work in private channels and DMs by default #1

Open
cardoso opened this issue Jul 27, 2018 · 5 comments
Open

Comments

@cardoso
Copy link
Owner

cardoso commented Jul 27, 2018

Right now you need to invite the bot to the private group for the integration to work.

This may need improvement in the Rocket.Chat.Apps framework.

PS: notifyUser & notifyRoom is not good yet because

  1. They're not persistent.
  2. It says 'only you can see this message' even if you use notifyRoom.
@graywolf336
Copy link
Contributor

Why is this? You can use the notifier interface: https://rocketchat.github.io/Rocket.Chat.Apps-ts-definition/interfaces/inotifier.html#notifyuser this way they get notified in whatever room they did the command instead of relying on a user being in a room

@cardoso
Copy link
Owner Author

cardoso commented Jul 27, 2018

Nice!! @graywolf336 ! I did not know about that interface. I'll try to use that & will report back 😃

@cardoso
Copy link
Owner Author

cardoso commented Jul 27, 2018

@graywolf336 I tried this approach but I can't figure out two things:

  1. How to notify entire room (message says 'only you can see this message')
  2. How to change avatar & alias of @rocket.cat
modify.getNotifer().notifyRoom(context.getRoom(), {
    room: context.getRoom(),
    sender: context.getSender(),
    text: `@${context.getSender().username} shared a new paper: [${result.data.title || 'Untitled'}](https://paper.dropbox.com/doc/${result.data.doc_id})`
})

Also note there's a typo in getNotifer

@cardoso
Copy link
Owner Author

cardoso commented Jul 27, 2018

I was able to modify the avatar and alias of the bot 😄

Like this:

const message = modify.getNotifer().getMessageBuilder()
    .setSender(botUser)
    .setRoom(context.getRoom())
    .setUsernameAlias('Dropbox Paper')
    .setAvatarUrl('https://cardo.so/Rocket.Chat.Dropbox.Paper/icon.png')
    .setText(`@${context.getSender().username} shared a new paper: [${result.data.title || 'Untitled'}](https://paper.dropbox.com/doc/${result.data.doc_id})`)
    .getMessage();

await modify.getNotifer().notifyRoom(context.getRoom(), message);

But to disable 'only you can see this message' is probably something that needs to be modified in the rocketchat-apps bridge

@cardoso
Copy link
Owner Author

cardoso commented Jul 27, 2018

@graywolf336 I just realized these notifications are not persistent 😞. No good for this use case.

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