Skip to content

Commit

Permalink
Update main.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
tuna2134 authored Sep 13, 2023
1 parent 82e514b commit 75cb0f9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use tokio::sync::Mutex;
struct Client {
pub http: Arc<HttpClient>,
pub cache: Arc<InMemoryCache>,
pub shard: Mutex<Arc<Shard>>,
pub shard: Arc<Mutex<Shard>>,
pub application_id: Id<ApplicationMarker>,
}

Expand Down Expand Up @@ -59,7 +59,7 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
application_id,
});
create_application_commands(Arc::clone(&client)).await?;
let mut shard = shard_mutex.lock().await?;
let mut shard = shard_mutex.lock().await;

loop {
let event = match shard.next_event().await {
Expand Down Expand Up @@ -202,11 +202,11 @@ async fn handle_event(
let interaction_http = client.http.interaction(client.application_id);
if let Some(InteractionData::ApplicationCommand(command)) = &interaction.data {
if command.name == "ping" {
let shard = client.shard.lock().await?;
let shard = client.shard.lock().await;
let latency = shard.latency();
let average = latency.average().unwrap();
let data = InteractionResponseDataBuilder::new()
.content(float!("Pong!\n{}", average.as_secs()).to_string())
.content(format!("Pong!\n{}", average.as_secs()).to_string())
.build();
let response = InteractionResponse {
kind: InteractionResponseType::ChannelMessageWithSource,
Expand Down

0 comments on commit 75cb0f9

Please sign in to comment.