story-kit: merge 352_bug_ambient_on_off_command_not_intercepted_by_bot_after_refactors
This commit is contained in:
@@ -52,9 +52,6 @@ pub struct CommandDispatch<'a> {
|
||||
pub ambient_rooms: &'a Arc<Mutex<HashSet<String>>>,
|
||||
/// The room this message came from (needed by ambient).
|
||||
pub room_id: &'a str,
|
||||
/// Whether the message directly addressed the bot (mention/reply).
|
||||
/// Some commands (e.g. ambient) only operate when directly addressed.
|
||||
pub is_addressed: bool,
|
||||
}
|
||||
|
||||
/// Context passed to individual command handlers.
|
||||
@@ -71,9 +68,6 @@ pub struct CommandContext<'a> {
|
||||
pub ambient_rooms: &'a Arc<Mutex<HashSet<String>>>,
|
||||
/// The room this message came from (needed by ambient).
|
||||
pub room_id: &'a str,
|
||||
/// Whether the message directly addressed the bot (mention/reply).
|
||||
/// Some commands (e.g. ambient) only operate when directly addressed.
|
||||
pub is_addressed: bool,
|
||||
}
|
||||
|
||||
/// Returns the full list of registered bot commands.
|
||||
@@ -171,7 +165,6 @@ pub fn try_handle_command(dispatch: &CommandDispatch<'_>, message: &str) -> Opti
|
||||
agents: dispatch.agents,
|
||||
ambient_rooms: dispatch.ambient_rooms,
|
||||
room_id: dispatch.room_id,
|
||||
is_addressed: dispatch.is_addressed,
|
||||
};
|
||||
|
||||
commands()
|
||||
@@ -291,7 +284,6 @@ pub(crate) mod tests {
|
||||
bot_user_id: &str,
|
||||
message: &str,
|
||||
ambient_rooms: &Arc<Mutex<HashSet<String>>>,
|
||||
is_addressed: bool,
|
||||
) -> Option<String> {
|
||||
let agents = test_agents();
|
||||
let room_id = "!test:example.com".to_string();
|
||||
@@ -302,13 +294,12 @@ pub(crate) mod tests {
|
||||
agents: &agents,
|
||||
ambient_rooms,
|
||||
room_id: &room_id,
|
||||
is_addressed,
|
||||
};
|
||||
try_handle_command(&dispatch, message)
|
||||
}
|
||||
|
||||
pub fn try_cmd_addressed(bot_name: &str, bot_user_id: &str, message: &str) -> Option<String> {
|
||||
try_cmd(bot_name, bot_user_id, message, &test_ambient_rooms(), true)
|
||||
try_cmd(bot_name, bot_user_id, message, &test_ambient_rooms())
|
||||
}
|
||||
|
||||
// Re-export commands() for submodule tests
|
||||
|
||||
Reference in New Issue
Block a user