out-of-your-element/scripts/register.js

23 lines
781 B
JavaScript
Raw Normal View History

2023-04-30 12:57:30 +00:00
// @ts-check
const { AppServiceRegistration } = require("matrix-appservice");
let id = AppServiceRegistration.generateToken()
try {
const reg = require("../matrix/read-registration")
if (reg.id) id = reg.id
} catch (e) {}
// creating registration files
const newReg = new AppServiceRegistration(null);
newReg.setAppServiceUrl("http://localhost:6693");
newReg.setId(id);
newReg.setHomeserverToken(AppServiceRegistration.generateToken());
newReg.setAppServiceToken(AppServiceRegistration.generateToken());
newReg.setSenderLocalpart("_ooye_bot");
newReg.addRegexPattern("users", "@_ooye_.*", true);
newReg.addRegexPattern("aliases", "#_ooye_.*", true);
newReg.setProtocols(["discord"]); // For 3PID lookups
newReg.setRateLimited(false);
newReg.outputAsYaml("registration.yaml");