aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/handler.rs9
-rw-r--r--src/main.rs3
2 files changed, 9 insertions, 3 deletions
diff --git a/src/handler.rs b/src/handler.rs
index 00cf0eb..ef8fc00 100644
--- a/src/handler.rs
+++ b/src/handler.rs
@@ -53,12 +53,15 @@ pub async fn event_handler(
.await?;
}
- let dm_chan = add_reaction
+ if let Ok(dm_chan) = add_reaction
.user_id
.unwrap()
.create_dm_channel(&ctx.http)
- .await?;
- dm_chan.say(ctx, format!("Toggled the role!")).await?;
+ .await {
+ dm_chan.say(ctx, format!("Toggled the role!")).await?;
+ } else {
+ println!("Could not DM user, but we did the role anyways");
+ }
add_reaction.delete(&ctx.http).await?;
}
diff --git a/src/main.rs b/src/main.rs
index 2968f20..8693381 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -123,6 +123,9 @@ async fn main() {
)
.await
.expect("Couldn't connect to postgresql");
+ sqlx::migrate!("./migrations")
+ .run(&pool)
+ .await.unwrap();
Ok(Data {
pg: Mutex::new(pool),
})