Class: Discorb::Webhook::Message

Inherits:
Message show all
Defined in:
lib/discorb/webhook.rb

Overview

Represents a webhook message.

Defined Under Namespace

Classes: Author

Instance Attribute Summary collapse

Attributes inherited from Message

#activity, #application_id, #attachments, #author, #channel, #components, #content, #created_at, #deleted, #edited?, #embed, #embeds, #guild, #id, #interaction, #jump_url, #mention_everyone, #message_reference, #pinned, #reactions, #stickers, #thread, #tts, #type, #updated_at, #webhook?, #webhook_id

Instance Method Summary collapse

Methods inherited from Message

#add_reaction, #fetch_reacted_users, #flag, #inspect, #pin, #publish, #remove_reaction, #remove_reaction_of, #reply, #start_thread, #to_reference, #unpin

Methods inherited from DiscordModel

#==, #eql?, #hash

Instance Attribute Details

#channel_id -> Discorb::Snowflake (readonly)

Returns The ID of the channel.

Returns:



298
299
300
# File 'lib/discorb/webhook.rb', line 298

def channel_id
  @channel_id
end

#guild_id -> Discorb::Snowflake (readonly)

Returns The ID of the guild.

Returns:



300
301
302
# File 'lib/discorb/webhook.rb', line 300

def guild_id
  @guild_id
end

Instance Method Details

#delete! -> Object

Note:

This is an asynchronous method, it will return a Async::Task object. Use Async::Task#wait to get the result.

Note:

This method calls HTTP request.

Deletes the message.

Raises:



329
330
331
332
333
# File 'lib/discorb/webhook.rb', line 329

def delete!
  Async do
    @webhook.delete_message!(self).wait
  end
end

#edit -> Object

Note:

This is an asynchronous method, it will return a Async::Task object. Use Async::Task#wait to get the result.

Note:

This method calls HTTP request.

Note:

The arguments of this method are defaultly set to :unset. Specify value to set the value, if not don't specify or specify :unset.

Edits the message.

Parameters:

Raises:



318
319
320
321
322
# File 'lib/discorb/webhook.rb', line 318

def edit(...)
  Async do
    @webhook.edit_message(self, ...).wait
  end
end