Repository: Pycord-Development/pycord

Issue:
commands.has_permissions() decorator dont work correctly in DM channels
### Summary

commands.has_permissions() decorator dont work correctly in DM channels

### Reproduction Steps

- Create command with @commands.has_permissions() decorator
- Try to use command in DM Channel

### Minimal Reproducible Code

```python
from discord.ext import commands
...

@commands.slash_command()
@commands.has_permissions(manage_guild=True)
async def test(self, ctx: discord.ApplicationContext:
    pass
```


### Expected Results

has_permissions should return True while using commands/slash commands in DM channel:
```If the command is executed within a DM, it returns "True".``` [(link)](https://github.com/Pycord-Development/pycord/blob/e0d4c4549a7706fd9966745e64a464a27d3da21f/discord/ext/commands/core.py#L2095)

### Actual Results

```bash
Ignoring exception in on_interaction
Traceback (most recent call last):
  File "C:\Users\*\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 382, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\*\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 1043, in on_interaction
    await self.process_application_commands(interaction)
  File "C:\Users\*\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 738, in process_application_commands
    await self.invoke_application_command(ctx)
  File "C:\Users\*\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 994, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "C:\Users\*\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 355, in invoke
    await self.prepare(ctx)
  File "C:\Users\*\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 277, in prepare
    if not await self.can_run(ctx):
  File "C:\Users\*\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 374, in can_run
    return await async_all(predicate(ctx) for predicate in predicates)  # type: ignore
  File "C:\Users\*\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\utils.py", line 562, in async_all
    for elem in gen:
  File "C:\Users\*\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 374, in <genexpr>
    return await async_all(predicate(ctx) for predicate in predicates)  # type: ignore
  File "C:\Users\*\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 2120, in predicate
    permissions = ch.permissions_for(ctx.author)  # type: ignore
AttributeError: 'PartialMessageable' object has no attribute 'permissions_for
```

### Intents

```py
discord.Intents.all()
```

### System Information

```bash
- Python v3.8.13-final
- py-cord v2.1.0-final
- aiohttp v3.8.1
- system info: Linux 5.4.0-122-generic #138-Ubuntu SMP Wed Jun 22 15:00:31 UTC 2022
```

### 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

https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.Interaction.channel

Note that due to a Discord limitation, DM channels are not resolved since there is no data to complete them. 
These are [PartialMessageable](https://discordpy.readthedocs.io/en/latest/api.html#discord.PartialMessageable) instead.

Commands in the SlashCommandGroup treat optional arguments as required
### Summary

Commands in the SlashCommandGroup treat optional arguments as required

### Reproduction Steps

- Create SlashCommandGroup and add command with optional parameter to it eg:
`member: discord.Member = None` or `member: discord.Option(discord.Member) = None`
- Go to any server where you can use this command
- Start writing a command and look at the parameters

### Minimal Reproducible Code

```python
test = SlashCommandGroup("test", "testing...")

@test.command(name='testcommand')
async def testcommand(
    self, 
    ctx: discord.ApplicationContext, 
    member: discord.Member = None, # or discord.Option(discord.Member) = None
):
    pass
```


### Expected Results

Parameter should be marked as optional:
![image](https://user-images.githubusercontent.com/61660055/170273210-7b5e07a6-afd7-45d4-918d-2a9858483bf8.png)

### Actual Results

Parameter is marked as required:
![image](https://user-images.githubusercontent.com/61660055/170270780-678b11df-937a-44c4-ad46-3da5f8444529.png)

### Intents

`discord.Intents.all()`

### System Information
```
- Python v3.8.13-final
- py-cord v2.0.0-candidate
    - py-cord pkg_resources: v2.0.0rc1
- aiohttp v3.8.1
- system info: Linux 5.4.0-107-generic #121-Ubuntu SMP Thu Mar 24 16:04:27 UTC 2022
```


### 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

_Previously no problem, after update to the latest version there are problems with it_


Discussion:

Resolving patch:
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py
--- a/discord/ext/commands/core.py
+++ b/discord/ext/commands/core.py
@@ -2116,8 +2116,9 @@ async def test(ctx):
         raise TypeError(f"Invalid permission(s): {', '.join(invalid)}")
 
     def predicate(ctx: Context) -> bool:
-        ch = ctx.channel
-        permissions = ch.permissions_for(ctx.author)  # type: ignore
+        if ctx.channel.type == ChannelType.private:
+            return True
+        permissions = ctx.channel.permissions_for(ctx.author)  # type: ignore
 
         missing = [perm for perm, value in perms.items() if getattr(permissions, perm) != value]
 


Test patch: