-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: plugin types compatibility issue with ctx.has (#268)
Co-authored-by: Kirill Loskutov <[email protected]> Co-authored-by: KnorpelSenf <[email protected]>
- Loading branch information
1 parent
bd13a27
commit e9ae05b
Showing
3 changed files
with
78 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Composer, Context } from "../src/mod.ts"; | ||
|
||
function _f<C extends Context>() { | ||
const c = new Composer<C & { state: 1 }>(); | ||
c.use((ctx) => { | ||
if (ctx.has(":contact")) { | ||
ctx.msg.contact.phone_number; | ||
ctx.state; | ||
} | ||
if (ctx.hasText("123")) { | ||
ctx.match.includes; | ||
} | ||
if (ctx.hasCommand("123")) { | ||
ctx.match.charCodeAt; | ||
} | ||
if (ctx.hasChatType("private")) { | ||
ctx.chat.type; | ||
} | ||
if (ctx.hasGameQuery("123")) { | ||
ctx.callbackQuery.game_short_name; | ||
} | ||
if (ctx.hasInlineQuery("123")) { | ||
ctx.inlineQuery.id; | ||
} | ||
ctx.state; | ||
}); | ||
c.command("c", (ctx) => { | ||
ctx.match.charCodeAt; | ||
}); | ||
} |