Skip to content

Message Utils #2

Description

@SelfMadeSystem

Message utils

Message utils is a collection of functions and classes that help you to create and send messages.

MessageBuilder

MessageBuilder is a class that helps you build messages.
It has a fluent interface and can be used to create easily complex messages.
It is used by MessageSender.

MessageSender

MessageSender is a class that helps you to send messages.


What these should roughly look like:

interface MessageBuilder {
    setContent(content: string): MessageBuilder;
    setTTS(tts: boolean): MessageBuilder;
    setAllowMentions(allowMentions: boolean): MessageBuilder;
    addEmbed(embed: MessageEmbed): MessageBuilder;
    addAttachment(attachment: MessageAttachment): MessageBuilder;
    addAction(action: MessageActionRow): MessageBuilder;
    setEphemeral(ephemeral: boolean): MessageBuilder; // Use only from MessageSender.replyEphemeral
}

interface MessageSender {
    send(channel: TextBasedChannel, message: MessageBuilder): Promise<Message>;
    reply(replyTo: Snowflake | MessageInteraction, message: MessageBuilder): Promise<Message>;
    replyEphemeral(interaction: MessageInteraction, message: MessageBuilder): Promise<Message>;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions