Merge branch 'master' into remove-vanity-url
This commit is contained in:
commit
e7f80c4af4
@ -94,9 +94,7 @@ export async function onIdentify(this: WebSocket, data: Payload) {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
x.channel.recipients = x.channel.recipients?.map((x) => x.user);
|
x.channel.recipients = x.channel.recipients?.map((x) => x.user);
|
||||||
//TODO is this needed? check if users in group dm that are not friends are sent in the READY event
|
//TODO is this needed? check if users in group dm that are not friends are sent in the READY event
|
||||||
users = users.concat(
|
users = users.concat(x.channel.recipients as unknown as User[]);
|
||||||
x.channel.recipients?.map((x) => x.user) as User[]
|
|
||||||
);
|
|
||||||
if (x.channel.isDm()) {
|
if (x.channel.isDm()) {
|
||||||
x.channel.recipients = x.channel.recipients!.filter(
|
x.channel.recipients = x.channel.recipients!.filter(
|
||||||
(x) => x.id !== this.user_id
|
(x) => x.id !== this.user_id
|
||||||
|
@ -58,10 +58,14 @@ async function main() {
|
|||||||
|
|
||||||
const oldDB = await initDatabase();
|
const oldDB = await initDatabase();
|
||||||
|
|
||||||
|
const type = process.env.TO.includes("://") ? process.env.TO.split(":")[0]?.replace("+srv", "") : "sqlite";
|
||||||
|
const isSqlite = type.includes("sqlite");
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const newDB = await createConnection({
|
const oldDB = await createConnection({
|
||||||
type: process.env.TO.split(":")[0]?.replace("+srv", ""),
|
type,
|
||||||
url: process.env.TO,
|
url: isSqlite ? undefined : process.env.TO,
|
||||||
|
database: isSqlite ? process.env.TO : undefined,
|
||||||
entities,
|
entities,
|
||||||
name: "old",
|
name: "old",
|
||||||
});
|
});
|
||||||
@ -71,6 +75,7 @@ async function main() {
|
|||||||
for (const e of entities) {
|
for (const e of entities) {
|
||||||
const entity = e as EntityTarget<any>;
|
const entity = e as EntityTarget<any>;
|
||||||
const entries = await oldDB.manager.find(entity);
|
const entries = await oldDB.manager.find(entity);
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
console.log("migrating " + entries.length + " " + entity.name + " ...");
|
console.log("migrating " + entries.length + " " + entity.name + " ...");
|
||||||
|
|
||||||
@ -115,7 +120,7 @@ async function main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
console.log("migrating " + entries.length + " " + entity.name + " ...");
|
console.log("migrated " + entries.length + " " + entity.name);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error((error as any).message);
|
console.error((error as any).message);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user