From 29a3bfcbecc99a2ad3137bc6cf1d0ef079c26f72 Mon Sep 17 00:00:00 2001 From: jspc Date: Sun, 20 Jun 2021 22:29:44 +0900 Subject: [PATCH] Do a big ol' banner every morning --- commands.go | 37 +++++++++++++++++++++++++++++++++++++ main.go | 3 +++ 2 files changed, 40 insertions(+) diff --git a/commands.go b/commands.go index 948b143..ce7ae7c 100644 --- a/commands.go +++ b/commands.go @@ -9,6 +9,33 @@ import ( "github.com/lrstanley/girc" ) +const ( + motd = ` +88888888888888 888888 .d8888b. 888 + 888 888 "88b d88P Y88b 888 + 888 888 888 888 888 888 + 888 88888b. .d88b. 888 8888b. 88888b.d88b. .d88b. .d8888b 888 .d88b. 88888b. .d88888888d888 .d88b. 88888b. + 888 888 "88bd8P Y8b 888 "88b888 "888 "88bd8P Y8b88K 888 d88""88b888 "88bd88" 888888P" d88""88b888 "88b + 888 888 88888888888 888.d888888888 888 88888888888"Y8888b. 888 888888 888888 888888 888888 888 888888 888 + 888 888 888Y8b. 88P888 888888 888 888Y8b. X88 Y88b d88PY88..88P888 888Y88b 888888 Y88..88P888 888 + 888 888 888 "Y8888 888"Y888888888 888 888 "Y8888 88888P' "Y8888P" "Y88P" 888 888 "Y88888888 "Y88P" 888 888 + .d88P + .d88P" + 888P" +8888888888 d8b +888 Y8P +888 +8888888 888 88888888b. .d88b. 888d888888 .d88b. 88888b. .d8888b .d88b. +888 Y8bd8P'888 "88bd8P Y8b888P" 888d8P Y8b888 "88bd88P" d8P Y8b +888 X88K 888 88888888888888 88888888888888 888888 88888888 +888 .d8""8b.888 d88PY8b. 888 888Y8b. 888 888Y88b. Y8b. +8888888888888 88888888P" "Y8888 888 888 "Y8888 888 888 "Y8888P "Y8888 + 888 + 888 + 888 +` +) + var ( Vals = TemplateValues{Time: time.Now().In(TZ), Date: time.Now().In(TZ).Format("2006. 01. 02")} ) @@ -60,3 +87,13 @@ func (c Command) Run() { c.irc.Send(e) } + +type DefaultJob struct { + irc *girc.Client +} + +func (d DefaultJob) Run() { + for _, line := range strings.Split(motd, "\n") { + d.irc.Cmd.Message(Chan, line) + } +} diff --git a/main.go b/main.go index a6974b7..1ce31d9 100644 --- a/main.go +++ b/main.go @@ -54,6 +54,9 @@ func main() { panic(err) } + d := DefaultJob{irc: c.bottom.Client} + c.cron.AddJob("0 7 * * *", d) + for _, command := range commands { log.Printf("adding %+v", command)