Documentation ¶
Index ¶
- Constants
- Variables
- func DownloadAsset(url string) ([]byte, string, error)
- func DownloadAvatarAsset(url string) ([]byte, error)
- type AssetCounter
- type Category
- type Channel
- type ErrorCodeType
- type ExportedData
- type ExtractedData
- type ImportError
- type ImportProgress
- func (progress *ImportProgress) AddTaskError(task ImportTask, err *ImportError)
- func (progress *ImportProgress) Init(totalChunkCount int, tasks []ImportTask)
- func (progress *ImportProgress) Stop()
- func (progress *ImportProgress) StopTask(task ImportTask)
- func (progress *ImportProgress) UpdateTaskProgress(task ImportTask, value float32)
- func (progress *ImportProgress) UpdateTaskState(task ImportTask, state ImportTaskState)
- type ImportTask
- type ImportTaskProgress
- type ImportTaskState
- type ImportTasks
- type MessageType
Constants ¶
View Source
const MaxImportFileSizeBytes = 52428800
View Source
const MaxTaskErrorItemsCount = 3
Variables ¶
View Source
var ( ErrNoChannelData = errors.New("No channels to import messages from") ErrNoMessageData = errors.New("No messages to import") ErrMarshalMessage = errors.New("Couldn't marshal discord message") ErrImportFileTooBig = fmt.Errorf("File is too big (max. %d MB)", MaxImportFileSizeBytes/1024/1024) )
Functions ¶
func DownloadAvatarAsset ¶ added in v0.114.1
Types ¶
type AssetCounter ¶ added in v0.114.1
type AssetCounter struct {
// contains filtered or unexported fields
}
func (*AssetCounter) Increase ¶ added in v0.114.1
func (c *AssetCounter) Increase()
func (*AssetCounter) Value ¶ added in v0.114.1
func (c *AssetCounter) Value() uint64
type ErrorCodeType ¶ added in v0.114.1
type ErrorCodeType uint
const ( NoErrorType ErrorCodeType = iota + 1 WarningType ErrorType )
type ExportedData ¶
type ExportedData struct { Channel Channel `json:"channel"` Messages []*protobuf.DiscordMessage `json:"messages"` MessageCount int `json:"messageCount"` }
type ExtractedData ¶
type ExtractedData struct { Categories map[string]*Category ExportedData []*ExportedData OldestMessageTimestamp int MessageCount int }
type ImportError ¶
type ImportError struct { // This code is used to distinguish between errors // that are considered "criticial" and those that are not. // // Critical errors are the ones that prevent the imported community // from functioning properly. For example, if the creation of the community // or its categories and channels fails, this is a critical error. // // Non-critical errors are the ones that would not prevent the imported // community from functioning. For example, if the channel data to be imported // has no messages, or is not parsable. Code ErrorCodeType `json:"code"` Message string `json:"message"` TaskInfo string `json:"taskInfo"` }
func Error ¶
func Error(message string) *ImportError
func Warning ¶
func Warning(message string) *ImportError
func (ImportError) Error ¶
func (d ImportError) Error() string
type ImportProgress ¶ added in v0.114.1
type ImportProgress struct { CommunityID string `json:"communityId,omitempty"` CommunityName string `json:"communityName"` CommunityImages map[string]images.IdentityImage `json:"communityImages"` Tasks []*ImportTaskProgress `json:"tasks"` Progress float32 `json:"progress"` ErrorsCount uint `json:"errorsCount"` WarningsCount uint `json:"warningsCount"` Stopped bool `json:"stopped"` TotalChunkCount int `json:"totalChunksCount,omitempty"` CurrentChunk int `json:"currentChunk,omitempty"` // contains filtered or unexported fields }
func (*ImportProgress) AddTaskError ¶ added in v0.114.1
func (progress *ImportProgress) AddTaskError(task ImportTask, err *ImportError)
func (*ImportProgress) Init ¶ added in v0.114.1
func (progress *ImportProgress) Init(totalChunkCount int, tasks []ImportTask)
func (*ImportProgress) Stop ¶ added in v0.114.1
func (progress *ImportProgress) Stop()
func (*ImportProgress) StopTask ¶ added in v0.114.1
func (progress *ImportProgress) StopTask(task ImportTask)
func (*ImportProgress) UpdateTaskProgress ¶ added in v0.114.1
func (progress *ImportProgress) UpdateTaskProgress(task ImportTask, value float32)
func (*ImportProgress) UpdateTaskState ¶ added in v0.114.1
func (progress *ImportProgress) UpdateTaskState(task ImportTask, state ImportTaskState)
type ImportTask ¶ added in v0.114.1
type ImportTask uint
const ( CommunityCreationTask ImportTask = iota + 1 ChannelsCreationTask ImportMessagesTask DownloadAssetsTask InitCommunityTask )
func (ImportTask) String ¶ added in v0.114.1
func (t ImportTask) String() string
type ImportTaskProgress ¶ added in v0.114.1
type ImportTaskState ¶ added in v0.114.1
type ImportTaskState uint
const ( TaskStateInitialized ImportTaskState = iota TaskStateSaving )
func (ImportTaskState) String ¶ added in v0.114.1
func (t ImportTaskState) String() string
type ImportTasks ¶ added in v0.114.1
type ImportTasks map[ImportTask]*ImportTaskProgress
type MessageType ¶
type MessageType string
const ( MessageTypeDefault MessageType = "Default" MessageTypeReply MessageType = "Reply" MessageTypeChannelPinned MessageType = "ChannelPinnedMessage" )
Click to show internal directories.
Click to hide internal directories.