Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/serenity-rs/poise into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
kangalio committed Jan 9, 2023
2 parents 0a03fb9 + a16a897 commit 6c082b5
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
3 changes: 3 additions & 0 deletions src/builtins/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ pub use help::*;
mod register;
pub use register::*;

#[cfg(any(feature = "chrono", feature = "time"))]
mod paginate;
#[cfg(any(feature = "chrono", feature = "time"))]
pub use paginate::*;

use crate::serenity_prelude as serenity;
Expand Down Expand Up @@ -167,6 +169,7 @@ pub async fn on_error<U, E: std::fmt::Display + std::fmt::Debug>(
/// An autocomplete function that can be used for the command parameter in your help function.
///
/// See `examples/framework_usage` for an example
#[allow(clippy::unused_async)] // Required for the return type
pub async fn autocomplete_command<'a, U, E>(
ctx: crate::Context<'a, U, E>,
partial: &'a str,
Expand Down
4 changes: 2 additions & 2 deletions src/dispatch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl<'a, U, E> FrameworkContext<'a, U, E> {
}

/// Retrieves user data
pub async fn user_data(&self) -> &'a U {
pub fn user_data(&self) -> &'a U {
self.user_data
}
}
Expand Down Expand Up @@ -161,7 +161,7 @@ pub async fn dispatch_event<U: Send + Sync, E>(
// Do this after the framework's Ready handling, so that get_user_data() doesnt
// potentially block infinitely
if let Err(error) =
(framework.options.event_handler)(ctx, event, framework, framework.user_data().await).await
(framework.options.event_handler)(ctx, event, framework, framework.user_data()).await
{
let error = crate::FrameworkError::EventHandler {
ctx,
Expand Down
6 changes: 3 additions & 3 deletions src/dispatch/prefix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ async fn strip_prefix<'a, U, E>(
author: &msg.author,
serenity_context: ctx,
framework,
data: framework.user_data().await,
data: framework.user_data(),
};

if let Some(dynamic_prefix) = framework.options.prefix_options.dynamic_prefix {
Expand Down Expand Up @@ -66,7 +66,7 @@ async fn strip_prefix<'a, U, E>(
}

if let Some(dynamic_prefix) = framework.options.prefix_options.stripped_dynamic_prefix {
match dynamic_prefix(ctx, msg, framework.user_data().await).await {
match dynamic_prefix(ctx, msg, framework.user_data()).await {
Ok(result) => {
if let Some((prefix, content)) = result {
return Some((prefix, content));
Expand Down Expand Up @@ -264,7 +264,7 @@ pub async fn parse_invocation<'a, U: Send + Sync, E>(
invoked_command_name,
args,
framework,
data: framework.user_data().await,
data: framework.user_data(),
parent_commands,
command,
invocation_data,
Expand Down
2 changes: 1 addition & 1 deletion src/dispatch/slash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub async fn extract_command_and_run_checks<'a, U, E>(
})?;

let ctx = crate::ApplicationContext {
data: framework.user_data().await,
data: framework.user_data(),
serenity_context: ctx,
framework,
interaction,
Expand Down
12 changes: 7 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#![cfg_attr(doc_nightly, feature(doc_cfg, doc_auto_cfg))]
#![doc(test(attr(deny(deprecated))))]
#![warn(rust_2018_idioms)]
#![warn(missing_docs)]
#![warn(clippy::missing_docs_in_private_items)]
#![allow(clippy::type_complexity)]
// native #[non_exhaustive] is awful because you can't do struct update syntax with it (??)
#![allow(clippy::manual_non_exhaustive)]

#![allow(clippy::type_complexity)]
#![warn(
clippy::missing_docs_in_private_items,
clippy::unused_async,
rust_2018_idioms,
missing_docs
)]
/*!
Poise is an opinionated Discord bot framework with a few distinctive features:
- edit tracking: when user edits their message, automatically update bot response
Expand Down

0 comments on commit 6c082b5

Please sign in to comment.