api

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DiscordToken                        = os.Getenv("DISCORD_TOKEN")
	DiscordChannel                      = os.Getenv("DISCORD_CHANNEL")
	TriggerWordMattermost               = os.Getenv("TRIGGER_WORD_MATTERMOST")
	MattermostToken                     = os.Getenv("MATTERMOST_TOKEN")
	DiscordTokenMissingMessage          = "No discord token provided!"
	DiscordChannelMissingMessage        = "No discord channel provided!"
	MattermostTriggerwordMissingMessage = "No trigger word provided!"
)

Functions

func HandleBotError

func HandleBotError(context *gin.Context)

func PanicIfDiscordBotMissesInformation

func PanicIfDiscordBotMissesInformation()

func SetupServer

func SetupServer() *gin.Engine

Types

type Bot

type Bot interface {
	SendMessage(context *gin.Context)
	GetPayload(context *gin.Context) Payload
	GetContent(payload Payload) Content
}

The interface to be implemented by the DiscordBot and the MattermostBot

type Content

type Content struct {
	User    string
	Message string
}

type DiscordAPICheck

type DiscordAPICheck struct {
	Status *DiscordStatus `json:"status"`
}

type DiscordBot

type DiscordBot struct {
	Session *discordgo.Session
}

func CreateDiscordBot

func CreateDiscordBot() *DiscordBot

func (*DiscordBot) GetContent

func (*DiscordBot) GetContent(payload Payload) Content

func (*DiscordBot) GetPayload

func (*DiscordBot) GetPayload(context *gin.Context) Payload

func (*DiscordBot) SendMessage

func (bot *DiscordBot) SendMessage(context *gin.Context)

type DiscordPayload

type DiscordPayload struct{}

type DiscordStatus

type DiscordStatus struct {
	Indicator   string `json:"indicator"`
	Description string `json:"description"`
}

type MattermostPayload

type MattermostPayload struct {
	Text     string `json:"text"`
	Username string `json:"user_name"`
	UserID   string `json:"user_id"`
	Token    string `json:"token"`
}

type Payload

type Payload struct {
	*DiscordPayload
	*MattermostPayload
}

Jump to

Keyboard shortcuts

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