Skip to content

Commit

Permalink
feat: add a command to show the list of headquarters
Browse files Browse the repository at this point in the history
  • Loading branch information
Phosphorus-M committed Apr 12, 2024
1 parent 24229d2 commit f0bb406
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{error::Error, sync::Arc};
use teloxide::{prelude::*, types::Me, utils::command::BotCommands};
use tracing::error;

use crate::{bot::InstanceState, commands::{calendario_academico::calendario_academico, comunidades_it::comunidades_it, get_siu_info::get_siu_info, hacer_algo::hacer_algo, links_utiles::links_utiles, mails_de_escuela::get_mails_de_escuela, roadmap::roadmap}, models::errors::BotErrors};
use crate::{bot::InstanceState, commands::{calendario_academico::calendario_academico, comunidades_it::comunidades_it, get_siu_info::get_siu_info, hacer_algo::hacer_algo, links_utiles::links_utiles, mails_de_escuela::get_mails_de_escuela, roadmap::roadmap, sedes::sedes}, models::errors::BotErrors};

/// Enumeration of commands accepted by the bot.
#[derive(BotCommands, Clone)]
Expand Down Expand Up @@ -31,6 +31,8 @@ pub enum Command {
SIU,
#[command(description = "Obtener mails de Escuela")]
MailDeEscuela(String),
#[command(description = "Da una lista de las sedes con sus datos")]
Sedes
}

impl Command {
Expand All @@ -51,7 +53,8 @@ impl Command {
Command::CalendarioAcademico => calendario_academico(&msg, &bot).await,
Command::SIU => get_siu_info(&msg, &bot).await,
Command::ComunidadesIT => comunidades_it(&msg, &bot).await,
Command::MailDeEscuela(escuela) => get_mails_de_escuela(&msg, &bot, escuela).await
Command::MailDeEscuela(escuela) => get_mails_de_escuela(&msg, &bot, escuela).await,
Command::Sedes => sedes(&msg, &bot).await
};

if let Err(error) = response {
Expand Down
3 changes: 2 additions & 1 deletion src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ pub mod calendario_academico;
pub mod get_siu_info;
pub mod comunidades_it;
pub mod mails_de_escuela;
pub mod roadmap;
pub mod roadmap;
pub mod sedes;
36 changes: 36 additions & 0 deletions src/commands/sedes.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
use teloxide::payloads::SendMessageSetters;
use teloxide::{requests::Requester, types::Message, Bot};
use teloxide::types::ParseMode::MarkdownV2;

use crate::models::errors::BotErrors;

const MESSAGE: &'static str = r#"
*Sede Rectorado*
Tel: \(0220\) 483 4150
[Belgrano 369 \- San Antonio de Padua](https://maps.app.goo.gl/6Yz6BKtcaTdcnxaz7)
Lunes a viernes de 9 a 16 hs
*CAMPUS UNIVERSITARIO*
[Av\. Dr\. Ricardo Balbín 2048\-2098, Merlo](https://maps.app.goo.gl/XpKfohxjGXmSu8dP9)
Lunes a viernes de 9 a 20 hs
*Sede Centenario*
[Centenario 1399 y Lavallol de Acosta \- San Antonio de Padua](https://maps.app.goo.gl/qMegZX6vxGE4bubr9)
Tel: \(0220\) 483 5390
Lunes a viernes de 9 a 20 hs
*Sede Córdoba*
[Córdoba 1055 \- Merlo](https://maps.app.goo.gl/mFQ4Wo8pmbHb8RJr5)
Tel: \(0220\) 482 0799
Lunes a viernes de 8 a 18 hs
*Hospital Odontológico*
[Moreno y pte\. Perón \- Merlo](https://maps.app.goo.gl/mVqNtUY9H1uDJZbWA)
"#;


pub async fn sedes(msg: &Message, bot: &Bot) -> Result<(), BotErrors> {
bot.send_message(msg.chat.id, MESSAGE).parse_mode(MarkdownV2).await?;

Ok(())
}

0 comments on commit f0bb406

Please sign in to comment.