async def _volume(self, ctx, volume):
        current_guild = utils.get_guild(self.bot, ctx.message)
        if current_guild is None:
            await utils.send_message(ctx, config.NO_GUILD_MESSAGE)
            return

        utils.guild_to_audiocontroller[current_guild].volume = volume
 async def _history(self, ctx):
     current_guild = utils.get_guild(self.bot, ctx.message)
     if current_guild is None:
         await utils.send_message(ctx, config.NO_GUILD_MESSAGE)
         return
     await utils.send_message(
         ctx, utils.guild_to_audiocontroller[current_guild].track_history())
    async def _changechannel(self, ctx, *, dest_channel_name: str):
        current_guild = utils.get_guild(self.bot, ctx.message)

        if current_guild is None:
            await utils.send_message(ctx, config.NO_GUILD_MESSAGE)
            return

        await utils.connect_to_channel(current_guild, dest_channel_name, ctx, switch=True, default=False)
    async def _disconnect(self, ctx):
        current_guild = utils.get_guild(self.bot, ctx.message)

        if current_guild is None:
            await utils.send_message(ctx, config.NO_GUILD_MESSAGE)
            return
        await utils.guild_to_audiocontroller[current_guild].stop_player()
        await current_guild.voice_client.disconnect()
Esempio n. 5
0
async def on_command_error(ctx, error):
    if isinstance(error, CommandNotFound):
        if ctx.message.content.startswith('!'):
            guild = get_guild(bot, ctx.message)
            if guild is not None:
                await LocalClipHelper.add_soundclip_from_name(
                    guild_to_audiocontroller[guild], ctx.message.content[1:])
            return
    raise error
 async def _pause(self, ctx):
     current_guild = utils.get_guild(self.bot, ctx.message)
     if current_guild is None:
         await utils.send_message(ctx, config.NO_GUILD_MESSAGE)
         return
     if current_guild.voice_client is None or not current_guild.voice_client.is_playing(
     ):
         return
     current_guild.voice_client.pause()
 async def _songinfo(self, ctx):
     current_guild = utils.get_guild(self.bot, ctx.message)
     if current_guild is None:
         await utils.send_message(ctx, config.NO_GUILD_MESSAGE)
         return
     songinfo = utils.guild_to_audiocontroller[
         current_guild].current_songinfo
     if songinfo is None:
         return
     await ctx.message.author.send(songinfo.output)
    async def _connect(self, ctx, *, dest_channel_name: str):
        current_guild = utils.get_guild(self.bot, ctx.message)

        if current_guild is None:
            await utils.send_message(ctx, config.NO_GUILD_MESSAGE)
            return

        if utils.guild_to_audiocontroller[current_guild] is None:
            utils.guild_to_audiocontroller[current_guild] = AudioController(self.bot, current_guild,
                                                                            config.DEFAULT_VOLUME)
        await utils.connect_to_channel(current_guild, dest_channel_name, ctx, switch=False, default=True)
    async def _play_youtube(self, ctx, *, track: str):
        current_guild = utils.get_guild(self.bot, ctx.message)

        if current_guild is None:
            await utils.send_message(ctx, config.NO_GUILD_MESSAGE)
            return
        audiocontroller = utils.guild_to_audiocontroller[current_guild]

        if track.isspace() or not track:
            return
        await YoutubeHelper.add_yt_to_controller(audiocontroller, track)
Esempio n. 10
0
 async def _resume(self, ctx):
     current_guild = utils.get_guild(self.bot, ctx.message)
     if current_guild is None:
         await utils.send_message(ctx, config.NO_GUILD_MESSAGE)
         return
     current_guild.voice_client.resume()