Add documentation for the PrefixGetter trait

This commit is contained in:
2025-08-13 14:54:35 -03:00
parent 7b3fa9905a
commit c284ede5b4
+15
View File
@@ -27,8 +27,23 @@ pub enum RuntimeError {
ApplicationFetchingFailed,
}
/// Getter trait for command prefixes.
#[async_trait]
pub trait PrefixGetter<T> {
/// Get the command prefixes for the given server and user IDs.
///
/// The getter must never fail. In case an internal process does, it must fall back to default
/// prefixes.
///
/// Arguments:
/// * `runtime` - The application [`Runtime`].
/// * `server_id` - The server ID in which the command, interaction, or event is running.
/// * `user_id` - The user ID who triggered the command, interaction, or event.
///
/// Returns:
/// [`Vec<String>`] - A list of command prefixes. When matching for commands, all these
/// prefixes should be checked against, as they're all valid. In case one should be picked, the
/// first one will always be the safest choice.
async fn get(
&self,
runtime: &Runtime<T>,