pycord icon indicating copy to clipboard operation
pycord copied to clipboard

SlashCommandGroup:: default_member_permissions: flag_value has no attribute value

Open Zifoduk opened this issue 4 years ago • 1 comments

Summary

SlashCommandGroup:: default_member_permissions: flag_value has no attribute value

Reproduction Steps

Using the Dev version of pycord available from GITHUB following the github download and install instructions

Create a cog or whichever, Create a SlashCommandGroup Add default_member_permissions to SlashCommandGroup

Minimal Reproducible Code

import discord
from discord import Option, Member, Permissions
from discord.commands import SlashCommandGroup
from discord.ext import commands, tasks

####<COG STUFF>####

    def __init__(self, bot):
        self.bot = bot

####<COG STUFF>####

Fish= SlashCommandGroup("fishes", "fish commands!", guild_ids=[...], default_member_permissions = Permissions.administrator)

####<COG STUFF>####

Expected Results

default_member_permissions = Permissions.administrator

Should work error free(??)

Actual Results

Traceback (most recent call last):
  File "R:\GitHub\Swift-Bot\env\lib\site-packages\discord\client.py", line 382, in _run_event
    await coro(*args, **kwargs)
  File "R:\GitHub\Swift-Bot\env\lib\site-packages\discord\bot.py", line 1042, in on_connect
    await self.sync_commands()
  File "R:\GitHub\Swift-Bot\env\lib\site-packages\discord\bot.py", line 644, in sync_commands
    registered_guild_commands[guild_id] = await self.register_commands(
  File "R:\GitHub\Swift-Bot\env\lib\site-packages\discord\bot.py", line 518, in register_commands
    data = [cmd["command"].to_dict() for cmd in filtered_deleted]
  File "R:\GitHub\Swift-Bot\env\lib\site-packages\discord\bot.py", line 518, in <listcomp>
    data = [cmd["command"].to_dict() for cmd in filtered_deleted]
  File "R:\GitHub\Swift-Bot\env\lib\site-packages\discord\commands\core.py", line 1022, in to_dict
    as_dict["default_member_permissions"] = self.default_member_permissions.value
AttributeError: 'flag_value' object has no attribute 'value'

Intents

intents = discord.Intents.all()

System Information

  • Python v3.10.2-final
  • py-cord v2.0.0-beta
    • py-cord pkg_resources: v2.0.0b7
  • aiohttp v3.8.1
  • system info: Windows 10 10.0.19044

Checklist

  • [X] I have searched the open issues for duplicates.
  • [X] I have shown the entire traceback, if possible.
  • [X] I have removed my token from display, if visible.

Additional Context

No response

Zifoduk avatar May 07 '22 11:05 Zifoduk

You're initializing Permissions improperly, you need Permissions(administrator=True)

plun1331 avatar May 07 '22 15:05 plun1331