Class CustomToggle
- java.lang.Object
-
- org.telegram.abilitybots.api.toggle.CustomToggle
-
- All Implemented Interfaces:
AbilityToggle
public class CustomToggle extends Object implements AbilityToggle
This custom toggle can be used to customize default abilities supplied by the library. Users can calltoggle(java.lang.String, java.lang.String)to rename the default abilites orturnOff(java.lang.String)to simply turn off the said ability.
-
-
Constructor Summary
Constructors Constructor Description CustomToggle()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisOff(Ability ability)AbilityprocessAbility(Ability ability)Abilities that are ON (and have failed theAbilityToggle.isOff(org.telegram.abilitybots.api.objects.Ability)condition) will be processed by this method.CustomToggletoggle(String abilityName, String targetName)CustomToggleturnOff(String ability)
-
-
-
Field Detail
-
OFF
public static final String OFF
- See Also:
- Constant Field Values
-
-
Method Detail
-
isOff
public boolean isOff(Ability ability)
- Specified by:
isOffin interfaceAbilityToggle- Parameters:
ability- the target ability- Returns:
- true if the ability has been turned off
-
processAbility
public Ability processAbility(Ability ability)
Description copied from interface:AbilityToggleAbilities that are ON (and have failed theAbilityToggle.isOff(org.telegram.abilitybots.api.objects.Ability)condition) will be processed by this method.- Specified by:
processAbilityin interfaceAbilityToggle- Parameters:
ability- the target ability- Returns:
- the processed ability
-
toggle
public CustomToggle toggle(String abilityName, String targetName)
- Parameters:
abilityName- the ability you want to changetargetName- the final name for this ability- Returns:
- the toggle instance
-
turnOff
public CustomToggle turnOff(String ability)
- Parameters:
ability- the ability name you would like turned off- Returns:
- the toggle instance
-
-