class Portal
Maps a Discord channel to a Matrix room.
Uses a composite primary key of (discord_id, receiver). For guild channels, receiver is an empty string. For DMs, receiver is the Discord user ID of the bridge user who owns the portal.
portal = Portal.create(discord_id: "chan123", receiver: "", mxid: "!room:x") portal.guild # => Guild or nil portal.messages # => [Message, ...]
Definitions
def dm?
Is this a DM portal? (has a receiver)
Implementation
def dm?
receiver && !receiver.empty?
end
def guild_channel?
Is this a guild channel portal?
Implementation
def guild_channel?
!dm?
end