summaryrefslogtreecommitdiff
path: root/components/stream.rb
diff options
context:
space:
mode:
authoricebaker <icebaker@proton.me>2023-11-18 19:07:10 -0300
committericebaker <icebaker@proton.me>2023-11-18 19:07:10 -0300
commit8ae78b954350755a47a13133668dba93bac15f37 (patch)
tree9cdc3bb770d778bd8d00675fdbc1f27a6e27e37c /components/stream.rb
parentab22d1bbe37093912cb7418b3c945153a15f4255 (diff)
adding support for tools
Diffstat (limited to 'components/stream.rb')
-rw-r--r--components/stream.rb7
1 files changed, 6 insertions, 1 deletions
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