mirror of
https://gitdab.com/cadence/out-of-your-element.git
synced 2025-09-10 12:22:50 +02:00
Interactive initial setup
This commit is contained in:
parent
e0bb19bfab
commit
37f3a59d8e
24 changed files with 249 additions and 43 deletions
|
@ -3,7 +3,7 @@
|
|||
const assert = require("assert").strict
|
||||
const DiscordTypes = require("discord-api-types/v10")
|
||||
const Ty = require("../../types")
|
||||
const reg = require("../../matrix/read-registration")
|
||||
const {reg} = require("../../matrix/read-registration")
|
||||
|
||||
const passthrough = require("../../passthrough")
|
||||
const {discord, sync, db, select} = passthrough
|
||||
|
@ -372,7 +372,7 @@ async function _unbridgeRoom(channelID) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {DiscordTypes.APIGuildChannel} channel
|
||||
* @param {{id: string, topic?: string?}} channel
|
||||
* @param {string} guildID
|
||||
*/
|
||||
async function unbridgeDeletedChannel(channel, guildID) {
|
||||
|
|
|
@ -4,7 +4,7 @@ const assert = require("assert").strict
|
|||
const {isDeepStrictEqual} = require("util")
|
||||
const DiscordTypes = require("discord-api-types/v10")
|
||||
const Ty = require("../../types")
|
||||
const reg = require("../../matrix/read-registration")
|
||||
const {reg} = require("../../matrix/read-registration")
|
||||
|
||||
const passthrough = require("../../passthrough")
|
||||
const {discord, sync, db, select} = passthrough
|
||||
|
@ -192,7 +192,7 @@ async function syncSpaceFully(guildID) {
|
|||
if (discord.channels.has(channelID)) {
|
||||
await createRoom.syncRoom(channelID)
|
||||
} else {
|
||||
await createRoom.unbridgeDeletedChannel(channelID, guildID)
|
||||
await createRoom.unbridgeDeletedChannel({id: channelID}, guildID)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// @ts-check
|
||||
|
||||
const assert = require("assert")
|
||||
const reg = require("../../matrix/read-registration")
|
||||
const {reg} = require("../../matrix/read-registration")
|
||||
const Ty = require("../../types")
|
||||
const fetch = require("node-fetch").default
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// @ts-check
|
||||
|
||||
const assert = require("assert").strict
|
||||
const reg = require("../../matrix/read-registration")
|
||||
const {reg} = require("../../matrix/read-registration")
|
||||
const DiscordTypes = require("discord-api-types/v10")
|
||||
const mixin = require("@cloudrac3r/mixin-deep")
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ const lottie = sync.require("../actions/lottie")
|
|||
const mxUtils = sync.require("../../m2d/converters/utils")
|
||||
/** @type {import("../../discord/utils")} */
|
||||
const dUtils = sync.require("../../discord/utils")
|
||||
const reg = require("../../matrix/read-registration")
|
||||
const {reg} = require("../../matrix/read-registration")
|
||||
|
||||
const userRegex = reg.namespaces.users.map(u => new RegExp(u.regex))
|
||||
|
||||
|
|
|
@ -4,10 +4,9 @@ const assert = require("assert").strict
|
|||
|
||||
const passthrough = require("../../passthrough")
|
||||
const {discord, sync, db, select} = passthrough
|
||||
/** @type {import("../../matrix/read-registration")} */
|
||||
const reg = sync.require("../../matrix/read-registration.js")
|
||||
/** @type {import("../../m2d/converters/utils")} */
|
||||
const mxUtils = sync.require("../../m2d/converters/utils")
|
||||
const {reg} = require("../../matrix/read-registration.js")
|
||||
|
||||
const userRegex = reg.namespaces.users.map(u => new RegExp(u.regex))
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// @ts-check
|
||||
|
||||
const assert = require("assert")
|
||||
const registration = require("../../matrix/read-registration")
|
||||
const {reg} = require("../../matrix/read-registration")
|
||||
|
||||
const passthrough = require("../../passthrough")
|
||||
const {select} = passthrough
|
||||
|
@ -26,7 +26,7 @@ function downcaseUsername(user) {
|
|||
// remove leading and trailing dashes and underscores...
|
||||
.replace(/(?:^[_-]*|[_-]*$)/g, "")
|
||||
// If requested, also make the Discord user ID part of the username
|
||||
if (registration.ooye.include_user_id_in_mxid) {
|
||||
if (reg.ooye.include_user_id_in_mxid) {
|
||||
downcased = user.id + "_" + downcased
|
||||
}
|
||||
// The new length must be at least 2 characters (in other words, it should have some content)
|
||||
|
|
|
@ -46,7 +46,7 @@ test("user2name: works on special user", t => {
|
|||
})
|
||||
|
||||
test("user2name: includes ID if requested in config", t => {
|
||||
const reg = require("../../matrix/read-registration")
|
||||
const {reg} = require("../../matrix/read-registration")
|
||||
reg.ooye.include_user_id_in_mxid = true
|
||||
t.equal(userToSimName({username: "Harry Styles!", discriminator: "0001", id: "123456"}), "123456_harry_styles")
|
||||
t.equal(userToSimName({username: "f***", discriminator: "0001", id: "123456"}), "123456_f")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue