Messageable

public protocol Messageable : PayloadType

A generic message used in GlobalEvents.

  • Channel this message was sent in. Can be downcast to backend specific type.

    Declaration

    Swift

    var gChannel: Channelable { get }
  • Content of the message.

    Declaration

    Swift

    var content: String { get }
  • Author of the message. Can be downcast to the backend specific type.

    Declaration

    Swift

    var gAuthor: Userable { get }
  • Send a message back to the received message.

    let message: Messageable = ... // !ping
    mesasge.reply("Pong!")
    

    Declaration

    Swift

    @discardableResult
    func reply(_ content: String) -> EventLoopFuture<Messageable>

    Parameters

    content

    Content to reply with.

    Return Value

    The created message.

  • Update a message to new content.

    let message: Messageable = ... // This message will self destruct.
    message.edit("Self destruct complete.")
    

    Declaration

    Swift

    @discardableResult
    func edit(_ content: String) -> EventLoopFuture<Messageable>

    Parameters

    content

    Content to update the message to.

    Return Value

    The updated message.

  • Deletes the message.

    Declaration

    Swift

    @discardableResult
    func delete() -> EventLoopFuture<Void>
  • error(_:on:) Default implementation

    Sends an error that occured on a command.

    Override this to add custom formatting to error messages. A default implementation is supplied.

    Default Implementation

    Declaration

    Swift

    func error(_ error: Error, on command: _ExecutableCommand)

    Parameters

    error

    The error that occured. Usually a CommandError.

    command

    The command that the error occured on.