backend

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TopGG = BotList{
		Name:         "top_gg",
		URL:          "https://top.gg",
		BotURL:       "/dbot/%s",
		VoteCooldown: 12 * time.Hour,
	}
	BotListSpace = BotList{
		Name:         "botlist_space",
		URL:          "https://botlist.space",
		BotURL:       "/dbot/%s",
		VoteCooldown: 24 * time.Hour,
	}
	DiscordBotsGG = BotList{
		Name:   "discord_bots_gg",
		URL:    "https://botlist.space",
		BotURL: "/bots/%s",
	}
	DiscordExtremeListXYZ = BotList{
		Name:   "discord_extreme_list_xyz",
		URL:    "https://discordextremelist.xyz",
		BotURL: "/bots/%s",
	}
	BotsForDiscordCom = BotList{
		Name:         "bots_for_discord_com",
		URL:          "https://botsfordiscord.com",
		BotURL:       "/dbot/%s",
		VoteCooldown: 24 * time.Hour,
	}
	DiscordBotListCom = BotList{
		Name:         "discord_bot_list_com",
		URL:          "https://discordbotlist.com",
		BotURL:       "/bots/%s",
		VoteCooldown: 12 * time.Hour,
	}
	DiscordservicesNet = BotList{
		Name:         "discordservices_net",
		URL:          "https://discordservices.net",
		BotURL:       "/dbot/%s",
		VoteCooldown: 12 * time.Hour,
	}
)

Functions

This section is empty.

Types

type Backend

type Backend struct {
	Logger        log.Logger
	DB            db.DB
	Rest          rest.Rest
	PrometheusAPI v1.API
	HTTPServer    *http.Server
	Scheduler     chrono.TaskScheduler
	Commands      []discord.ApplicationCommandCreate
	Config        Config
	Version       string
}

func (*Backend) AddVote

func (b *Backend) AddVote(userID snowflake.ID, botList BotList, multiplier int) error

func (*Backend) LoadCommands

func (b *Backend) LoadCommands(commands ...handler.Command)

func (*Backend) SetupPrometheusAPI

func (b *Backend) SetupPrometheusAPI() error

func (*Backend) SetupRestServices

func (b *Backend) SetupRestServices()

func (*Backend) SetupScheduler

func (b *Backend) SetupScheduler() error

func (*Backend) SetupServer

func (b *Backend) SetupServer(handler http.Handler)

func (*Backend) VoteTask

func (b *Backend) VoteTask(ctx context.Context)

type BotList

type BotList struct {
	Name         string
	URL          string
	BotURL       string
	VoteCooldown time.Duration
}

type BotListsConfig

type BotListsConfig struct {
	VoterRoleID snowflake.ID      `json:"voter_role_id"`
	Tokens      map[string]string `json:"tokens"`
}

type Config

type Config struct {
	config.Config
	Address string `json:"address"`

	BotLists BotListsConfig `json:"bot_lists"`

	BotInvite          string `json:"bot_invite"`
	GuildInvite        string `json:"guild_invite"`
	PrometheusEndpoint string `json:"prometheus_endpoint"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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