static

package
v0.0.0-...-b40d7d9 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DIGEST_ERROR_LIMIT = 10

Variables

View Source
var CRITICAL_TASKS = NotionDatabase{
	ID: os.Getenv("NOTION_DATABASE_TASKS_ID"),
	Query: notionapi.DatabaseQuery{
		Filter: &notionapi.DatabaseQueryFilter{
			And: []notionapi.DatabaseQueryFilter{

				{
					Property: "Priority",
					DatabaseQueryPropertyFilter: notionapi.DatabaseQueryPropertyFilter{
						Select: &notionapi.SelectDatabaseQueryFilter{
							Equals: "Critical",
						},
					},
				},

				{
					Property: "Canceled",
					DatabaseQueryPropertyFilter: notionapi.DatabaseQueryPropertyFilter{
						Formula: &notionapi.FormulaDatabaseQueryFilter{
							Checkbox: &notionapi.CheckboxDatabaseQueryFilter{
								Equals: boolPointer(false),
							},
						},
					},
				},

				{
					Property: "Complete",
					DatabaseQueryPropertyFilter: notionapi.DatabaseQueryPropertyFilter{
						Checkbox: &notionapi.CheckboxDatabaseQueryFilter{
							Equals: boolPointer(false),
						},
					},
				},
			},
		},

		Sorts: []notionapi.DatabaseQuerySort{
			{
				Property:  "Effort",
				Direction: notionapi.SortDirDesc,
			},
		},
	},
}
View Source
var MORNING_AFFIRMATIONS_PAGE = os.Getenv("NOTION_PAGE_MORNING_AFFIRMATIONS")
View Source
var NIGHT_AFFIRMATIONS_PAGE = os.Getenv("NOTION_PAGE_NIGHT_AFFIRMATIONS")
View Source
var NORMAL_TASKS = NotionDatabase{
	ID: os.Getenv("NOTION_DATABASE_TASKS_ID"),
	Query: notionapi.DatabaseQuery{
		Filter: &notionapi.DatabaseQueryFilter{
			And: []notionapi.DatabaseQueryFilter{

				{
					Property: "Complete",
					DatabaseQueryPropertyFilter: notionapi.DatabaseQueryPropertyFilter{
						Checkbox: &notionapi.CheckboxDatabaseQueryFilter{
							Equals: boolPointer(false),
						},
					},
				},

				{
					Property: "Canceled",
					DatabaseQueryPropertyFilter: notionapi.DatabaseQueryPropertyFilter{
						Formula: &notionapi.FormulaDatabaseQueryFilter{
							Checkbox: &notionapi.CheckboxDatabaseQueryFilter{
								Equals: boolPointer(false),
							},
						},
					},
				},

				{
					Property: "Priority",
					DatabaseQueryPropertyFilter: notionapi.DatabaseQueryPropertyFilter{
						Select: &notionapi.SelectDatabaseQueryFilter{
							DoesNotEqual: "Critical",
						},
					},
				},
				{
					Or: []notionapi.DatabaseQueryFilter{

						{
							Property: "Rank",
							DatabaseQueryPropertyFilter: notionapi.DatabaseQueryPropertyFilter{
								Formula: &notionapi.FormulaDatabaseQueryFilter{
									Number: &notionapi.NumberDatabaseQueryFilter{
										GreaterThanOrEqualTo: intPointer(5),
									},
								},
							},
						},

						{
							Property: "Date",
							DatabaseQueryPropertyFilter: notionapi.DatabaseQueryPropertyFilter{
								Date: &notionapi.DatePropertyFilter{
									NextWeek: &struct{}{},
								},
							},
						},
						{
							Property: "Date",
							DatabaseQueryPropertyFilter: notionapi.DatabaseQueryPropertyFilter{
								Date: &notionapi.DatePropertyFilter{
									OnOrBefore: timePointer(time.Now()),
								},
							},
						},
					},
				},
			},
		},

		Sorts: []notionapi.DatabaseQuerySort{
			{
				Property:  "Date",
				Direction: notionapi.SortDirAsc,
			},
		},
	},
}
View Source
var RECURRING_TASKS = NotionDatabase{
	ID: os.Getenv("NOTION_DATABASE_RECURRING_ID"),
	Query: notionapi.DatabaseQuery{
		Filter: &notionapi.DatabaseQueryFilter{
			And: []notionapi.DatabaseQueryFilter{

				{
					Property: "Active",
					DatabaseQueryPropertyFilter: notionapi.DatabaseQueryPropertyFilter{
						Checkbox: &notionapi.CheckboxDatabaseQueryFilter{
							Equals: boolPointer(true),
						},
					},
				},

				{
					Property: "Upcoming",
					DatabaseQueryPropertyFilter: notionapi.DatabaseQueryPropertyFilter{
						Formula: &notionapi.FormulaDatabaseQueryFilter{
							Checkbox: &notionapi.CheckboxDatabaseQueryFilter{
								Equals: boolPointer(true),
							},
						},
					},
				},

				{
					Property: "Done",
					DatabaseQueryPropertyFilter: notionapi.DatabaseQueryPropertyFilter{
						Checkbox: &notionapi.CheckboxDatabaseQueryFilter{
							Equals: boolPointer(false),
						},
					},
				},

				{
					Property: "Type",
					DatabaseQueryPropertyFilter: notionapi.DatabaseQueryPropertyFilter{
						Select: &notionapi.SelectDatabaseQueryFilter{
							Equals: "",
						},
					},
				},
			},
		},

		Sorts: []notionapi.DatabaseQuerySort{
			{
				Property:  "Name",
				Direction: notionapi.SortDirAsc,
			},
		},
	},
}
View Source
var SCHEDULE_ITEMS = NotionDatabase{
	ID: os.Getenv("NOTION_DATABASE_SCHEDULE_ID"),
	Query: notionapi.DatabaseQuery{
		Filter: &notionapi.DatabaseQueryFilter{

			Property: "Day",
			DatabaseQueryPropertyFilter: notionapi.DatabaseQueryPropertyFilter{
				Formula: &notionapi.FormulaDatabaseQueryFilter{
					Checkbox: &notionapi.CheckboxDatabaseQueryFilter{
						Equals: boolPointer(true),
					},
				},
			},
		},

		Sorts: []notionapi.DatabaseQuerySort{
			{
				Property:  "Date",
				Direction: notionapi.SortDirAsc,
			},
		},
	},
}

Functions

func Init

func Init() error

Run init functions

func New

func New(services *types.OutreachServices, channels []chan string, raw any) (types.OutreachMessage, error)

New creates a new static message (we don't save these to a DB because they're statically called in implementations)

func NotionDailyDigest

func NotionDailyDigest() string

NotionDailyDigest formats a long, digest string for the user to read with tons of information from Notion

func NotionInit

func NotionInit() error

func NotionMorningAffirmations

func NotionMorningAffirmations() string

NotionMorningAffirmations returns the morning affirmations stored in Notion

func NotionNightAffirmations

func NotionNightAffirmations() string

NotionNightAffirmations returns the night affirmations stored in Notion

func Ping

func Ping() string

Ping is a testing function that sends the user "Ping!"

Types

type Event

type Event struct {
	Start  time.Time
	Format string
	AllDay bool
}

Event type used to hold calendar events for nice formatting

type NotionDatabase

type NotionDatabase struct {
	ID    string
	Query notionapi.DatabaseQuery
}

NotionDatabase type holds a database ID and query to get the database with

type StaticOutreachMessage

type StaticOutreachMessage struct {
	Function func() string // The function that will be called repeatedly
	Channels []chan string // Channels that Horus will send the response to

	Repeat string // The cron string used to repeat calls
	// contains filtered or unexported fields
}

StaticOutreachMessage represents a statically sent message to the user. Static messages repeat on a given interval supplied by a CRON string by calling a custom-built function

func (*StaticOutreachMessage) Delete

func (m *StaticOutreachMessage) Delete() error

func (*StaticOutreachMessage) GetChannels

func (m *StaticOutreachMessage) GetChannels() []chan string

func (*StaticOutreachMessage) GetContent

func (m *StaticOutreachMessage) GetContent() string

func (*StaticOutreachMessage) Start

func (m *StaticOutreachMessage) Start() error

func (*StaticOutreachMessage) Stop

func (m *StaticOutreachMessage) Stop() error

Jump to

Keyboard shortcuts

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