The plugin allows to automatically answerCallbackQuery
when the developer forgets or decides not to do so.
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
import type { Context, Middleware } from 'grammy'; | |
import type { MaybeArray } from '../types/maybe-array'; | |
import { middlewareToFn } from './middleware-to-fn'; | |
/** | |
* Middleware tree execution result. Equals `true` when |
Please read my post in Telegram: Don't use spread operator with byte arrays
- Use
target.set(source, offset)
MDN - Pre-alocate the entire array once
- Don't use
...spread
operator with bytes
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
{ | |
"5.9.10.47:19949": { | |
"errors": { | |
"LITE_SERVER_UNKNOWN: timeout(during last block synchronization)": 2 | |
}, | |
"results": {} | |
}, | |
"5.9.10.15:48014": { | |
"errors": { | |
"LITE_SERVER_NOTREADY: block is not applied": 38, |
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 module implements ECMAScript (stage-3) proposal: | |
* Promise with resolvers: | |
* https://github.com/tc39/proposal-promise-with-resolvers | |
* | |
* Copyright 2023 Slava Fomin II | |
* | |
* Permission is hereby granted, free of charge, to any | |
* person obtaining a copy of this software and associated | |
* documentation files (the “Software”), to deal in the |
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
const isValid$ = ( | |
merge( | |
value$.pipe( | |
distinctUntilChanged(), | |
map(() => undefined), | |
), | |
value$.pipe( | |
debounceTime(500), | |
withLatestFrom(isComplete$), | |
filter(([_, isComplete]) => isComplete), |
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
import { WebApp } from '@grammyjs/web-app'; | |
export function isTwa(): boolean { | |
return ( | |
Boolean(WebApp.initData) || | |
(WebApp.platform !== 'unknown') | |
); |
NewerOlder