From Ken Swenson to ~erk/lasagne-devel
Signed-off-by: Ken Swenson <flat@esoteric.moe> --- src/comic.rs | 15 -- src/command_handler.rs | 347 ----------------------------------------- src/context.rs | 20 +-- src/database.rs | 27 ++-- src/main.rs | 70 +-------- src/slash_handler.rs | 11 +- src/syndicate.rs | 2 +- 7 files changed, 30 insertions(+), 462 deletions(-) delete mode 100644 src/command_handler.rs diff --git a/src/comic.rs b/src/comic.rs index 8b867b3..3da8adb 100644 [message trimmed]
From Ken Swenson to ~erk/inbox
Signed-off-by: Ken Swenson <flat@esoteric.moe> --- This is a WIP patch to use the gocomics cdn after 7-22-2020 as they are not longer uploaded to the old CDN. The issue with the current project structure is there are many sync fns that prevent us from using reqwest without converting many things to async. Any feedback or directional ideas to be able to make webcalls from the date_url function would be appreciated. I was short on time today writing this up. Cargo.toml | 2 +- src/comic.rs | 67 ++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 63 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 51fd814..4092a3d 100644 [message trimmed]
From Ken Swenson to ~erk/inbox
Signed-off-by: Ken Swenson <flat@esoteric.moe> --- src/theme.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/theme.rs b/src/theme.rs index 5a57c24..f0e013a 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -48,7 +48,11 @@ impl ThemeClient { .await?; if let Some(cap) = self.count_re.captures(&page) { Ok(Some(cap[1].parse::<u64>().unwrap_or(1)))[message trimmed]
From Ken Swenson to ~erk/inbox
Signed-off-by: Ken Swenson <flat@esoteric.moe> --- src/theme.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/theme.rs b/src/theme.rs index 5a57c24..db7d268 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -93,9 +93,10 @@ impl ThemeClient { pub async fn get_theme(&self, theme: &str) -> GarfieldResult<ComicEmbed> { let count = match self.get_count(theme).await? { Some(c) => c,[message trimmed]
From Ken Swenson to ~erk/inbox
Signed-off-by: Ken Swenson <flat@esoteric.moe> --- Third time is the charm. Rebased to master. src/comic.rs | 6 +++--- src/main.rs | 10 +++++----- src/theme.rs | 29 +++++++++++++++++++++-------- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/src/comic.rs b/src/comic.rs index 8572b72..3e0cdc7 100644 --- a/src/comic.rs +++ b/src/comic.rs @@ -33,9 +33,9 @@ impl ComicEmbed { Embed { [message trimmed]
From Ken Swenson to ~erk/inbox
Signed-off-by: Ken Swenson <flat@esoteric.moe> --- Tested and this proper grabs a themed comic from gocomics. src/comic.rs | 2 +- src/main.rs | 22 +++++++++++++++------- src/theme.rs | 29 +++++++++++++++++++++-------- 3 files changed, 37 insertions(+), 16 deletions(-) diff --git a/src/comic.rs b/src/comic.rs index 8572b72..24a5fec 100644 --- a/src/comic.rs +++ b/src/comic.rs [message trimmed]
From Ken Swenson to ~erk/inbox
I've fixed the hang but it seems the patch doesn't work as intended. Debugging now. On 7/1/20 6:19 PM, Valdemar Erk wrote: > On Wed, 01 Jul 2020 01:15:52 +0200, > Ken Swenson wrote: >> @@ -16,9 +16,9 @@ pub struct ThemeClient { >> >> impl ThemeClient { >> pub fn new_rwc(rwc: ReqwestClient) -> GarfieldResult<Self> { >> - let count_re = Regex::new(r#"<span class="pull-right">(?:\d+) of (\d+)</span>"#)?; >> + let count_re = Regex::new(r#"(\d.*) Results for Garfield"#)?; >> let comic_re = Regex::new( >> - r#"src="https://d1ejxu6vysztl5.cloudfront.net/comics/garfield/[0-9]{4}/([0-9]{4}-[0-9]{2}-[0-9]{2}).gif"#,
From Ken Swenson to ~erk/inbox
Signed-off-by: Ken Swenson <flat@esoteric.moe> --- src/main.rs | 87 +++++++++++++++++++++++++++-------------------------- 1 file changed, 45 insertions(+), 42 deletions(-) diff --git a/src/main.rs b/src/main.rs index 4801e73..287fc9a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -163,7 +163,7 @@ async fn async_main() -> GarfieldResult<()> { let mut events = cluster.events().await; let ctx = Context::new(http, rqc, theme_client, parser, cluster, subs, cache.clone());[message trimmed]
From Ken Swenson to ~erk/inbox
Signed-off-by: Ken Swenson <flat@esoteric.moe> --- This is untested as I cannot get the bot to run on my computer. I believe it to be sound however. Please test and let me know if changes are needed. src/comic.rs | 2 +- src/theme.rs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/comic.rs b/src/comic.rs index 8572b72..24a5fec 100644 --- a/src/comic.rs +++ b/src/comic.rs @@ -101,7 +101,7 @@ impl ComicEmbed { [message trimmed]
From Ken Swenson to ~erk/inbox
Signed-off-by: Ken Swenson <flat@esoteric.moe> --- src/comic.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/comic.rs b/src/comic.rs index 70c55ad..bbfd31d 100644 --- a/src/comic.rs +++ b/src/comic.rs @@ -174,9 +174,9 @@ impl ComicEmbed { .await?; } ErrorType::InvalidFormat => { const INVALID_FORMAT: &str = "Date was written in a invalid format, \[message trimmed]