Skip to content

Commit

Permalink
chore: type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kravetsone committed May 12, 2024
1 parent c3230be commit a03d5ab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
6 changes: 1 addition & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,7 @@ export function prompt(): Plugin<
if (prompt) {
if (prompt?.event && !context.is(prompt.event)) return next();
if (prompt.validate && !(await prompt.validate(context))) {
if ("send" in context)
await context.send(prompt.text, prompt.sendParams);
else
await context.message?.send(prompt.text, prompt.sendParams);
return;
return context.send(prompt.text, prompt.sendParams);
}

prompt.resolve(context);
Expand Down
3 changes: 1 addition & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ export function getPrompt(
? textOrParams
: eventOrText;

if ("send" in context) await context.send(text, sendParams);
else await context.message?.send(text, sendParams);
await context.send(text, sendParams);

return new Promise<PromptAnswer<Event>>((resolve) => {
prompts.set(id, {
Expand Down

0 comments on commit a03d5ab

Please sign in to comment.