diff options
Diffstat (limited to 'cogs/voice.py')
| -rw-r--r-- | cogs/voice.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/cogs/voice.py b/cogs/voice.py index ba1993e..86416ef 100644 --- a/cogs/voice.py +++ b/cogs/voice.py | |||
| @@ -151,6 +151,17 @@ class VoiceManager: | |||
| 151 | """Backward-compatible alias for connect().""" | 151 | """Backward-compatible alias for connect().""" |
| 152 | return await self.connect(channel) | 152 | return await self.connect(channel) |
| 153 | 153 | ||
| 154 | async def join_by_channel_id(self, channel_id): | ||
| 155 | """Join a voice channel by channel ID.""" | ||
| 156 | channel = self.bot.get_channel(channel_id) | ||
| 157 | if not channel: | ||
| 158 | logger.error(f"Channel {channel_id} not found") | ||
| 159 | return None | ||
| 160 | if not isinstance(channel, discord.VoiceChannel): | ||
| 161 | logger.error(f"Channel {channel_id} is not a voice channel") | ||
| 162 | return None | ||
| 163 | return await self.connect(channel) | ||
| 164 | |||
| 154 | async def get_client(self, guild): | 165 | async def get_client(self, guild): |
| 155 | """Get existing voice client for a guild.""" | 166 | """Get existing voice client for a guild.""" |
| 156 | return discord.utils.get(self.bot.voice_clients, guild=guild) | 167 | return discord.utils.get(self.bot.voice_clients, guild=guild) |
