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, #dm?, #edited?, #embed, #embed?, #embeds, #guild, #guild?, #id, #interaction, #jump_url, #mention_everyone, #message_reference, #pinned, #reactions, #reply?, #stickers, #thread, #tts, #type, #updated_at, #webhook?, #webhook_id

Instance Method Summary collapse

Methods inherited from Message

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

Methods inherited from DiscordModel

#==, #eql?, #inspect

Instance Attribute Details

#channel_id -> Discorb::Snowflake (readonly)

Returns The ID of the channel.

Returns:



325
326
327
# File 'lib/discorb/webhook.rb', line 325

def channel_id
  @channel_id
end

#guild_id -> Discorb::Snowflake (readonly)

Returns The ID of the guild.

Returns:



327
328
329
# File 'lib/discorb/webhook.rb', line 327

def guild_id
  @guild_id
end

Instance Method Details

#delete! -> Async::Task<void>

Deletes the message.

Returns:

  • (Async::Task<void>)

    The task.



364
365
366
367
368
# File 'lib/discorb/webhook.rb', line 364

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

#edit -> Async::Task<void>

Note:

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

Edits the message.

Parameters:

  • message (Discorb::Webhook::Message)

    The message to edit.

  • content (String)

    The new content of the message.

  • embed (Discorb::Embed)

    The new embed of the message.

  • embeds (Array<Discorb::Embed>)

    The new embeds of the message.

  • attachments (Array<Discorb::Attachment>)

    The attachments to remain.

  • file (Discorb::File)

    The file to send.

  • files (Array<Discorb::File>)

    The files to send.

  • allowed_mentions (Discorb::AllowedMentions)

    The allowed mentions to send.

Returns:

  • (Async::Task<void>)

    The task.



352
353
354
355
356
# File 'lib/discorb/webhook.rb', line 352

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