Skip to content

Commit

Permalink
Use dedicated types for GuildId::audit_logs (#2623)
Browse files Browse the repository at this point in the history
Fixes #2488
  • Loading branch information
GnomedDev authored Nov 26, 2023
1 parent 7454868 commit bc2a5b5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/http/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2576,14 +2576,14 @@ impl Http {
pub async fn get_audit_logs(
&self,
guild_id: GuildId,
action_type: Option<u8>,
action_type: Option<audit_log::Action>,
user_id: Option<UserId>,
before: Option<u64>,
before: Option<AuditLogEntryId>,
limit: Option<u8>,
) -> Result<AuditLogs> {
let mut params = vec![];
if let Some(action_type) = action_type {
params.push(("action_type", action_type.to_string()));
params.push(("action_type", action_type.num().to_string()));
}
if let Some(before) = before {
params.push(("before", before.to_string()));
Expand Down
6 changes: 2 additions & 4 deletions src/model/guild/guild_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,12 @@ impl GuildId {
pub async fn audit_logs(
self,
http: impl AsRef<Http>,
action_type: Option<u8>,
action_type: Option<audit_log::Action>,
user_id: Option<UserId>,
before: Option<AuditLogEntryId>,
limit: Option<u8>,
) -> Result<AuditLogs> {
http.as_ref()
.get_audit_logs(self, action_type, user_id, before.map(AuditLogEntryId::get), limit)
.await
http.as_ref().get_audit_logs(self, action_type, user_id, before, limit).await
}

/// Gets all of the guild's channels over the REST API.
Expand Down
2 changes: 1 addition & 1 deletion src/model/guild/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ impl Guild {
pub async fn audit_logs(
&self,
http: impl AsRef<Http>,
action_type: Option<u8>,
action_type: Option<audit_log::Action>,
user_id: Option<UserId>,
before: Option<AuditLogEntryId>,
limit: Option<u8>,
Expand Down
2 changes: 1 addition & 1 deletion src/model/guild/partial_guild.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ impl PartialGuild {
pub async fn audit_logs(
&self,
http: impl AsRef<Http>,
action_type: Option<u8>,
action_type: Option<audit_log::Action>,
user_id: Option<UserId>,
before: Option<AuditLogEntryId>,
limit: Option<u8>,
Expand Down

0 comments on commit bc2a5b5

Please sign in to comment.