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

refactor: replace deprecated method #262

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
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
35 changes: 15 additions & 20 deletions src/slack/handler.explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,38 +44,34 @@ export class SlackHandlerExplorer {
eventHandlers: instanceWrappers
.map(({ instance }) => {
const instancePrototype = Object.getPrototypeOf(instance);
return this.metadataScanner.scanFromPrototype(
instance,
instancePrototype,
(method) =>
this.exploreEventHandler(instance, instancePrototype, method),
);
return this.metadataScanner
.getAllMethodNames(instancePrototype)
.map((method) => {
return this.exploreEventHandler(instancePrototype, method);
});
})
.reduce((prev, curr) => {
return prev.concat(curr);
.reduce((previous, current) => {
return previous.concat(current);
}),
interactivityHandlers: instanceWrappers
.map(({ instance }) => {
const instancePrototype = Object.getPrototypeOf(instance);
return this.metadataScanner.scanFromPrototype(
instance,
instancePrototype,
(method) =>
this.exploreInteractivityHandler(
instance,
return this.metadataScanner
.getAllMethodNames(instancePrototype)
.map((method) => {
return this.exploreInteractivityHandler(
instancePrototype,
method,
),
);
);
});
})
.reduce((prev, curr) => {
return prev.concat(curr);
.reduce((previous, current) => {
return previous.concat(current);
}),
};
}

public exploreEventHandler(
instance: object,
instancePrototype: Controller,
methodKey: string,
): SlackEventHandlerConfig | null {
Expand All @@ -88,7 +84,6 @@ export class SlackHandlerExplorer {
}

public exploreInteractivityHandler(
instance: object,
instancePrototype: Controller,
methodKey: string,
): SlackInteractivityHandlerConfig | null {
Expand Down