showfile: serve a text file as its own command (e.g. /RULES), config-driven like aliases

This commit is contained in:
Jean Chevronnet 2026-08-09 23:00:07 +00:00
parent 61584a545b
commit e0d849b4c9
4 changed files with 51 additions and 0 deletions

View file

@ -283,6 +283,11 @@ impl Ircd {
let Some(handler) = self.commands.get(cmd) else {
if registered {
// showfile (m_showfile): config `showfile = <CMD> <path>` streams a
// text file as its own command (e.g. /RULES), like a config-named alias.
if crate::modules::showfile::maybe_show(&mut self.server, uid, cmd) {
return;
}
// command aliases (m_alias): config `alias = <CMD> <target-nick>`
// e.g. `alias = NS NickServ` makes `/NS help` -> PRIVMSG NickServ :help
if let Some(target) = self.server.conf_all("alias").iter().find_map(|line| {