Add more irc commands

This commit is contained in:
Nick Chambers 2021-07-12 00:41:59 -05:00 committed by Nick Chambers
parent 9088b4f799
commit 68258b65ee
1 changed files with 36 additions and 0 deletions

36
rowbot
View File

@ -629,6 +629,24 @@ irc_nick() {
net_send "NICK :%s" "$1"
}
irc_notice() {
local msg=$2 msg_len
if [[ -v config[host] ]]; then
(( msg_len = 494 - (${#config[nick]} + ${#config[ident]} + ${#config[host]} + ${#1}) ))
log_debug "max message length is %d" "$msg_len"
while (( ${#msg} > msg_len )); do
net_send "NOTICE %s :"$'\xe2\x80\x8b'"%s" "$1" "${msg:0:$msg_len}"
log_info "[%s/%s] %s" "${config[nick]}" "$1" "${msg:0:$msg_len}"
msg=${msg:$msg_len}
done
fi
net_send "NOTICE %s :"$'\xe2\x80\x8b'"%s" "$1" "$msg"
log_info "[%s/%s] %s" "${config[nick]}" "$1" "$msg"
}
irc_ping() {
net_send "PING :%s" "$1"
}
@ -667,6 +685,24 @@ irc_who() {
fi
}
irc_part() {
if (( $# )); then
if (( $# > 1 )); then
net_send "PART $1 :$2"
else
net_send "PART $1"
fi
fi
}
irc_quit() {
if (( $# )); then
net_send "QUIT :%s" "$1"
else
net_send QUIT
fi
}
###
# plugin api
###