formatting

This commit is contained in:
Oleg Sobolev 2024-03-25 17:21:28 +07:00
parent aa04c6ef5b
commit 9a924c8c0d
2 changed files with 10 additions and 12 deletions

View file

@ -1,5 +1,5 @@
use std::{collections::VecDeque, fs::File, io::BufReader, thread, thread::JoinHandle};
use rodio::{Decoder, OutputStream, OutputStreamHandle, Sink};
use std::{collections::VecDeque, fs::File, io::BufReader, thread, thread::JoinHandle};
use crate::channel::{self, Requester, Responder, TryRecvError};
use crate::track::TrackInfo;

View file

@ -1,7 +1,7 @@
use std::sync::{Arc, Mutex};
use teloxide::{prelude::*, utils::command::BotCommands};
use crate::{player::MusicPlayer, download};
use crate::{download, player::MusicPlayer};
#[derive(BotCommands, Clone)]
#[command(
@ -41,17 +41,15 @@ impl TelegramBot {
cmd: Command,
) -> Result<(), teloxide::RequestError> {
match cmd {
Command::Play(url) => {
match download::download_from_youtube(&url) {
Command::Play(url) => match download::download_from_youtube(&url) {
Ok(track_info) => {
player.lock().unwrap().enqueue(track_info);
bot.send_message(msg.chat.id, "Added to the queue.").await?;
},
}
Err(_) => {
bot.send_message(msg.chat.id, "Failed to download.").await?;
}
}
}
},
Command::Stop => {
player.lock().unwrap().stop();
bot.send_message(msg.chat.id, "Stopped.").await?;