mirror of
https://github.com/IllusionMan1212/gorc.git
synced 2026-10-24 02:12:33 +00:00
feat: small refactor. basic PRIVMSG sending
This commit is contained in:
+14
-4
@@ -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}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user