Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use m.login.application_service when registering #315

Merged
merged 2 commits into from
Mar 4, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/components/intent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ const returnFirstNumber = (...args: unknown[]) => {

const DEFAULT_CACHE_TTL = 90000;
const DEFAULT_CACHE_SIZE = 1024;
export const APPSERVICE_REGISTER_TYPE = "m.login.application_service";

export type PowerLevelContent = {
// eslint-disable-next-line camelcase
Expand Down Expand Up @@ -1046,9 +1047,12 @@ export class Intent {
}
let registerRes;
if (forceRegister || !this.opts.registered) {
const localpart = (new MatrixUser(userId)).localpart;
const username = (new MatrixUser(userId)).localpart;
try {
registerRes = await this.botClient.register(localpart);
registerRes = await this.botClient.registerRequest({
type: "APPSERVICE_REGISTER_TYPE",
username,
});
this.opts.registered = true;
}
catch (err) {
Expand Down