Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dpy2_unstable] Updates the Red-Lavalink dependency #5628

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
787e292
Temporarily set d.py to use latest git revision
Jackenmen Feb 19, 2022
8949892
Remove `bot` param to Client.start
Jackenmen Feb 19, 2022
f7aad77
Switch to aware datetimes
Jackenmen Feb 19, 2022
d87f140
Update to work with new Asset design
Jackenmen Feb 19, 2022
b3c4802
[read commit description] Update library usage to support threads
Jackenmen Feb 19, 2022
4b20b74
Update for in-place edits
Jackenmen Feb 19, 2022
91f9a26
Embed's bool changed behavior, I'm hoping it doesn't affect us
Jackenmen Feb 19, 2022
e81dd81
Address User.permissions_in() removal
Jackenmen Feb 19, 2022
973ba7e
Swap VerificationLevel.extreme with VerificationLevel.highest
Jackenmen Feb 19, 2022
32aff28
Change to keyword-only parameters
Jackenmen Feb 19, 2022
90f204d
Change of `Guild.vanity_invite()` return type
Jackenmen Feb 19, 2022
32519b1
avatar -> display_avatar
Jackenmen Feb 19, 2022
8e99d9c
Fix metaclass shenanigans with Converter
Jackenmen Feb 19, 2022
2a1af0d
Update Red.add_cog() to be inline with `dpy_commands.Bot.add_cog()`
Jackenmen Feb 19, 2022
b4f2231
Address all DEP-WARNs
Jackenmen Feb 19, 2022
24df6e2
Remove Context.clean_prefix and use upstream implementation instead
Jackenmen Feb 19, 2022
2b2ff9c
Remove commands.Literal and use upstream implementation instead
Jackenmen Feb 19, 2022
1ff3783
Update Command.callback's setter
Jackenmen Feb 19, 2022
8e55afb
Add new perms in HUMANIZED_PERM mapping (some from d.py 1.7 it seems)
Jackenmen Feb 19, 2022
f73745c
Swap to pos-only for params that are pos-only in upstream
Jackenmen Feb 21, 2022
d2adf4a
Remove the part of do_conversion that has not worked for a long while
Jackenmen Feb 27, 2022
285ad01
Stop wrapping BadArgument in ConversionFailure
Jackenmen Feb 27, 2022
5c178ef
Get rid of _dpy_reimplements
Jackenmen Feb 27, 2022
9294e69
Add custom errors for int and float converters
Jackenmen Feb 27, 2022
1e20dcb
Remove Command.__call__ as it's now implemented in d.py
Jackenmen Feb 27, 2022
7695cb4
Add a missing DEP-WARN
Jackenmen Feb 27, 2022
0a4ae91
Add check for being timed out to message_eligible_as_command
Jackenmen Feb 27, 2022
c8269e9
Add return to Red.remove_cog
Jackenmen Feb 28, 2022
5de75c1
Ensure we don't delete messages that differ only by used sticker
Jackenmen Feb 28, 2022
53c8bd8
discord.InvalidArgument->ValueError
Jackenmen Feb 28, 2022
ea5d5ff
Move from raw <t:...> syntax to discord.utils.format_dt()
Jackenmen Feb 28, 2022
12c9ac6
Update for changes to Command.params
Jackenmen Feb 28, 2022
60ff759
Add DEP-WARN to StringView usage
Jackenmen Feb 28, 2022
3defb98
Address AsyncIter removal
Jackenmen Feb 21, 2022
6476325
Merge e48fbc05552f051acd1f8dc51b281e3ab1c2a344 into 02f1ad919dcc5126d…
PredaaA Feb 28, 2022
1e8c79b
Update commit hash for d.py in setup.cfg
Jackenmen Mar 5, 2022
a3d870a
Bump d.py commit
Jackenmen Mar 6, 2022
a521c05
Switch from Guild.vanity_invite() to Guild.vanity_url_code
Jackenmen Mar 6, 2022
6f30678
Merge commit 'refs/pull/5204/merge' of https://github.com/Cog-Creator…
Jackenmen Mar 6, 2022
370fb81
[dpy2_unstable] Updates the Red-Lavalink dep
Crossedfall Mar 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions docs/cog_customcom.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,27 @@ Cooldowns

You can set cooldowns for your custom commands. If a command is on cooldown, it will not be triggered.

You can set cooldowns per member or per channel, or set a cooldown guild-wide. You can also set multiple types of cooldown on a single custom command. All cooldowns must pass before the command will trigger.
You can set cooldowns per member or per thread/channel, or set a cooldown guild-wide. You can also set multiple types of cooldown on a single custom command. All cooldowns must pass before the command will trigger.

------------------
Context Parameters
------------------

You can enhance your custom command's response by leaving spaces for the bot to substitute.

+-----------+----------------------------------------+
| Argument | Substitute |
+===========+========================================+
| {message} | The message the bot is responding to. |
+-----------+----------------------------------------+
| {author} | The user who called the command. |
+-----------+----------------------------------------+
| {channel} | The channel the command was called in. |
+-----------+----------------------------------------+
| {server} | The server the command was called in. |
+-----------+----------------------------------------+
| {guild} | Same as with {server}. |
+-----------+----------------------------------------+
+-----------+--------------------------------------------------+
| Argument | Substitute |
+===========+==================================================+
| {message} | The message the bot is responding to. |
+-----------+--------------------------------------------------+
| {author} | The user who called the command. |
+-----------+--------------------------------------------------+
| {channel} | The channel or thread the command was called in. |
+-----------+--------------------------------------------------+
| {server} | The server the command was called in. |
+-----------+--------------------------------------------------+
| {guild} | Same as with {server}. |
+-----------+--------------------------------------------------+

You can further refine the response with dot notation. For example, {author.mention} will mention the user who called the command.

Expand Down Expand Up @@ -81,7 +81,7 @@ Showing your own avatar

.. code-block:: none

[p]customcom add simple avatar {author.avatar_url}
[p]customcom add simple avatar {author.display_avatar}
[p]avatar
https://cdn.discordapp.com/avatars/133801473317404673/be4c4a4fe47cb3e74c31a0504e7a295e.webp?size=1024

Expand Down
6 changes: 3 additions & 3 deletions docs/cog_guides/admin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -389,16 +389,16 @@ announceset channel

.. code-block:: none

[p]announceset channel [channel]
[p]announceset channel <channel>

**Description**

Sets the channel where the bot owner announcements will be sent.

**Arguments**

* ``[channel]``: The channel that will be used for bot announcements.
|channel-input| Defaults to where you typed the command.
* ``<channel>``: The channel that will be used for bot announcements.
|channel-input|

.. _admin-command-announceset-clearchannel:

Expand Down
12 changes: 6 additions & 6 deletions docs/cog_guides/core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1842,9 +1842,9 @@ ignore channel

**Description**

Ignore commands in the channel or category.
Ignore commands in the channel, thread, or category.

Defaults to the current channel.
Defaults to the current thread or channel.

.. Note:: Owners, Admins, and those with Manage Channel permissions override ignored channels.

Expand All @@ -1856,7 +1856,7 @@ Defaults to the current channel.
- ``[p]ignore channel 356236713347252226`` - Also accepts IDs.

**Arguments:**
- ``<channel>`` - The channel to ignore. Can be a category channel.
- ``<channel>`` - The channel to ignore. This can also be a thread or category channel.

.. _core-command-ignore-list:

Expand Down Expand Up @@ -4045,9 +4045,9 @@ unignore channel

**Description**

Remove a channel or category from the ignore list.
Remove a channel, thread, or category from the ignore list.

Defaults to the current channel.
Defaults to the current thread or channel.

**Examples:**
- ``[p]unignore channel #general`` - Unignores commands in the #general channel.
Expand All @@ -4056,7 +4056,7 @@ Defaults to the current channel.
- ``[p]unignore channel 356236713347252226`` - Also accepts IDs. Use this method to unignore categories.

**Arguments:**
- ``<channel>`` - The channel to unignore. This can be a category channel.
- ``<channel>`` - The channel to unignore. This can also be a thread or category channel.

.. _core-command-unignore-server:

Expand Down
2 changes: 1 addition & 1 deletion docs/cog_guides/customcommands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ customcom cooldown

Set, edit, or view the cooldown for a custom command.

You may set cooldowns per member, channel, or guild. Multiple
You may set cooldowns per member, thread/channel, or guild. Multiple
cooldowns may be set. All cooldowns must be cooled to call the
custom command.

Expand Down
4 changes: 2 additions & 2 deletions docs/cog_guides/mod.rst
Original file line number Diff line number Diff line change
Expand Up @@ -574,14 +574,14 @@ slowmode

**Description**

Changes channel's slowmode setting.
Changes thread's or channel's slowmode setting.

Interval can be anything from 0 seconds to 6 hours.
Use without parameters to disable.

**Arguments**

* ``[interval=0:00:00]``: The time for the channel's slowmode settings.
* ``[interval=0:00:00]``: The time for the thread's/channel's slowmode settings.

.. note::
Interval can be anything from 0 seconds to 6 hours.
Expand Down
4 changes: 2 additions & 2 deletions docs/cog_guides/mutes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ mutechannel

**Description**

Mute a user in the current text channel.
Mute a user in the current text channel (or in the parent of the current thread).

Examples:

Expand Down Expand Up @@ -355,7 +355,7 @@ unmutechannel

**Description**

Unmute a user in this channel.
Unmute a user in this channel (or in the parent of this thread).

**Arguments**

Expand Down
2 changes: 1 addition & 1 deletion docs/cog_guides/permissions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Global rules (set by the owner) are checked first, then rules set for servers. I

1. Rules about a user.
2. Rules about the voice channel a user is in.
3. Rules about the text channel a command was issued in.
3. Rules about the text channel or a parent of the thread a command was issued in.
4. Rules about a role the user has (The highest role they have with a rule will be used).
5. Rules about the server a user is in (Global rules only).

Expand Down
2 changes: 1 addition & 1 deletion docs/cog_guides/reports.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ report interact

Open a message tunnel.

This tunnel will forward things you say in this channel
This tunnel will forward things you say in this channel or thread
to the ticket opener's direct messages.

Tunnels do not persist across bot restarts.
Expand Down
2 changes: 1 addition & 1 deletion docs/cog_permissions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ For each of those, the first rule pertaining to one of the following models will

1. User
2. Voice channel
3. Text channel
3. Text channel (parent text channel in case of invocations in threads)
4. Channel category
5. Roles, highest to lowest
6. Server (can only be in global rules)
Expand Down
2 changes: 1 addition & 1 deletion docs/framework_config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ Here is an example of the :code:`async with` syntax:
* :py:meth:`Config.member` which takes :py:class:`discord.Member`.
* :py:meth:`Config.user` which takes :py:class:`discord.User`.
* :py:meth:`Config.role` which takes :py:class:`discord.Role`.
* :py:meth:`Config.channel` which takes :py:class:`discord.TextChannel`.
* :py:meth:`Config.channel` which takes :py:class:`discord.abc.GuildChannel` or :py:class:`discord.Thread`.

If you need to wipe data from the config, you want to look at :py:meth:`Group.clear`, or :py:meth:`Config.clear_all`
and similar methods, such as :py:meth:`Config.clear_all_guilds`.
Expand Down
3 changes: 2 additions & 1 deletion redbot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,11 @@ async def run_bot(red: Red, cli_flags: Namespace) -> None:
sys.exit(1)

if cli_flags.dry_run:
# DEP-WARN
await red.http.close()
sys.exit(0)
try:
await red.start(token, bot=True)
await red.start(token)
except discord.LoginFailure:
log.critical("This token doesn't seem to be valid.")
db_token = await red._config.token()
Expand Down
10 changes: 2 additions & 8 deletions redbot/cogs/admin/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,14 +356,8 @@ async def announceset(self, ctx):
pass

@announceset.command(name="channel")
async def announceset_channel(self, ctx, *, channel: discord.TextChannel = None):
"""
Change the channel where the bot will send announcements.

If channel is left blank it defaults to the current channel.
"""
if channel is None:
channel = ctx.channel
async def announceset_channel(self, ctx, *, channel: discord.TextChannel):
"""Change the channel where the bot will send announcements."""
await self.config.guild(ctx.guild).announce_channel.set(channel.id)
await ctx.send(
_("The announcement channel has been set to {channel.mention}").format(channel=channel)
Expand Down
2 changes: 1 addition & 1 deletion redbot/cogs/alias/alias_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from re import findall

import discord
from discord.ext.commands.view import StringView
from discord.ext.commands.view import StringView # DEP-WARN
from redbot.core import commands, Config
from redbot.core.i18n import Translator
from redbot.core.utils import AsyncIter
Expand Down
4 changes: 2 additions & 2 deletions redbot/cogs/audio/core/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ async def command_search(self, ctx: commands.Context, *, query: str):
async def is_query_allowed(
self,
config: Config,
ctx_or_channel: Optional[Union[Context, discord.TextChannel]],
ctx_or_channel: Optional[Union[Context, discord.TextChannel, discord.Thread]],
query: str,
query_obj: Query,
) -> bool:
Expand Down Expand Up @@ -232,7 +232,7 @@ async def send_embed_msg(
raise NotImplementedError()

@abstractmethod
def _has_notify_perms(self, channel: discord.TextChannel) -> bool:
def _has_notify_perms(self, channel: Union[discord.TextChannel, discord.Thread]) -> bool:
raise NotImplementedError()

@abstractmethod
Expand Down
11 changes: 11 additions & 0 deletions redbot/cogs/audio/core/cog_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

LazyGreedyConverter = get_lazy_converter("--")
PlaylistConverter = get_playlist_converter()
# DEP-WARN
HUMANIZED_PERM = {
"create_instant_invite": "Create Instant Invite",
"kick_members": "Kick Members",
Expand Down Expand Up @@ -50,6 +51,16 @@
"manage_roles": "Manage Roles",
"manage_webhooks": "Manage Webhooks",
"manage_emojis": "Manage Emojis",
"use_slash_commands": "Use Slash Commands",
"request_to_speak": "Request to Speak",
"manage_events": "Manage Events",
"manage_threads": "Manage Threads",
"create_public_threads": "Create Public Threads",
"create_private_threads": "Create Private Threads",
"external_stickers": "Use External Stickers",
"send_messages_in_threads": "Send Messages in Threads",
"start_embedded_activities": "Start Activities",
"moderate_members": "Moderate Member",
}


Expand Down
2 changes: 1 addition & 1 deletion redbot/cogs/audio/core/events/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ async def on_red_audio_track_auto_play(

if notify_channel and has_perms and not player.fetch("autoplay_notified", False):
if (
len(player.manager.players) < 10
len(player.node.players) < 10
or not player._last_resume
and player._last_resume + datetime.timedelta(seconds=60)
> datetime.datetime.now(tz=datetime.timezone.utc)
Expand Down
2 changes: 1 addition & 1 deletion redbot/cogs/audio/core/events/dpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ async def cog_command_error(self, ctx: commands.Context, error: Exception) -> No
)
if error.send_cmd_help:
await ctx.send_help()
elif isinstance(error, commands.ConversionFailure):
elif isinstance(error, commands.BadArgument):
handled = True
if error.args:
if match := RE_CONVERSION.search(error.args[0]):
Expand Down
16 changes: 5 additions & 11 deletions redbot/cogs/audio/core/events/lavalink.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import discord
import lavalink
from discord.backoff import ExponentialBackoff
from discord.gateway import DiscordWebSocket

from redbot.core.i18n import Translator, set_contextual_locales_from_guild
from ...errors import DatabaseError, TrackEnqueueError
Expand Down Expand Up @@ -307,14 +306,13 @@ async def _websocket_closed_handler(
disconnect: bool,
) -> None:
guild_id = guild.id
shard = self.bot.shards[guild.shard_id]
event_channel_id = extra.get("channelID")
try:
if not self._ws_resume[guild_id].is_set():
await self._ws_resume[guild_id].wait()
else:
self._ws_resume[guild_id].clear()
node = player.node
voice_ws: DiscordWebSocket = node.get_voice_ws(guild_id)
code = extra.get("code")
by_remote = extra.get("byRemote", "")
reason = extra.get("reason", "No Specified Reason").strip()
Expand Down Expand Up @@ -353,7 +351,7 @@ async def _websocket_closed_handler(
self._ws_op_codes[guild_id]._init(self._ws_op_codes[guild_id]._maxsize)
return

if voice_ws.socket._closing or voice_ws.socket.closed or not voice_ws.open:
if shard.is_closed():
if player._con_delay:
delay = player._con_delay.delay()
else:
Expand All @@ -365,21 +363,17 @@ async def _websocket_closed_handler(
"Socket Closed %s. "
"Code: %d -- Remote: %s -- %s, %r",
guild_id,
voice_ws.socket._closing or voice_ws.socket.closed,
shard.is_closed(),
code,
by_remote,
reason,
player,
)
ws_audio_log.debug(
"Reconnecting to channel %d in guild: %d | %.2fs",
channel_id,
guild_id,
delay,
"Reconnecting to channel %d in guild: %d | %.2fs", channel_id, guild_id, delay
)
await asyncio.sleep(delay)
while voice_ws.socket._closing or voice_ws.socket.closed or not voice_ws.open:
voice_ws = node.get_voice_ws(guild_id)
while shard.is_closed():
await asyncio.sleep(0.1)

if has_perm and player.current and player.is_playing:
Expand Down
2 changes: 1 addition & 1 deletion redbot/cogs/audio/core/utilities/miscellaneous.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ async def send_embed_msg(
embed.set_author(name=name)
return await ctx.send(embed=embed)

def _has_notify_perms(self, channel: discord.TextChannel) -> bool:
def _has_notify_perms(self, channel: Union[discord.TextChannel, discord.Thread]) -> bool:
perms = channel.permissions_for(channel.guild.me)
return all((perms.send_messages, perms.embed_links))

Expand Down
2 changes: 1 addition & 1 deletion redbot/cogs/audio/core/utilities/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def can_join_and_speak(self, channel: discord.VoiceChannel) -> bool:
async def is_query_allowed(
self,
config: Config,
ctx_or_channel: Optional[Union[Context, discord.TextChannel]],
ctx_or_channel: Optional[Union[Context, discord.TextChannel, discord.Thread]],
query: str,
query_obj: Query,
) -> bool:
Expand Down
Loading