Repository: Pycord-Development/pycord

Issue:
Bug with `max_concurrency` and `slash_command`
### Summary

max_concurrency does not work propper.

### Reproduction Steps

create a slash command with `max_concrrency`, execute it. Second time it will raise `MaxConcurrencyReached`

### Minimal Reproducible Code

```python
@slash_command(description = "test cmd")
@commands.max_concurrency(1, per=BucketType.channel)
async def test(self, ctx):
        await ctx.channel.send("test")
```


### Expected Results

First use: print "test"
Sec use: print "test"

### Actual Results

First use: print "test"
Sec use: Raise `MaxConcurrencyReached`

### Intents

all

### System Information

- Python v3.9.5-final
- py-cord v2.0.0-alpha
    - py-cord pkg_resources: v2.0.0a4744+g9aafd033
- aiohttp v3.7.3

### 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_
Fix Max Concurrency On Application Commands
## Summary

Closes #716.

## Checklist

<!-- Put an x inside [ ] to check it, like so: [x] -->

- [x If code changes were made then they have been tested.
    - [ ] I have updated the documentation to reflect the changes.
- [ ] If `type: ignore` comments were used, a comment is also left explaining why
- [x] This PR fixes an issue.
- [ ] This PR adds something new (e.g. new method or parameters).
- [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
- [ ] This PR is **not** a code change (e.g. documentation, README, typehinting, examples, ...)

Bug with `max_concurrency` and `slash_command`
### Summary

max_concurrency does not work propper.

### Reproduction Steps

create a slash command with `max_concrrency`, execute it. Second time it will raise `MaxConcurrencyReached`

### Minimal Reproducible Code

```python
@slash_command(description = "test cmd")
@commands.max_concurrency(1, per=BucketType.channel)
async def test(self, ctx):
        await ctx.channel.send("test")
```


### Expected Results

First use: print "test"
Sec use: print "test"

### Actual Results

First use: print "test"
Sec use: Raise `MaxConcurrencyReached`

### Intents

all

### System Information

- Python v3.9.5-final
- py-cord v2.0.0-alpha
    - py-cord pkg_resources: v2.0.0a4744+g9aafd033
- aiohttp v3.7.3

### 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_


Discussion:

Resolving patch:
diff --git a/discord/commands/commands.py b/discord/commands/commands.py
--- a/discord/commands/commands.py
+++ b/discord/commands/commands.py
@@ -102,7 +102,7 @@ async def wrapped(arg):
         except Exception as exc:
             raise ApplicationCommandInvokeError(exc) from exc
         finally:
-            if command._max_concurrency is not None:
+            if hasattr(command, '_max_concurrency') and command._max_concurrency is not None:
                 await command._max_concurrency.release(ctx)
             await command.call_after_hooks(ctx)
         return ret


Test patch: