attzonko / mmpy_bot

A python-based chatbot for Mattermost (http://www.mattermost.org).
MIT License
266 stars 104 forks source link

Improvement: Add `type` optional param for `create_post(...)` function #386

Open datorr2 opened 1 year ago

datorr2 commented 1 year ago

For example: to create an emote, you would create a post with a type of me.

image

unode commented 1 year ago

If you want to reply with a reaction you can use driver.react_to(message, "emoji-name").

unode commented 1 year ago

Additional mattermost driver actions can be found in mattermost-autodriver documentation.

datorr2 commented 1 year ago

If you want to reply with a reaction you can use driver.react_to(message, "emoji-name").

The use case I was looking to do was not an emoji reaction, but a /me emote message.

Like, when the bot first starts up, it could do:

/me enters stage left.

And when it shuts down:

/me exits stage right.

unode commented 1 year ago

I can't find much about this type argument. It seems poorly documented and a little obscure.

I think a pull request adding this feature would be acceptable but I would like to know if this is just for /me or other post types are possible? And if so, can you provide a link to documentation that lists the post types?

datorr2 commented 1 year ago

I can't find much about this type argument. It seems poorly documented and a little obscure.

That is correct. I haven't been able to find much on it. I found it when I was trying to figure out how to have the bot send /me messages.

I think a pull request adding this feature would be acceptable but I would like to know if this is just for /me or other post types are possible? And if so, can you provide a link to documentation that lists the post types?

No documentation found so far, but there's an entire list of types in the mattermost/mattermost-server project:

https://github.com/mattermost/mattermost-server/blob/c943ed6859b1be013e4da92b1952c607a35258bc/model/post.go

Lines 22 through 53.

unode commented 1 year ago

https://github.com/mattermost/mattermost-server/blob/c943ed6859b1be013e4da92b1952c607a35258bc/model/post.go

This is interesting. #377 might benefit from this as well (system_join_channel) even if on the listen side.

If you are able to propose a pull request, I'd happily review.

unode commented 1 year ago

I think this could also be a nice feature to showcase in the documentation. Some screenshots of how the different post types look like. It's surprising how many of them there are. I didn't expect the list to be so extensive.