From b53d252fb45af9f966d8217c9abf7c71d27f61bf Mon Sep 17 00:00:00 2001 From: Abbas Abou Daya Date: Tue, 31 Oct 2017 23:08:23 -0400 Subject: [PATCH] Update FAQ on the global flag --- TelegramBots.wiki/abilities/Advanced.md | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/TelegramBots.wiki/abilities/Advanced.md b/TelegramBots.wiki/abilities/Advanced.md index 39189c36..962f83e7 100644 --- a/TelegramBots.wiki/abilities/Advanced.md +++ b/TelegramBots.wiki/abilities/Advanced.md @@ -23,17 +23,12 @@ It is possible to declare "DEFAULT" abilities that process non-command messages. This ability will send a *"Daaaaang, what a nice photo!"* whenever the bot receives a photo. This is one use case where replies and abilities are interchangeable. ## The Global Flag -However, there is one important note here. This ability without any additional code will not be able to process photos. There is a global flag in AbilityBot that restricts the kind of "updates" it can process. -To freely process any update given to your bot, make sure to: +There is a global flag in AbilityBot that restricts the kind of "updates" it can process. The default implementation is passthrough - it allows all updates to be processed. +As an example, if you want to restrict the updates to photos only, then you may do: ```java -/** - * By default, any update that does not have a message will not pass through abilities. - * To customize that, you can just override this global flag and make it return true at every update. - * This way, the ability flags will be the only ones responsible for checking the update's validity. - */ @Override public boolean checkGlobalFlags(Update update) { - return true; + return Flag.PHOTO; } ``` \ No newline at end of file