[mod-base] Auth n'est pas async
This commit is contained in:
parent
aa633bf5e1
commit
d5421cf64c
@ -45,8 +45,8 @@ class BaseClass:
|
||||
inline=False)
|
||||
await channel.send(embed=embed)
|
||||
|
||||
async def auth(self, user: discord.User, role_list: List[int] = None, user_list: List[int] = None,
|
||||
guild: int = None):
|
||||
def auth(self, user: discord.User, role_list: List[int] = None, user_list: List[int] = None,
|
||||
guild: int = None):
|
||||
"""
|
||||
Return True if user is an owner of the bot or in authorized_users or he have a role in authorized_roles.
|
||||
|
||||
@ -93,7 +93,7 @@ class BaseClass:
|
||||
self.client.config["prefix"] + (self.config.command_text if self.config.command_text else ""))
|
||||
sub_command, args, kwargs = self._parse_command_content(content)
|
||||
sub_command = "com_" + sub_command
|
||||
if await self.auth(message.author):
|
||||
if self.auth(message.author):
|
||||
if sub_command in dir(self):
|
||||
await self.__getattribute__(sub_command)(message, args, kwargs)
|
||||
else:
|
||||
|
@ -66,8 +66,8 @@ class BaseClassLua(BaseClass):
|
||||
self.client.config["prefix"] + (self.command_text if self.command_text else ""))
|
||||
sub_command, args, kwargs = self._parse_command_content(content)
|
||||
sub_command = "com_" + sub_command
|
||||
if await self.auth(message.author):
|
||||
self.call(sub_command, args, kwargs)
|
||||
if self.auth(message.author):
|
||||
self.call(sub_command, args, kwargs)
|
||||
else:
|
||||
await self.unauthorized(message)
|
||||
|
||||
|
@ -95,7 +95,9 @@ class MainClass(BaseClassPython):
|
||||
await message.add_reaction("🗑️")
|
||||
|
||||
try:
|
||||
reaction, user = await self.client.wait_for('reaction_add', timeout=60.0, check=lambda r, u: r.emoji == "🗑️" and not u.bot and await self.auth(user))
|
||||
reaction, user = await self.client.wait_for('reaction_add', timeout=60.0, check=lambda r,
|
||||
u: r.emoji == "🗑️" and not u.bot and self.auth(
|
||||
user))
|
||||
except asyncio.TimeoutError:
|
||||
await message.delete()
|
||||
else:
|
||||
|
@ -84,7 +84,7 @@ class MainClass(BaseClassPython):
|
||||
return saved_messages
|
||||
|
||||
async def com_fill(self, message: discord.Message, args, kwargs):
|
||||
if await self.auth(message.author):
|
||||
if self.auth(message.author):
|
||||
async with message.channel.typing():
|
||||
await self.fill_history()
|
||||
await message.channel.send("Fait.")
|
||||
|
Loading…
Reference in New Issue
Block a user