internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: interactions-py/interactions.py

Issue:
[BUG] Member.get_avatar_url returns wrong URL when a member doesn't have a guild avatar.
### Describe the bug.

When using `Member.get_avatar_url`, the method returns a URL that's built as follows:
```
f"https://cdn.discordapp.com/guilds/{_guild_id}/users/{int(self.user.id)}/avatars/{self.avatar}"
```
The URL that's returned is, if the member object has a server-specific profile picture, correct. However, when it doesn't, a malformed cdn URL is returned which points to nothing. This is caused by the `avatar` property returning the hash of a global profile picture.

I propose checking if `Member.user.avatar` and `Member.avatar` match, and if so, return `None`. A PR will be created shortly after this issue if you believe this change is appropiate.

### List the steps.

1. Create a dummy command with a member option
2. Have the bot send both `Member.get_avatar_url()` & `Member.user.avatar_url`

3.1 Input a user with a server profile picture
4.1 Notice how both CDN URLs work and point to valid images

3.2 Input a user without a server profile picture
4.2 A server profile picture link is sent
4.3 Notice how it points to a nonexistent image

### What you expected.

-

### What you saw.

-

### 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:

Resolving patch:
diff --git a/interactions/api/models/member.py b/interactions/api/models/member.py
--- a/interactions/api/models/member.py
+++ b/interactions/api/models/member.py
@@ -490,7 +490,7 @@ def get_avatar_url(
         :return: URL of the members's avatar (None will be returned if no avatar is set)
         :rtype: str
         """
-        if not self.avatar:
+        if not self.avatar or self.avatar == self.user.avatar:
             return None
 
         if guild_id is MISSING:


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

Issue:
[BUG] Docs: Incorrect parameter description on Embed.remove_field()
### Describe the bug.

In the docs, the description of the `index` parameter to the `Embed.remove_field()` method says it's the index of the new field. This doesn't make sense, since you pass the index of the field to be removed.

### List the steps.

1. Open https://interactionspy.readthedocs.io/en/latest/api.models.message.html#interactions.api.models.message.Embed.remove_field
2. see description of `remove_field`'s `index` parameter

### What you expected.

`Index of the field to be removed`

### What you saw.

`The new field’s index`

### What version of the library did you use?

stable

### Version specification

_No response_

### Code of Conduct

- [X] I agree to follow the contribution requirements.


Discussion:

Resolving patch:
diff --git a/interactions/api/models/message.py b/interactions/api/models/message.py
--- a/interactions/api/models/message.py
+++ b/interactions/api/models/message.py
@@ -477,7 +477,7 @@ def insert_field_at(
         """
         Inserts a field in the embed at the specified index
 
-        :param index: The new field's index
+        :param index: The field's index to insert
         :type index: int
         :param name: The name of the field
         :type name: str
@@ -501,7 +501,7 @@ def set_field_at(
         """
         Overwrites the field in the embed at the specified index
 
-        :param index: The new field's index
+        :param index: The field's index to overwrite
         :type index: int
         :param name: The name of the field
         :type name: str
@@ -526,7 +526,7 @@ def remove_field(self, index: int) -> None:
         """
         Remove field at the specified index
 
-        :param index: The new field's index
+        :param index: The field's index to remove
         :type index: int
         """
 


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

Issue:
[BUG] forcing http in get() not working
### Describe the bug.

forcing http in get() function returns the cache if there is one.

### List the steps.

1. get member: `member: interactions.Member = await di.get(client=bot, obj=interactions.Member, parent_id=ctx.guild_id, object_id=ctx.author.id._snowflake, force="http")`
2. Add Role to Member via Discord
3. get member again
4. compare member.role before and after

### What you expected.

The rolelists before/after should have difference

### What you saw.

Instead the rolelists are the same

### What version of the library did you use?

release

### Version specification

_No response_

### Code of Conduct

- [X] I agree to follow the contribution requirements.


Discussion:

Resolving patch:
diff --git a/interactions/utils/get.py b/interactions/utils/get.py
--- a/interactions/utils/get.py
+++ b/interactions/utils/get.py
@@ -194,8 +194,9 @@ def _check():
         _objects: List[Union[_obj, Coroutine]] = []
         kwarg_name += "s"
 
-        force_cache = kwargs.pop("force", None) == "cache"
-        force_http = kwargs.pop("force", None) == "http"
+        force_arg = kwargs.pop("force", None)
+        force_cache = force_arg == "cache"
+        force_http = force_arg == "http"
 
         if not force_http:
             _objects = _get_cache(_obj, client, kwarg_name, _list=True, **kwargs)
@@ -230,8 +231,10 @@ def _check():
 
     _obj: Optional[_T] = None
 
-    force_cache = kwargs.pop("force", None) == "cache"
-    force_http = kwargs.pop("force", None) == "http"
+    force_arg = kwargs.pop("force", None)
+    force_cache = force_arg == "cache"
+    force_http = force_arg == "http"
+
     if not force_http:
         _obj = _get_cache(obj, client, kwarg_name, **kwargs)
 


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

Issue:
[BUG] Guild.get_audit_logs fails when passed a User or Snowflake to the user id
### Describe the bug.

`Guild.get_audit_logs` accepts a User, Snowflake, int, or None in the `user_id` parameter. However, it fails to convert the first two into ints, which results in an error. This likely also applies to other audit log functions, as a quick glance shows that no conversion to ints happen.

### List the steps.

(Image taken from a help thread)
![image](https://user-images.githubusercontent.com/84055084/198934164-6fd92bec-82d2-48e1-8ac5-8ff3a08135c3.png)


### What you expected.

The code to run successfully

### What you saw.

(Image taken from a help thread)
![image](https://user-images.githubusercontent.com/84055084/198934202-127d980b-d311-4713-b623-73f3507ca6db.png)


### What version of the library did you use?

release

### Version specification

_No response_

### Code of Conduct

- [X] I agree to follow the contribution requirements.


Discussion:

Resolving patch:
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
@@ -2701,7 +2701,7 @@ async def get_audit_logs(
         """
 
         _user_id = (
-            (user_id.id if isinstance(user_id, User) else user_id)
+            int(user_id.id if isinstance(user_id, User) else user_id)
             if user_id is not MISSING
             else None
         )
@@ -2745,7 +2745,7 @@ async def get_latest_audit_log_action(
                     "is the user ID and the second is the action type!",
                 )
 
-            _user = of[0].id if isinstance(of[0], (Member, User)) else of[0]
+            _user = int(of[0].id if isinstance(of[0], (Member, User)) else of[0])
             res = await self._client.get_guild_auditlog(
                 guild_id=int(self.id), user_id=_user, action_type=of[1]
             )
@@ -2758,7 +2758,9 @@ async def get_latest_audit_log_action(
         else:
             if isinstance(of, (Member, User)):
                 of = of.id
-            res = await self._client.get_guild_auditlog(guild_id=int(self.id), user_id=of, limit=1)
+            res = await self._client.get_guild_auditlog(
+                guild_id=int(self.id), user_id=int(of), limit=1
+            )
 
         return AuditLogs(**res)
 
@@ -2780,7 +2782,7 @@ async def get_full_audit_logs(
 
         _action_type = action_type if action_type is not MISSING else None
         _user_id = (
-            (user_id.id if isinstance(user_id, User) else user_id)
+            int(user_id.id if isinstance(user_id, User) else user_id)
             if user_id is not MISSING
             else None
         )
diff --git a/interactions/api/models/member.py b/interactions/api/models/member.py
--- a/interactions/api/models/member.py
+++ b/interactions/api/models/member.py
@@ -91,7 +91,7 @@ def guild_id(self) -> Optional[Union[Snowflake, LibraryException]]:
 
         if not self._client:
             raise LibraryException(code=13)
-            
+
         from .guild import Guild
 
         if self.roles:


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

Issue:
[REQUEST] Add event listener for bot disconnect
### Describe the feature.

I am currently developing my own Discord bot using interactions.py, however due to my internet not being the best, the bot tends to go offline randomly. I would like to know when the bot goes offline, and adding an event listener to listen for bot disconnects can help with this. Discord.py has an on_disconnect function, so it would make sense to have one here for interactions.py, as interactions.py was built to be an extension of Discord.py, according to the FAQ section on the documentation website.

### Code of Conduct

- [X] I agree to follow the contribution requirements.
[REQUEST] Add event listener for bot disconnect
### Describe the feature.

I am currently developing my own Discord bot using interactions.py, however due to my internet not being the best, the bot tends to go offline randomly. I would like to know when the bot goes offline, and adding an event listener to listen for bot disconnects can help with this. Discord.py has an on_disconnect function, so it would make sense to have one here for interactions.py, as interactions.py was built to be an extension of Discord.py, according to the FAQ section on the documentation website.

### Code of Conduct

- [X] I agree to follow the contribution requirements.


Discussion:
This would be amazing.
This would be amazing.

Resolving patch:
diff --git a/interactions/api/gateway/client.py b/interactions/api/gateway/client.py
--- a/interactions/api/gateway/client.py
+++ b/interactions/api/gateway/client.py
@@ -946,6 +946,12 @@ async def _reconnect(self, to_resume: bool, code: Optional[int] = 1012) -> None:
                 if self.__heartbeat_event.is_set():
                     self.__heartbeat_event.clear()  # Because we're hardresetting the process
 
+            self._dispatch.dispatch(
+                "on_disconnect"
+            )  # will be followed by the on_ready event after reconnection
+            # reconnection happens whenever it disconnects either with or without a resume prompt
+            # as this is called whenever the WS client closes
+
             if not to_resume:
                 url = self.ws_url if self.ws_url else await self._http.get_gateway()
             else:


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

Issue:
[BUG] Unable to create new `Role` with `Permissions.NONE`
### Library Version

5.5.1

### Describe the Bug

When attempting to create a new guild role with permissions set to `Permissions.NONE` (i.e. the role should have all permissions disabled), the role is instead created with Discord's default set of permissions for new guild roles.

### Steps to Reproduce

Call the function `create_role` on a `interactions.Guild` object, and attempt to create a new role, passing in `permissions=interactions.Permissions.NONE`. Then through the Discord UI, observe the permissions enabled for the role. Notice that the default permissions for guild roles are all enabled.

### Expected Results

When calling `interactions.Guild.create_role` with `permissions=interactions.Permissions.NONE`, the role created should have all guild permissions disabled on it.

### Minimal Reproducible Code

```python
import interactions as ipy

bot = ipy.Client(intents=ipy.Intents.DEFAULT, debug_scope=<your_guild_id>)

@ipy.slash_command()
async def create_role(ctx: ipy.SlashContext):
    role = await ctx.guild.create_role(name="test role", permissions=ipy.Permissions.NONE)
    await ctx.send(f"role's new permissions: {role.permissions}")

if __name__ == "__main__":
    bot.start("<token>")
```


### Traceback

_No response_

### 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.
- [X] I have attempted to debug this myself, and I believe this issue is with the library

### Additional Information

I think the bug is just an improper falsey check on the `permissions` argument.


Discussion:

Resolving patch:
diff --git a/interactions/models/discord/guild.py b/interactions/models/discord/guild.py
--- a/interactions/models/discord/guild.py
+++ b/interactions/models/discord/guild.py
@@ -1457,7 +1457,7 @@ async def create_role(
         if name:
             payload["name"] = name
 
-        if permissions:
+        if permissions is not MISSING and permissions is not None:
             payload["permissions"] = str(int(permissions))
 
         if colour := colour or color:


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

Issue:
[BUG] Fix ctx.send("", delete_after) for ephemeral message
### Library Version

5.7.0

### Describe the Bug

```
ValueError("Cannot delete ephemeral message without interaction context parameter")
```

### Steps to Reproduce

ctx is SlashContext

```py
await ctx.send("some", delete_after=2)
```

### Expected Results

Delete the interaction message after 2 seconds.

### Minimal Reproducible Code

```python
await ctx.send("some", delete_after=2)
```


### Traceback

```
ValueError("Cannot delete ephemeral message without interaction context parameter")
```

### 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.
- [X] I have attempted to debug this myself, and I believe this issue is with the library

### Additional Information

I think it can be fixed if a context is passed. Perhaps add a way to pass context or something. 


Discussion:
@BigChungus888 are you using `ctx.defer(ephemeral=True)` before this code?
Yeah I do. But deleting ephemeral should not be a problem right? As ctx.delete() is able to do that.

Resolving patch:
diff --git a/interactions/client/mixins/send.py b/interactions/client/mixins/send.py
--- a/interactions/client/mixins/send.py
+++ b/interactions/client/mixins/send.py
@@ -111,5 +111,8 @@ async def send(
         if message_data:
             message = self.client.cache.place_message_data(message_data)
             if delete_after:
-                await message.delete(delay=delete_after)
+                if kwargs.get("pass_self_into_delete"):  # hack to pass in interaction/hybrid context
+                    await message.delete(delay=delete_after, context=self)
+                else:
+                    await message.delete(delay=delete_after)
             return message
diff --git a/interactions/ext/hybrid_commands/context.py b/interactions/ext/hybrid_commands/context.py
--- a/interactions/ext/hybrid_commands/context.py
+++ b/interactions/ext/hybrid_commands/context.py
@@ -311,6 +311,7 @@ async def send(
             tts=tts,
             flags=flags,
             delete_after=delete_after,
+            pass_self_into_delete=bool(self._slash_ctx),
             **kwargs,
         )
 
diff --git a/interactions/models/internal/context.py b/interactions/models/internal/context.py
--- a/interactions/models/internal/context.py
+++ b/interactions/models/internal/context.py
@@ -523,6 +523,7 @@ async def send(
             tts=tts,
             flags=flags,
             delete_after=delete_after,
+            pass_self_into_delete=True,
             **kwargs,
         )
 


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

Issue:
[BUG] color in create_role() doesn´t allow int
### Library Version

5.7.0

### Describe the Bug

the options colour and color in guild.create_role() have int as typehint included.
By passing an integer you will get an AttributeError "'int' object has no attribute 'value'"

For code reference:
interactions.py > interactions > models > discord > guild.py
lines: 1445, 1446, 1478

### Steps to Reproduce

```python
color = int("E67E22", 16))
new_role = await guild.create_role(name="rolename", color=color)
```

### Expected Results

creating a role with given color

### Minimal Reproducible Code

_No response_

### Traceback

```
AttributeError: 'int' object has no attribute 'value'
  File "interactions/client/client.py", line 1890, in __dispatch_interaction
    response = await callback
  File "interactions/models/internal/command.py", line 132, in __call__
    await self.call_callback(self.callback, context)
  File "interactions/models/internal/command.py", line 198, in call_callback
    await self.call_with_binding(callback, context, **context.kwargs)  # type: ignore
  File "interactions/models/internal/callback.py", line 43, in call_with_binding
    return await callback(*args, **kwargs)
  File "/home/Discord/***.py", line 418, in create_button
    new_role = await guild.create_role(name=name, color=color)
  File "interactions/models/discord/guild.py", line 1478, in create_role
    payload["color"] = colour.value
```

### 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.
- [X] I have attempted to debug this myself, and I believe this issue is with the library

### Additional Information

I´m not sure if "RGB integer" is something else which would work.

By creating a Color object like `interactions.Color(int("E67E22", 16))` and passing it as color it works as expected.
If this is the way to go, the typehint is wrong i guess


Discussion:

Resolving patch:
diff --git a/interactions/models/discord/guild.py b/interactions/models/discord/guild.py
--- a/interactions/models/discord/guild.py
+++ b/interactions/models/discord/guild.py
@@ -1476,7 +1476,7 @@ async def create_role(
             payload["permissions"] = str(int(permissions))
 
         if colour := colour or color:
-            payload["color"] = colour.value
+            payload["color"] = colour if isinstance(colour, int) else colour.value
 
         if hoist:
             payload["hoist"] = True


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

Issue:
[FEAT] Add the ability to pass arguments to all packages in load_extensions method
### Problem Description

The load_extensions method was recently added, however it does not have the ability to pass arguments through to the setup function.

### Proposed Solution

Change recursive key word into **kwargs and use kwargs.get(). Remove this then pass through the rest of the kwargs through to the setup function.

### Alternatives Considered

Change *packages: str into packages: tuple[str] and pass through *args to the setup function.

### Additional Information

_No response_

### Code of Conduct

- [X] I agree to follow the contribution requirements.


Discussion:
I want to make sure I understand your request right: what exactly are you wanting a `**kwargs` signature to pass? We only use the `recursive` argument to handle pattern handling when we check your path/cwd for extension files. I don't think it's wise for us to remove it because it's important for parsing extension import resolutions, *especially* since we're handling numerous extensions.

If you don't mind extending off of this example, it would help me:

```py
def load_extension(
    self,
    *packages: str,
    **kwargs
):
    for (...):
       ...
       extensions = [
          f.replace(os.path.sep, ".").replace(".py", "")
          for f in glob.glob(pattern, recursive=kwargs.get("recursive", False))
       ]
```

The only thing I can think of is replicating the existing logic we use for `.load_extension()`. To my knowledge, `setup()` should already allow for this [as seen here](https://interactions-py.github.io/interactions.py/Guides/20%20Extensions/#passing-arguments-to-extensions).
`load_extension("filename")` supports arbitrary kwargs.  `load_extensions("folder")` does not.  This issue is asking for feature parity between the two.

Resolving patch:
diff --git a/interactions/client/client.py b/interactions/client/client.py
--- a/interactions/client/client.py
+++ b/interactions/client/client.py
@@ -2012,6 +2012,7 @@ def load_extensions(
         self,
         *packages: str,
         recursive: bool = False,
+        **load_kwargs: Any,
     ) -> None:
         """
         Load multiple extensions at once.
@@ -2035,7 +2036,7 @@ def load_extensions(
             extensions = [f.replace(os.path.sep, ".").replace(".py", "") for f in glob.glob(pattern, recursive=True)]
 
             for ext in extensions:
-                self.load_extension(ext)
+                self.load_extension(ext, **load_kwargs)
 
     def unload_extension(
         self, name: str, package: str | None = None, force: bool = False, **unload_kwargs: Any


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

Issue:
[FEAT] Add create_invite method to GuildForum
### Library Version

5.11.0

### Describe the Bug

`AttributeError: 'GuildForum' object has no attribute 'create_invite'`
![image](https://github.com/interactions-py/interactions.py/assets/51890392/6ab266eb-d073-4663-a856-770755bab2b4)


### Steps to Reproduce

Try creating an invitation for a forum channel.

### Expected Results

That you can create one.

### Minimal Reproducible Code

_No response_

### Traceback

_No response_

### 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.
- [X] I have attempted to debug this myself, and I believe this issue is with the library

### Additional Information

_No response_


Discussion:
This is a feature request, I suggest submitting a PR (you or anyone else for that matter) for implementing this.

Resolving patch:
diff --git a/interactions/models/discord/channel.py b/interactions/models/discord/channel.py
--- a/interactions/models/discord/channel.py
+++ b/interactions/models/discord/channel.py
@@ -2389,7 +2389,7 @@ async def close_stage(self, reason: Absent[Optional[str]] = MISSING) -> None:
 
 
 @attrs.define(eq=False, order=False, hash=False, kw_only=True)
-class GuildForum(GuildChannel):
+class GuildForum(GuildChannel, InvitableMixin):
     available_tags: List[ThreadTag] = attrs.field(repr=False, factory=list)
     """A list of tags available to assign to threads"""
     default_reaction_emoji: Optional[DefaultReaction] = attrs.field(repr=False, default=None)


Test patch: