-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixed the ip command input not being processed, updated the output. - Fixed the GoodReads module not being registered. - Fixed the news and books commands not returning results.
- Loading branch information
1 parent
52b455c
commit b07adba
Showing
12 changed files
with
159 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
using System; | ||
using System.Xml.Serialization; | ||
using System.Collections.Generic; | ||
|
||
namespace FlawBOT.Framework.Models | ||
{ | ||
[XmlRoot(ElementName = "results")] | ||
public class GoodReadsResponse | ||
{ | ||
[XmlElement(ElementName = "work")] | ||
public List<Book> Books { get; set; } | ||
} | ||
|
||
[XmlRoot(ElementName = "work")] | ||
public class Book | ||
{ | ||
[XmlElement(ElementName = "best_book")] | ||
public Work Work { get; set; } | ||
|
||
[XmlElement(ElementName = "original_publication_day")] | ||
public PublicationDay PublicationDay { get; set; } | ||
|
||
[XmlElement(ElementName = "original_publication_month")] | ||
public PublicationMonth PublicationMonth { get; set; } | ||
|
||
[XmlElement(ElementName = "original_publication_year")] | ||
public PublicationYear PublicationYear { get; set; } | ||
|
||
[XmlElement(ElementName = "average_rating")] | ||
public string RatingAverage { get; set; } | ||
|
||
[XmlElement(ElementName = "ratings_count")] | ||
public RatingsCount RatingCount { get; set; } | ||
} | ||
|
||
[XmlRoot(ElementName = "best_book")] | ||
public class Work | ||
{ | ||
[XmlElement(ElementName = "title")] | ||
public string Title { get; set; } | ||
|
||
[XmlElement(ElementName = "author")] | ||
public Author Author { get; set; } | ||
|
||
[XmlElement(ElementName = "image_url")] | ||
public string ImageUrl { get; set; } | ||
|
||
[XmlElement(ElementName = "small_image_url")] | ||
public string ImageUrlSmall { get; set; } | ||
} | ||
|
||
[XmlRoot(ElementName = "author")] | ||
public class Author | ||
{ | ||
[XmlElement(ElementName = "name")] | ||
public string Name { get; set; } | ||
} | ||
|
||
[XmlRoot(ElementName = "original_publication_day")] | ||
public class PublicationDay | ||
{ | ||
[XmlText] | ||
public string Text { get; set; } | ||
} | ||
|
||
[XmlRoot(ElementName = "original_publication_month")] | ||
public class PublicationMonth | ||
{ | ||
[XmlText] | ||
public string Text { get; set; } | ||
} | ||
|
||
[XmlRoot(ElementName = "original_publication_year")] | ||
public class PublicationYear | ||
{ | ||
[XmlText] | ||
public string Text { get; set; } | ||
} | ||
|
||
[XmlRoot(ElementName = "ratings_count")] | ||
public class RatingsCount | ||
{ | ||
[XmlText] | ||
public string Text { get; set; } | ||
|
||
[XmlAttribute(AttributeName = "type")] | ||
public string Type { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
using System.Threading.Tasks; | ||
using System.Net; | ||
using System.Threading.Tasks; | ||
using System.Xml.Serialization; | ||
using FlawBOT.Framework.Common; | ||
using FlawBOT.Framework.Models; | ||
using FlawBOT.Framework.Properties; | ||
using Goodreads; | ||
using Goodreads.Http; | ||
using Goodreads.Models.Response; | ||
using Newtonsoft.Json; | ||
|
||
namespace FlawBOT.Framework.Services.Search | ||
{ | ||
public class GoodReadService : HttpHandler | ||
{ | ||
public static async Task<Book> GetBookDataAsync(string query) | ||
public static async Task<GoodReadsResponse> GetBookDataAsync(string query) | ||
{ | ||
var client = GoodreadsClient.Create(TokenHandler.Tokens.GoodReadsKey, TokenHandler.Tokens.GoodReadsSecret); | ||
var results = await client.Books.GetByTitle(query); | ||
return results; | ||
var _serializer = new XmlSerializer(typeof(GoodReadsResponse)); | ||
var results = await _http.GetStreamAsync(Resources.API_GoodReads + "?key=" + TokenHandler.Tokens.GoodReadsKey + "&q=" + WebUtility.UrlEncode(query)); | ||
return (GoodReadsResponse)_serializer.Deserialize(results); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters