mirror of
https://github.com/Xevion/banner.git
synced 2025-12-10 08:06:35 -06:00
Add NewCalendar helper, make timezone string constant, add version constant
This commit is contained in:
11
helpers.go
11
helpers.go
@@ -12,6 +12,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
ics "github.com/arran4/golang-ical"
|
||||||
"github.com/bwmarrin/discordgo"
|
"github.com/bwmarrin/discordgo"
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
log "github.com/rs/zerolog/log"
|
log "github.com/rs/zerolog/log"
|
||||||
@@ -327,3 +328,13 @@ func GetFooter(time time.Time) *discordgo.MessageEmbedFooter {
|
|||||||
Text: fmt.Sprintf("Fetched at %s", time.Format("Monday, January 2, 2006 at 3:04:05PM")),
|
Text: fmt.Sprintf("Fetched at %s", time.Format("Monday, January 2, 2006 at 3:04:05PM")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewCalendar() *ics.Calendar {
|
||||||
|
c := &ics.Calendar{
|
||||||
|
Components: []ics.Component{},
|
||||||
|
CalendarProperties: []ics.CalendarProperty{},
|
||||||
|
}
|
||||||
|
c.SetVersion(Version)
|
||||||
|
c.SetProductId("-//xevion//Banner Discord Bot//EN")
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|||||||
5
main.go
5
main.go
@@ -31,6 +31,9 @@ var (
|
|||||||
centralTime *time.Location
|
centralTime *time.Location
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const Version = "0.0.1"
|
||||||
|
const CentralTimezone = "America/Chicago"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
// Load environment variables
|
// Load environment variables
|
||||||
if err := godotenv.Load(); err != nil {
|
if err := godotenv.Load(); err != nil {
|
||||||
@@ -40,7 +43,7 @@ func init() {
|
|||||||
ctx = context.Background()
|
ctx = context.Background()
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
centralTime, err = time.LoadLocation("America/Chicago")
|
centralTime, err = time.LoadLocation(CentralTimezone)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user