feat: small refactor. basic PRIVMSG sending

This commit is contained in:
2022-01-05 00:54:54 +02:00
parent 327f59a14c
commit 1168a2a4dd
6 changed files with 134 additions and 66 deletions
+14 -4
View File
@@ -22,16 +22,16 @@ import (
tea "github.com/charmbracelet/bubbletea"
)
type ReceivedIRCCommandMsg struct {
Msg string
}
type InitialReadMsg struct{}
func InitialRead() tea.Msg {
return InitialReadMsg{}
}
type ReceivedIRCCommandMsg struct {
Msg string
}
func (s State) readFromServer() tea.Msg {
msg, err := s.Reader.ReadString('\n')
if err != nil {
@@ -40,3 +40,13 @@ func (s State) readFromServer() tea.Msg {
return ReceivedIRCCommandMsg{Msg: msg}
}
type SendPrivMsg struct {
Msg string
}
func (s InputState) SendingPrivMsg(msg string) tea.Cmd {
return func() tea.Msg {
return SendPrivMsg{Msg: msg}
}
}