1
0
Fork 0
out-of-your-element-fork-th.../d2m/actions/create-room.js

23 lines
581 B
JavaScript
Raw Normal View History

2023-04-30 12:57:30 +00:00
// @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)
})