class Chatrix::Components::Admin
Provides administrative actions for a room.
Public Class Methods
Public Instance Methods
ban(user, reason)
click to toggle source
Bans a user from the room.
@param user [User] The user to kick. @param reason [String] The reason for the ban. @return [Boolean] `true` if the user was kicked, otherwise `false`.
# File lib/chatrix/components/admin.rb, line 45 def ban(user, reason) @matrix.rooms.actions.ban @room.id, user.id, reason end
join()
click to toggle source
Joins the room. Can only be used on public rooms or if the user has been invited.
# File lib/chatrix/components/admin.rb, line 21 def join @matrix.rooms.actions.join @room.id end
kick(user, reason)
click to toggle source
Kicks a user from the room.
@param user [User] The user to kick. @param reason [String] The reason for the kick. @return [Boolean] `true` if the user was kicked, otherwise `false`.
# File lib/chatrix/components/admin.rb, line 36 def kick(user, reason) @matrix.rooms.actions.kick @room.id, user.id, reason end
leave()
click to toggle source
Leaves the room. If the user is currently invited to the room, leaving the room is the same as rejecting the invite.
# File lib/chatrix/components/admin.rb, line 27 def leave @matrix.rooms.actions.leave @room.id end
unban(user)
click to toggle source
Unbans a user from the room.
@param user [User] The user to unban. @return [Boolean] `true` if the user was unbanned, otherwise `false`.
# File lib/chatrix/components/admin.rb, line 53 def unban(user) @matrix.rooms.actions.unban @room.id, user.id end