feat: made roleinfo a slash command
This commit is contained in:
parent
71972144f2
commit
a7ec04870e
1 changed files with 5 additions and 5 deletions
10
info/info.py
10
info/info.py
|
@ -1,6 +1,6 @@
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import discord
|
import discord
|
||||||
from redbot.core import commands, checks, Config
|
from redbot.core import commands, checks, Config, app_commands
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
from redbot.core.i18n import Translator, cog_i18n
|
from redbot.core.i18n import Translator, cog_i18n
|
||||||
import re
|
import re
|
||||||
|
@ -502,9 +502,9 @@ class Info(commands.Cog):
|
||||||
emoji_url = f"{base_url}{valid_segments[0]}.png"
|
emoji_url = f"{base_url}{valid_segments[0]}.png"
|
||||||
return emoji_url
|
return emoji_url
|
||||||
|
|
||||||
@commands.command()
|
@app_commands.command()
|
||||||
@commands.guild_only()
|
@app_commands.guild_only()
|
||||||
async def roleinfo(self, ctx, role: discord.Role, list_permissions: bool = False):
|
async def roleinfo(self, interaction: discord.Interaction, role: discord.Role, list_permissions: bool = False):
|
||||||
"""Gives information on a specific role.
|
"""Gives information on a specific role.
|
||||||
`list_permissions` is ignored if the role you're checking has the `Administrator` permission."""
|
`list_permissions` is ignored if the role you're checking has the `Administrator` permission."""
|
||||||
try:
|
try:
|
||||||
|
@ -544,4 +544,4 @@ class Info(commands.Cog):
|
||||||
embed.set_thumbnail(url=icon_url)
|
embed.set_thumbnail(url=icon_url)
|
||||||
if permissions.administrator == False and list_permissions == True:
|
if permissions.administrator == False and list_permissions == True:
|
||||||
embed.add_field(name="Permissions", value=f"**Manage Server:** {permissions.manage_guild}\n**Manage Webhooks:** {permissions.manage_webhooks}\n**Manage Channels:** {permissions.manage_channels}\n**Manage Roles:** {permissions.manage_roles}\n**Manage Emojis:** {permissions.manage_emojis}\n**Manage Messages:** {permissions.manage_messages}\n**Manage Nicknames:** {permissions.manage_nicknames}\n**Mention @everyone**: {permissions.mention_everyone}\n**Ban Members:** {permissions.ban_members}\n**Kick Members:** {permissions.kick_members}")
|
embed.add_field(name="Permissions", value=f"**Manage Server:** {permissions.manage_guild}\n**Manage Webhooks:** {permissions.manage_webhooks}\n**Manage Channels:** {permissions.manage_channels}\n**Manage Roles:** {permissions.manage_roles}\n**Manage Emojis:** {permissions.manage_emojis}\n**Manage Messages:** {permissions.manage_messages}\n**Manage Nicknames:** {permissions.manage_nicknames}\n**Mention @everyone**: {permissions.mention_everyone}\n**Ban Members:** {permissions.ban_members}\n**Kick Members:** {permissions.kick_members}")
|
||||||
await ctx.send(embed=embed)
|
await interaction.response.send_message(embed=embed, ephemeral=True)
|
||||||
|
|
Loading…
Reference in a new issue