From 0495351b44cc7fc171c98cbcce57e966092ce6a1 Mon Sep 17 00:00:00 2001 From: Hubert Hirtz Date: Wed, 26 Aug 2020 17:27:14 +0200 Subject: Move ui.Home and ui.homeMessages up --- window.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'window.go') diff --git a/window.go b/window.go index 77719f2..a3b7e91 100644 --- a/window.go +++ b/window.go @@ -1,11 +1,32 @@ package senpai import ( + "math/rand" "time" "git.sr.ht/~taiite/senpai/ui" ) +var Home = "home" + +var homeMessages = []string{ + "\x1dYou open an IRC client.", + "Welcome to the Internet Relay Network!", + "DMs & cie go here.", + "May the IRC be with you.", + "Hey! I'm senpai, you everyday IRC student!", + "Student? No, I'm an IRC \x02client\x02!", +} + +func (app *App) initWindow() { + hmIdx := rand.Intn(len(homeMessages)) + app.win.AddBuffer(Home) + app.addLineNow("", ui.Line{ + Head: "--", + Body: homeMessages[hmIdx], + }) +} + func (app *App) addLineNow(buffer string, line ui.Line) { if line.At.IsZero() { line.At = time.Now() -- cgit v1.2.3