models

package
v0.0.0-...-eae27d5 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2021 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AL_EVERYONE = 1
	AL_STAFF    = 2
	AL_MOD      = 3
	AL_DEV      = 4
)

Command access levels

View Source
const (
	PlatformTwitter = "twitter"
	PlatformDiscord = "discord"
	PlatformGoogle  = "google"
)
View Source
const (
	EventTypeVerify     = "verify"
	EventTypeInvalidate = "invalidate"
)

Types of verification events

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessKey

type AccessKey struct {
	OID bson.ObjectId `json:"_id" bson:"_id,omitempty"`

	Platform          string `json:"platform" bson:"platform"`
	PlatformUserID    string `json:"platform_user_id" bson:"platform_user_id"`
	AccessToken       string `json:"access_token" bson:"access_token"`
	AccessTokenSecret string `json:"access_token_secret" bson:"access_token_secret"`
}

AccessKey Store access key in a collection that won't be sent to the client

type BTableOptions

type BTableOptions struct {
	Filter      string
	PageSize    int
	CurrentPage int
	Skip        int
	Exclude     []bson.ObjectId
	ExcludeStr  []string
	SortBy      string
	SortDir     int
	Active      bool
}

BTableOptions holds metadata about how to sort and paginate a query for a Bootstrap-Vue table provider

type CommentReference

type CommentReference struct {
	PostID    string `json:"post_id" bson:"post_id"`
	CommentID string `json:"comment_id" bson:"comment_id"`
}

CommentReference post ID + comment ID, the minimum info to identify a comment

type Config

type Config struct {
	SuppressFanboxSweep bool     `bson:"suppress_fanbox_sweep"`
	GoogleCredentials   bson.M   `bson:"google_credentials"`
	AdminTwitterIDs     []string `bson:"admin_twitter_ids"`
	IdolTwitterIDs      []string `bson:"idol_twitter_ids"`
}

Config Config model

func (*Config) TwitterIDIsAdmin

func (con *Config) TwitterIDIsAdmin(twitterID string) bool

TwitterIDIsAdmin Checks the config object for whether the given Twitter ID should be an Admin

func (*Config) TwitterIDIsIdol

func (con *Config) TwitterIDIsIdol(twitterID string) bool

TwitterIDIsIdol Checks the config object for whether the given Twitter ID should be an Idol

type DiscordVerificationEvent

type DiscordVerificationEvent struct {
	OID                  bson.ObjectId `json:"_id" bson:"_id,omitempty"`
	FiredAt              time.Time     `json:"fired_at" bson:"fired_at"`
	Type                 string        `json:"type" bson:"type"`
	PixivHandle          string        `json:"pixiv_handle" bson:"pixiv_handle"`
	DiscordHandle        string        `json:"discord_hanle" bson:"discord_handle"`
	DiscordDiscriminator string        `json:"discord_discriminator" bson:"discord_discriminator"`
	Processed            bool          `json:"processed" bson:"processed"`
}

DiscordVerificationEvent Event representing a change in Discord verification

type FanboxComment

type FanboxComment struct {
	OID             bson.ObjectId   `json:"_id" bson:"_id,omitempty"`
	PostID          string          `json:"post_id" bson:"post_id"` // Not parsed from request, must be applied manually
	ID              string          `json:"id" bson:"id"`
	ParentCommentID string          `json:"parentCommentId" bson:"parentCommentId"`
	RootCommentID   string          `json:"rootCommentId" bson:"rootCommentId"`
	Body            string          `json:"body" bson:"body"`
	CreatedDateTime time.Time       `json:"createdDatetime" bson:"createdDatetime"`
	LikeCount       int             `json:"likeCount" bson:"likeCount"`
	IsLiked         bool            `json:"isLiked" bson:"isLiked"`
	IsOwn           bool            `json:"isOwn" bson:"isOwn"`
	User            FanboxUser      `json:"user" bson:"user"`
	Replies         []FanboxComment `json:"replies" bson:"replies"`
	WasReply        bool            `json:"was_reply" bson:"was_reply"` // Not parsed from request, used to flatten replies
	Deleted         bool            `json:"deleted" bson:"deleted"`     // Not parsed from request, must be applied manually
}

FanboxComment A top level Fanbox comment

func (*FanboxComment) MadeBefore

func (cmnt *FanboxComment) MadeBefore(comp FanboxComment) bool

MadeBefore Check if the receiver comment was made before the parameter comment

func (*FanboxComment) SameAs

func (cmnt *FanboxComment) SameAs(comp FanboxComment) bool

SameAs Check if two comments are the same (by Post ID and Comment ID)

type FanboxPost

type FanboxPost struct {
	OID               bson.ObjectId          `json:"_id" bson:"_id,omitempty"`
	ID                string                 `json:"id" bson:"id"`
	Title             string                 `json:"title" bson:"title"`
	CoverImageURL     string                 `json:"coverImageUrl" bson:"coverImageUrl"`
	FeeRequired       int                    `json:"feeRequired" bson:"feeRequired"`
	PublishedDateTime time.Time              `json:"publishedDatetime" bson:"publishedDatetime"`
	UpdatedDateTime   time.Time              `json:"updatedDatetime" bson:"updatedDatetime"`
	Type              string                 `json:"type" bson:"type"`
	Body              map[string]interface{} `json:"body" bson:"body"`
	Tags              []string               `json:"tags" bson:"tags"`
	Excerpt           string                 `json:"excerpt" bson:"excerpt"`
	IsLiked           bool                   `json:"isLiked" bson:"isLiked"`
	LikeCount         int                    `json:"likeCount" bson:"likeCount"`
	CommentCount      int                    `json:"commentCount" bson:"commentCount"`
	RestrictedFor     int                    `json:"restrictedFor" bson:"restrictedFor"`
	User              FanboxUser             `json:"user" bson:"user"`
	CreatorID         string                 `json:"creatorId" bson:"creatorId"`
	HasAdultContent   bool                   `json:"hasAdultContent" bson:"hasAdultContent"`
	Status            string                 `json:"published" bson:"published"`
}

FanboxPost A Fanbox post

type FanboxResponse

type FanboxResponse struct {
	Body struct {
		Items   []map[string]interface{} `json:"items"`
		NextURL string                   `json:"nextUrl"`
	} `json:"body"`
}

FanboxResponse Response carrying Fanbox objects

type FanboxUser

type FanboxUser struct {
	UserID  string `json:"userId" bson:"userId"`
	Name    string `json:"name" bson:"name"`
	IconURL string `json:"iconUrl" bson:"iconUrl"`

	UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` // Not parsed from request, must be applied manually
}

FanboxUser A Fanbox user

type Session

type Session struct {
	OID bson.ObjectId `json:"_id" bson:"_id,omitempty"`

	UserID    bson.ObjectId `json:"user_id" bson:"user_id"`
	AuthToken string        `json:"auth_token" bson:"auth_token"`

	CreatedAt time.Time `json:"created_at" bson:"created_at"`
}

Session Session model

type Sticky

type Sticky struct {
	OID             bson.ObjectId `json:"_id" bson:"_id,omitempty"`
	AuthorName      string        `json:"author_name" bson:"author_name"`
	AuthorAvatarURL string        `json:"author_avatar_url" bson:"author_avatar_url"`
	ChannelID       string        `json:"channel_id" bson:"channel_id"`
	MessageID       string        `json:"message_id" bson:"message_id"`
	Text            string        `json:"text" bson:"text"`
	Time            time.Time     `json:"time" bson:"time"`
}

type SyncedTweet

type SyncedTweet struct {
	OID              bson.ObjectId `json:"_id" bson:"_id,omitempty"`
	ChannelID        string        `json:"channel_id" bson:"channel_id"`
	MessageID        string        `json:"message_id" bson:"message_id"`
	ControlChannelID string        `json:"control_channel_id" bson:"control_channel_id"`
	ControlMessageID string        `json:"control_message_id" bson:"control_message_id"`
	Tweet            twitter.Tweet `json:"tweet" bson:"tweet"`
	Translation      string        `json:"translation" bson:"translation"`
	CreatedAt        time.Time     `json:"created_at" bson:"created_at"`
	UpdatedAt        time.Time     `json:"updated_at" bson:"updated_at"`
	Translators      []string      `json:"translators" bson:"translators"`
	HumanTranslated  bool          `json:"human_translated" bson:"human_translated"`
}

SyncedTweet Record of a tweet that was echoed from Twitter into Discord

type TwitterVerificationEvent

type TwitterVerificationEvent struct {
	OID           bson.ObjectId `json:"_id" bson:"_id,omitempty"`
	FiredAt       time.Time     `json:"fired_at" bson:"fired_at"`
	Type          string        `json:"type" bson:"type"`
	PixivHandle   string        `json:"pixiv_handle" bson:"pixiv_handle"`
	TwitterHandle string        `json:"twitter_handle" bson:"twitter_handle"`
	Processed     bool          `json:"processed" bson:"processed"`
}

TwitterVerificationEvent Event representing a change in Twitter verification

type UpdateEvent

type UpdateEvent struct {
	UpdatedAt      time.Time `json:"updated_at" bson:"updated_at"`
	Platform       string    `json:"platform" bson:"platform"`
	PreviousHandle string    `json:"previous_handle" bson:"previous_handle"`
	NewHandle      string    `json:"new_handle" bson:"new_handle"`
	UserID         string    `json:"user_id" bson:"user_id"`
}

UpdateEvent record of a verification being updated beyond its original definition (because of a change of handle that is matched to an underlying user ID)

type User

type User struct {
	OID bson.ObjectId `json:"_id" bson:"_id,omitempty"`

	PixivUserID   string `json:"pixiv_user_id" bson:"pixiv_user_id"`
	PixivUserName string `json:"pixiv_user_name" bson:"pixiv_user_name"`
	PixivIconURL  string `json:"pixiv_icon_url" bson:"pixiv_icon_url"`

	TwitterUserID  string `json:"twitter_user_id" bson:"twitter_user_id"`
	TwitterHandle  string `json:"twitter_handle" bson:"twitter_handle"`
	TwitterName    string `json:"twitter_name" bson:"twitter_name"`
	TwitterIconURL string `json:"twitter_icon_url" bson:"twitter_icon_url"`

	DiscordUserID        string `json:"discord_user_id" bson:"discord_user_id"`
	DiscordHandle        string `json:"discord_handle" bson:"discord_handle"`
	DiscordDiscriminator string `json:"discord_discriminator" bson:"discord_discriminator"`
	DiscordIconURL       string `json:"discord_icon_url" bson:"discord_icon_url"`
	DiscordNickName      string `json:"discord_nickname" bson:"discord_nickname"`

	GoogleUserID   string `json:"google_user_id" bson:"google_user_id"`
	YoutubeName    string `json:"youtube_name" bson:"youtube_name"`
	YoutubeIconURL string `json:"youtube_icon_url" bson:"youtube_icon_url"`

	IsAdmin bool `json:"is_admin" bson:"is_admin"`
	IsIdol  bool `json:"is_idol" bson:"is_idol"`
}

User User model

func (*User) Merge

func (u *User) Merge(from User)

Merge Merge all fields (except _id) from the parameter user onto the receiver user

type Verification

type Verification struct {
	OID           bson.ObjectId `json:"_id" bson:"_id,omitempty"`
	PixivUserID   string        `json:"pixiv_user_id" bson:"pixiv_user_id"`
	PixivUserName string        `json:"pixiv_user_name" bson:"pixiv_user_name"`
	PixivIconURL  string        `json:"pixiv_icon_url" bson:"pixiv_icon_url"`

	TwitterHandle  string        `json:"twitter_handle" bson:"twitter_handle"`
	TwitterComment FanboxComment `json:"twitter_comment" bson:"twitter_comment"`

	DiscordHandle        string        `json:"discord_handle" bson:"discord_handle"`
	DiscordDiscriminator string        `json:"discord_discriminator" bson:"discord_discriminator"`
	DiscordComment       FanboxComment `json:"discord_comment" bson:"discord_comment"`

	UpdateLog []UpdateEvent `json:"update_log" bson:"update_log"`
}

Verification record of a parsed verification comment

type WatchedVideo

type WatchedVideo struct {
	OID       bson.ObjectId `json:"_id" bson:"_id,omitempty"`
	VideoID   string        `json:"video_id" bson:"video_id"`
	LastScan  time.Time     `json:"last_scan" bson:"last_scan"`
	ChannelID string        `json:"channel_id" bson:"channel_id"`
}

WatchedVideo Record a video that should be scanned for new comments

type YoutubeComment

type YoutubeComment struct {
	AuthorDisplayName     string
	AuthorProfileImageURL string
	Text                  string
	ReplyDisplayName      string
	ReplyText             string
	UpdatedAt             time.Time
}

type YoutubeStreamRecord

type YoutubeStreamRecord struct {
	OID             bson.ObjectId `json:"_id" bson:"_id,omitempty"`
	PostTitle       string        `json:"post_title" bson:"post_title"`
	PostLink        string        `json:"post_link" bson:"post_link"`
	PostPlan        int           `json:"post_plan" bson:"post_plan"`
	YoutubeID       string        `json:"youtube_id" bson:"youtube_id"`
	Completed       bool          `json:"completed" bson:"completed"`
	ScheduledTime   time.Time     `json:"scheduled_time" bson:"scheduled_time"`
	StreamTitle     string        `json:"stream_title" bson:"stream_title"`
	StreamThumbnail string        `json:"stream_thumbnail" bson:"stream_thumbnail"`
}

YoutubeStreamRecord Record of an upcoming or finished Youtube stream, parsed from Fanbox posts

Jump to

Keyboard shortcuts

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