Class: Discorb::AllowedMentions

Inherits:
Object
  • Object
show all
Defined in:
lib/discorb/message.rb

Overview

Represents a allowed mentions in a message.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(everyone: nil, roles: nil, users: nil, replied_user: nil) -> AllowedMentions

Initializes a new instance of the AllowedMentions class.

Parameters:

  • everyone (Boolean) (defaults to: nil)

    Whether to allow @everyone or @here.

  • roles (Boolean, Array<Discorb::Role>) (defaults to: nil)

    The roles to allow, or false to disable.

  • users (Boolean, Array<Discorb::User>) (defaults to: nil)

    The users to allow, or false to disable.

  • replied_user (Boolean) (defaults to: nil)

    Whether to ping the user that sent the message to reply.



25
26
27
28
29
30
# File 'lib/discorb/message.rb', line 25

def initialize(everyone: nil, roles: nil, users: nil, replied_user: nil)
  @everyone = everyone
  @roles = roles
  @users = users
  @replied_user = replied_user
end

Instance Attribute Details

#everyone -> Boolean

Returns Whether to allow @everyone or @here.

Returns:

  • (Boolean)

    Whether to allow @everyone or @here.



9
10
11
# File 'lib/discorb/message.rb', line 9

def everyone
  @everyone
end

#replied_user -> Boolean

Returns Whether to ping the user that sent the message to reply.

Returns:

  • (Boolean)

    Whether to ping the user that sent the message to reply.



15
16
17
# File 'lib/discorb/message.rb', line 15

def replied_user
  @replied_user
end

#roles -> Boolean, Array<Discorb::Role>

Returns The roles to allow, or false to disable.

Returns:

  • (Boolean, Array<Discorb::Role>)

    The roles to allow, or false to disable.



11
12
13
# File 'lib/discorb/message.rb', line 11

def roles
  @roles
end

#users -> Boolean, Array<Discorb::User>

Returns The users to allow, or false to disable.

Returns:

  • (Boolean, Array<Discorb::User>)

    The users to allow, or false to disable.



13
14
15
# File 'lib/discorb/message.rb', line 13

def users
  @users
end

Instance Method Details

#nil_merge(*args) -> Object



54
55
56
57
58
59
# File 'lib/discorb/message.rb', line 54

def nil_merge(*args)
  args.each do |a|
    return a unless a.nil?
  end
  nil
end