switch to using api functions over mreq

This commit is contained in:
Cadence Ember 2023-05-08 23:37:51 +12:00
commit 3bc29def41
9 changed files with 64 additions and 31 deletions

View file

@ -8,12 +8,16 @@ const { discord, sync, db } = passthrough
const api = sync.require("../../matrix/api")
/** @type {import("../../matrix/file")} */
const file = sync.require("../../matrix/file")
/** @type {import("../converters/user-to-mxid")} */
const userToMxid = sync.require("../converters/user-to-mxid")
/**
* A sim is an account that is being simulated by the bridge to copy events from the other side.
* @param {import("discord-api-types/v10").APIUser} user
*/
async function createSim(user) {
assert.notEqual(user.discriminator, "0000", "user is not a webhook")
api.register("_ooye_example")
const simName = userToMxid.userToSimName(user)
const appservicePrefix = "_ooye_"
const localpart = appservicePrefix + simName
await api.register(localpart)
}