def __init__(self, bot):
     self.bot = bot
     self.bot.lavalink = lavalink.Client(bot.user.id)
     self.bot.music = lavalink.Client(self.bot.user.id)
     self.bot.music.add_node('localhost', 8888, 'testing', 'na',
                             'music-node')
     self.bot.add_listener(self.bot.music.voice_update_handler,
                           'on_socket_response')
     self.bot.music.add_event_hook(self.track_hook)
Ejemplo n.º 2
0
    def __init__(self, bot):
        self.bot = bot

        if not hasattr(bot, 'lavalink'):
            bot.lavalink = lavalink.Client(bot.user.id)
            host = os.getenv("LAVALINK_HOST")
            port = int(os.getenv("LAVALINK_PORT"))
            password = os.getenv("LAVALINK_PASS")
            bot.lavalink.add_node(host=host,
                                  port=port,
                                  password=password,
                                  region="us",
                                  name="DEFAULT US")
            bot.lavalink.add_node(host=host,
                                  port=port,
                                  password=password,
                                  region="eu",
                                  name="DEFAULT EU")
            bot.lavalink.add_node(host=host,
                                  port=port,
                                  password=password,
                                  region="asia",
                                  name="DEFAULT ASIA")
            bot.add_listener(bot.lavalink.voice_update_handler,
                             "on_socket_response")

        bot.lavalink.add_event_hook(self.track_hook)
Ejemplo n.º 3
0
    def __init__(self, *, pool: asyncpg.pool.Pool, **kwargs):
        super().__init__(command_prefix=_get_prefix,
                         description=config.description,
                         pm_help=None,
                         game=discord.Game(name=config.game),
                         **kwargs)

        self.all_commands = utils.CaseInsensitiveDict(self.all_commands)

        self.pool = pool
        self.prefixes = utils.Config('prefixes.json', loop=self.loop)
        self.session = aiohttp.ClientSession(loop=self.loop)
        self.lavalink = lavalink.Client(bot=self,
                                        loop=self.loop,
                                        host=config.lava_host,
                                        rest_port=config.lava_rest,
                                        ws_port=config.lava_ws,
                                        password=config.lava_pass,
                                        player=music.Player)
        self.process = psutil.Process()

        for extension in self.startup_extensions:
            try:
                self.load_extension(extension)
            except Exception as e:
                print(f'Failed to load extension {extension}')
                traceback.print_exc()

        self.loop.create_task(self.init())
Ejemplo n.º 4
0
    def __init__(self, bot):
        self.bot = bot
        self.np = None
        self.reactions = ['⏯️', '⏭️', '⏹']
        self.skip_votes = set()
        self.skip_vote_msg = None
        self.clear_votes = set()
        self.clear_vote_msg = None
        self.vote_ratio = 0.5

        self.sp = spotipy.Spotify(auth_manager=SpotifyClientCredentials(
            client_id=os.environ.get("SPOTIFY_CLIENT_ID"),
            client_secret=os.environ.get("SPOTIFY_CLIENT_SECRET")))

        guild = self.bot.get_guild(self.bot.settings.guild_id)
        self.channel = guild.get_channel(
            self.bot.settings.guild().channel_botspam)
        if not hasattr(
                bot, 'lavalink'
        ):  # This ensures the client isn't overwritten during cog reloads.
            bot.lavalink = lavalink.Client(self.bot.user.id)
            bot.lavalink.add_node(
                '127.0.0.1', 2333, os.environ.get("LAVALINK_PASS"),
                guild.region,
                'default-node')  # Host, Port, Password, Region, Name
            bot.add_listener(bot.lavalink.voice_update_handler,
                             'on_socket_response')

        lavalink.add_event_hook(self.track_hook)
Ejemplo n.º 5
0
 def __init__(self, bot):
     self.bot = bot
     self.bot.music = lavalink.Client(self.bot.user.id)
     self.bot.music.add_node('IP', Port, 'Passwd', 'na', 'music-node')
     self.bot.add_listener(self.bot.music.voice_update_handler,
                           'on_socket_response')
     self.bot.music.add_event_hook(self.track_hook)
Ejemplo n.º 6
0
    def __init__(self, bot):
        self.bot = bot
        self.now_playing_embed_message = None
        self.reactions = ['⏯️', '⏭️', '⏹']
        
        # set of users that have voted to skip currently playing song
        self.skip_votes = set()
        # message where users are voting to skip
        self.skip_vote_msg = None
        
        # set of users that have voted to clear queue
        self.clear_votes = set()
        # message where users are voting to clear queue
        self.clear_vote_msg = None
        
        # percentage of users in voice channels that need to vote to skip or clear queue
        self.vote_ratio = 0.5

        # spotify API session for queueing spotify songs/playlists
        self.sp = spotipy.Spotify(auth_manager=SpotifyClientCredentials(client_id=os.environ.get("SPOTIFY_CLIENT_ID"),
                                                           client_secret=os.environ.get("SPOTIFY_CLIENT_SECRET")))

        # initialize music backend (lavalink)
        guild = self.bot.get_guild(self.bot.settings.guild_id)
        self.bot_commands_text_channel = guild.get_channel(self.bot.settings.guild().channel_botspam)
        if not hasattr(bot, 'lavalink'):  # This ensures the client isn't overwritten during cog reloads.
            bot.lavalink = lavalink.Client(self.bot.user.id)
            bot.lavalink.add_node('127.0.0.1', 2333, os.environ.get("LAVALINK_PASS"), guild.region, 'default-node')  # Host, Port, Password, Region, Name
            bot.add_listener(bot.lavalink.voice_update_handler, 'on_socket_response')

        lavalink.add_event_hook(self.track_hook)
Ejemplo n.º 7
0
    def __init__(self, bot):
        self.bot = bot

        if not hasattr(bot, 'lavalink'):
            lavalink.Client(bot=bot, password='******',
                            loop=bot.loop, log_level=logging.DEBUG)
            self.bot.lavalink.register_hook(self._track_hook)
Ejemplo n.º 8
0
    def __init__(self):
        self.loop = loop
        self.initialised = False
        self.pool = None  # Async init
        self.session = None  # Async init
        self.proc = psutil.Process()
        self.owners = (402159684724719617, 214925855359631360)
        self.starttime = datetime.datetime.utcnow()

        self.defaults = {'>>', 'eviee pls ', 'eviee '}  # Prefix Defaults
        self.lru_prefix = utils.EvieeLRU(name='Prefix LRU', limit=120)
        self.lru_blocks = utils.EvieeLRU(name='Blocks LRU', limit=500)
        self._wspings = deque(maxlen=60)
        self._rtts = deque(maxlen=60)

        self._config = config
        self._abstract_commands = None
        self._reconnecting = asyncio.Event()
        self._last_result = None
        self.categories = {}
        self.extensions_other = {}

        self.fkey = Fernet(config.get('ENCRYPTION', '_token').encode())

        super().__init__(command_prefix=get_prefix)
        self.lavalink = lavalink.Client(bot=self,
                                        password=self._config.get(
                                            "LL", "value"),
                                        rest_port=2333,
                                        ws_port=80,
                                        loop=self.loop,
                                        log_level=logging.WARN,
                                        host='51.158.68.132')
Ejemplo n.º 9
0
 def __init__(self, bot):
     self.bot = bot
     if not hasattr(bot, 'lavalink'):
         with open("data/apikeys.json") as file:
             apikeys = json.load(file)
             lavalink.Client(bot, loop=self.bot.loop, host=apikeys["ll_host"], password=apikeys["ll_password"], ws_port=apikeys["ll_port"])
             self.bot.lavalink.register_hook(self.track_hook)
Ejemplo n.º 10
0
 def __init__(self, bot):
     self.bot = bot
     lavalink.Client(bot=bot,
                     password='******',
                     loop=self.bot.loop,
                     log_level='debug')
     self.bot.lavalink.client.register_hook(self.track_hook)
Ejemplo n.º 11
0
    def __init__(self, bot: Bot):
        self.bot: Bot = bot
        self.handles: dict = {}

        if not hasattr(bot, "lavalink"):
            bot.lavalink = lavalink.Client(bot.user.id)
            bot.ksoftapi = ksoftapi.Client(api_key=os.getenv("KSOFT"))
            host = os.getenv("LAVALINK_HOST", "localhost")
            port = int(os.getenv("LAVALINK_PORT", "4437"))
            password = os.getenv("LAVALINK_PASS")
            bot.lavalink.add_node(host=host,
                                  port=port,
                                  password=password,
                                  region="us",
                                  name="DEFAULT US")
            bot.lavalink.add_node(host=host,
                                  port=port,
                                  password=password,
                                  region="eu",
                                  name="DEFAULT EU")
            bot.lavalink.add_node(host=host,
                                  port=port,
                                  password=password,
                                  region="asia",
                                  name="DEFAULT ASIA")
            bot.add_listener(bot.lavalink.voice_update_handler,
                             "on_socket_response")

        if len(bot.lavalink._event_hooks["Generic"]
               ) == 0:  # Seems something is going wrong with cog_unload
            lavalink.add_event_hook(self.track_hook, self.autoplay_hook)
Ejemplo n.º 12
0
 async def prepare_lavalink(self):
     await self.bot.wait_until_ready()
     self.bot.lavalink = lavalink.Client(self.bot.user.id)
     self.bot.lavalink.add_node('127.0.0.1', 8080, 'IWILLPASS', 'eu',
                                'default-node')
     self.bot.add_listener(self.bot.lavalink.voice_update_handler,
                           'on_socket_response')
     self.bot.lavalink.add_event_hook(self.track_hook)
Ejemplo n.º 13
0
    def __init__(self, bot):
        self.bot = bot

        if not hasattr(bot, 'lavalink'):  # This ensures the client isn't overwritten during cog reloads.
            bot.lavalink = lavalink.Client(BOT_ID)
            bot.lavalink.add_node(host, 2333, psw, region, "default-node")  # Host, Port, Password, Region, Name

        lavalink.add_event_hook(self.track_hook)
Ejemplo n.º 14
0
    def __init__(self, bot):
        self.bot = bot

        if not hasattr(bot, 'lavalink'):
            #This shouldn't be run because we have music going first, but just in case.
            bot.lavalink = lavalink.Client(bot.user.id)
            bot.lavalink.add_node('159.89.233.140', 2333, lbvars.lavalinkpass, 'us', 'default-node')  # Host, Port, Password, Region, Name
            bot.add_listener(bot.lavalink.voice_update_handler, 'on_socket_response')
Ejemplo n.º 15
0
 async def init_lava(self):
     await self.wait_until_ready()
     self.lavalink = lavalink.Client(self.user.id, shard_count=len(self.shards) if bool(self.shards) else 1)
     self.lavalink.add_node(host=self.get_bot_settings()["lavahost"],
                            port=self.get_bot_settings()["lavaport"],
                            password=self.get_bot_settings()["lavapw"],
                            region="ko")
     self.add_listener(self.lavalink.voice_update_handler, 'on_socket_response')
Ejemplo n.º 16
0
    def __init__(self, bot):
        self.bot = bot

        if not hasattr(bot, 'lavalink'):  # This ensures the client isn't overwritten during cog reloads.
            bot.lavalink = lavalink.Client(bot.user.id)
            bot.lavalink.add_node('127.0.0.1', 2333, 'youshallnotpass', 'eu', 'default-node')  # Host, Port, Password, Region, Name

        lavalink.add_event_hook(self.track_hook)
Ejemplo n.º 17
0
    def __init__(self, bot):
        self.bot = bot

        if not hasattr(bot, 'lavalink'):
            bot.lavalink = lavalink.Client(BOTID)
            bot.lavalink.add_node('127.0.0.1', 2333, '123456', 'eu', 'default-node')
            bot.add_listener(bot.lavalink.voice_update_handler, 'on_socket_response')
        lavalink.add_event_hook(self.track_hook)
Ejemplo n.º 18
0
 def __init__(self, bot):
     self.bot = bot
     self.bot.music = lavalink.Client(723524131970351194)
     self.bot.music.add_node('localhost', 8888, [CENSORED], 'eu',
                             'music_node')
     self.bot.add_listener(self.bot.music.voice_update_handler,
                           'on_socket_response')
     self.bot.music.add_event_hook(self.track_hook)
Ejemplo n.º 19
0
 def __init__(self, bot):
     self.bot = bot
     self.bot.music = lavalink.Client(630743566960033802)
     self.bot.music.add_node('127.0.0.1', 7000, 'testing', 'ru',
                             'music-node')
     self.bot.add_listener(self.bot.music.voice_update_handler,
                           'on_socket_response')
     self.bot.music.add_event_hook(self.track_hook)
Ejemplo n.º 20
0
 def __init__(self, bot):
     self.bot = bot
     self.bot.music = lavalink.Client(754169016087478302)  # Bot's user id
     self.bot.music.add_node("localhost", 7000, "ILoveHatsuneMiku", "na",
                             "music-node")
     self.bot.add_listener(self.bot.music.voice_update_handler,
                           "on_socket_response")
     self.bot.music.add_event_hook(self.track_hook)
Ejemplo n.º 21
0
 def __init__(self, bot):
     self.bot = bot
     self.bot.music = lavalink.Client(self.bot.user.id)
     self.bot.music.add_node('https://lavalinkserver.herokuapp.com/', 80,
                             'youshallnotpass', 'me', 'default-node')
     self.bot.add_listener(self.bot.music.voice_update_handler,
                           'on_socket_response')
     self.bot.music.add_event_hook(self.track_hook)
Ejemplo n.º 22
0
 def __init__(self, bot):
     self.bot = bot
     self.bot.music = lavalink.Client(self.bot.user.id)
     self.bot.music.add_node(
         'localhost', 8000, os.getenv('LAVALINK_PASS'), 'br', 'music-node')
     self.bot.add_listener(
         self.bot.music.voice_update_handler, 'on_socket_response')
     self.bot.music.add_event_hook(self.track_hook)
Ejemplo n.º 23
0
    def __init__(self, bot):
        self.bot = bot

        if not hasattr(bot, 'lavalink'):
            bot.lavalink = lavalink.Client(bot.user.id)
            bot.lavalink.add_node("0.0.0.0", self.bot.lavalinkport, self.bot.lavalinkpass, 'na', 'default-node')
            bot.add_listener(bot.lavalink.voice_update_handler, 'on_socket_response')

        lavalink.add_event_hook(self.track_hook)
Ejemplo n.º 24
0
    def __init__(self, bot):
        self.bot = bot

        if not hasattr(bot, 'lavalink'):
            bot.lavalink = lavalink.Client(748476058675970079)
            bot.lavalink.add_node(ll_host, ll_port, ll_pass, ll_region, ll_node)
            bot.add_listener(bot.lavalink.voice_update_handler, 'on_socket_response')

        lavalink.add_event_hook(self.track_hook)
Ejemplo n.º 25
0
    def __init__(self, bot):
        self.bot = bot

        if not hasattr(bot, 'lavalink'):  # This ensures the client isn't overwritten during cog reloads.
            bot.lavalink = lavalink.Client(bot.user.id)
            bot.lavalink.add_node('127.0.0.1', bot.config.lavalink['port'], bot.config.lavalink['password'], 'eu', 'default-node')  # Host, Port, Password, Region, Name
            bot.add_listener(bot.lavalink.voice_update_handler, 'on_socket_response')

        lavalink.add_event_hook(self.track_hook)
Ejemplo n.º 26
0
    def __init__(self, bot):
        self.bot = bot

        if not hasattr(bot, 'lavalink'):
            bot.lavalink = lavalink.Client(740514706858442792)
            bot.lavalink.add_node('your server ip', you_know_some_port, 'youshallnopass', 'region', 'other stuff')
            bot.add_listener(bot.lavalink.voice_update_handler, 'on_socket_response')

        lavalink.add_event_hook(self.track_hook)
Ejemplo n.º 27
0
    def __init__(self, bot):
        self.bot = bot

        if not hasattr(bot, 'lavalink'):
            lavalink.Client(bot=self.bot,
                            ws_port=1420,
                            password='******',
                            loop=self.bot.loop)
            self.bot.lavalink.register_hook(self.track_hook)
Ejemplo n.º 28
0
    def __init__(self, bot):
        self.bot = bot

        if not hasattr(bot, 'lavalink'):
            lavalink.Client(bot=bot,
                            password=config.lavalink['pwd'],
                            loop=self.bot.loop,
                            log_level=logging.DEBUG)
            self.bot.lavalink.register_hook(self.track_hook)
Ejemplo n.º 29
0
 def __init__(self, bot):
     self.bot = bot
     self.bot.music = lavalink.Client(self.bot.user.id)
     self.bot.music.add_node(
         'localhost', 2333, 'changeme123', 'na',
         'local_music_node')  # PASSWORD HERE MUST MATCH YML
     self.bot.add_listener(self.bot.music.voice_update_handler,
                           'on_socket_response')
     self.bot.music.add_event_hook(self.track_hook)
Ejemplo n.º 30
0
 def __init__(self, bot):
     self.bot = bot
     self.path = (path.realpath(__file__)).split('src')
     if not hasattr(bot, 'music'):
         self.bot.music = lavalink.Client(self.bot.user.id)
         self.bot.music.add_node('localhost', 7000, 'Shiggybot', 'eu',
                                 'music-node')
         self.bot.add_listener(self.bot.music.voice_update_handler,
                               'on_socket_response')