refactor(commands/utils): formatting using rustfmt on ping
This commit is contained in:
parent
1b1f3ae9d3
commit
ee99b6c4c4
1 changed files with 10 additions and 9 deletions
|
|
@ -1,9 +1,6 @@
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|
||||||
use crate::commands::{
|
use crate::commands::{CommandEntry, SlashCommand};
|
||||||
CommandEntry,
|
|
||||||
SlashCommand,
|
|
||||||
};
|
|
||||||
|
|
||||||
use serenity::all::{
|
use serenity::all::{
|
||||||
CommandInteraction, Context, CreateCommand, CreateInteractionResponse,
|
CommandInteraction, Context, CreateCommand, CreateInteractionResponse,
|
||||||
|
|
@ -25,11 +22,15 @@ impl SlashCommand for Ping {
|
||||||
|
|
||||||
fn register(&self) -> CreateCommand {
|
fn register(&self) -> CreateCommand {
|
||||||
println!("\t✅ | {}", self.name());
|
println!("\t✅ | {}", self.name());
|
||||||
CreateCommand::new(self.name())
|
CreateCommand::new(self.name()).description(self.description())
|
||||||
.description(self.description())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn run(&self, ctx: &Context, command: &CommandInteraction, _database: &PgPool) -> Result<(), serenity::Error> {
|
async fn run(
|
||||||
|
&self,
|
||||||
|
ctx: &Context,
|
||||||
|
command: &CommandInteraction,
|
||||||
|
_database: &PgPool,
|
||||||
|
) -> Result<(), serenity::Error> {
|
||||||
let message: CreateInteractionResponseMessage = CreateInteractionResponseMessage::new()
|
let message: CreateInteractionResponseMessage = CreateInteractionResponseMessage::new()
|
||||||
.content("🏓 | Pong!")
|
.content("🏓 | Pong!")
|
||||||
.ephemeral(true);
|
.ephemeral(true);
|
||||||
|
|
@ -40,8 +41,8 @@ impl SlashCommand for Ping {
|
||||||
command.create_response(&ctx.http, response).await?;
|
command.create_response(&ctx.http, response).await?;
|
||||||
let delta_time: u128 = start.elapsed().as_millis();
|
let delta_time: u128 = start.elapsed().as_millis();
|
||||||
|
|
||||||
let edit_msg: EditInteractionResponse = EditInteractionResponse::new()
|
let edit_msg: EditInteractionResponse =
|
||||||
.content(format!("Ping: **{delta_time}**ms"));
|
EditInteractionResponse::new().content(format!("Ping: **{delta_time}**ms"));
|
||||||
|
|
||||||
command.edit_response(&ctx.http, edit_msg).await?;
|
command.edit_response(&ctx.http, edit_msg).await?;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue