class MijDiscord::Data::Invite

Attributes

channel[R]
code[R]
inviter[R]
max_uses[R]
online_members[R]
revoked[R]
revoked?[R]
server[R]
temporary[R]
temporary?[R]
total_members[R]
user[R]
uses[R]

Public Class Methods

new(data, bot) click to toggle source
# File lib/mij-discord/data/invite.rb, line 67
def initialize(data, bot)
  @bot = bot

  @channel = InviteChannel.new(data['channel'], bot)
  @server = InviteServer.new(data['guild'], bot)

  @code, @max_uses = data['code'], data['uses']
  @temporary, @revoked = data['temporary'], data['revoked']

  @online_members = data['approximate_presence_count']
  @total_members = data['approximate_member_count']

  @inviter = data['inviter'] ? @bot.cache.put_user(data['inviter']) : nil
end

Public Instance Methods

==(other) click to toggle source
# File lib/mij-discord/data/invite.rb, line 82
def ==(other)
  @code == (other.respond_to?(:code) ? other.code : other)
end
Also aliased as: eql?
delete(reason = nil) click to toggle source
# File lib/mij-discord/data/invite.rb, line 88
def delete(reason = nil)
  MijDiscord::Core::API::Invite.delete(@bot.auth, @code, reason)
end
Also aliased as: revoke
eql?(other)
Alias for: ==
inspect() click to toggle source
# File lib/mij-discord/data/invite.rb, line 98
def inspect
  MijDiscord.make_inspect(self,
    :code, :channel, :server, :max_uses, :temporary, :revoked, :inviter)
end
invite_url() click to toggle source
# File lib/mij-discord/data/invite.rb, line 94
def invite_url
  "https://discord.gg/#{@code}"
end
revoke(reason = nil)
Alias for: delete