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 call toggle(java.lang.String, java.lang.String) to rename the default abilities or turnOff(java.lang.String) to simply turn off the said ability.
  • Field Details

  • Constructor Details

    • CustomToggle

      public CustomToggle()
  • Method Details

    • isOff

      public boolean isOff(Ability ability)
      Specified by:
      isOff in interface AbilityToggle
      Parameters:
      ability - the target ability
      Returns:
      true if the ability has been turned off
    • processAbility

      public Ability processAbility(Ability ability)
      Description copied from interface: AbilityToggle
      Abilities that are ON (and have failed the AbilityToggle.isOff(org.telegram.abilitybots.api.objects.Ability) condition) will be processed by this method.
      Specified by:
      processAbility in interface AbilityToggle
      Parameters:
      ability - the target ability
      Returns:
      the processed ability
    • toggle

      public CustomToggle toggle(String abilityName, String targetName)
      Parameters:
      abilityName - the ability you want to change
      targetName - 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
    • config

      public CustomToggle config(Properties properties)
      Parameters:
      properties - the abilities toggle definition
      Returns:
      the toggle instance