diff --git a/src/d2m/actions/create-room.js b/src/d2m/actions/create-room.js index 3caf187..8399657 100644 --- a/src/d2m/actions/create-room.js +++ b/src/d2m/actions/create-room.js @@ -146,9 +146,6 @@ async function channelToKState(channel, guild, di) { /** @type {Ty.Event.M_Power_Levels} */ "m.room.power_levels/": { events_default: everyoneCanSend ? 0 : 50, - events: { - "m.reaction": 0 - }, notifications: { room: everyoneCanMentionEveryone ? 0 : 20 }, diff --git a/src/stdin.js b/src/stdin.js index fea5fad..6c49bdd 100644 --- a/src/stdin.js +++ b/src/stdin.js @@ -5,7 +5,7 @@ const util = require("util") const {addbot} = require("../addbot") const passthrough = require("./passthrough") -const {discord, sync, db, select, from, as} = passthrough +const {discord, sync, db} = passthrough const data = sync.require("../test/data") const createSpace = sync.require("./d2m/actions/create-space") @@ -20,17 +20,19 @@ const updatePins = sync.require("./d2m/actions/update-pins") const speedbump = sync.require("./d2m/actions/speedbump") const ks = sync.require("./matrix/kstate") const setPresence = sync.require("./d2m/actions/set-presence") -const channelWebhook = sync.require("./m2d/actions/channel-webhook") const guildID = "112760669178241024" +const extraContext = {} + if (process.stdin.isTTY) { - setImmediate(() => { + setImmediate(() => { // assign after since old extraContext data will get removed if (!passthrough.repl) { const cli = repl.start({ prompt: "", eval: customEval, writer: s => s }) - Object.assign(cli.context, passthrough) + Object.assign(cli.context, extraContext, passthrough) passthrough.repl = cli + } else { + Object.assign(passthrough.repl.context, extraContext) } - // @ts-ignore sync.addTemporaryListener(passthrough.repl, "exit", () => process.exit()) }) } @@ -59,3 +61,9 @@ async function customEval(input, _context, _filename, callback) { return callback(null, util.inspect(e, false, 100, true)) } } + +sync.events.once(__filename, () => { + for (const key in extraContext) { + delete passthrough.repl.context[key] + } +})