Fixed permissions for embed usage
This commit is contained in:
parent
1d1b66f87a
commit
67b50c3b8c
|
@ -3,10 +3,11 @@ from discord.ext import commands
|
||||||
from utils import jisho
|
from utils import jisho
|
||||||
|
|
||||||
class JishoKanjiObject():
|
class JishoKanjiObject():
|
||||||
def __init__(self, query):
|
def __init__(self, query, owner):
|
||||||
self.response = jisho.JishoKanji(query)
|
self.response = jisho.JishoKanji(query)
|
||||||
self.total_pages = self.response.entries
|
self.total_pages = self.response.entries
|
||||||
self.page = 0
|
self.page = 0
|
||||||
|
self.owner = owner
|
||||||
|
|
||||||
def prev(self):
|
def prev(self):
|
||||||
self.page -= 1
|
self.page -= 1
|
||||||
|
@ -54,6 +55,9 @@ class Kanji(commands.Cog):
|
||||||
if user == self.bot.user:
|
if user == self.bot.user:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if user.id != self.activeObject.owner:
|
||||||
|
return
|
||||||
|
|
||||||
if reaction.me:
|
if reaction.me:
|
||||||
if reaction.emoji == "⬅️":
|
if reaction.emoji == "⬅️":
|
||||||
self.activeObject.prev()
|
self.activeObject.prev()
|
||||||
|
@ -72,7 +76,7 @@ class Kanji(commands.Cog):
|
||||||
if kanji is None:
|
if kanji is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.activeObject = JishoKanjiObject(kanji)
|
self.activeObject = JishoKanjiObject(kanji, ctx.author.id)
|
||||||
embed = await self.createEmbed()
|
embed = await self.createEmbed()
|
||||||
message = await ctx.send(embed=embed)
|
message = await ctx.send(embed=embed)
|
||||||
self.latestMessage = message.id
|
self.latestMessage = message.id
|
||||||
|
|
|
@ -3,10 +3,11 @@ from discord.ext import commands
|
||||||
from utils import jisho
|
from utils import jisho
|
||||||
|
|
||||||
class JishoObject():
|
class JishoObject():
|
||||||
def __init__(self, query):
|
def __init__(self, query, owner):
|
||||||
self.response = jisho.JishoResponse(query)
|
self.response = jisho.JishoResponse(query)
|
||||||
self.total_pages = self.response.entries
|
self.total_pages = self.response.entries
|
||||||
self.page = 0
|
self.page = 0
|
||||||
|
self.owner = owner
|
||||||
|
|
||||||
def prev(self):
|
def prev(self):
|
||||||
self.page -= 1
|
self.page -= 1
|
||||||
|
@ -64,6 +65,9 @@ class Search(commands.Cog):
|
||||||
if user == self.bot.user:
|
if user == self.bot.user:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if user.id != self.activeObject.owner:
|
||||||
|
return
|
||||||
|
|
||||||
if reaction.me:
|
if reaction.me:
|
||||||
if reaction.emoji == "⬅️":
|
if reaction.emoji == "⬅️":
|
||||||
self.activeObject.prev()
|
self.activeObject.prev()
|
||||||
|
@ -83,7 +87,7 @@ class Search(commands.Cog):
|
||||||
if query == None:
|
if query == None:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.activeObject = JishoObject(query)
|
self.activeObject = JishoObject(query, ctx.author.id)
|
||||||
embed = await self.createEmbed()
|
embed = await self.createEmbed()
|
||||||
message = await ctx.send(embed=embed)
|
message = await ctx.send(embed=embed)
|
||||||
self.latestMessage = message.id
|
self.latestMessage = message.id
|
||||||
|
|
|
@ -90,6 +90,10 @@ class JishoKanjiNode():
|
||||||
self.meaning = ""
|
self.meaning = ""
|
||||||
self.kun = []
|
self.kun = []
|
||||||
self.on = []
|
self.on = []
|
||||||
|
self.radical = ""
|
||||||
|
self.grade = ""
|
||||||
|
self.jlpt = ""
|
||||||
|
|
||||||
|
|
||||||
class JishoKanji():
|
class JishoKanji():
|
||||||
def __init__(self, query):
|
def __init__(self, query):
|
||||||
|
@ -138,3 +142,8 @@ class JishoKanji():
|
||||||
readings = on_block.findChildren("a", recursive=True)
|
readings = on_block.findChildren("a", recursive=True)
|
||||||
for reading in readings:
|
for reading in readings:
|
||||||
self.nodes[-1].on.append(reading.string)
|
self.nodes[-1].on.append(reading.string)
|
||||||
|
|
||||||
|
# Radical
|
||||||
|
radical_block = readings_block.findChild("div", {"class": "radicals"}, recursive=True)
|
||||||
|
print(radical_block)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue