internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: Cog-Creators/Red-DiscordBot

Issue:
[Core] command listdisabled error in DMs
# Command bugs

<!-- 
Did you find a bug with a command? Fill out the following:
-->

#### Command name

`command listdisabled` and `command listdisabled guild` in DMs

#### What cog is this command from?

Core

#### What were you expecting to happen?

Do nothing, or announce this command doesn't work in DMs.

#### What actually happened?

```
[ERROR] red: Exception in command 'command listdisabled guild'
Traceback (most recent call last):
  File "C:\Users\Bobloy\Documents\GitHub\Red-DiscordBot\.venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\Bobloy\Documents\GitHub\Red-DiscordBot\redbot\core\core_commands.py", line 3846, in list_disabled_guild
    Examples:
  File "C:\Users\Bobloy\Documents\GitHub\Red-DiscordBot\redbot\core\config.py", line 976, in guild
    return self._get_base_group(self.GUILD, str(guild.id))
AttributeError: 'NoneType' object has no attribute 'id'
```

#### How can we reproduce this issue?

Be a server owner but not the bot owner and use `[p]command listdisabled` in DMs, or be bot owner and use `[p]command listdisabled guild` in DMs



Discussion:

Resolving patch:
diff --git a/redbot/core/core_commands.py b/redbot/core/core_commands.py
--- a/redbot/core/core_commands.py
+++ b/redbot/core/core_commands.py
@@ -3199,6 +3199,7 @@ async def list_disabled_global(self, ctx: commands.Context):
         paged[0] = header + paged[0]
         await ctx.send_interactive(paged)
 
+    @commands.guild_only()
     @list_disabled.command(name="guild")
     async def list_disabled_guild(self, ctx: commands.Context):
         """List disabled commands in this server."""


Test patch:
Repository: Cog-Creators/Red-DiscordBot

Issue:
Copy info about the bands from help of `[p]eq set` to help of `[p]eq`?
I think that would make it a bit more obvious, especially when you consider that the ℹ️ emoji shows you the help of `[p]eq`, not the help of `[p]eq set`.
Alternatively, we could have `[p]eq explain` or something, but it's probably not worth adding another command in the group.

What do you think?


Discussion:
Sounds good to me until EQ is rewritten. Anyone is free to open a PR for the copy pasta, no need to add a new command
i'll like to be assigned to this pr, i'll do this one.

Resolving patch:
diff --git a/redbot/cogs/audio/core/commands/equalizer.py b/redbot/cogs/audio/core/commands/equalizer.py
--- a/redbot/cogs/audio/core/commands/equalizer.py
+++ b/redbot/cogs/audio/core/commands/equalizer.py
@@ -27,7 +27,13 @@ class EqualizerCommands(MixinMeta, metaclass=CompositeMetaClass):
     @commands.cooldown(1, 15, commands.BucketType.guild)
     @commands.bot_has_permissions(embed_links=True, add_reactions=True)
     async def command_equalizer(self, ctx: commands.Context):
-        """Equalizer management."""
+        """Equalizer management.
+
+        Band positions are 1-15 and values have a range of -0.25 to 1.0.
+        Band names are 25, 40, 63, 100, 160, 250, 400, 630, 1k, 1.6k, 2.5k, 4k,
+        6.3k, 10k, and 16k Hz.
+        Setting a band value to -0.25 nullifies it while +0.25 is double.
+        """
         if not self._player_check(ctx):
             ctx.command.reset_cooldown(ctx)
             return await self.send_embed_msg(ctx, title=_("Nothing playing."))


Test patch:
Repository: Cog-Creators/Red-DiscordBot

Issue:
`SetParser` converter (`[p]bank set` command) should have meaningful error message
**What component of Red (cog, command, API) would you like to see improvements on?**

`[p]bank set` command

**Describe the enhancement you're suggesting.**

Currently using invalid input with `[p]bank set` gives an error that doesn't tell you what's wrong:
![image](https://user-images.githubusercontent.com/6032823/107106044-e7647380-6829-11eb-8590-41a8f665e7dc.png)

We should add some meaningful error messages to the converter used there.




Discussion:
can you assign me ? i want to work on this.
@rijusougata13 done. If you need any more guidance on this, feel free to ask in here or on [our discord server](https://discord.gg/red).

And just in case you change your mind about working on this, just let us know and someone will unassign you.
yeah sure if change my mind i will let you know..

@jack1142  hey i was trying to make changes in some files .But it seems it has no effect on that bot..can you guide me how to update the bot after i make any changes..
I would recommend taking a look at our CONTRIBUTING.md for steps on how to set up the bot in a developer environment (https://github.com/Cog-Creators/Red-DiscordBot/blob/V3/develop/CONTRIBUTING.md).  If you have any other questions, feel free to join the discord server Jack linked above, which will allow us to help you a bit more easily in a back-and-forth context.

![Screenshot from 2021-02-10 19-25-19](https://user-images.githubusercontent.com/52108435/107519352-30c01480-6bd6-11eb-8446-c100f99b6da4.png)

it will give a meaningfull error message to user if argument is not valid. @NeuroAssassin  @jack1142 please take a look if it is correct or not .

Resolving patch:
diff --git a/redbot/cogs/economy/economy.py b/redbot/cogs/economy/economy.py
--- a/redbot/cogs/economy/economy.py
+++ b/redbot/cogs/economy/economy.py
@@ -100,19 +100,30 @@ async def pred(ctx: commands.Context):
 class SetParser:
     def __init__(self, argument):
         allowed = ("+", "-")
-        self.sum = int(argument)
+        try:
+            self.sum = int(argument)
+        except ValueError:
+            raise commands.BadArgument(
+                _(
+                    "Invalid value, the argument must be an integer,"
+                    " optionally preceded with a `+` or `-` sign."
+                )
+            )
         if argument and argument[0] in allowed:
             if self.sum < 0:
                 self.operation = "withdraw"
             elif self.sum > 0:
                 self.operation = "deposit"
             else:
-                raise RuntimeError
+                raise commands.BadArgument(
+                    _(
+                        "Invalid value, the amount of currency to increase or decrease"
+                        " must be an integer different from zero."
+                    )
+                )
             self.sum = abs(self.sum)
-        elif argument.isdigit():
-            self.operation = "set"
         else:
-            raise RuntimeError
+            self.operation = "set"
 
 
 @cog_i18n(_)


Test patch:
Repository: Cog-Creators/Red-DiscordBot

Issue:
Update Lavalink build for 3.4.6 release
This serves solely as an informational issue to put in the milestone so that it's not forgotten.


Discussion:
There's another Lavaplayer build we want to update the jar for, so looks like this still needs to be done :)

Resolving patch:
diff --git a/redbot/cogs/audio/manager.py b/redbot/cogs/audio/manager.py
--- a/redbot/cogs/audio/manager.py
+++ b/redbot/cogs/audio/manager.py
@@ -24,7 +24,7 @@
 _ = Translator("Audio", pathlib.Path(__file__))
 log = logging.getLogger("red.audio.manager")
 JAR_VERSION: Final[str] = "3.3.2.3"
-JAR_BUILD: Final[int] = 1198
+JAR_BUILD: Final[int] = 1199
 LAVALINK_DOWNLOAD_URL: Final[str] = (
     "https://github.com/Cog-Creators/Lavalink-Jars/releases/download/"
     f"{JAR_VERSION}_{JAR_BUILD}/"


Test patch:
Repository: Cog-Creators/Red-DiscordBot

Issue:
[Mod] Send ban reason on Temp Bans
**What component of Red (cog, command, API) would you like to see improvements on?**

Mod

**Describe the enhancement you're suggesting.**

Send the ban reason when a user is temporarily banned




Discussion:

Resolving patch:
diff --git a/redbot/cogs/mod/kickban.py b/redbot/cogs/mod/kickban.py
--- a/redbot/cogs/mod/kickban.py
+++ b/redbot/cogs/mod/kickban.py
@@ -620,12 +620,14 @@ async def tempban(
             await ctx.send(_("I cannot do that due to Discord hierarchy rules."))
             return
 
+        guild_data = await self.config.guild(guild).all()
+
         if duration is None:
-            duration = timedelta(seconds=await self.config.guild(guild).default_tempban_duration())
+            duration = timedelta(seconds=guild_data["default_tempban_duration"])
         unban_time = datetime.now(timezone.utc) + duration
 
         if days is None:
-            days = await self.config.guild(guild).default_days()
+            days = guild_data["default_days"]
 
         if not (0 <= days <= 7):
             await ctx.send(_("Invalid days. Must be between 0 and 7."))
@@ -643,8 +645,10 @@ async def tempban(
             msg = _("You have been temporarily banned from {server_name} until {date}.").format(
                 server_name=guild.name, date=unban_time.strftime("%m-%d-%Y %H:%M:%S")
             )
+            if guild_data["dm_on_kickban"] and reason:
+                msg += _("\n\n**Reason:** {reason}").format(reason=reason)
             if invite:
-                msg += _(" Here is an invite for when your ban expires: {invite_link}").format(
+                msg += _("\n\nHere is an invite for when your ban expires: {invite_link}").format(
                     invite_link=invite
                 )
             await member.send(msg)


Test patch:
Repository: Cog-Creators/Red-DiscordBot

Issue:
[Mutes] Mute error shows incorrect text
When muting a user fails, the message for unmuting is shown instead.

![image](https://user-images.githubusercontent.com/57032623/108998410-ca88c680-7698-11eb-9f2c-f641376b6d37.jpeg)


Discussion:
#4850 was meant to fix this, but looking at the full message here, it appears that the "That user cannot be muted" reason still needs fixing so I'm keeping this open.

Resolving patch:
diff --git a/redbot/cogs/mutes/mutes.py b/redbot/cogs/mutes/mutes.py
--- a/redbot/cogs/mutes/mutes.py
+++ b/redbot/cogs/mutes/mutes.py
@@ -31,7 +31,7 @@
     "assigned_role_hierarchy_problem": _(
         "I cannot let you do that. You are not higher than the mute role in the role hierarchy."
     ),
-    "is_admin": _("That user cannot be muted, as they have the Administrator permission."),
+    "is_admin": _("That user cannot be (un)muted, as they have the Administrator permission."),
     "permissions_issue_role": _(
         "Failed to mute or unmute user. I need the Manage Roles "
         "permission and the user I'm muting must be "


Test patch:
Repository: Cog-Creators/Red-DiscordBot

Issue:
Aliases for some commands which have optional arguments fail to operate normally
#### Command name

Aliases for _some_ commands which require optional arguments.

#### What cog is this command from?

Alias, but also the cog from which the command of the alias is from. Currently, it seems to be the case especially with `Downloader`.

#### What were you expecting to happen?

For the aliases for `pipinstall` and `load` to return the help menu, as no arguments were given.

#### What actually happened?

For `load`, the redbot would start typing but there would be no result.
For `pipinstall`, the redbot would start typing and then send "Libraries installed", although no arguments were given.

These are two examples I've discovered, but there may be more.

#### How can we reproduce this issue?

Create an alias for `pipinstall`, and/or `load`.
Use these aliases without any arguments.


Discussion:
++ Aliases for reload, and unload have the same behavior as above, too
https://github.com/Cog-Creators/Red-DiscordBot/blob/aad34f2b08df8954d669c9b12caa09c936181918/redbot/cogs/alias/alias.py#L186-L188

When there are no args, there is a trailing space after the command. This causes commands like `load` which take an arbitrary (but non-zero) number of values to glitch out. Running `.strip()` on the mocked message should fix this issue.

Resolving patch:
diff --git a/redbot/cogs/alias/alias.py b/redbot/cogs/alias/alias.py
--- a/redbot/cogs/alias/alias.py
+++ b/redbot/cogs/alias/alias.py
@@ -185,7 +185,7 @@ async def call_alias(self, message: discord.Message, prefix: str, alias: AliasEn
         # noinspection PyDunderSlots
         new_message.content = "{}{} {}".format(
             prefix, command, " ".join(args[trackform.max + 1 :])
-        )
+        ).strip()
         await self.bot.process_commands(new_message)
 
     async def paginate_alias_list(


Test patch:
Repository: Cog-Creators/Red-DiscordBot

Issue:
[Warnings] Raw namedtuple output in [p]warnings
### What Red version are you using?

3.4.7

### Cog name

Warnings

### Command name

warnings

### What did you expect to happen?

Have the member name properly show

### What actually happened?

Because `user` is treated as a member object, if it is a named tuple (when a user id is used for a member no longer in the server) it prints out that named tuple instead of the member name.

`Warnings for Member(id=00000000000, guild=<Guild id=00000000 name='Server' shard_id=0 chunked=True member_count=0>)`

https://github.com/Cog-Creators/Red-DiscordBot/blob/d26335b01b892e346e52cfd3bfcb86706647a76c/redbot/cogs/warnings/warnings.py#L529
https://github.com/Cog-Creators/Red-DiscordBot/blob/d26335b01b892e346e52cfd3bfcb86706647a76c/redbot/cogs/warnings/warnings.py#L555

### How can we reproduce this error?

1. Warn a user
2. Have that user leave the server
3. Run `[p]warnings <uid>` on that user




Discussion:
Would displaying the user's `Username#Disc`(from a `self.bot.fetch_user()`) be acceptable? I am interested in taking this issue. 
I'm not sure we want to use a `fetch_user` call due to rate limits, I was thinking either a fallback `"Unknown User"` or use their id.

Resolving patch:
diff --git a/redbot/cogs/warnings/warnings.py b/redbot/cogs/warnings/warnings.py
--- a/redbot/cogs/warnings/warnings.py
+++ b/redbot/cogs/warnings/warnings.py
@@ -552,7 +552,9 @@ async def warnings(self, ctx: commands.Context, user: Union[discord.Member, int]
                     )
                 await ctx.send_interactive(
                     pagify(msg, shorten_by=58),
-                    box_lang=_("Warnings for {user}").format(user=user),
+                    box_lang=_("Warnings for {user}").format(
+                        user=user if isinstance(user, discord.Member) else user.id
+                    ),
                 )
 
     @commands.command()


Test patch:
Repository: Cog-Creators/Red-DiscordBot

Issue:
Dispatch listener when deleting services
### What component of Red (cog, command, API) would you like to see improvements on?

Shared API Keys

### Describe the enhancement you're suggesting.

I have a cog that was previously fetching the shared API keys when running a command, I fixed this by making a little cache, so on, I made a listener in my cog to detect changes if the API key of the service I'm using is being touched, so if the API key is edited, my cog will then call again the shared API.

The problem here is that if the user delete the service, my cog will NOT get any updates, so it'll still use the cache I made, that is a problem since I want my cog to know if the key is updated, or deleted.

My proposal is to either add this to the actual `on_red_api_tokens_update` or create a new listener. (`on_red_api_service_delete`)




Discussion:

Resolving patch:
diff --git a/redbot/core/bot.py b/redbot/core/bot.py
--- a/redbot/core/bot.py
+++ b/redbot/core/bot.py
@@ -1230,6 +1230,7 @@ async def remove_shared_api_tokens(self, service_name: str, *token_names: str):
         async with self._config.custom(SHARED_API_TOKENS, service_name).all() as group:
             for name in token_names:
                 group.pop(name, None)
+        self.dispatch("red_api_tokens_update", service_name, MappingProxyType(group))
 
     async def remove_shared_api_services(self, *service_names: str):
         """
@@ -1249,6 +1250,9 @@ async def remove_shared_api_services(self, *service_names: str):
         async with self._config.custom(SHARED_API_TOKENS).all() as group:
             for service in service_names:
                 group.pop(service, None)
+        # dispatch needs to happen *after* it actually updates
+        for service in service_names:
+            self.dispatch("red_api_tokens_update", service, MappingProxyType({}))
 
     async def get_context(self, message, *, cls=commands.Context):
         return await super().get_context(message, cls=cls)


Test patch:
Repository: Cog-Creators/Red-DiscordBot

Issue:
Picarto streams are not working (API changes)
### What Red version are you using?

3.4.0

### Cog name

Streams

### Command name

!picarto Unnoen

### What did you expect to happen?

I expected the output of whether Unnoen (The user) is live or not

### What actually happened?

I got the message "That channel doesn't seem to exist."

### How can we reproduce this error?

1. Simply execute this command on a discord



![image](https://user-images.githubusercontent.com/32965886/114037815-9ac90300-9881-11eb-9a2b-04cdb15a6098.png)
![image](https://user-images.githubusercontent.com/32965886/114037886-ac120f80-9881-11eb-8d61-5df2f42a5432.png)


The solution to this problem is probably updating API interaction.


Discussion:
Have you tried to reproduce it on the latest version of Red? (3.4.9)
Can confirm that it happens on latest version too.

Resolving patch:
diff --git a/redbot/cogs/streams/streamtypes.py b/redbot/cogs/streams/streamtypes.py
--- a/redbot/cogs/streams/streamtypes.py
+++ b/redbot/cogs/streams/streamtypes.py
@@ -479,7 +479,7 @@ class PicartoStream(Stream):
     token_name = None  # This streaming services don't currently require an API key
 
     async def is_online(self):
-        url = "https://api.picarto.tv/v1/channel/name/" + self.name
+        url = "https://api.picarto.tv/api/v1/channel/name/" + self.name
 
         async with aiohttp.ClientSession() as session:
             async with session.get(url) as r:


Test patch:
Repository: Cog-Creators/Red-DiscordBot

Issue:
the check for warning points should be after a DM is attempted
# Feature request

<!-- This template is for feature requests. Please fill out the following: -->


#### Select the type of feature you are requesting:

<!-- To check a box, replace the space between the [] with a x -->

- [ ] Cog
- [X] Command
- [ ] API functionality

#### Describe your requested feature

I wasn't really sure if this counted for a bug report or not, but since its not really a bug but just some weird placement I've put it under here.

as it stands, the check that handles users getting hit by a warnaction occurs **before** Red attempts to DM the warn to them.
[Line 434 here](https://github.com/Cog-Creators/Red-DiscordBot/blob/V3/develop/redbot/cogs/warnings/warnings.py#L434]) should probably be realistically after [this block right under it.](https://github.com/Cog-Creators/Red-DiscordBot/blob/V3/develop/redbot/cogs/warnings/warnings.py#L435-L516)

The common use case I see here is softban as a warnaction - it'll send the softban, say its for excessive warnings, but not send the actual warning.

_Thank you Deihim007 in the main server for confirming it wasn't me going crazy._


Discussion:

Resolving patch:
diff --git a/redbot/cogs/warnings/warnings.py b/redbot/cogs/warnings/warnings.py
--- a/redbot/cogs/warnings/warnings.py
+++ b/redbot/cogs/warnings/warnings.py
@@ -430,12 +430,6 @@ async def warn(
                 "mod": ctx.author.id,
             }
         }
-        async with member_settings.warnings() as user_warnings:
-            user_warnings.update(warning_to_add)
-        current_point_count += reason_type["points"]
-        await member_settings.total_points.set(current_point_count)
-
-        await warning_points_add_check(self.config, ctx, user, current_point_count)
         dm = guild_settings["toggle_dm"]
         showmod = guild_settings["show_mod"]
         dm_failed = False
@@ -465,6 +459,11 @@ async def warn(
                     " but I wasn't able to send them a warn message."
                 ).format(user=user.mention)
             )
+        async with member_settings.warnings() as user_warnings:
+            user_warnings.update(warning_to_add)
+        current_point_count += reason_type["points"]
+        await member_settings.total_points.set(current_point_count)
+        await warning_points_add_check(self.config, ctx, user, current_point_count)
 
         toggle_channel = guild_settings["toggle_channel"]
         if toggle_channel:


Test patch:
Repository: Cog-Creators/Red-DiscordBot

Issue:
Menus raises an error if the bot is missing read_message_history permission
### What Red version are you using?

3.4.9

### What were you trying to do?

Using help inside a channel where the bot does not have read message history permission.

### What did you expect to happen?

Help menu's to work correctly.

### What actually happened?

The first page of the help menu appears but no reactions appear and the following error appears in the logs
 ```py
[2021-04-06 16:48:12] [CRITICAL] red.main: Caught unhandled exception in task:
Traceback (most recent call last):
  File "/mnt/e/github/Red-DiscordBot/redbot/core/utils/menus.py", line 204, in task
    await message.add_reaction(emoji)
  File "/mnt/e/github/Red-DiscordBot/.venv/lib/python3.8/site-packages/discord/message.py", line 1220, in add_reaction
    await self._state.http.add_reaction(self.channel.id, self.id, emoji)
  File "/mnt/e/github/Red-DiscordBot/.venv/lib/python3.8/site-packages/discord/http.py", line 248, in request
    raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access
```

### How can we reproduce this error?

1. Remove the bots permission to read message history
2. run `[p]help`
...





Discussion:

Resolving patch:
diff --git a/redbot/core/commands/help.py b/redbot/core/commands/help.py
--- a/redbot/core/commands/help.py
+++ b/redbot/core/commands/help.py
@@ -804,7 +804,11 @@ async def send_pages(
         # save on config calls
         channel_permissions = ctx.channel.permissions_for(ctx.me)
 
-        if not (channel_permissions.add_reactions and help_settings.use_menus):
+        if not (
+            channel_permissions.add_reactions
+            and channel_permissions.read_message_history
+            and help_settings.use_menus
+        ):
 
             max_pages_in_guild = help_settings.max_pages_in_guild
             use_DMs = len(pages) > max_pages_in_guild


Test patch: