Skip to content

Commit

Permalink
Fix things up to new versions, get myself ready to get this all updat…
Browse files Browse the repository at this point in the history
…ed to newer serenity libs.
  • Loading branch information
tmcarr committed Apr 16, 2024
1 parent d22c759 commit 27f461f
Show file tree
Hide file tree
Showing 12 changed files with 135 additions and 48 deletions.
5 changes: 5 additions & 0 deletions .idea/discord.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

129 changes: 106 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ repository = "https://github.com/tmcarr/testbot"

[dependencies]
# env_logger = "0.9.0"
log = "0.4.20"
rand = "0.8.5"
log = "0.4.21"
rand = "0.9.0-alpha.1"
# migrant_lib = "0.33.0"
reqwest = { version = "0.12.2", features = ["blocking", "json"] }
serde = { version = "1.0.188", features = ["derive"] }
serde_json = "1.0.105"
tokio = { version = "1.32.0", features = ["macros", "rt-multi-thread", "time"] }
tracing = "0.1.37"
tracing-subscriber = { version = "0.3.17", features = ["std", "env-filter"] }
reqwest = { version = "0.12.3", features = ["blocking", "json"] }
serde = { version = "1.0.198", features = ["derive"] }
serde_json = "1.0.116"
tokio = { version = "1.37.0", features = ["macros", "rt-multi-thread", "time"] }
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["std", "env-filter"] }
dotenvy = "0.15.7"

[dependencies.serenity]
Expand All @@ -36,7 +36,7 @@ features = [
"rustls_backend",
"unstable_discord_api"
]
version = "0.11.6"
version = "0.11.7"

# [dependencies.diesel]
# version = "2.0.2"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Toying around with Rust and the [serenity library](https://github.com/serenity-r

### Notes for M1 Macs:

You need to use rustup to target x86 since some of diesel deps dont really like ARM yet.
You need to use rustup to target x86 since some diesel deps don't really like ARM yet.

```
rustup default nightly-x86_64-apple-darwin
Expand Down
5 changes: 2 additions & 3 deletions src/commands/ball.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use rand::seq::SliceRandom;
use rand::prelude::IteratorRandom;
use serenity::framework::standard::{macros::command, CommandResult};
use serenity::model::prelude::*;
use serenity::prelude::*;
Expand Down Expand Up @@ -31,8 +31,7 @@ async fn ball(ctx: &Context, msg: &Message) -> CommandResult {
"You may rely on it.",
];

let choice = responses.choose(&mut rand::thread_rng()).unwrap();

let choice = responses.iter().choose(&mut rand::thread_rng()).unwrap();
let _ = msg.channel_id.say(&ctx.http, choice).await;

Ok(())
Expand Down
4 changes: 2 additions & 2 deletions src/commands/botsnack.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use rand::seq::SliceRandom;
use rand::seq::IteratorRandom;
use serenity::framework::standard::{macros::command, CommandResult};
use serenity::model::prelude::*;
use serenity::prelude::*;
Expand All @@ -8,7 +8,7 @@ use serenity::prelude::*;
#[usage = ""]
async fn botsnack(ctx: &Context, msg: &Message) -> CommandResult {
let responses = ["Yum!", "*cronch*", "MOAR", "*Smiles*", "Nice."];
let response = responses.choose(&mut rand::thread_rng()).unwrap();
let response = responses.iter().choose(&mut rand::thread_rng()).unwrap();

let _ = msg.channel_id.say(&ctx.http, response).await;

Expand Down
2 changes: 1 addition & 1 deletion src/commands/desc.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::diesel::prelude::*;
use crate::diesel::QueryDsl;
use crate::diesel::RunQueryDsl;
use crate::models::*;
// use crate::models::*;
use crate::schema::descriptions::dsl::*;
use crate::PostgresClient;
use diesel::r2d2::ManageConnection;
Expand Down
4 changes: 2 additions & 2 deletions src/commands/drink.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use rand::seq::SliceRandom;
use rand::seq::IteratorRandom;
use serenity::framework::standard::{macros::command, CommandResult};
use serenity::model::prelude::*;
use serenity::prelude::*;
Expand All @@ -25,7 +25,7 @@ async fn drink(ctx: &Context, msg: &Message) -> CommandResult {
"Agua",
];

let drink = responses.choose(&mut rand::thread_rng()).unwrap();
let drink = responses.iter().choose(&mut rand::thread_rng()).unwrap();

let _ = msg.channel_id.say(&ctx.http, drink).await;

Expand Down
4 changes: 2 additions & 2 deletions src/commands/food.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use rand::seq::SliceRandom;
use rand::seq::IteratorRandom;
use serenity::framework::standard::{macros::command, CommandResult};
use serenity::model::prelude::*;
use serenity::prelude::*;
Expand All @@ -13,7 +13,7 @@ async fn food(ctx: &Context, msg: &Message) -> CommandResult {
"Indian", "Cajun",
];

let item = responses.choose(&mut rand::thread_rng()).unwrap();
let item = responses.iter().choose(&mut rand::thread_rng()).unwrap();

let _ = msg.channel_id.say(&ctx.http, item).await;

Expand Down
2 changes: 1 addition & 1 deletion src/commands/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub mod advice;
pub mod ball;
pub mod botsnack;
//pub mod desc;
// pub mod desc;
pub mod drink;
pub mod food;
pub mod github;
Expand Down
Loading

0 comments on commit 27f461f

Please sign in to comment.