Tidy up repo
This commit is contained in:
parent
d5ec013648
commit
f35c5266b6
2 changed files with 50 additions and 2 deletions
13
.gitignore
vendored
13
.gitignore
vendored
|
@ -1,7 +1,16 @@
|
||||||
node_modules
|
# Secrets
|
||||||
config.js
|
config.js
|
||||||
registration.yaml
|
registration.yaml
|
||||||
coverage
|
|
||||||
ooye.db*
|
ooye.db*
|
||||||
|
events.db*
|
||||||
|
|
||||||
|
# Automatically generated
|
||||||
|
node_modules
|
||||||
|
coverage
|
||||||
test/res/*
|
test/res/*
|
||||||
!test/res/lottie*
|
!test/res/lottie*
|
||||||
|
icon.svg
|
||||||
|
*~
|
||||||
|
.#*
|
||||||
|
\#*#
|
||||||
|
launch.json
|
||||||
|
|
39
scripts/remove-old-bridged-users.js
Normal file
39
scripts/remove-old-bridged-users.js
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
// @ts-check
|
||||||
|
|
||||||
|
const HeatSync = require("heatsync")
|
||||||
|
const sync = new HeatSync({watchFS: false})
|
||||||
|
|
||||||
|
const sqlite = require("better-sqlite3")
|
||||||
|
const db = new sqlite("db/ooye.db")
|
||||||
|
|
||||||
|
const passthrough = require("../src/passthrough")
|
||||||
|
Object.assign(passthrough, {db, sync})
|
||||||
|
|
||||||
|
const api = require("../src/matrix/api")
|
||||||
|
const mreq = require("../src/matrix/mreq")
|
||||||
|
|
||||||
|
const rooms = db.prepare("select room_id from channel_room").pluck().all()
|
||||||
|
|
||||||
|
;(async () => {
|
||||||
|
// Step 5: Kick users starting with @_discord_
|
||||||
|
await mreq.withAccessToken("baby", async () => {
|
||||||
|
for (const roomID of rooms) {
|
||||||
|
try {
|
||||||
|
const members = await api.getJoinedMembers(roomID)
|
||||||
|
for (const mxid of Object.keys(members.joined)) {
|
||||||
|
if (mxid.startsWith("@_discord_") && !mxid.startsWith("@_discord_bot")) {
|
||||||
|
await api.leaveRoom(roomID, mxid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await api.setUserPower(roomID, "@_discord_bot:cadence.moe", 0)
|
||||||
|
await api.leaveRoom(roomID)
|
||||||
|
} catch (e) {
|
||||||
|
if (e.message.includes("Appservice not in room")) {
|
||||||
|
// ok
|
||||||
|
} else {
|
||||||
|
throw e
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})()
|
Loading…
Reference in a new issue