BotServ: add SAY and ACT
The channel's assigned bot can now speak: SAY <#channel> <text> and ACT <#channel> <text> (CTCP ACTION), gated on channel-operator access. Bots are tracked in the network view so uid_by_nick resolves them, and the message is sourced from the bot's own uid via a new ServiceCtx::privmsg.
This commit is contained in:
parent
6a37d010b8
commit
c7d05a8b77
5 changed files with 129 additions and 4 deletions
|
|
@ -178,6 +178,16 @@ impl ServiceCtx {
|
|||
});
|
||||
}
|
||||
|
||||
// A channel/target message sourced from one of our pseudo-clients (e.g. a
|
||||
// bot answering a fantasy command, or BotServ SAY).
|
||||
pub fn privmsg(&mut self, from: &str, to: &str, text: impl Into<String>) {
|
||||
self.actions.push(NetAction::Privmsg {
|
||||
from: from.to_string(),
|
||||
to: to.to_string(),
|
||||
text: text.into(),
|
||||
});
|
||||
}
|
||||
|
||||
// Hand a registration to the engine to finish: its password derivation runs
|
||||
// off the reactor, then the engine commits it and answers `reply`.
|
||||
pub fn defer_register(&mut self, account: impl Into<String>, password: impl Into<String>, email: Option<String>, reply: RegReply) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue