Update to new version compatability
This commit is contained in:
parent
d9250ec4c0
commit
4aa918a966
|
@ -185,7 +185,7 @@ fn get_events(v: Eurosport) -> Result<Vec<ESEvents>, serde_json::Error> {
|
|||
|
||||
let sport_name = match &relationships.sport_id {
|
||||
None => None,
|
||||
Some(sportid) => match sportid.data.get(0) {
|
||||
Some(sport_id) => match sport_id.data.get(0) {
|
||||
None => None,
|
||||
Some(sv) => match sports.get(&sv.id) {
|
||||
None => None,
|
||||
|
@ -254,7 +254,7 @@ async fn get_eurosport_events(url: String) -> Option<Vec<ESEvents>> {
|
|||
.get("cookie")
|
||||
.expect("Config error, please set the eurosport[cookie] value")
|
||||
.clone()
|
||||
.into_str()
|
||||
.into_string()
|
||||
.expect("Config error, please make sure eurosport[cookie] is a string");
|
||||
let client = reqwest::Client::new();
|
||||
let x_disco_client = HeaderName::from_lowercase(b"x-disco-client").unwrap();
|
||||
|
@ -302,7 +302,7 @@ async fn get_eurosport_events(url: String) -> Option<Vec<ESEvents>> {
|
|||
return result;
|
||||
}
|
||||
|
||||
// #[derive(Debug, poise::SlashChoiceParameter)]
|
||||
// #[derive(Debug, poise::ChoiceParameter)]
|
||||
// pub enum Timeframe {
|
||||
// #[name = "Currently happening"]
|
||||
// Current,
|
||||
|
@ -361,11 +361,13 @@ async fn get_eurosport_events(url: String) -> Option<Vec<ESEvents>> {
|
|||
// Ok(())
|
||||
// }
|
||||
|
||||
/// Eurosport player events
|
||||
pub async fn proc_eurosport(
|
||||
// Eurosport player events
|
||||
#[poise::command(slash_command)]
|
||||
pub async fn eurosport(
|
||||
ctx: Context<'_>,
|
||||
#[description = "Filter sessions for when they are/were happening, defaults to future"]
|
||||
timeframe: Option<Timeframe>,
|
||||
filter: Option<String>,
|
||||
#[description = "Content to filter on"] filter: Option<String>,
|
||||
) -> Result<(), Error> {
|
||||
let url = super::super::super::SETTINGS
|
||||
.read()
|
||||
|
@ -375,7 +377,7 @@ pub async fn proc_eurosport(
|
|||
.get("url")
|
||||
.expect("Config error, please set the eurosport[url] value")
|
||||
.clone()
|
||||
.into_str()
|
||||
.into_string()
|
||||
.expect("Config error, please make sure eurosport[url] is a string");
|
||||
let events = get_eurosport_events(url).await;
|
||||
match events {
|
||||
|
@ -455,6 +457,7 @@ pub async fn proc_eurosport(
|
|||
// }
|
||||
|
||||
/// Eurosport olympics events
|
||||
#[allow(dead_code)]
|
||||
pub async fn proc_olympics(
|
||||
ctx: Context<'_>,
|
||||
timeframe: Option<Timeframe>,
|
||||
|
@ -468,7 +471,7 @@ pub async fn proc_olympics(
|
|||
.get("olympics")
|
||||
.expect("Config error, please set the eurosport[olympics] value")
|
||||
.clone()
|
||||
.into_str()
|
||||
.into_string()
|
||||
.expect("Config error, please make sure eurosport[olympics] is a string");
|
||||
let events = get_eurosport_events(url).await;
|
||||
match events {
|
||||
|
|
Loading…
Reference in a new issue