lib/blather_ext.rb 🔗
@@ -1,9 +1,19 @@
# frozen_string_literal: true
+require "securerandom"
+
module Blather
class JID
def with(node: self.node, domain: self.domain, resource: self.resource)
self.class.new(node, domain, resource)
end
end
+
+ module DSL
+ def say(to, msg, using=:chat)
+ client.write(Blather::Stanza::Message.new(to, msg, using).tap { |message|
+ message.id = SecureRandom.uuid
+ })
+ end
+ end
end