storage: make constructors more idiomatic

This commit is contained in:
seth 2024-03-03 18:06:40 -05:00
parent 46fd02605f
commit 651f14d724
No known key found for this signature in database
GPG key ID: D31BD0D494BBEE86
5 changed files with 44 additions and 85 deletions

View file

@ -1,7 +1,7 @@
use crate::{api, Data};
use eyre::{Report, Result};
use log::{debug, info};
use log::{debug, info, trace};
use poise::serenity_prelude::{ActivityData, Context, FullEvent, OnlineStatus};
use poise::FrameworkContext;
@ -15,7 +15,7 @@ mod support_onboard;
pub async fn handle(
ctx: &Context,
event: &FullEvent,
_framework: FrameworkContext<'_, Data, Report>,
_: FrameworkContext<'_, Data, Report>,
data: &Data,
) -> Result<()> {
match event {
@ -33,7 +33,7 @@ pub async fn handle(
// ignore new messages from bots
// NOTE: the webhook_id check allows us to still respond to PK users
if new_message.author.bot && new_message.webhook_id.is_none() {
debug!("Ignoring message {} from bot", new_message.id);
trace!("Ignoring message {} from bot", new_message.id);
return Ok(());
}

View file

@ -2,7 +2,7 @@ use crate::{api, Data};
use std::time::Duration;
use eyre::Result;
use log::debug;
use log::{debug, trace};
use poise::serenity_prelude::{Context, Message};
use tokio::time::sleep;
@ -20,14 +20,14 @@ pub async fn is_message_proxied(message: &Message) -> Result<bool> {
Ok(proxied)
}
pub async fn handle(_ctx: &Context, msg: &Message, data: &Data) -> Result<()> {
pub async fn handle(_: &Context, msg: &Message, data: &Data) -> Result<()> {
if msg.webhook_id.is_some() {
debug!(
"Message {} has a webhook ID. Checking if it was sent through PluralKit",
msg.id
);
debug!(
trace!(
"Waiting on PluralKit API for {} seconds",
PK_DELAY_SEC.as_secs()
);