dialogs

package
v0.0.0-...-b0fc717 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const DISCARDED string = "discarded"
View Source
const EDIT_PROMPT_ID data.DialogID = "editprompt"
View Source
const PARENT_NONE int = -1

special parent constants

View Source
const PARENT_RESET int = 0
View Source
const PF_FROM_TELEGRAM int = 1
View Source
const PF_FROM_URL int = 2
View Source
const PF_UNSET int = 0
View Source
const POST_PROMPT_ID data.DialogID = "postprompt"
View Source
const SAVED string = "saved"
View Source
const WAIT_ALL string = "wait_all"
View Source
const WAIT_DESC string = "wait_desc"
View Source
const WAIT_FILE string = "wait_file"
View Source
const WAIT_MODE string = ""

state constants

View Source
const WAIT_PARENT string = "wait_parent"
View Source
const WAIT_RATING string = "wait_rating"
View Source
const WAIT_REASON string = "wait_reason"
View Source
const WAIT_SOURCE string = "wait_source"
View Source
const WAIT_TAGS string = "wait_tags"

Variables

This section is empty.

Functions

func EditPromptID

func EditPromptID() data.DialogID

func GetNameOfState

func GetNameOfState(state string) string

func PostPromptID

func PostPromptID() data.DialogID

Types

type EditFormatter

type EditFormatter struct {
	EditFormatterBase

	Error error
}

func NewEditFormatter

func NewEditFormatter(request_reply bool, err error) EditFormatter

func (EditFormatter) GenerateMarkup

func (this EditFormatter) GenerateMarkup(prompt *EditPrompt) interface{}

func (EditFormatter) GenerateMessage

func (this EditFormatter) GenerateMessage(prompt *EditPrompt) string

func (EditFormatter) Warnings

func (this EditFormatter) Warnings(b *bytes.Buffer, prompt *EditPrompt)

type EditFormatterBase

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

func (EditFormatterBase) WarningsBase

func (this EditFormatterBase) WarningsBase(b *bytes.Buffer, warnings []string)

type EditPrompt

type EditPrompt struct {
	dialog.TelegramDialogPost `json:"-"`

	PostId int    `json:"post_id"`
	Status string `json:"status"`
	State  string `json:"state"`

	// stuff to generate the post info
	TagChanges         tags.TagDiff     `json:"tag_changes"`
	SourceChanges      tags.StringDiff  `json:"source_changes"` // not actually tags, but you can treat them the same.
	OrigSources        map[string]int   `json:"sources_live"`
	SeenSources        map[string]int   `json:"source_seen"`
	SeenSourcesReverse []string         `json:"source_seen_rev"`
	Parent             int              `json:"parent"`
	Rating             types.PostRating `json:"rating"`
	Description        string           `json:"description"`
	File               PostFile         `json:"file"`
	Reason             string           `json:"reason"`
}

func LoadEditPrompt

func LoadEditPrompt(tx storage.DBLike, msg_id data.MsgID, chat_id data.ChatID) (*EditPrompt, error)

func (*EditPrompt) ApplyReset

func (this *EditPrompt) ApplyReset(state string)

func (*EditPrompt) CommitEdit

func (this *EditPrompt) CommitEdit(tx storage.DBLike, user, api_key string, ctx *gogram.MessageCtx) (*types.TPostInfo, error)

func (*EditPrompt) Finalize

func (*EditPrompt) HandleCallback

func (this *EditPrompt) HandleCallback(ctx *gogram.CallbackCtx)

func (*EditPrompt) HandleFreeform

func (this *EditPrompt) HandleFreeform(ctx *gogram.MessageCtx)

func (*EditPrompt) ID

func (this *EditPrompt) ID() data.DialogID

func (*EditPrompt) IsComplete

func (this *EditPrompt) IsComplete() error

func (*EditPrompt) IsNoop

func (this *EditPrompt) IsNoop() bool

func (*EditPrompt) JSON

func (this *EditPrompt) JSON() (string, error)

func (*EditPrompt) ParseArgs

func (this *EditPrompt) ParseArgs(ctx *gogram.MessageCtx) (bool, error)

func (*EditPrompt) PostStatus

func (this *EditPrompt) PostStatus(b *bytes.Buffer)

func (*EditPrompt) Prompt

func (*EditPrompt) ResetState

func (this *EditPrompt) ResetState()

func (*EditPrompt) SeeSource

func (this *EditPrompt) SeeSource(source string)

func (*EditPrompt) SourceButton

func (this *EditPrompt) SourceButton(n int, pick bool)

func (*EditPrompt) SourceStringLiteral

func (this *EditPrompt) SourceStringLiteral(source string, pick bool)

func (*EditPrompt) SourceStringPrefixed

func (this *EditPrompt) SourceStringPrefixed(source string)

type PostFile

type PostFile struct {
	Mode      int         `json:"pf_mode"`
	FileId    data.FileID `json:"pf_tfid"`
	FileName  string      `json:"pf_tfname"`
	Url       string      `json:"pf_furl"`
	SizeBytes int64       `json:"pf_size"`
}

func (*PostFile) Clear

func (this *PostFile) Clear()

func (*PostFile) SetTelegramFile

func (this *PostFile) SetTelegramFile(id data.FileID, name string, size int64)

func (*PostFile) SetUrl

func (this *PostFile) SetUrl(url string, size int64)

type PostFormatter

type PostFormatter struct {
	EditFormatterBase

	Result *api.UploadCallResult
}

func NewPostFormatter

func NewPostFormatter(request_reply bool, result *api.UploadCallResult) PostFormatter

func (PostFormatter) GenerateMarkup

func (this PostFormatter) GenerateMarkup(prompt *PostPrompt) interface{}

func (PostFormatter) GenerateMessage

func (this PostFormatter) GenerateMessage(prompt *PostPrompt) string

func (PostFormatter) Warnings

func (this PostFormatter) Warnings(b *bytes.Buffer, prompt *PostPrompt)

type PostPrompt

type PostPrompt struct {
	dialog.TelegramDialogPost `json:"-"`

	PostId int    `json:"post_id"`
	Status string `json:"status"`
	State  string `json:"state"`

	// stuff to generate the post info
	TagWizard          wizard.TagWizard `json:"tagwiz"`
	Sources            tags.StringSet   `json:"sources"` // not actually tags, but you can treat them the same.
	SeenSources        map[string]int   `json:"source_seen"`
	SeenSourcesReverse []string         `json:"source_seen_rev"`
	Parent             int              `json:"parent"`
	Rating             types.PostRating `json:"rating"`
	Description        string           `json:"description"`
	File               PostFile         `json:"file"`
}

func LoadPostPrompt

func LoadPostPrompt(tx storage.DBLike, msg_id data.MsgID, chat_id data.ChatID, user_id data.UserID, api_user string) (*PostPrompt, error)

func (*PostPrompt) ApplyReset

func (this *PostPrompt) ApplyReset(state string)

func (*PostPrompt) CommitPost

func (this *PostPrompt) CommitPost(user, api_key string, ctx *gogram.MessageCtx) (*api.UploadCallResult, error)

func (*PostPrompt) Finalize

func (*PostPrompt) HandleCallback

func (this *PostPrompt) HandleCallback(ctx *gogram.CallbackCtx)

func (*PostPrompt) HandleFreeform

func (this *PostPrompt) HandleFreeform(ctx *gogram.MessageCtx)

func (*PostPrompt) ID

func (this *PostPrompt) ID() data.DialogID

func (*PostPrompt) IsComplete

func (this *PostPrompt) IsComplete() error

func (*PostPrompt) JSON

func (this *PostPrompt) JSON() (string, error)

func (*PostPrompt) ParseArgs

func (this *PostPrompt) ParseArgs(ctx *gogram.MessageCtx) (bool, error)

func (*PostPrompt) PostStatus

func (this *PostPrompt) PostStatus(b *bytes.Buffer)

func (*PostPrompt) Prompt

func (*PostPrompt) ResetState

func (this *PostPrompt) ResetState()

func (*PostPrompt) SeeSource

func (this *PostPrompt) SeeSource(source string)

func (*PostPrompt) SourceButton

func (this *PostPrompt) SourceButton(n int, pick bool)

func (*PostPrompt) SourceStringLiteral

func (this *PostPrompt) SourceStringLiteral(source string, pick bool)

func (*PostPrompt) SourceStringPrefixed

func (this *PostPrompt) SourceStringPrefixed(source string)

func (*PostPrompt) TestRating

func (this *PostPrompt) TestRating() types.PostRating

Jump to

Keyboard shortcuts

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