messenger

package
v0.0.0-...-2e419a0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncMessage

type AsyncMessage struct {
	// contains filtered or unexported fields
}

func NewAsyncMessage

func NewAsyncMessage(sendable Sendable) *AsyncMessage

func (*AsyncMessage) Send

func (m *AsyncMessage) Send(discord DiscordSender) (<-chan *discordgo.Message, <-chan error)

type BoostRequestMessenger

type BoostRequestMessenger struct {
	Destroyed bool
	// contains filtered or unexported fields
}

func NewBoostRequestMessenger

func NewBoostRequestMessenger(
	discord *discordgo.Session,
	bundle *i18n.Bundle,
	delayedMessageRepository repository.DelayedMessageRepository,
) *BoostRequestMessenger

func (*BoostRequestMessenger) CancelDelayedMessage

func (messenger *BoostRequestMessenger) CancelDelayedMessage(id int64) error

func (*BoostRequestMessenger) Destroy

func (messenger *BoostRequestMessenger) Destroy()

func (*BoostRequestMessenger) SendAdvertiserChosenDMToAdvertiser

func (messenger *BoostRequestMessenger) SendAdvertiserChosenDMToAdvertiser(
	br *repository.BoostRequest,
) (*discordgo.Message, error)

func (*BoostRequestMessenger) SendAdvertiserChosenDMToRequester

func (messenger *BoostRequestMessenger) SendAdvertiserChosenDMToRequester(
	br *repository.BoostRequest,
) (*discordgo.Message, error)

func (*BoostRequestMessenger) SendAutoSignupMessages

func (messenger *BoostRequestMessenger) SendAutoSignupMessages(
	guildID string,
	userID string,
	expiresAt time.Time,
) ([]*repository.DelayedMessage, <-chan error)

func (*BoostRequestMessenger) SendBackendAdvertiserChosenMessage

func (messenger *BoostRequestMessenger) SendBackendAdvertiserChosenMessage(
	br *repository.BoostRequest,
) ([]*discordgo.Message, error)

func (*BoostRequestMessenger) SendBackendSignupMessage

func (messenger *BoostRequestMessenger) SendBackendSignupMessage(
	br *repository.BoostRequest,
	channelID string,
	buttonConfiguration BackendSignupMessageButtonConfiguration,
) (*discordgo.Message, error)

func (*BoostRequestMessenger) SendBoostRequestCreatedDM

func (messenger *BoostRequestMessenger) SendBoostRequestCreatedDM(br *repository.BoostRequest) (*discordgo.Message, error)

func (*BoostRequestMessenger) SendCreditsUpdateDM

func (messenger *BoostRequestMessenger) SendCreditsUpdateDM(userID string, credits int) (*discordgo.Message, error)

func (*BoostRequestMessenger) SendLogChannelMessage

func (messenger *BoostRequestMessenger) SendLogChannelMessage(
	br *repository.BoostRequest, channelID string,
) (*discordgo.Message, error)

Logs the creation of a boost request to a channel only moderators can view

func (*BoostRequestMessenger) SendPreferredAdvertiserReminder

func (messenger *BoostRequestMessenger) SendPreferredAdvertiserReminder(br *repository.BoostRequest) (*repository.DelayedMessage, <-chan error)

func (*BoostRequestMessenger) SendRoll

func (messenger *BoostRequestMessenger) SendRoll(
	channelID string, br *repository.BoostRequest, rollResults *weighted_picker.WeightedPickerResults[string],
) (*discordgo.Message, error)

type DelayedMessage

type DelayedMessage struct {
	// contains filtered or unexported fields
}

func NewDelayedMessage

func NewDelayedMessage(sendable Sendable, delay time.Duration, cancel <-chan struct{}) *DelayedMessage

func (*DelayedMessage) Send

func (m *DelayedMessage) Send(discord DiscordSender) (*discordgo.Message, error)

type DestinationType

type DestinationType int
const (
	DestinationChannel DestinationType = iota
	DestinationUser
)

type DiscordSender

type DiscordSender interface {
	// contains filtered or unexported methods
}

type DiscordSenderAndDeleter

type DiscordSenderAndDeleter interface {
	DiscordSender
	// contains filtered or unexported methods
}

type Message

type Message struct {
	// contains filtered or unexported fields
}

func NewMessage

func NewMessage(dest *MessageDestination, mg MessageGenerator) *Message

func (*Message) Send

func (m *Message) Send(discord DiscordSender) (*discordgo.Message, error)

type MessageBroker

type MessageBroker struct {
	// contains filtered or unexported fields
}

func NewMessageBroker

func NewMessageBroker(discord DiscordSenderAndDeleter) *MessageBroker

func (*MessageBroker) Destroy

func (mb *MessageBroker) Destroy()

func (*MessageBroker) Send

func (*MessageBroker) SendDelayed

func (mb *MessageBroker) SendDelayed(
	dest *MessageDestination,
	mg MessageGenerator,
	delay time.Duration,
	cancel <-chan struct{},
) (<-chan *discordgo.Message, <-chan error)

func (*MessageBroker) SendTemporaryMessage

func (mb *MessageBroker) SendTemporaryMessage(dest *MessageDestination, mg MessageGenerator, duration time.Duration) (*discordgo.Message, <-chan error)

type MessageDestination

type MessageDestination struct {
	DestinationID     string
	DestinationType   DestinationType
	FallbackChannelID string
}

func (*MessageDestination) ResolveChannelID

func (dest *MessageDestination) ResolveChannelID(discord discordUserChannelCreate) (string, error)

type MessageGenerator

type MessageGenerator interface {
	Message() (*discordgo.MessageSend, error)
}

type Sendable

type Sendable interface {
	Send(discord DiscordSender) (*discordgo.Message, error)
}

Directories

Path Synopsis
Package mock_messenger is a generated GoMock package.
Package mock_messenger is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL