<br> properly handled in ~ani and ~mang

This commit is contained in:
Kwoth
2016-12-24 12:26:37 +01:00
parent 129fa9f827
commit 11245283be
3 changed files with 25 additions and 70 deletions

View File

@@ -89,17 +89,6 @@ namespace NadekoBot.Modules.Gambling
await InternallDndRoll(umsg, arg, false).ConfigureAwait(false);
}
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
public async Task FateRoll(IUserMessage msg, string arg)
{
var channel = (ITextChannel)msg.Channel;
int n1;
Match match;
}
private async Task InternalRoll(IUserMessage umsg, int num, bool ordered)
{
var channel = (ITextChannel)umsg.Channel;

View File

@@ -46,7 +46,8 @@ namespace NadekoBot.Modules.Searches
anilistToken = JObject.Parse(stringContent)["access_token"].ToString();
}
}
catch (Exception ex) {
catch (Exception ex)
{
_log.Error(ex);
}
}, null, TimeSpan.FromSeconds(0), TimeSpan.FromMinutes(29));
@@ -69,34 +70,15 @@ namespace NadekoBot.Modules.Searches
return;
}
var embed = new Discord.API.Embed()
{
Description = animeData.Synopsis,
Title = animeData.title_english,
Url = animeData.Link,
Image = new Discord.API.EmbedImage() {
Url = animeData.image_url_lge
},
Fields = new[] {
new Discord.API.EmbedField() {
Inline = true,
Name = "Episodes",
Value = animeData.total_episodes.ToString()
},
new Discord.API.EmbedField() {
Inline = true,
Name = "Status",
Value = animeData.AiringStatus.ToString()
},
new Discord.API.EmbedField() {
Inline = true,
Name = "Genres",
Value = String.Join(", ", animeData.Genres)
}
},
Color = NadekoBot.OkColor
};
await channel.EmbedAsync(embed).ConfigureAwait(false);
var embed = new EmbedBuilder().WithColor(NadekoBot.OkColor)
.WithDescription(animeData.Synopsis.Replace("<br>", Environment.NewLine))
.WithTitle(animeData.title_english)
.WithUrl(animeData.Link)
.WithImageUrl(animeData.image_url_lge)
.AddField(efb => efb.WithName("Episodes").WithValue(animeData.total_episodes.ToString()).WithIsInline(true))
.AddField(efb => efb.WithName("Status").WithValue(animeData.AiringStatus.ToString()).WithIsInline(true))
.AddField(efb => efb.WithName("Genres").WithValue(String.Join(", ", animeData.Genres)).WithIsInline(true));
await channel.EmbedAsync(embed.Build()).ConfigureAwait(false);
}
[NadekoCommand, Usage, Description, Aliases]
@@ -116,36 +98,16 @@ namespace NadekoBot.Modules.Searches
return;
}
var embed = new Discord.API.Embed()
{
Description = mangaData.Synopsis,
Title = mangaData.title_english,
Url = mangaData.Link,
Image = new Discord.API.EmbedImage()
{
Url = mangaData.image_url_lge
},
Fields = new[] {
new Discord.API.EmbedField() {
Inline = true,
Name = "Chapters",
Value = mangaData.total_chapters.ToString()
},
new Discord.API.EmbedField() {
Inline = true,
Name = "Status",
Value = mangaData.publishing_status.ToString()
},
new Discord.API.EmbedField() {
Inline = true,
Name = "Genres",
Value = String.Join(", ", mangaData.Genres)
}
},
Color = NadekoBot.OkColor
};
var embed = new EmbedBuilder().WithColor(NadekoBot.OkColor)
.WithDescription(mangaData.Synopsis)
.WithTitle(mangaData.title_english)
.WithUrl(mangaData.Link)
.WithImageUrl(mangaData.image_url_lge)
.AddField(efb => efb.WithName("Episodes").WithValue(mangaData.total_chapters.ToString()).WithIsInline(true))
.AddField(efb => efb.WithName("Status").WithValue(mangaData.publishing_status.ToString()).WithIsInline(true))
.AddField(efb => efb.WithName("Genres").WithValue(String.Join(", ", mangaData.Genres)).WithIsInline(true));
await channel.EmbedAsync(embed).ConfigureAwait(false);
await channel.EmbedAsync(embed.Build()).ConfigureAwait(false);
}
private async Task<AnimeResult> GetAnimeData(string query)
@@ -165,7 +127,8 @@ namespace NadekoBot.Modules.Searches
return await Task.Run(() => { try { return JsonConvert.DeserializeObject<AnimeResult>(aniData); } catch { return null; } }).ConfigureAwait(false);
}
}
catch (Exception ex) {
catch (Exception ex)
{
_log.Warn(ex, "Failed anime search for {0}", query);
return null;
}