forked from cadence/out-of-your-element
sending events in matrix
This commit is contained in:
parent
6990957c9e
commit
8a0c2b5663
13 changed files with 2764 additions and 10 deletions
|
@ -0,0 +1,22 @@
|
|||
// @ts-check
|
||||
|
||||
const reg = require("../../matrix/read-registration.js")
|
||||
const fetch = require("node-fetch")
|
||||
|
||||
fetch("https://matrix.cadence.moe/_matrix/client/v3/createRoom?user_id=@_ooye_example:cadence.moe", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
invite: ["@cadence:cadence.moe"],
|
||||
is_direct: false,
|
||||
name: "New Bot User Room",
|
||||
preset: "trusted_private_chat"
|
||||
}),
|
||||
headers: {
|
||||
Authorization: `Bearer ${reg.as_token}`
|
||||
}
|
||||
}).then(res => res.text()).then(text => {
|
||||
// {"room_id":"!aAVaqeAKwChjWbsywj:cadence.moe"}
|
||||
console.log(text)
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue