Skip to content

Instantly share code, notes, and snippets.

@matthew-ball
Created June 12, 2014 04:25
Show Gist options
  • Save matthew-ball/11b5367b49c328d23ccd to your computer and use it in GitHub Desktop.
Save matthew-ball/11b5367b49c328d23ccd to your computer and use it in GitHub Desktop.
;; TODO: can achieve this with the chanserv command ...
(defun erc-cmd-OPME ()
"Request ChanServ to put me into operator status."
(let ((chan (erc-default-target))
(nick (erc-current-nick)))
(erc-message "PRIVMSG" (format "chanserv op %s %s" chan nick) nil)))
(defun erc-cmd-DEOPME ()
"Deop me from current channel."
(erc-cmd-DEOP (format "%s" (erc-current-nick))))
;; TODO: can achieve this with the chanserv command ...
(defun erc-cmd-VOICE (nick &optional devoice)
"Apply (de)voice to user."
(let ((chan (erc-default-target)))
(erc-message "PRIVMSG" (format "chanserv %s %s %s" (if devoice "devoice" "voice") chan nick))))
(defun erc-cmd-QUIET (nick &optional unquiet)
"Apply (un)quiet to user."
(let* ((chan (erc-default-target))
(who (erc-get-server-user nick))
(host (erc-server-user-host who)))
(erc-cmd-OPME)
(erc-send-command (format "MODE %s %sq *!*@%s" chan (if unquiet "-" "+") host))
(erc-cmd-DEOPME)))
(defun erc-cmd-BAN (nick &optional unban)
"Ban user NICK from channel specified by `erc-default-target'."
(let* ((chan (erc-default-target))
(who (erc-get-server-user nick))
(host (erc-server-user-host who)))
(erc-send-command (format "MODE %s %sb *!*@%s" chan (if unban "-" "+") host))))
(defun erc-cmd-KICK (nick)
"Kick NICK from channel."
(let ((chan (erc-default-target)))
(erc-send-command (format "KICK %s %s (Kicked)" chan nick))))
(defun erc-cmd-REMOVE (nick)
"Remove user NICK from current ERC channel."
(let ((chan (erc-default-target)))
(erc-send-command (format "REMOVE %s %s Removed" chan nick))))
;; (defun erc-cmd-BANREMOVE (nick)
;; "Remove and ban user NICK from current ERC channel."
;; (erc-cmd-OPME)
;; (erc-cmd-REMOVE nick)
;; (erc-cmd-BAN nick)
;; (erc-cmd-DEOPME))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment