Ajouter une condition dans un package personnalisé pour la condition Si
Ajoutez des conditions dans un package personnalisé.
Créer des valeurs de condition dans une Action
- Pour créer une condition, définissez la propriété commandType de l'annotation BotCommand avec une valeur telle que Condition.
- Pour définir la méthode de saisie de la condition, utilisez l'annotation ConditionTest.
@BotCommand(commandType = Condition)
@CommandPkg(label = "File exists", name = "fileExists",
description = "Checks the file exists condition.",
node_label = "file exists at {{sourceFilePath}}", icon = "")
public class Exist extends AbstractCondition {
@ConditionTest
public boolean test(@Idx(index = "1", type = FILE) @LocalFile @Pkg(label = "File path") @NotEmpty String sourceFilePath,
@Idx(index = "2", type = NUMBER) @Pkg(label = "How long you would like to wait for this condition
to be true?(Seconds)",
default_value = "0", default_value_type = DataType.NUMBER)
@GreaterThanEqualTo("0") @LessThanEqualTo("99999") @NotEmpty @NumberInteger Double waitTimeout) {
// Logic to check for the condition goes here
}
}