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

Some improvements that I need & collaboration. #1

Open
dpc opened this issue Sep 12, 2018 · 3 comments
Open

Some improvements that I need & collaboration. #1

dpc opened this issue Sep 12, 2018 · 3 comments

Comments

@dpc
Copy link
Contributor

dpc commented Sep 12, 2018

Hi & Cześć!

So I have a need for a simple matrix bot. I've fired the example, looked at the code and it worked for me.

I think I'll need to extend it a little bit so I wanted to ask how should I go about it. Maybe you could set up a gitter channel where I could ping you directly? Or would prefer Github issues?

First thing I need is more meta information about received messages (at least the sender).

I see that right now you're parsing Json Value in get_new_messages which is not very scalable. I would just write a type based on https://matrix.org/docs/api/client-server/#!/Room32participation/sync , starting small, and adding interesting sub-types, fields and enums with time.

What do you think?

@dpc
Copy link
Contributor Author

dpc commented Sep 12, 2018

BTW. Please run cargo fmt and commit the formatting changes. Right now there's a lot of whitespace noise etc. I would advice setting automatic rustfmt on every write anyway. :)

@zgtm
Copy link
Owner

zgtm commented Sep 14, 2018

Hi @dpc , thanks for sharing your ideas! I was a bit busy yesterday, so that I just managed to skim your changes and accept the pull request for rustfmt. I will have more time this weekend.

My plan is to enhance the documentation a little bit and then publish a version 0.0.4 to crates.io (for my purposes), first. After that, I'm completely open for changes. :)

@zgtm
Copy link
Owner

zgtm commented Sep 16, 2018

Hey @dpc, I've finally had a chance to look at the changes you're proposing. Thank a lot for working on this, I appreciate your effort!

I've got some general points where I would propose some slight changes. I hope I'm not beeing too conservative, here.

dementia was intended to be a high level abstraction over the matrix protocol, so reading and responding to text messages should be a easy as it gets. With the changes in #4, the boilerplate to get to the text is now 7 lines instead of 3 (yeah, I know, not really meaningful numbers, but what I want to say; it's more). Probably a method named get_new_messages() should return a vector of messages instead of events, and that would already help a bit.

But I see that it will be necessary for most people to get information about the sender of a message. I could also imagine that the timestamp of messages is a useful information.

Maybe we can incorporate a very simple API for the enduser with the complete serde types for the matrix api you wrote. That would probably be very convenient.

Alternatively, it could make sense to split the whole low level serde types and comunication with the server into a module (or even a crate? think dementia-core) and let the high level API use that.

I'm not really sure which approach is best. I'd like to hear your opinion before proceding in any way.

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