Skip to content

Commit

Permalink
update ( i think)�
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruthenic committed Oct 22, 2023
1 parent d457ae6 commit dd0f538
Show file tree
Hide file tree
Showing 8 changed files with 463 additions and 656 deletions.
1,090 changes: 452 additions & 638 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ mongodb = { version = "2.4.0", features = ["bson-chrono-0_4"] }
once_cell = "1.17.1"
orderless = "0.1.5"
poise = { git = "https://github.com/serenity-rs/poise", branch = "serenity-next" }
proc-macro2 = "1.0.67"
rand = "0.8.5"
rust-s3 = "0.33.0"
secrecy = "0.8.0"
Expand Down
2 changes: 1 addition & 1 deletion src/commands/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::num::NonZeroU64;

use anyhow::{Context, Result};
use mongodb::bson::doc;
use poise::serenity_prelude::{CacheHttp, MessageId};
use poise::serenity_prelude::MessageId;

use super::{autocomplete::mate as mate_autocomplete, CommandContext};
use crate::{
Expand Down
2 changes: 1 addition & 1 deletion src/commands/edit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::num::NonZeroU64;

use anyhow::{Context, Result};
use mongodb::bson::doc;
use poise::serenity_prelude::{self as serenity, CacheHttp, EditWebhookMessage, MessageId};
use poise::serenity_prelude::{self as serenity, EditWebhookMessage, MessageId};

use super::{autocomplete::mate as mate_autocomplete, CommandContext};
use crate::{
Expand Down
6 changes: 3 additions & 3 deletions src/commands/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use mongodb::bson::doc;
use poise::{
serenity_prelude::{
self as serenity, collector::ComponentInteractionCollector, futures::stream::StreamExt,
CacheHttp, CreateActionRow, CreateButton, CreateEmbed, CreateInteractionResponse,
CreateActionRow, CreateButton, CreateEmbed, CreateInteractionResponse,
CreateInteractionResponseMessage, UserId,
},
CreateReply,
Expand Down Expand Up @@ -134,7 +134,7 @@ pub async fn info(
return Ok(());
}

let mut collector = ComponentInteractionCollector::new(&ctx.discord().shard)
let mut collector = ComponentInteractionCollector::new(&ctx.serenity_context().shard)
.timeout(Duration::from_secs(300))
.filter(move |press| press.data.custom_id.starts_with(&ctx_id.to_string()))
.stream();
Expand All @@ -152,7 +152,7 @@ pub async fn info(

press
.create_response(
ctx.cache_and_http(),
ctx,
CreateInteractionResponse::UpdateMessage(
CreateInteractionResponseMessage::new().embed(
final_embed.clone().field(
Expand Down
11 changes: 3 additions & 8 deletions src/commands/misc.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
use anyhow::{Context, Result};
use anyhow::Result;
use chrono::Utc;
use mongodb::bson::doc;
use poise::{
serenity_prelude::{CacheHttp, CreateEmbed},
CreateReply,
};
use poise::{serenity_prelude::CreateEmbed, CreateReply};

use super::CommandContext;
use crate::{models::DBMate, utils::misc::envvar};
Expand All @@ -15,9 +12,7 @@ pub async fn stats(ctx: CommandContext<'_>) -> Result<()> {
let database = &ctx.data().database;
let mates_collection = database.collection::<DBMate>("mates");

let cache = ctx
.cache()
.context("Failed to get bot cache; try again later!")?;
let cache = ctx.cache();

let user_count = mates_collection
.distinct("user_id", None, None)
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ async fn main() {
commands::admin::admin(),
commands::switch_logs::switch_logs(),
],
listener: |event, _framework, data| {
event_handler: |event, _framework, data| {
Box::pin(async move {
match event {
FullEvent::Ready {
Expand Down
5 changes: 1 addition & 4 deletions src/utils/user_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ use mongodb::{
bson::{self, doc},
Collection,
};
use poise::{
futures_util::TryStreamExt,
serenity_prelude::{Message, UserId},
};
use poise::serenity_prelude::{Message, UserId};

use crate::models::{AutoproxySettings, DBUserSettings, Latch};

Expand Down

0 comments on commit dd0f538

Please sign in to comment.