Ejemplo n.º 1
0
    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
Ejemplo n.º 2
0
 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())
Ejemplo n.º 3
0
    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)
Ejemplo n.º 4
0
    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()
Ejemplo 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
Ejemplo n.º 6
0
 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()
Ejemplo n.º 7
0
 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)
Ejemplo n.º 8
0
    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)
Ejemplo n.º 9
0
    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)
Ejemplo 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()