Loading src/index.ts +4 −0 Original line number Diff line number Diff line Loading @@ -9,3 +9,7 @@ Discord.login(process.env.DISCORD_TOKEN); Matrix.for("_discord_bot").then(() => { console.log("_discord_bot registered"); }); Matrix.sendAlivePing().then((data) => { console.log("Alive ping result", data); }); src/lib/matrix.ts +8 −0 Original line number Diff line number Diff line Loading @@ -450,6 +450,14 @@ export class Matrix { .map((match) => match?.[0]) .filter((a) => a) as any; } static async sendAlivePing() { return await this.fetch( `/_matrix/client/v1/appservice/${process.env.MATRIX_AS_ID}/ping`, "POST", {} ); } } type IUsername = `_discord_${string}`; Loading src/matrix.ts +1 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ class MatrixHandler_ { for (const event of events) { console.log("[Matrix->]", event); switch (event.type) { case "m.room.member": { const event2: MatrixRoomMembership = event as any; Loading src/types/env.ts +4 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,10 @@ declare global { * Outgoing token (-> matrix) */ MATRIX_AS_TOKEN: string; /** * What AS identifier we're registered as */ MATRIX_AS_ID: string; /** * Incoming token (-> express) */ Loading Loading
src/index.ts +4 −0 Original line number Diff line number Diff line Loading @@ -9,3 +9,7 @@ Discord.login(process.env.DISCORD_TOKEN); Matrix.for("_discord_bot").then(() => { console.log("_discord_bot registered"); }); Matrix.sendAlivePing().then((data) => { console.log("Alive ping result", data); });
src/lib/matrix.ts +8 −0 Original line number Diff line number Diff line Loading @@ -450,6 +450,14 @@ export class Matrix { .map((match) => match?.[0]) .filter((a) => a) as any; } static async sendAlivePing() { return await this.fetch( `/_matrix/client/v1/appservice/${process.env.MATRIX_AS_ID}/ping`, "POST", {} ); } } type IUsername = `_discord_${string}`; Loading
src/matrix.ts +1 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ class MatrixHandler_ { for (const event of events) { console.log("[Matrix->]", event); switch (event.type) { case "m.room.member": { const event2: MatrixRoomMembership = event as any; Loading
src/types/env.ts +4 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,10 @@ declare global { * Outgoing token (-> matrix) */ MATRIX_AS_TOKEN: string; /** * What AS identifier we're registered as */ MATRIX_AS_ID: string; /** * Incoming token (-> express) */ Loading