diff --git a/main.js b/main.js new file mode 100644 index 0000000..cb1ca19 --- /dev/null +++ b/main.js @@ -0,0 +1,20 @@ +const sdk = require("matrix-bot-sdk"); +const config = require("./config.js"); + +const { MatrixAuth } = sdk; +const { + homeserverUrl, + username, + password, +} = config; + +// This will be the URL where clients can reach your homeserver. Note that this might be different +// from where the web/chat interface is hosted. The server must support password registration without +// captcha or terms of service (public servers typically won't work). +const login = async () => { + const auth = new MatrixAuth(homeserverUrl); + const client = await auth.passwordLogin(username, password); + console.log("Copy this access token to your bot's config: ", client.accessToken); +} + +login();