internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: platformsh/platformsh-docs

Issue:
Add keywords for search
### Where on docs.platform.sh should be changed?

/configuration/app/app-reference.html

### What exactly should be updated?

We'd like specific pages to be findable by searching for specific words. For example, the app reference when searching for `.platform.app.yaml` (this may also involve a problem with escaping characters like `.`). Add keywords or other to make these pages findable.

### Additional context

_No response_


Discussion:

Resolving patch:
diff --git a/search/main.py b/search/main.py
--- a/search/main.py
+++ b/search/main.py
@@ -21,9 +21,9 @@ def __init__(self):
         # Below are Platform.sh custom settings for how the search engine functions.
 
         # Data available to the dropdown React app in docs, used to fill out autocomplete results.
-        self.displayed_attributes = ['title', 'text', 'url', 'site', 'section']
+        self.displayed_attributes = ['keywords', 'title', 'text', 'url', 'site', 'section']
         # Data actually searchable by our queries.
-        self.searchable_attributes = ['title', 'pageUrl', 'section', 'url', 'text']
+        self.searchable_attributes = ['keywords', 'title', 'pageUrl', 'section', 'text', 'url']
 
         # Show results for one query with the listed pages, when they by default would not show up as best results.
         # Note: these aren't automatically two-way, which is why they're all defined twice.


Test patch:
Repository: platformsh/platformsh-docs

Issue:
:arrow_up: Update MeiliSearch
### What needs to be documented?

We should update MeiliSearch to version 0.25. This means we have to change how we manage API keys. It does mean we can create more keys for monitoring and the like.

### Additional context

[Blog post on version](https://blog.meilisearch.com/whats-new-in-v0-25/)
[Additional context](https://github.com/orgs/platformsh/projects/3)


Discussion:

Resolving patch:
diff --git a/search/main.py b/search/main.py
--- a/search/main.py
+++ b/search/main.py
@@ -119,10 +119,14 @@ def update(self):
 
         # Delete previous index
         if len(client.get_indexes()):
-            client.get_index(self.docs_index).delete()
+            client.index(self.docs_index).delete()
 
         # Create a new index
-        index = client.create_index(uid=self.docs_index, options={'primaryKey': self.primaryKey, 'uid': self.index_name})
+        create_index_task = client.create_index(uid=self.docs_index, options={'primaryKey': self.primaryKey, 'uid': self.index_name})
+
+        client.wait_for_task(create_index_task['uid'])
+
+        index = client.get_index(create_index_task['indexUid'])
 
         # Add synonyms for the index
         index.update_synonyms(self.synonyms)


Test patch:
Repository: platformsh/platformsh-docs

Issue:
🐛 Allow searching for code strings with separators
### Where on docs.platform.sh should be changed?

The search

### What exactly should be updated?

Searching for strings with separators like `X-Frame-Options` and `memory_ratio` don't show the results for pages that have those strings directly. Putting quotes around the strings doesn't help.

We'd like people to be able to get info on specific properties and strings, so the search should return these results.

### Additional context

_No response_


Discussion:

Resolving patch:
diff --git a/search/main.py b/search/main.py
--- a/search/main.py
+++ b/search/main.py
@@ -59,7 +59,7 @@ def __init__(self):
         #   - sort: queries are sorted at query time
         #   - exactness: similarity of matched words in document with query
 
-        self.ranking_rules = ["rank:asc", "attribute", "typo", "words", "proximity", "exactness"]
+        self.ranking_rules = ["rank:asc", "exactness", "attribute", "proximity", "typo", "words"]
 
         self.updated_settings = {
             "rankingRules": self.ranking_rules,


Test patch:
Repository: interactions-py/interactions.py

Issue:
Subcommands are registered to guilds where there are not allowed
I've noticed that when I use `guild_ids` on a subcommand for a command which is shared between multiple guilds, that subcommand is registered to all guilds where one of its subcommands is allowed.

## Steps
1. Register a subcommand `s1` for command `c`  for **Guild A**: 
   ```python
      @slash.subcommand(
         base="c",
         name="s1",
         guilds_ids=[GUILD_A_ID],
      )
      def _handle(ctx):
         # ....
     ```
1. Register a subcommand `s2` for command `c`  for **Guild B**: 
   ```python
      @slash.subcommand(
         base="c",
         name="s2",
         guilds_ids=[GUILD_A_ID],
      )
      def _handle(ctx):
         # ....
     ```

## Expected behavior
**Guild A** has `/c s1` command only and **Guild B** has `/c s2` command only.

## Actual behavior
**Guild A** has `/c s1` and `/c s2` but only can use `/c s1`, and **Guild B** has `/c s1` and `/c s2` but only can use `/c s2`.


Discussion:
I need to fix this ASAP. And I think, I can do it by fixing [`Client#to_dict`](https://github.com/eunwoo1104/discord-py-slash-command/blob/master/discord_slash/client.py#L173) so that it makes copies of the commands with appropriate subcommand for each guild.

Resolving patch:
diff --git a/discord_slash/client.py b/discord_slash/client.py
--- a/discord_slash/client.py
+++ b/discord_slash/client.py
@@ -425,8 +425,8 @@ def add_subcommand(self,
         name = name.lower()
         description = description or getdoc(cmd)
 
-        if name in self.commands:
-            tgt = self.commands[name]
+        if base in self.commands:
+            tgt = self.commands[base]
             for x in tgt.allowed_guild_ids:
                 if x not in guild_ids:
                     guild_ids.append(x)


Test patch:
Repository: interactions-py/interactions.py

Issue:
Add parsed args to SlashContext
Regular command contexts have [args/kwargs attributes](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Context.args), this is useful for debugging command errors as the user input can be easily accessed by command error events, however, SlashContext doesn't have this (despite it being arguably more important, as there's no message to log).

Would be a nice little enhancement.


Discussion:

Resolving patch:
diff --git a/discord_slash/client.py b/discord_slash/client.py
--- a/discord_slash/client.py
+++ b/discord_slash/client.py
@@ -691,12 +691,15 @@ async def invoke_command(self, func, ctx, args):
         try:
             not_kwargs = False
             if isinstance(args, dict):
+                ctx.kwargs = args
+                ctx.args = list(args.values())
                 try:
                     await func.invoke(ctx, **args)
                 except TypeError:
                     args = list(args.values())
                     not_kwargs = True
             else:
+                ctx.args = args
                 not_kwargs = True
             if not_kwargs:
                 await func.invoke(ctx, *args)
diff --git a/discord_slash/context.py b/discord_slash/context.py
--- a/discord_slash/context.py
+++ b/discord_slash/context.py
@@ -18,6 +18,8 @@ class SlashContext:
 
     :ivar message: Message that invoked the slash command.
     :ivar name: Name of the command.
+    :ivar args: List of processed arguments invoked with the command.
+    :ivar kwargs: Dictionary of processed arguments invoked with the command.
     :ivar subcommand_name: Subcommand of the command.
     :ivar subcommand_group: Subcommand group of the command.
     :ivar interaction_id: Interaction ID of the command message.
@@ -40,6 +42,8 @@ def __init__(self,
         self.__token = _json["token"]
         self.message = None # Should be set later.
         self.name = self.command = self.invoked_with = _json["data"]["name"]
+        self.args = []
+        self.kwargs = {}
         self.subcommand_name = self.invoked_subcommand = self.subcommand_passed = None
         self.subcommand_group = self.invoked_subcommand_group = self.subcommand_group_passed = None
         self.interaction_id = _json["id"]


Test patch:
Repository: interactions-py/interactions.py

Issue:
Missing await in sync_all_commands
```
Task exception was never retrieved
future: <Task finished name='Task-26' coro=<SlashCommand.sync_all_commands() done, defined at C:\Users\henry\AppData\Local\Programs\Python\Python39\lib\site-packages\discord_slash\client.py:294> exception=TypeError("object of type 'coroutine' has no len()")>
Traceback (most recent call last):
  File "C:\Users\henry\AppData\Local\Programs\Python\Python39\lib\site-packages\discord_slash\client.py", line 353, in sync_all_commands
    if len(existing) != 0:
TypeError: object of type 'coroutine' has no len()
C:\Users\henry\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py:1891: RuntimeWarning: coroutine 'HTTPClient.request' was never awaited
  handle = None  # Needed to break cycles when an exception occurs.
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
```
There is a missing `await` [here](https://github.com/eunwoo1104/discord-py-slash-command/blob/cc62eeb22718857ca1603205554834b8f3ac7d76/discord_slash/client.py#L352), due to [`SlashCommandRequest.get_all_commands`](https://github.com/eunwoo1104/discord-py-slash-command/blob/cc62eeb22718857ca1603205554834b8f3ac7d76/discord_slash/http.py#L48) calling [`self.command_request`](https://github.com/eunwoo1104/discord-py-slash-command/blob/cc62eeb22718857ca1603205554834b8f3ac7d76/discord_slash/http.py#L72), both of which are functions; `command_request` returns the result of calling [`self._discord.http.request`](https://github.com/Rapptz/discord.py/blob/8517f1e085df27acd5191d0d0cb2363242be0c29/discord/http.py#L134), which is/returns a coroutine.

`sync_all_commands` needs an `await`, but `get_all_commands` and `command_request` should probably be asynchronous and themselves `await` that which they call.


Discussion:
From looking at the source, changing `command_request` would require a lot of functions to be changed to coroutines, but it would make the code much clearer; alternatively, type annotation could help clarify (ie. `def f() -> typing.Coroutine:` or `collections.abc.Coroutine`)

Resolving patch:
diff --git a/discord_slash/client.py b/discord_slash/client.py
--- a/discord_slash/client.py
+++ b/discord_slash/client.py
@@ -349,7 +349,7 @@ async def sync_all_commands(self, delete_from_unused_guilds=False):
             
             for guild in other_guilds:
                 with suppress(discord.Forbidden):
-                    existing = self.req.get_all_commands(guild_id = guild)
+                    existing = await self.req.get_all_commands(guild_id = guild)
                     if len(existing) != 0:
                         await self.req.put_slash_commands(slash_commands=[], guild_id=guild)
 


Test patch:
Repository: interactions-py/interactions.py

Issue:
Ephemeral (hidden) Messages now support embeds
Whenever an embed is sent with the `hidden=True`, a warning is printed : `Embed/File is not supported for hidden!`. But ephemeral messages now support embeds.


Discussion:

Resolving patch:
diff --git a/discord_slash/context.py b/discord_slash/context.py
--- a/discord_slash/context.py
+++ b/discord_slash/context.py
@@ -134,9 +134,6 @@ async def send(self,
         """
         Sends response of the slash command.
 
-        .. note::
-            - Param ``hidden`` doesn't support embed and file.
-
         .. warning::
             - Since Release 1.0.9, this is completely changed. If you are migrating from older version, please make sure to fix the usage.
             - You can't use both ``embed`` and ``embeds`` at the same time, also applies to ``file`` and ``files``.
@@ -186,8 +183,6 @@ async def send(self,
             else self.bot.allowed_mentions.to_dict() if self.bot.allowed_mentions else {}
         }
         if hidden:
-            if embeds or files:
-                self._logger.warning("Embed/File is not supported for `hidden`!")
             base["flags"] = 64
 
         initial_message = False


Test patch:
Repository: interactions-py/interactions.py

Issue:
Editing SlashMessage should support multiple embeds
Calling `discord_slash.model.SlashMessage.edit` with an `embeds` kwarg does not work. However the official Discord API documentation says that it should be possible [when editing interaction messages](https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response).


Discussion:

Resolving patch:
diff --git a/discord_slash/model.py b/discord_slash/model.py
--- a/discord_slash/model.py
+++ b/discord_slash/model.py
@@ -336,7 +336,7 @@ async def _slash_edit(self, **fields):
 
     async def edit(self, **fields):
         """Refer :meth:`discord.Message.edit`."""
-        if "file" in fields or "files" in fields:
+        if "file" in fields or "files" in fields or "embeds" in fields:
             await self._slash_edit(**fields)
         else:
             try:


Test patch:
Repository: interactions-py/interactions.py

Issue:
Pressing a Button sent by current bot causes exception in on_socket_response
When your bot sent a message with new discord buttons - upon pressing on button, following exception arises in console (not critical, but annoying and suboptimal):
```
Ignoring exception in on_socket_response
Traceback (most recent call last):
  File "***\venv\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "***\venv\lib\site-packages\discord_slash\client.py", line 762, in on_socket_response
    if to_use["data"]["name"] in self.commands:
KeyError: 'name'
```

Steps to reproduce:
1) Have your bot send message containing components (buttons) (for example sent  by another python script with discord-components library)
2) Launch your bot with discord-py-slash-command
3) Press on button in the message
4) Exception

Reproducable on example from readme
```py
import discord
from discord.ext import commands
from discord_slash import SlashCommand, SlashContext

bot = commands.Bot(command_prefix="!", intents=discord.Intents.all())
slash = SlashCommand(bot)

@slash.slash(name="test")
async def _test(ctx: SlashContext):
    embed = discord.Embed(title="embed test")
    await ctx.send(content="test", embeds=[embed])

bot.run("token")
```

discord-py-slash-command version: 1.1.2 from pypi


Discussion:

Resolving patch:
diff --git a/discord_slash/client.py b/discord_slash/client.py
--- a/discord_slash/client.py
+++ b/discord_slash/client.py
@@ -887,6 +887,9 @@ async def on_socket_response(self, msg):
 
         to_use = msg["d"]
 
+        if to_use["type"] not in (1, 2):
+            return  # to only process ack and slash-commands and exclude other interactions like buttons
+
         if to_use["data"]["name"] in self.commands:
 
             ctx = context.SlashContext(self.req, to_use, self._discord, self.logger)


Test patch:
Repository: interactions-py/interactions.py

Issue:
`SlashMessage.edit` references non-existing attribute `bot`
These [conditionals](https://github.com/discord-py-slash-commands/discord-py-interactions/blob/38bbde4f1643fe83a09cfa9a44c6e0e5fcbb132d/discord_slash/model.py#L552-L560) seem to be causing an AttributeError when running `SlashMessage.edit`. 
Reading through the code, `SlashMessage` does indeed not seem to inherit this attribute anywhere.

The relevant [equivalent discord.py code ](https://github.com/Rapptz/discord.py/blob/d7ed88459341527a69e8d8a7a77ad1d9c5e2832c/discord/message.py#L1228-L1236 ) uses the attribute `_state` instead.


Discussion:

Resolving patch:
diff --git a/discord_slash/model.py b/discord_slash/model.py
--- a/discord_slash/model.py
+++ b/discord_slash/model.py
@@ -549,15 +549,15 @@ async def _slash_edit(self, **fields):
 
         allowed_mentions = fields.get("allowed_mentions")
         if allowed_mentions is not None:
-            if self.bot.allowed_mentions is not None:
-                _resp["allowed_mentions"] = self.bot.allowed_mentions.merge(
+            if self._state.allowed_mentions is not None:
+                _resp["allowed_mentions"] = self._state.allowed_mentions.merge(
                     allowed_mentions
                 ).to_dict()
             else:
                 _resp["allowed_mentions"] = allowed_mentions.to_dict()
         else:
-            if self.bot.allowed_mentions is not None:
-                _resp["allowed_mentions"] = self.bot.allowed_mentions.to_dict()
+            if self._state.allowed_mentions is not None:
+                _resp["allowed_mentions"] = self._state.allowed_mentions.to_dict()
             else:
                 _resp["allowed_mentions"] = {}
 


Test patch:
Repository: interactions-py/interactions.py

Issue:
[BUG] Leftover debug prints in synchronize()
**Describe the bug**

Starting the bot always print out the internal list of commands. This is presumably prints used during debugging that should have been removed or changed to proper logging. These lists can be very long if there are many registered commands with many parameters specified.

https://github.com/goverfl0w/interactions.py/blob/unstable/interactions/client.py#L272-L273

**Reproducing steps**

Start any valid bot.

**What's normally expected**
The bot starts up without unnecessary debug output.

**What actually happened**
The bot prints out two lists of application commands regardless of log level.

**Versions**
- [ ] I am using discord.py versions 1.7 and below with my code.
    - [ ] I am using 2.0 or higher, or a modified fork.
- [ ] I am using dis-snek with my code.
- [x] I am not using any of the listed above and am using the library code alone.



Discussion:
~~Should have been fixed in unstable with https://github.com/goverfl0w/interactions.py/pull/421~~

Edit: Oh sorry, different logging issue. You can open a pr to change it to a log.debug
Will do, thanks

Resolving patch:
diff --git a/interactions/client.py b/interactions/client.py
--- a/interactions/client.py
+++ b/interactions/client.py
@@ -269,8 +269,8 @@ async def create(data: ApplicationCommand) -> None:
             command.get("name") for command in cached_commands if command.get("name")
         ]
 
-        print(cached_commands)
-        print(cached_command_names)
+        log.debug(f"Cached commands: {cached_commands}")
+        log.debug(f"Cached command names: {cached_command_names}")
 
         if cached_commands:
             for command in commands:


Test patch:
Repository: interactions-py/interactions.py

Issue:
[REQUEST] implement channel invite and channel.get classmethod 
^



Discussion:

Resolving patch:
diff --git a/interactions/api/models/channel.py b/interactions/api/models/channel.py
--- a/interactions/api/models/channel.py
+++ b/interactions/api/models/channel.py
@@ -857,29 +857,10 @@ async def create_thread(
 
         return Channel(**res, _client=self._client)
 
-    @classmethod
-    async def get(
-        cls,
-        channel: Union[int, str],
-        client: "HTTPClient",  # noqa
-    ) -> "Channel":
-        """
-        Gets a channel based of its URL or its id.
-
-        :param channel: The URL to the channel or the id of the channel
-        :type channel: Union[int, str]
-        :param client: The HTTPClient of your bot. Set as ``bot._http``
-        :type client: HTTPClient
-        """
-
-        channel_id = channel if isinstance(channel, int) else int(channel.split(sep="/")[-1])
-
-        res = await client.get_channel(channel_id)
-        return cls(**res, _client=client)
-
     @property
     def url(self) -> str:
-        return f"https://discord.com/channels/{self.guild_id}/{self.id}" if self.guild_id else None
+        _guild_id = "@me" if not isinstance(self.guild_id, int) else self.guild_id
+        return f"https://discord.com/channels/{_guild_id}/{self.id}"
 
     async def create_invite(
         self,
diff --git a/interactions/api/models/guild.py b/interactions/api/models/guild.py
--- a/interactions/api/models/guild.py
+++ b/interactions/api/models/guild.py
@@ -54,6 +54,13 @@ class EventStatus(IntEnum):
     CANCELED = 4
 
 
+class InviteTargetType(IntEnum):
+    """An enumerable object representing the different invite target types"""
+
+    STREAM = 1
+    EMBEDDED_APPLICATION = 2
+
+
 class WelcomeChannels(DictSerializerMixin):
     """
     A class object representing a welcome channel on the welcome screen.
@@ -1755,6 +1762,14 @@ def __init__(self, **kwargs):
             else None
         )
 
+    async def delete(self) -> None:
+        """Deletes the invite"""
+
+        if not self._client:
+            raise AttributeError("HTTPClient not found!")
+
+        await self._client.delete_invite(self.code)
+
 
 class GuildTemplate(DictSerializerMixin):
     """


Test patch:
Repository: interactions-py/interactions.py

Issue:
[BUG] message and code are swapped in LibraryException
### Describe the bug.

in `LibraryException` this is the `__init__`:
```py
def __init__(self, message: str = None, code: int = 0, severity: int = 0, **kwargs):
```
however, the library uses errors like:
```py
raise LibraryException(11, message="Your command must have a name.")
```
which when tried in a terminal results in
```py
>>> raise LibraryException(11, message="Your command must have a name.")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() got multiple values for argument 'message'
```
so the `__init__` should instead be
```py
def __init__(self, code: int = 0, message: str = None, severity: int = 0, **kwargs):
```

### List the steps.

```py
>>> from interactions import LibraryException 
>>> raise LibraryException(11, message="Your command must have a name.") 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() got multiple values for argument 'message'
```

### What you expected.

```py
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
interactions.api.error.LibraryException: An error occurred:
Your command must have a name., with code '11' and severity '0'
```

### What you saw.

```py
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() got multiple values for argument 'message'
```

### What version of the library did you use?

unstable

### Version specification

_No response_

### Code of Conduct

- [X] I agree to follow the contribution requirements.


Discussion:
"intended feature 🤓"

jokes aside this is a breaking bug when an interaction exception occurs anywhere as our running process only throws it and keeps the loop ongoing

Resolving patch:
diff --git a/interactions/api/error.py b/interactions/api/error.py
--- a/interactions/api/error.py
+++ b/interactions/api/error.py
@@ -269,7 +269,7 @@ def lookup(code: int) -> str:
             180002: "Failed to create stage needed for stage event",
         }.get(code, f"Unknown error: {code}")
 
-    def __init__(self, message: str = None, code: int = 0, severity: int = 0, **kwargs):
+    def __init__(self, code: int = 0, message: str = None, severity: int = 0, **kwargs):
         self.code: int = code
         self.severity: int = severity
         self.data: dict = kwargs.pop("data", None)


Test patch: