Compare commits
No commits in common. "b6b0c1204effe1f48a295a5922a3339876a63c12" and "902dfa7e7c4c3b2e16cabf6d7bac906c45a22242" have entirely different histories.
b6b0c1204e
...
902dfa7e7c
2 changed files with 13 additions and 8 deletions
|
@ -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
|
||||
},
|
||||
|
|
18
src/stdin.js
18
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]
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue