<br> properly handled in ~ani and ~mang
This commit is contained in:
parent
129fa9f827
commit
11245283be
@ -89,17 +89,6 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
await InternallDndRoll(umsg, arg, false).ConfigureAwait(false);
|
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)
|
private async Task InternalRoll(IUserMessage umsg, int num, bool ordered)
|
||||||
{
|
{
|
||||||
var channel = (ITextChannel)umsg.Channel;
|
var channel = (ITextChannel)umsg.Channel;
|
||||||
|
@ -46,7 +46,8 @@ namespace NadekoBot.Modules.Searches
|
|||||||
anilistToken = JObject.Parse(stringContent)["access_token"].ToString();
|
anilistToken = JObject.Parse(stringContent)["access_token"].ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex)
|
||||||
|
{
|
||||||
_log.Error(ex);
|
_log.Error(ex);
|
||||||
}
|
}
|
||||||
}, null, TimeSpan.FromSeconds(0), TimeSpan.FromMinutes(29));
|
}, null, TimeSpan.FromSeconds(0), TimeSpan.FromMinutes(29));
|
||||||
@ -69,34 +70,15 @@ namespace NadekoBot.Modules.Searches
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var embed = new Discord.API.Embed()
|
var embed = new EmbedBuilder().WithColor(NadekoBot.OkColor)
|
||||||
{
|
.WithDescription(animeData.Synopsis.Replace("<br>", Environment.NewLine))
|
||||||
Description = animeData.Synopsis,
|
.WithTitle(animeData.title_english)
|
||||||
Title = animeData.title_english,
|
.WithUrl(animeData.Link)
|
||||||
Url = animeData.Link,
|
.WithImageUrl(animeData.image_url_lge)
|
||||||
Image = new Discord.API.EmbedImage() {
|
.AddField(efb => efb.WithName("Episodes").WithValue(animeData.total_episodes.ToString()).WithIsInline(true))
|
||||||
Url = animeData.image_url_lge
|
.AddField(efb => efb.WithName("Status").WithValue(animeData.AiringStatus.ToString()).WithIsInline(true))
|
||||||
},
|
.AddField(efb => efb.WithName("Genres").WithValue(String.Join(", ", animeData.Genres)).WithIsInline(true));
|
||||||
Fields = new[] {
|
await channel.EmbedAsync(embed.Build()).ConfigureAwait(false);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
@ -116,36 +98,16 @@ namespace NadekoBot.Modules.Searches
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var embed = new Discord.API.Embed()
|
var embed = new EmbedBuilder().WithColor(NadekoBot.OkColor)
|
||||||
{
|
.WithDescription(mangaData.Synopsis)
|
||||||
Description = mangaData.Synopsis,
|
.WithTitle(mangaData.title_english)
|
||||||
Title = mangaData.title_english,
|
.WithUrl(mangaData.Link)
|
||||||
Url = mangaData.Link,
|
.WithImageUrl(mangaData.image_url_lge)
|
||||||
Image = new Discord.API.EmbedImage()
|
.AddField(efb => efb.WithName("Episodes").WithValue(mangaData.total_chapters.ToString()).WithIsInline(true))
|
||||||
{
|
.AddField(efb => efb.WithName("Status").WithValue(mangaData.publishing_status.ToString()).WithIsInline(true))
|
||||||
Url = mangaData.image_url_lge
|
.AddField(efb => efb.WithName("Genres").WithValue(String.Join(", ", mangaData.Genres)).WithIsInline(true));
|
||||||
},
|
|
||||||
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
|
|
||||||
};
|
|
||||||
|
|
||||||
await channel.EmbedAsync(embed).ConfigureAwait(false);
|
await channel.EmbedAsync(embed.Build()).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<AnimeResult> GetAnimeData(string query)
|
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);
|
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);
|
_log.Warn(ex, "Failed anime search for {0}", query);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,9 @@ namespace NadekoBot.Extensions
|
|||||||
http.DefaultRequestHeaders.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
|
http.DefaultRequestHeaders.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static EmbedBuilder WithImageUrl(this EmbedBuilder eb, string url) =>
|
||||||
|
eb.WithImage(eib => eib.WithUrl(url));
|
||||||
|
|
||||||
public static EmbedBuilder WithOkColor(this EmbedBuilder eb) =>
|
public static EmbedBuilder WithOkColor(this EmbedBuilder eb) =>
|
||||||
eb.WithColor(NadekoBot.OkColor);
|
eb.WithColor(NadekoBot.OkColor);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user