Skip to content

Commit 3bdd61e

Browse files
committed
fix: prevent timeout
1 parent bcd0ad4 commit 3bdd61e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/adapters/discord/mod.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ pub struct Data {
1818
pub orders: Arc<dyn OrderRepository>,
1919
}
2020

21-
/// Discord adapter - primary/driving adapter for Discord bot access
2221
pub struct DiscordAdapter {
2322
token: String,
2423
queue: Arc<dyn QueueRepository>,
@@ -88,11 +87,22 @@ pub async fn check_is_oracle(ctx: Context<'_>) -> Result<bool, Error> {
8887
.find(|r| r.name.to_lowercase() == "orakel")
8988
.map(|r| r.id)
9089
{
91-
return Ok(member.roles.contains(&orakel_role_id));
90+
if member.roles.contains(&orakel_role_id) {
91+
return Ok(true);
92+
}
9293
}
9394
}
9495
}
9596
}
9697

98+
// Send message to discord to prevent timeout.
99+
// Dsicord expects a response within 3 seconds. Just
100+
// returning false does not respond to the interaction.
101+
ctx.send(
102+
poise::CreateReply::default()
103+
.content("❌ Du har ikke tilgang til denne kommandoen.")
104+
.ephemeral(true),
105+
)
106+
.await?;
97107
Ok(false)
98108
}

0 commit comments

Comments
 (0)