importdb

package
v2.0.0-...-e570596 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cli.Command{
	Name:   "importdb",
	Usage:  "Import messages and guild settings from an old database version",
	Action: run,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:     "from-db",
			Usage:    "URL of old database",
			Required: true,
		},
		&cli.StringFlag{
			Name:     "from-key",
			Usage:    "Encryption key of old database",
			Required: true,
		},
		&cli.StringFlag{
			Name:     "to-db",
			Usage:    "URL of new database",
			Required: true,
		},
		&cli.StringFlag{
			Name:     "to-key",
			Usage:    "Encryption key of new database",
			Required: true,
		},
	},
}

Functions

func InsertNewMessage

func InsertNewMessage(conn *pgx.Conn, key [32]byte, oldMessage OldMessage) (err error)

Types

type Metadata

type Metadata struct {
	UserID   *discord.UserID `json:"user_id,omitempty"`
	Username string          `json:"username,omitempty"`
	Avatar   string          `json:"avatar,omitempty"`
	Embeds   []discord.Embed `json:"embeds,omitempty"`
}

Metadata is optional message metadata

type NewMessage

type NewMessage = db.Message

type NewMetadata

type NewMetadata = db.Metadata

type OldMessage

type OldMessage struct {
	MsgID     discord.MessageID
	UserID    discord.UserID
	ChannelID discord.ChannelID
	ServerID  discord.GuildID

	Content  string
	Username string

	// These are only filled if the message was proxied by PluralKit
	Member *string
	System *string

	Metadata    *Metadata `db:"-"`
	RawMetadata *[]byte   `db:"metadata"`
}

func GetOldMessages

func GetOldMessages(conn *pgx.Conn, key [32]byte, prevMaxID discord.MessageID) (ms []OldMessage, err error)

GetOldMessages gets 1000 messages from the old database

Jump to

Keyboard shortcuts

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