Comments (1)
pattern must be the exact text, try to add .* before and after your text
// before
'chat not found'
// after
'.*chat not found.*'
how to stop code execution/throw exception to catch in your code:
// custom exception
class ChatNotFoundException extends Exception{}
// routes
$bot->onApiError('.*chat not found.*', fn (Nutgram $bot, $e) {
throw new ChatNotFoundException($e->getMessage());
});
// your code
try{
$bot->sendMessage('Hello!', ['chat_id' => 123456789]);
} catch(ChatNotFoundException $e){
$bot->sendMessage('chat not found!');
}
from nutgram.
Related Issues (20)
- [BUG] Bulk Messenger just sending to one chat HOT 3
- [BUG] Cannot resolve 'SergiX44\Nutgram\Telegram\Types\WebApp\WebAppInfo' HOT 2
- [BUG] Bulk message stops in first error HOT 1
- [BUG] Incompatible Hydrator Type in Configuration and Nutgram Classes HOT 1
- [BUG] Conversations not restoring state when using auto-wire container HOT 1
- [BUG] starting inline conversation from server
- [BUG] starting an inline conversation from custom step HOT 1
- [BUG] "Serialization of 'Closure' is not allowed" when using Dependency Injection HOT 2
- [BUG] Bot username regex HOT 1
- Better DI injection services for Commands and Conversations HOT 1
- Is it possible to set default params value in sendMessage (and other methods) when bot init? [FEATURE] HOT 2
- [FEATURE] Passing parameters to the next step of conversation without setUserData and serialised in webhook mode HOT 2
- [BUG] starting inline conversation from server HOT 2
- [BUG] Conversation does not store it's chat_id HOT 1
- [BUG] Can not sendMessage to Group by chat_id HOT 3
- [BUG] Inline menu HOT 2
- [FEATURE] sendMediaGroup
- [BUG] Can't get EntityManager in Command class HOT 1
- sendMessage on replayed message in general topic always set message_thread_id HOT 3
- [BUG] Implementation of server-side conversations can be tricky. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nutgram.