From 8ae78b954350755a47a13133668dba93bac15f37 Mon Sep 17 00:00:00 2001 From: icebaker Date: Sat, 18 Nov 2023 19:07:10 -0300 Subject: adding support for tools --- components/stream.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'components/stream.rb') diff --git a/components/stream.rb b/components/stream.rb index 45c4a2b..347eb87 100644 --- a/components/stream.rb +++ b/components/stream.rb @@ -7,7 +7,12 @@ module NanoBot class Stream < StringIO def write(*args) if @callback - @accumulated += args.first + begin + @accumulated += args.first + rescue StandardError => _e + @accumulated = "#{@accumulated.force_encoding('UTF-8')}#{args.first.force_encoding('UTF-8')}" + end + @callback.call(@accumulated, args.first, false) end super -- cgit v1.2.3