commit 785489442f8ff63c164a949929b138596dd7181a
parent 7e83bbb93ab45956318523ed83509fcab05e7489
Author: Marcel <mtrnord1@gmail.com>
Date: Sat, 27 Jun 2020 16:29:27 +0200
Add Readme.md
Took 7 minutes
Diffstat:
| M | Readme.md | | | 146 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| M | src/main.rs | | | 7 | ------- |
2 files changed, 146 insertions(+), 7 deletions(-)
diff --git a/Readme.md b/Readme.md
@@ -1,2 +1,148 @@
+<!-- PROJECT SHIELDS -->
+[![Contributors][contributors-shield]][contributors-url]
+[![Forks][forks-shield]][forks-url]
+[![Stargazers][stars-shield]][stars-url]
+[![Issues][issues-shield]][issues-url]
+[![GPL-3.0 License][license-shield]][license-url]
+<!--[](https://matrix.to/#/#daydream:nordgedanken.dev)-->
+
+
+
+<!-- PROJECT LOGO -->
+<br />
+<p align="center">
+ <h3 align="center">Matrix IPFS Bot</h3>
+
+ <p align="center">
+ A bot for <a href="https://matrix.org">Matrix</a> that converts Matrix events using the <a href="https://github.com/matrix-org/matrix-rust-sdk/">Matrix Rust SDK</a> to IPFS Files
+ <br />
+ <br />
+ <a href="https://github.com/MTRNord/matrix-ipfs-bot/issues">Report Bug</a>
+ ·
+ <a href="https://github.com/MTRNord/matrix-ipfs-bot/issues">Request Feature</a>
+ </p>
+</p>
+
+
+
+<!-- TABLE OF CONTENTS -->
+## Table of Contents
+
+* [About the Project](#about-the-project)
+ * [Built With](#built-with)
+* [Getting Started](#getting-started)
+ * [Prerequisites](#prerequisites)
+ * [Setting up a Development Environment](#setting-up-a-development-environment)
+<!--* [Usage](#usage)-->
+* [Roadmap](#roadmap)
+* [Contributing](#contributing)
+* [License](#license)
+* [Contact](#contact)
+* [Acknowledgements](#acknowledgements)
+
+
+
+<!-- ABOUT THE PROJECT -->
+## About The Project
+
+
+### Built With
+
+* [Rust](https://www.rust-lang.org/)
+* [Matrix](https://matrix.org)
+* [Matrix Rust SDK](https://github.com/matrix-org/matrix-rust-sdk/)
+
+
+
+<!-- GETTING STARTED -->
+## Getting Started
+
+To get a local copy up and running follow these simple steps.
+
## Best practice
Make your upload ipfs gateway public and use it for links for best performance
+
+### Prerequisites
+
+This is an example of how to list things you need to use the software and how to install them.
+* Rust
+* IPFS
+
+### Setting up a Development Environment
+
+1. Clone the repo
+```sh
+git clone https://github.com/MTRNord/Daydream.git
+```
+
+2. Install the IPFS client from [ipfs.io](https://ipfs.io)
+
+#### 🛠️ Build
+
+```sh
+cargo build
+```
+
+#### 🔬 Run
+
+```sh
+cargo run -- <homeserver_url> <username> <password>
+```
+
+<!-- ROADMAP -->
+## Roadmap
+
+See the [open issues](https://github.com/MTRNord/matrix-ipfs-bot/issues) for a list of proposed features (and known issues).
+
+
+
+<!-- CONTRIBUTING -->
+## Contributing
+
+Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.
+
+1. Fork the Project
+2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
+3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
+4. Push to the Branch (`git push origin feature/AmazingFeature`)
+5. Open a Pull Request
+
+
+
+<!-- LICENSE -->
+## License
+
+Distributed under the AGPL-v3.0 License. See `LICENSE` for more information.
+
+
+
+<!-- CONTACT -->
+## Contact
+
+<!--Matrix Room - [#daydream:nordgedanken.dev](https://matrix.to/#/#daydream:nordgedanken.dev)-->
+
+MTRNord - [@mtrnord](https://github.com/mtrnord) - https://matrix.to/#/@mtrnord:nordgedanken.dev
+
+Project Link: [https://github.com/MTRNord/matrix-ipfs-bot](https://github.com/MTRNord/matrix-ipfs-bot)
+
+
+
+<!-- ACKNOWLEDGEMENTS -->
+## Acknowledgements
+
+
+
+
+
+<!-- MARKDOWN LINKS & IMAGES -->
+<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
+[contributors-shield]: https://img.shields.io/github/contributors/MTRNord/matrix-ipfs-bot.svg?style=flat-square
+[contributors-url]: https://github.com/MTRNord/matrix-ipfs-bot/graphs/contributors
+[forks-shield]: https://img.shields.io/github/forks/MTRNord/matrix-ipfs-bot.svg?style=flat-square
+[forks-url]: https://github.com/MTRNord/matrix-ipfs-bot/network/members
+[stars-shield]: https://img.shields.io/github/stars/MTRNord/matrix-ipfs-bot.svg?style=flat-square
+[stars-url]: https://github.com/MTRNord/matrix-ipfs-bot/stargazers
+[issues-shield]: https://img.shields.io/github/issues/MTRNord/matrix-ipfs-bot.svg?style=flat-square
+[issues-url]: https://github.com/MTRNord/matrix-ipfs-bot/issues
+[license-shield]: https://img.shields.io/github/license/MTRNord/matrix-ipfs-bot.svg?style=flat-square
+[license-url]: https://github.com/MTRNord/matrix-ipfs-bot/blob/master/LICENSE
diff --git a/src/main.rs b/src/main.rs
@@ -117,23 +117,16 @@ impl EventEmitter for CommandBot {
_: &StrippedRoomMember,
_: Option<MemberEventContent>,
) {
- println!("room: {:?}", room);
if let SyncRoom::Invited(room) = room {
let room_id = room.read().await.room_id.clone();
- println!("room_id: {:?}", &room_id);
let resp = self.client.join_room_by_id(&room_id).await.unwrap();
- println!("JoinResp: {:?}", resp);
}
}
async fn on_room_message(&self, room: SyncRoom, event: &MessageEvent) {
if let SyncRoom::Joined(room) = room {
if let MessageEventContent::Text(text_event) = event.clone().content {
- // reply to an event with a file attachment with !ipfs, and have the bot reply with an ipfs link
- // TODO config
let msg_body = text_event.body.clone();
- println!("new text message: {}", msg_body.clone());
- println!("text_event: {:?}", text_event.clone());
// TODO fix e2ee relates_to with something like https://github.com/matrix-org/matrix-rust-sdk/blob/master/matrix_sdk_base/src/client.rs#L93 inside of receive_joined_timeline_event