~edwargix/tallyard

f3c3f657dca7b148acb48b273b5818e73c171bb2 — David Florness 2 years ago 47dc769
Send human-readable event on election creation
1 files changed, 11 insertions(+), 0 deletions(-)

M ui/tui.go
M ui/tui.go => ui/tui.go +11 -0
@@ 264,10 264,21 @@ func RoomTUI(kill <-chan error, client *mautrix.Client, room *election.Room, ele
		if err != nil {
			return
		}

		err = el.JoinElection(client, electionsMap.EventStore)
		if err != nil {
			return
		}

		body := fmt.Sprintf("Let's vote on:\n\n%s\n\n", title)
		for _, candidate := range candidates {
			body += fmt.Sprintf("- %s\n", candidate)
		}
		body += fmt.Sprintf("\n see tallyard.xyz for joining instructions")
		_, err = client.SendMessageEvent(room.ID, event.EventMessage, event.MessageEventContent{
			MsgType: event.MsgNotice,
			Body:    body,
		})
	})

	app.SetRoot(list, true)