mirror of
https://github.com/myned/modufur.git
synced 2024-12-24 22:27:28 +00:00
Add permissions command to list contextual permissions
This commit is contained in:
parent
41a4fb9055
commit
a65716f77a
1 changed files with 26 additions and 0 deletions
|
@ -14,6 +14,7 @@ from discord.ext import commands as cmds
|
||||||
from misc import exceptions as exc
|
from misc import exceptions as exc
|
||||||
from misc import checks
|
from misc import checks
|
||||||
from utils import utils as u
|
from utils import utils as u
|
||||||
|
from utils import formatter
|
||||||
|
|
||||||
|
|
||||||
class Bot:
|
class Bot:
|
||||||
|
@ -78,6 +79,31 @@ class Bot:
|
||||||
for page in paginator.pages:
|
for page in paginator.pages:
|
||||||
await ctx.send(f'**Guilds:**\n{page}')
|
await ctx.send(f'**Guilds:**\n{page}')
|
||||||
|
|
||||||
|
@cmds.command(name=',permissions', aliases=[',permission', ',perms', ',perm'])
|
||||||
|
@cmds.is_owner()
|
||||||
|
async def permissions(self, ctx, *args: d.Member):
|
||||||
|
members = list(args)
|
||||||
|
permissions = {}
|
||||||
|
|
||||||
|
if not members:
|
||||||
|
members.append(ctx.guild.me)
|
||||||
|
|
||||||
|
for member in members:
|
||||||
|
permissions[member.mention] = []
|
||||||
|
|
||||||
|
for k, v in dict(ctx.channel.permissions_for(member)).items():
|
||||||
|
if v:
|
||||||
|
permissions[member.mention].append(k)
|
||||||
|
|
||||||
|
await ctx.send(f'**Permissions:**\n\n{formatter.dict_tostring(permissions, f=False)}')
|
||||||
|
|
||||||
|
@cmds.command(name=',tasks', aliases=[',task'])
|
||||||
|
@cmds.is_owner()
|
||||||
|
async def tasks(self, ctx):
|
||||||
|
tasks = [task for task in asyncio.Task.all_tasks() if not task.done()]
|
||||||
|
|
||||||
|
await ctx.send(f'**Tasks active:** `{int((len(tasks) - 6) / 3)}`')
|
||||||
|
|
||||||
@cmds.command(name=',status', aliases=[',presence', ',game'], hidden=True)
|
@cmds.command(name=',status', aliases=[',presence', ',game'], hidden=True)
|
||||||
@cmds.is_owner()
|
@cmds.is_owner()
|
||||||
async def change_status(self, ctx, *, game=None):
|
async def change_status(self, ctx, *, game=None):
|
||||||
|
|
Loading…
Reference in a new issue