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])
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)
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)
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)