From a03d5ab0cdefbc4f0aa2b90f2e8d594739631b14 Mon Sep 17 00:00:00 2001 From: Kravets <57632712+kravetsone@users.noreply.github.com> Date: Sun, 12 May 2024 16:04:09 +0300 Subject: [PATCH] chore: type fixes --- src/index.ts | 6 +----- src/utils.ts | 3 +-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/index.ts b/src/index.ts index 420b247..1ea4a4e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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); diff --git a/src/utils.ts b/src/utils.ts index 6e20c75..b5cfcd3 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -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>((resolve) => { prompts.set(id, {