mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
Refactor nickserv.go to better support NS HELP and translations
This commit is contained in:
parent
a39c46d470
commit
7b8c4e7e91
3 changed files with 351 additions and 218 deletions
|
|
@ -3,6 +3,19 @@
|
|||
|
||||
package utils
|
||||
|
||||
import "strings"
|
||||
|
||||
// ExtractParam extracts a parameter from the given string, returning the param and the rest of the string.
|
||||
func ExtractParam(line string) (string, string) {
|
||||
rawParams := strings.SplitN(strings.TrimSpace(line), " ", 2)
|
||||
param0 := rawParams[0]
|
||||
var param1 string
|
||||
if 1 < len(rawParams) {
|
||||
param1 = strings.TrimSpace(rawParams[1])
|
||||
}
|
||||
return param0, param1
|
||||
}
|
||||
|
||||
// ArgsToStrings takes the arguments and splits them into a series of strings,
|
||||
// each argument separated by delim and each string bounded by maxLength.
|
||||
func ArgsToStrings(maxLength int, arguments []string, delim string) []string {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue