Class: Async::Matrix::Bridge::Discord::DB::Puppet
- Inherits:
-
Sequel::Model
- Object
- Sequel::Model
- Async::Matrix::Bridge::Discord::DB::Puppet
- Defined in:
- lib/async/matrix/bridge/discord/db/puppet.rb
Overview
Maps a Discord user to a Matrix ghost user.
The ghost’s Matrix ID is derived from the username template in the bridge config (e.g., @discord_123456:example.com). This model tracks the Discord user’s profile info for syncing to Matrix.
puppet = Puppet.create(discord_id: "123", username: "alice", name: "Alice")
puppet.is_bot? # => false
puppet.double_puppet? # => true (if custom_mxid is set)
Instance Method Summary collapse
-
#double_puppet? ⇒ Boolean
Is this puppet configured for double puppeting?.
- #validate ⇒ Object
Instance Method Details
#double_puppet? ⇒ Boolean
Is this puppet configured for double puppeting?
33 34 35 |
# File 'lib/async/matrix/bridge/discord/db/puppet.rb', line 33 def double_puppet? !custom_mxid.nil? && !custom_mxid.empty? end |
#validate ⇒ Object
27 28 29 30 |
# File 'lib/async/matrix/bridge/discord/db/puppet.rb', line 27 def validate super errors.add(:discord_id, "cannot be empty") if discord_id.nil? || discord_id.empty? end |