コード例 #1
0
    async def uconnect(self, ctx):

        vchannel = await utils.is_connected(ctx)

        if vchannel is not None:
            await utils.send_message(ctx, config.ALREADY_CONNECTED_MESSAGE)
            return

        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)

        guild_to_audiocontroller[current_guild] = AudioController(
            self.bot, current_guild)
        await guild_to_audiocontroller[current_guild].register_voice_channel(
            ctx.author.voice.channel)

        await ctx.send("Connected to {} {}".format(
            ctx.author.voice.channel.name, ":white_check_mark:"))
コード例 #2
0
ファイル: run.py プロジェクト: DanielAlpha-Python/DingoLingo
async def on_guild_join(guild):
    print(guild.name)
    guild_to_audiocontroller[guild] = AudioController(bot, guild)
    guild_to_settings[guild] = Settings(guild)

    await guild_to_audiocontroller[guild].register_voice_channel(
        guild.voice_channels[0])
コード例 #3
0
ファイル: run.py プロジェクト: nuggetcatsoftware/Alpaca-bot
async def register(guild):

    guild_to_settings[guild] = Settings(guild)
    guild_to_audiocontroller[guild] = AudioController(bot, guild)

    vc_channels = guild.voice_channels
    await guild.me.edit(nick=guild_to_settings[guild].get('default_nickname'))
    start_vc = guild_to_settings[guild].get('start_voice_channel')
    if start_vc != None:
        for vc in vc_channels:
            if vc.id == start_vc:
                await guild_to_audiocontroller[guild].register_voice_channel(
                    vc_channels[vc_channels.index(vc)])

                #place for disconnect
                try:
                    await guild_to_audiocontroller[
                        guild].register_voice_channel(
                            vc_channels[vc_channels.index(vc)])
                except Exception as e:
                    print(e)
    else:
        await guild_to_audiocontroller[guild].register_voice_channel(
            guild.voice_channels[0])
        try:
            await guild_to_audiocontroller[guild].register_voice_channel(
                guild.voice_channels[0])
        except Exception as e:
            print(e)
コード例 #4
0
ファイル: run.py プロジェクト: Raptor123471/DingoLingo
async def register(guild):

    guild_to_settings[guild] = Settings(guild)
    guild_to_audiocontroller[guild] = AudioController(bot, guild)

    sett = guild_to_settings[guild]

    try:
        await guild.me.edit(nick=sett.get('default_nickname'))
    except:
        pass

    if config.GLOBAL_DISABLE_AUTOJOIN_VC == True:
        return

    vc_channels = guild.voice_channels

    if sett.get('vc_timeout') == False:
        if sett.get('start_voice_channel') == None:
            try:
                await guild_to_audiocontroller[guild].register_voice_channel(
                    guild.voice_channels[0])
            except Exception as e:
                print(e)

        else:
            for vc in vc_channels:
                if vc.id == sett.get('start_voice_channel'):
                    try:
                        await guild_to_audiocontroller[
                            guild].register_voice_channel(
                                vc_channels[vc_channels.index(vc)])
                    except Exception as e:
                        print(e)
コード例 #5
0
ファイル: run.py プロジェクト: mitch3b/DiscordJockey
async def on_guild_join(guild):
    print(guild.name)
    guild_to_audiocontroller[guild] = AudioController(bot, guild,
                                                      DEFAULT_VOLUME)
    try:
        await guild_to_audiocontroller[guild].register_voice_channel(
            guild.voice_channels[0])
    except:
        print("could not join " + guild.name)
コード例 #6
0
ファイル: general.py プロジェクト: Raptor123471/DingoLingo
    async def _reset(self, ctx):
        current_guild = utils.get_guild(self.bot, ctx.message)

        if current_guild is None:
            await ctx.send(config.NO_GUILD_MESSAGE)
            return
        await utils.guild_to_audiocontroller[current_guild].stop_player()
        await current_guild.voice_client.disconnect(force=True)

        guild_to_audiocontroller[current_guild] = AudioController(
            self.bot, current_guild)
        await guild_to_audiocontroller[current_guild].register_voice_channel(ctx.author.voice.channel)

        await ctx.send("{} Connected to {}".format(":white_check_mark:", ctx.author.voice.channel.name))
コード例 #7
0
ファイル: general.py プロジェクト: mitch3b/DiscordJockey
    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)
コード例 #8
0
ファイル: run.py プロジェクト: DanielAlpha-Python/DingoLingo
async def on_ready():
    print(config.STARTUP_MESSAGE)
    await bot.change_presence(
        status=discord.Status.online,
        activity=discord.Game(
            name="Music, type {}help".format(config.BOT_PREFIX)))

    config.BOT_VERISON = "0.9.9"

    for guild in bot.guilds:

        guild_to_settings[guild] = Settings(guild)
        guild_to_audiocontroller[guild] = AudioController(bot, guild)

        vc_channels = guild.voice_channels

        await guild.me.edit(
            nick=guild_to_settings[guild].get('default_nickname'))
        start_vc = guild_to_settings[guild].get('start_voice_channel')

        if start_vc != None:
            for vc in vc_channels:
                if vc.id == start_vc:
                    await guild_to_audiocontroller[
                        guild].register_voice_channel(
                            vc_channels[vc_channels.index(vc)])
                    await General.udisconnect(self=None, ctx=None, guild=guild)
                    try:
                        await guild_to_audiocontroller[
                            guild].register_voice_channel(
                                vc_channels[vc_channels.index(vc)])
                    except Exception as e:
                        print(e)
        else:
            await guild_to_audiocontroller[guild].register_voice_channel(
                guild.voice_channels[0])
            await General.udisconnect(self=None, ctx=None, guild=guild)
            try:
                await guild_to_audiocontroller[guild].register_voice_channel(
                    guild.voice_channels[0])
            except Exception as e:
                print(e)

        print("Joined {}".format(guild.name))

    print(config.STARTUP_COMPLETE_MESSAGE)
コード例 #9
0
    async def on_ready(self):
        """ The function that actiavtes when boot was completed """
        playing = "kek help"
        playing_type = "watching"
        status_type = "online"
        if not hasattr(self.bot, 'uptime'):
            self.bot.uptime = datetime.utcnow()

        # Indicate that the bot has successfully booted up
        print(f'Ready: {self.bot.user} | Servers: {len(self.bot.guilds)}')

        # Check if user desires to have something other than online
        if status_type == "idle":
            status_type = discord.Status.idle
        elif status_type == "dnd":
            status_type = discord.Status.dnd
        else:
            status_type = discord.Status.online

        # Check if user desires to have a different type of playing status
        if playing_type == "listening":
            playing_type = 2
        elif playing_type == "watching":
            playing_type = 3
        else:
            playing_type = 0

        await self.bot.change_presence(
            activity=discord.Activity(type=playing_type, name=playing),
            status=status_type
        )
        config.BOT_VERISON = "0.9.7"

        for guild in self.bot.guilds:

            guild_to_audiocontroller[guild] = AudioController(self.bot, guild)

            await guild_to_audiocontroller[guild].register_voice_channel(guild.voice_channels[0])

            await General.udisconnect(self=None, ctx=None, guild=guild)

            try:
                await guild_to_audiocontroller[guild].register_voice_channel(guild.voice_channels[0])
            except:
                pass
コード例 #10
0
ファイル: run.py プロジェクト: mitch3b/DiscordJockey
async def on_ready():
    print(STARTUP_MESSAGE)
    await bot.change_presence(
        status=discord.Status.online,
        activity=discord.Game(name=" Music, type !help "))

    for guild in bot.guilds:
        print(guild.name)
        await guild.me.edit(nick=DEFAULT_NICKNAME)
        guild_to_audiocontroller[guild] = AudioController(
            bot, guild, DEFAULT_VOLUME)
        try:
            await guild_to_audiocontroller[guild].register_voice_channel(
                guild.voice_channels[0])
        except Exception as inst:
            print("could not join " + guild.name + " bc..." + inst)

    print(STARTUP_COMPLETE_MESSAGE)
コード例 #11
0
    async def on_guild_join(self,guild):
        print(guild.name)
        guild_to_audiocontroller[guild] = AudioController(self.bot, guild)

        await guild_to_audiocontroller[guild].register_voice_channel(guild.voice_channels[0])