Skip to content

Commit

Permalink
switch to stable poise and clean up tupper import model
Browse files Browse the repository at this point in the history
  • Loading branch information
nomyTx committed Nov 29, 2023
1 parent 127c53c commit cd4b563
Show file tree
Hide file tree
Showing 9 changed files with 236 additions and 94 deletions.
295 changes: 223 additions & 72 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ mime2ext = "0.1.52"
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" }
poise = "0.6.0"
proc-macro2 = "1.0.67"
rand = "0.8.5"
rust-s3 = "0.33.0"
Expand Down
2 changes: 1 addition & 1 deletion src/commands/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pub async fn export(ctx: CommandContext<'_>) -> Result<()> {
};

ctx.send(
CreateReply::new()
CreateReply::default()
.content(
"Exported data! (Warning: This download may not work properly on mobile devices, \
because Discord doesn't know how to program.)",
Expand Down
6 changes: 3 additions & 3 deletions src/commands/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub async fn info(
);
}

ctx.send(CreateReply::new().embed(final_embed)).await?;
ctx.send(CreateReply::default().embed(final_embed)).await?;
} else {
let user = ctx.http().get_user(user_id).await?;

Expand Down Expand Up @@ -115,7 +115,7 @@ pub async fn info(
.collect::<Vec<_>>();

if !mates_content.is_empty() {
let mut reply = CreateReply::new().embed(final_embed.clone().field(
let mut reply = CreateReply::default().embed(final_embed.clone().field(
"Mates",
mates_content[0..=4.min(mates_content.len() - 1)].join("\n"),
false,
Expand Down Expand Up @@ -181,7 +181,7 @@ pub async fn info(
.await?;
}
} else {
ctx.send(CreateReply::new().embed(final_embed)).await?;
ctx.send(CreateReply::default().embed(final_embed)).await?;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/commands/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub async fn stats(ctx: CommandContext<'_>) -> Result<()> {
("Guilds", guild_count.to_string(), false),
]);

ctx.send(CreateReply::new().embed(embed)).await?;
ctx.send(CreateReply::default().embed(embed)).await?;

Ok(())
}
Expand Down Expand Up @@ -72,6 +72,6 @@ pub async fn explain(ctx: CommandContext<'_>) -> Result<()> {
("Why are the bots talking?", "Discord shows webhooks as bots. No, they aren't real bots.", false)
]);

ctx.send(CreateReply::new().embed(embed)).await?;
ctx.send(CreateReply::default().embed(embed)).await?;
Ok(())
}
4 changes: 2 additions & 2 deletions src/commands/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pub async fn autoproxy(
)
.await?;

ctx.send(CreateReply::new().content("Successfully updated your autoproxy settings!"))
ctx.send(CreateReply::default().content("Successfully updated your autoproxy settings!"))
.await?;

return Ok(());
Expand All @@ -107,7 +107,7 @@ pub async fn autoproxy(

update_user_settings(&settings_collection, settings, Some(new_autoproxy)).await?;

ctx.send(CreateReply::new().content("Successfully updated your autoproxy settings!"))
ctx.send(CreateReply::default().content("Successfully updated your autoproxy settings!"))
.await?;

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion src/commands/switch_logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub async fn switch_logs(ctx: CommandContext<'_>) -> Result<()> {

let embed = CreateEmbed::new().title("Last 5 switches").fields(fields);

ctx.send(CreateReply::new().embed(embed)).await?;
ctx.send(CreateReply::default().embed(embed)).await?;
} else {
ctx.say("You have never switched!").await?;
}
Expand Down
8 changes: 3 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,29 +73,27 @@ async fn main() {
commands::admin::admin(),
commands::switch_logs::switch_logs(),
],
event_handler: |event, _framework, data| {
event_handler: |ctx, event, _framework, data| {
Box::pin(async move {
match event {
FullEvent::Ready {
ctx: _,
data_about_bot: _,
} => {
tracing::info!("Bot is ready!")
}
FullEvent::Message { ctx, new_message } => {
FullEvent::Message { new_message } => {
if new_message.content.starts_with(&envvar("PREFIX")) {
events::on_text_command::run(ctx, data, new_message).await?
} else {
events::on_message::run(ctx, data, new_message).await?
}
}
FullEvent::MessageUpdate {
ctx,
old_if_available: _,
new: _,
event,
} => events::on_edit::run(ctx, data, event).await?,
FullEvent::ReactionAdd { ctx, add_reaction } => {
FullEvent::ReactionAdd { add_reaction } => {
events::on_reaction::run(ctx, data, add_reaction).await?
}
_ => {}
Expand Down
7 changes: 0 additions & 7 deletions src/tupperbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,12 @@ pub struct TupperboxExport {
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Tupper {
pub id: i64,
pub user_id: Option<String>,
pub name: String,
pub position: Option<i64>,
pub avatar_url: String,
pub brackets: Vec<String>,
pub posts: i64,
pub show_brackets: bool,
pub birthday: Option<String>,
pub description: Option<String>,
pub tag: Option<String>,
pub group_id: Option<i64>,
pub group_pos: Option<i64>,
pub created_at: Option<String>,
pub nick: Option<String>,
}

Expand Down

0 comments on commit cd4b563

Please sign in to comment.