Skip to content

Commit 47288e4

Browse files
committed
Bug Fixes
1 parent 268ad7b commit 47288e4

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pit-tracker"
3-
version = "0.1.0"
3+
version = "1.0.0"
44
authors = ["Joseph Zurowski <12567900+Dunklheit@users.noreply.github.com>"]
55
edition = "2018"
66

src/handler.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ impl BotHandler {
2626
let usr = punished.id.to_user(&ctx).await.unwrap();
2727
let _ = self.config.warn_channel.send_message(&ctx, |m| {
2828
m.allowed_mentions(|am| {
29-
am.roles(vec![*(self.config.warn_role.id).as_u64()]);
29+
am.roles(vec![*(self.config.warn_role).as_u64()]);
3030

3131
am
3232
});
3333

34+
m.content(format!("<@&{}>", self.config.warn_role.as_u64()));
35+
3436
m.embed(|e| {
3537
e.title("Pit Threshold Reached");
3638
e.description(format!(r#"
@@ -45,7 +47,9 @@ Active Strikes: `{}`
4547
});
4648

4749
m
48-
});
50+
})
51+
.await
52+
.unwrap();
4953
}
5054
}
5155

@@ -78,6 +82,8 @@ impl EventHandler for BotHandler {
7882
}
7983
}
8084

85+
state.pits += 1;
86+
8187
if user.is_none() {
8288
state.users.push(PunishedUser {
8389
id: new.user.id,

src/main.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ use clokwerk::{Scheduler, TimeUnits};
55
use serde::{Serialize, Deserialize};
66
use serenity::{
77
model::{
8-
guild::Role,
98
id::{
109
ChannelId,
1110
RoleId,
1211
UserId
1312
},
1413
},
1514
prelude::*,
16-
};
15+
framework::StandardFramework};
1716

1817
use std::error::Error;
1918
use std::fs::File;
@@ -29,7 +28,7 @@ pub struct BotConfig {
2928
pub settle_time: u16,
3029
pub(crate) token: String,
3130
pub warn_channel: ChannelId,
32-
pub warn_role: Role,
31+
pub warn_role: RoleId,
3332
pub warn_threshold: u16,
3433
}
3534

@@ -158,13 +157,20 @@ async fn main() {
158157
let config = Arc::new(read_config().unwrap());
159158
let state = BotState::new();
160159

160+
let framework = StandardFramework::new()
161+
.configure(|c| c
162+
.with_whitespace(true)
163+
.prefix("!")
164+
);
165+
161166
let mut client = Client::new(&config.token)
162167
.event_handler(
163168
handler::BotHandler::new(
164169
Arc::clone(&state),
165170
Arc::clone(&config),
166171
)
167172
)
173+
.framework(framework)
168174
.await
169175
.expect("Error creating Discord client");
170176

0 commit comments

Comments
 (0)