!veagCdDBjKrMsOCzrq:privacytools.io

Ruma

279 Members
A set of Rust library crates for working with the Matrix protocol. ruma.io | github.com/ruma | liberapay.com/ruma | #ruma-dev:matrix.org109 Servers

Load older messages


SenderMessageTime
3 Oct 2022
@nyaaori:pixelthefox.netNyaaori ⚛️hmmm22:13:07
@nyaaori:pixelthefox.netNyaaori ⚛️
In reply to @jplatte:flipdot.org
Otherwise you could create your own copy of RoomMessageEventContent also deriving EventContent like the type in ruma-common, and use that with send
maybe there should be a macro to easily create more EventContents
22:13:24
@nyaaori:pixelthefox.netNyaaori ⚛️
In reply to @jplatte:flipdot.org
Otherwise you could create your own copy of RoomMessageEventContent also deriving EventContent like the type in ruma-common, and use that with send
* maybe there should be a macro to easily create more EventContents
22:13:59
@jplatte:flipdot.orgJonas Platte Yes, that's the EventContent derive macro 22:14:07
@nyaaori:pixelthefox.netNyaaori ⚛️oh; well it sounds like mtr has a known schema for events; so that sounds like it'd work 22:14:38
@nyaaori:pixelthefox.netNyaaori ⚛️ * oh; well it sounds like mtr has a known schema for events, so that sounds like it'd work 22:14:48
@nyaaori:pixelthefox.netNyaaori ⚛️ MTRNord: here's that macro that Jonas Platte mentioned; https://docs.ruma.io/ruma_macros/derive.EventContent.html 22:17:05
@mtrnord:midnightthoughts.spaceMTRNord
In reply to @jplatte:flipdot.org
MTRNord: unless you need the best possible perf because you run this millions of times or sth., send_raw is a good solution for this.
Nah just writing a ping bot with the Trinity framework thingy :D
22:19:22
@nyaaori:pixelthefox.netNyaaori ⚛️ if you have a known schema you can use it to create the type you'd pass to RoomMessageEventContent 22:19:25
@nyaaori:pixelthefox.netNyaaori ⚛️or that gets wrapped/however that particular bit works22:20:14
@mtrnord:midnightthoughts.spaceMTRNord

Doing this hellish thing was quicker in the end:

let text = if let wasm::exports::OptionalString::Some(formatted_body) =
                                msg.formatted_content
                            {
                                if let wasm::exports::OptionalPong::Some(pong) = msg.pong {
                                    serde_json::json!({
                                        "msgtype": "m.notice",
                                        "format": "org.matrix.custom.html",
                                        "body": msg.content,
                                        "formatted_body": formatted_body,
                                        "m.relates_to": {
                                            "m.in_reply_to": {
                                                "event_id": ev.event_id().as_str(),
                                            }
                                        },
                                        "pong": {
                                            "from": homeserver,
                                            "ms": pong,
                                            "ping": ev.event_id().as_str(),
                                        }
                                    })
                                } else {
                                    serde_json::json!({
                                        "msgtype": "m.notice",
                                        "format": "org.matrix.custom.html",
                                        "body": msg.content,
                                        "formatted_body": formatted_body,
                                        "m.relates_to": {
                                            "m.in_reply_to": {
                                                "event_id": ev.event_id().as_str(),
                                            }
                                        }
                                    })
                                }
                            } else if let wasm::exports::OptionalPong::Some(pong) = msg.pong {
                                serde_json::json!({
                                    "msgtype": "m.notice",
                                    "body": msg.content,
                                    "m.relates_to": {
                                        "m.in_reply_to": {
                                            "event_id": ev.event_id().as_str(),
                                        }
                                    },
                                    "pong": {
                                        "from": homeserver,
                                        "ms": pong,
                                        "ping": ev.event_id().as_str(),
                                    }
                                })
                            } else {
                                serde_json::json!({
                                    "msgtype": "m.notice",
                                    "body": msg.content,
                                    "m.relates_to": {
                                        "m.in_reply_to": {
                                            "event_id": ev.event_id().as_str(),
                                        }
                                    },
                                })
                            };
22:21:01
@nyaaori:pixelthefox.netNyaaori ⚛️ahh right it gives you another EventContent which you would use like a RoomMessageEventContent22:21:05
@nyaaori:pixelthefox.netNyaaori ⚛️or that lol22:21:12
@mtrnord:midnightthoughts.spaceMTRNordthe whole thing is interleaved with wasm bindings22:21:13
@mtrnord:midnightthoughts.spaceMTRNord * the whole thing is connected with wasm bindings22:21:21
@mtrnord:midnightthoughts.spaceMTRNordSo I had to fight wasm too :D22:21:29
4 Oct 2022
@damccull:matrix.orgdamccullIs matrix a platform that would lend itself to a text based game? Or is chat rooms about it?04:02:21
@nyaaori:pixelthefox.netNyaaori ⚛️
In reply to @damccull:matrix.org
Is matrix a platform that would lend itself to a text based game? Or is chat rooms about it?
should work pretty good for that as long as your expected interaction rate is similar to a chat room
04:05:21
@nyaaori:pixelthefox.netNyaaori ⚛️you'd even be able to store some attributes inside of account or room state and not have to deal with storing them locally 04:06:06
@damccull:matrix.orgdamccullHmm. I am forming a multi user text game in my head and deciding if I want to do it. I once read that matrix is not just designed for chat but for all kinds of multimedia stuff so that got me thinking it'd be kind of neat if you could just join a room and now you're in a game. I've only ever seen chat though...04:14:20
@nyaaori:pixelthefox.netNyaaori ⚛️
In reply to @damccull:matrix.org
Hmm. I am forming a multi user text game in my head and deciding if I want to do it. I once read that matrix is not just designed for chat but for all kinds of multimedia stuff so that got me thinking it'd be kind of neat if you could just join a room and now you're in a game. I've only ever seen chat though...
are you using element-web at right now?
04:15:13
@damccull:matrix.orgdamccullI do sometimes but I'm on the Android element app atm04:18:41
@nyaaori:pixelthefox.netNyaaori ⚛️ah04:32:20
@nyaaori:pixelthefox.netNyaaori ⚛️well you can do /devtools on element-web to explore room contents04:32:29
@jboi:jboi.nlJonathan
In reply to @mtrnord:midnightthoughts.space
Yeah I am ditching ruma
(you're not ditching ruma if you still use the SDK :P)
07:59:19
@damccull:matrix.orgdamccull
In reply to @nyaaori:pixelthefox.net
well you can do /devtools on element-web to explore room contents
Oh cool. Thanks. I'll try that.
14:47:48
@nyaaori:pixelthefox.netNyaaori ⚛️that'll give you an idea of what you can do14:48:08
5 Oct 2022
@mtrnord:midnightthoughts.spaceMTRNord
In reply to @jboi:jboi.nl
(you're not ditching ruma if you still use the SDK :P)
(good thing that I am working on ditching that too. But that's not usable yet)
12:02:37
@mtrnord:midnightthoughts.spaceMTRNord (oh and if someone wonders its more a "it doesn't work for me" thing than anything else. It doesn't fit the way I would like to use matrix. Which is 95% custom events and 5% going by spec) 12:03:50
6 Oct 2022
@hoverbear:matrix.orgAna changed their display name from hoverbear to Ana.18:01:42

There are no newer messages yet.


Back to Room List