diff options
author | icebaker <icebaker@proton.me> | 2023-11-18 21:45:16 -0300 |
---|---|---|
committer | icebaker <icebaker@proton.me> | 2023-11-18 21:45:16 -0300 |
commit | c470d63b169058d81f44569a5f1c4c1fb222279f (patch) | |
tree | 8d2f520d4eb73e65a44e3815f36e38ff09943d52 /logic/cartridge | |
parent | 89962f27a75183947fc44cd051a1061ce157221d (diff) |
adding support for confirm
Diffstat (limited to 'logic/cartridge')
-rw-r--r-- | logic/cartridge/safety.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/logic/cartridge/safety.rb b/logic/cartridge/safety.rb index 84b39d7..6414e51 100644 --- a/logic/cartridge/safety.rb +++ b/logic/cartridge/safety.rb @@ -6,6 +6,27 @@ module NanoBot module Logic module Cartridge module Safety + def self.default_answer(cartridge) + default = Fetch.cascate(cartridge, [%i[interfaces tools confirm default]]) + return [] if default.nil? + + default + end + + def self.yeses(cartridge) + yeses_values = Fetch.cascate(cartridge, [%i[interfaces tools confirm yeses]]) + return [] if yeses_values.nil? + + yeses_values + end + + def self.confirmable?(cartridge) + confirmable = Fetch.cascate(cartridge, [%i[safety tools confirmable]]) + return true if confirmable.nil? + + confirmable + end + def self.sandboxed?(cartridge) sandboxed = Fetch.cascate(cartridge, [%i[safety functions sandboxed]]) return true if sandboxed.nil? |