feat: made roleinfo a slash command

This commit is contained in:
Seaswimmer 2023-08-08 21:40:18 -04:00
parent 71972144f2
commit a7ec04870e
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -1,6 +1,6 @@
from datetime import datetime
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.i18n import Translator, cog_i18n
import re
@ -502,9 +502,9 @@ class Info(commands.Cog):
emoji_url = f"{base_url}{valid_segments[0]}.png"
return emoji_url
@commands.command()
@commands.guild_only()
async def roleinfo(self, ctx, role: discord.Role, list_permissions: bool = False):
@app_commands.command()
@app_commands.guild_only()
async def roleinfo(self, interaction: discord.Interaction, role: discord.Role, list_permissions: bool = False):
"""Gives information on a specific role.
`list_permissions` is ignored if the role you're checking has the `Administrator` permission."""
try:
@ -544,4 +544,4 @@ class Info(commands.Cog):
embed.set_thumbnail(url=icon_url)
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}")
await ctx.send(embed=embed)
await interaction.response.send_message(embed=embed, ephemeral=True)