Exemplo n.º 1
0
    async def embed_recent(self, ctx):
        username = rym_data.get_username(ctx.message.author.id)

        page = 0
        description = ""
        data = retrievers.get_recent(username, page)
        if len(data) == 0:
            await self.bot.say(
                "Either that is not a year or you have rated no albums from it."
            )
            return
        for datum in data[:5]:
            description += "[" + datum[
                'artist'] + "](https://www.rateyourmusic.com" + datum[
                    'artist_link'] + ") - [" + datum[
                        'album'] + "](https://www.rateyourmusic.com" + datum[
                            'album_link'] + ") (" + datum['rating'] + ")\n"

        embed = discord.Embed(title=username + "'s recently rated albums",
                              description=description)
        embed.set_footer(text="Page " + str(page + 1))
        msg = await self.bot.say(embed=embed)

        self.recent_msgs[msg.id] = (username, page, data)
        await self.bot.add_reaction(msg, '⬅')
        await self.bot.add_reaction(msg, '➡')
Exemplo n.º 2
0
    async def rym(self, ctx):
        if perms_data.get_disallowed(ctx.message.channel.id, "rym"):
            return
        if ctx.invoked_subcommand is not None:
            return
        elif perms_data.get_disallowed(ctx.message.channel.id, "rym"):
            return

        username = rym_data.get_username(ctx.message.author.id)
        if username is None:
            await self.bot.say("Looks like you don't have a username set!")
            return

        await self.bot.say("https://www.rateyourmusic.com/~" + username)
Exemplo n.º 3
0
    async def recent(self, ctx):
        self.current_server = (self.current_server + 1) % 1
        if self.current_server != SERVER_INDEX:
            return

        username = rym_data.get_username(ctx.message.author.id)
        if username is None:
            await self.bot.say("Looks like you don't have a username set!")
            return

        if self.check_cooled_down():
            return
        self.time_last_crawled = time.time()

        await commands.Command.invoke(self.embed_recent, ctx)
Exemplo n.º 4
0
    async def get(self, ctx):
        member = discord.utils.find(
            lambda m: m.name.lower() == ctx.message.content[9:].lower() or m.id
            in ctx.message.content, ctx.message.channel.server.members)
        if member is None:
            await self.bot.say("Sorry, this user was not found.")
            return

        username = rym_data.get_username(member.id)
        if username is None:
            await self.bot.say(
                member.name +
                " doesn't seem to have a RYM profile established.")
            return

        await self.bot.say("https://www.rateyourmusic.com/~" + username)
Exemplo n.º 5
0
    async def topratings(self, ctx, genre=''):
        self.current_server = (self.current_server + 1) % 1
        if self.current_server != SERVER_INDEX:
            return

        username = rym_data.get_username(ctx.message.author.id)
        if username is None:
            await self.bot.say("Looks like you don't have a username set!")
            return

        if self.check_cooled_down():
            for emoji in self.bot.get_all_emojis():
                if emoji.id == '449250117833457680':
                    await self.bot.add_reaction(ctx.message, str(x))
            return
        self.time_last_crawled = time.time()

        ctx.genre = genre
        await commands.Command.invoke(self.embed_top_ratings, ctx)