Skip to content

Commit f9ed5f3

Browse files
committed
Implemented is_owner
1 parent ec1ce40 commit f9ed5f3

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

dico_command/bot.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ async def get_owners(self) -> typing.List[dico.Snowflake]:
5353
await self.request_current_bot_application_information()
5454
return self.application.owner_ids if self.application.owner_ids else [self.application.owner.id]
5555

56+
async def is_owner(self, ctx: Context):
57+
return ctx.author.id in await self.get_owners()
58+
5659
async def verify_prefix(self, message: dico.Message):
5760
# final_prefixes = [(await x(message)) if is_coro(x) else x(message) if inspect.isfunction(x) else x for x in self.prefixes]
5861
final_prefixes = []

dico_command/decorator.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,12 @@ def wrap(maybe_cmd):
1414
maybe_cmd._checks = [*funcs]
1515
return maybe_cmd
1616
return wrap
17+
18+
19+
async def __is_owner(ctx: Context):
20+
return await ctx.bot.is_owner(ctx)
21+
22+
23+
def is_owner():
24+
return checks(__is_owner)
25+

0 commit comments

Comments
 (0)