mirror of
https://github.com/IllusionMan1212/gorc.git
synced 2026-10-24 02:12:33 +00:00
WIP: offloading to disk
This commit is contained in:
+6
-19
@@ -17,6 +17,7 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"log"
|
||||
"strings"
|
||||
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
@@ -25,24 +26,6 @@ import (
|
||||
"github.com/illusionman1212/gorc/irc/commands"
|
||||
)
|
||||
|
||||
func handleSlashJoin(params []string, client *irc.Client) tea.Cmd {
|
||||
channel := ""
|
||||
if len(params) > 0 {
|
||||
channel = params[0]
|
||||
}
|
||||
|
||||
for i, c := range client.Channels {
|
||||
if c.Name == channel {
|
||||
client.ActiveChannelIndex = i
|
||||
client.ActiveChannel = channel
|
||||
return cmds.SwitchChannels
|
||||
}
|
||||
}
|
||||
client.SendCommand(commands.JOIN, params...)
|
||||
|
||||
return cmds.SwitchChannels
|
||||
}
|
||||
|
||||
func HandleSlashCommand(msg string, client *irc.Client) tea.Cmd {
|
||||
substrs := strings.Fields(msg[1:])
|
||||
command := strings.ToUpper(substrs[0])
|
||||
@@ -53,10 +36,14 @@ func HandleSlashCommand(msg string, client *irc.Client) tea.Cmd {
|
||||
|
||||
switch command {
|
||||
case commands.JOIN:
|
||||
return handleSlashJoin(params, client)
|
||||
client.SendCommand(commands.JOIN, params...)
|
||||
return cmds.SwitchChannels
|
||||
case commands.QUIT:
|
||||
client.SendCommand(command, params...)
|
||||
return cmds.Quit(client)
|
||||
case "TEST":
|
||||
log.Println("running the spammer")
|
||||
return cmds.Tick(client)
|
||||
default:
|
||||
client.SendCommand(command, params...)
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user