commit d2b79de

delthas  ·  2023-11-13 11:52:20 +0000 UTC
parent e21fa4e
Allow running more commands on the server buffer

Fixes: https://todo.sr.ht/~taiite/senpai/127
1 files changed,  +16, -19
+16, -19
 1@@ -53,17 +53,15 @@ func init() {
 2 			Handle:    commandDoJoin,
 3 		},
 4 		"ME": {
 5-			AllowHome: true,
 6-			MinArgs:   1,
 7-			MaxArgs:   1,
 8-			Usage:     "<message>",
 9-			Desc:      "send an action (reply to last query if sent from home)",
10-			Handle:    commandDoMe,
11+			MinArgs: 1,
12+			MaxArgs: 1,
13+			Usage:   "<message>",
14+			Desc:    "send an action (reply to last query if sent from home)",
15+			Handle:  commandDoMe,
16 		},
17 		"NP": {
18-			AllowHome: true,
19-			Desc:      "send the current song that is being played on the system",
20-			Handle:    commandDoNP,
21+			Desc:   "send the current song that is being played on the system",
22+			Handle: commandDoNP,
23 		},
24 		"MSG": {
25 			AllowHome: true,
26@@ -158,7 +156,7 @@ func init() {
27 			Handle:    commandDoBuffer,
28 		},
29 		"WHOIS": {
30-			AllowHome: false,
31+			AllowHome: true,
32 			MinArgs:   0,
33 			MaxArgs:   1,
34 			Usage:     "<nick>",
35@@ -174,7 +172,7 @@ func init() {
36 			Handle:    commandDoInvite,
37 		},
38 		"KICK": {
39-			AllowHome: false,
40+			AllowHome: true,
41 			MinArgs:   1,
42 			MaxArgs:   2,
43 			Usage:     "<nick> [channel]",
44@@ -182,7 +180,7 @@ func init() {
45 			Handle:    commandDoKick,
46 		},
47 		"BAN": {
48-			AllowHome: false,
49+			AllowHome: true,
50 			MinArgs:   1,
51 			MaxArgs:   2,
52 			Usage:     "<nick> [channel]",
53@@ -190,7 +188,7 @@ func init() {
54 			Handle:    commandDoBan,
55 		},
56 		"UNBAN": {
57-			AllowHome: false,
58+			AllowHome: true,
59 			MinArgs:   1,
60 			MaxArgs:   2,
61 			Usage:     "<nick> [channel]",
62@@ -198,11 +196,10 @@ func init() {
63 			Handle:    commandDoUnban,
64 		},
65 		"SEARCH": {
66-			AllowHome: true,
67-			MaxArgs:   1,
68-			Usage:     "<text>",
69-			Desc:      "search messages in a target",
70-			Handle:    commandDoSearch,
71+			MaxArgs: 1,
72+			Usage:   "<text>",
73+			Desc:    "search messages in a target",
74+			Handle:  commandDoSearch,
75 		},
76 		"SHRUG": {
77 			Desc:   "send a shrug to the current channel ¯\\_(ツ)_/¯",
78@@ -592,7 +589,7 @@ func commandDoWhois(app *App, args []string) (err error) {
79 	}
80 	var nick string
81 	if len(args) == 0 {
82-		if s.IsChannel(channel) {
83+		if channel == "" || s.IsChannel(channel) {
84 			return fmt.Errorf("either send this command from a DM, or specify the user")
85 		}
86 		nick = channel