Added stroke count

This commit is contained in:
Robert 2020-08-11 18:50:56 +02:00
parent 643b8486ae
commit 8f7bdf64e2
2 changed files with 6 additions and 0 deletions

View file

@ -50,6 +50,7 @@ class Kanji(commands.Cog):
embed.add_field(name="On", value="".join(node.on), inline=False)
embed.add_field(name=f"Radical: {node.radical[0]}", value=node.radical[1], inline=False)
embed.add_field(name=f"{node.strokes} strokes", value="\u200b", inline=False)
embed.set_footer(text=f"Jōyō kanji (Grade {node.grade}) | JLPT level {node.jlpt}\t\t{self.activeObject.page + 1}/{self.activeObject.total_pages}")
@ -85,6 +86,8 @@ class Kanji(commands.Cog):
if kanji is None:
return
kanji = kanji[:5]
self.activeObject = JishoKanjiObject(kanji, ctx.author.id)
embed = await self.createEmbed()
message = await ctx.send(embed=embed)

View file

@ -94,6 +94,7 @@ class JishoKanjiNode():
self.radical = []
self.grade = ""
self.jlpt = ""
self.strokes = ""
class JishoKanji():
@ -156,3 +157,5 @@ class JishoKanji():
self.nodes[-1].jlpt = info.findChild("div", {"class": "jlpt"}, recursive=True).findChild("strong").string
# Strokes
self.nodes[-1].strokes = info.findChild("div", {"class": "kanji-details__stroke_count"}, recursive=True).findChild("strong").string