diff --git a/cogs/kanji.py b/cogs/kanji.py index c65ad2f..ab58b89 100644 --- a/cogs/kanji.py +++ b/cogs/kanji.py @@ -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) diff --git a/utils/jisho.py b/utils/jisho.py index ac2dd88..e92d2a8 100644 --- a/utils/jisho.py +++ b/utils/jisho.py @@ -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 \ No newline at end of file