Class: Discordrb::ServerBan

Inherits:
Object
  • Object
show all
Defined in:
lib/discordrb/data.rb

Overview

A ban entry on a server

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#reasonString? (readonly)

Returns the reason the user was banned, if provided.

Returns:

  • (String, nil)

    the reason the user was banned, if provided


3687
3688
3689
# File 'lib/discordrb/data.rb', line 3687

def reason
  @reason
end

#serverServer (readonly)

Returns the server this ban belongs to.

Returns:

  • (Server)

    the server this ban belongs to


3693
3694
3695
# File 'lib/discordrb/data.rb', line 3693

def server
  @server
end

#userUser (readonly)

Returns the user that was banned.

Returns:

  • (User)

    the user that was banned


3690
3691
3692
# File 'lib/discordrb/data.rb', line 3690

def user
  @user
end

Instance Method Details

#remove(reason = nil) ⇒ Object Also known as: unban, lift

Removes this ban on the associated user in the server

Parameters:

  • reason (String) (defaults to: nil)

    the reason for removing the ban


3704
3705
3706
# File 'lib/discordrb/data.rb', line 3704

def remove(reason = nil)
  @server.unban(user, reason)
end