Ejemplo n.º 1
0
    async def randomimgin(self, ctx, room_name):
        functions.log(ctx.guild.name, ctx.author, ctx.command)

        room = functions.get_room_json(room_name)
        if room:

            embed = discord.Embed(
                colour=discord.Colour.orange(),
                description=
                f"<a:spinning:804022054822346823> Loading >10,000 pictures taken in `^{room['Name']}`, and picking one randomly..."
            )
            functions.embed_footer(ctx, embed)
            loading = await ctx.send(embed=embed)

            room_photos = functions.get_photos_in_room(room_name)
            if room_photos:
                random_photo = room_photos[random.randint(
                    0,
                    len(room_photos) - 1)]

                embed = functions.image_embed(random_photo)
            else:
                embed = functions.error_msg(
                    ctx,
                    f"Not a single picture has been taken in `^{room['Name']}`"
                )
        else:
            embed = functions.error_msg(ctx,
                                        f"Room `^{room_name}` doesn't exist!")

        await loading.delete()
        functions.embed_footer(ctx, embed)  # get default footer from function
        await ctx.send(f"Random image in `^{room['Name']}`", embed=embed)
Ejemplo n.º 2
0
    async def randomimg(self, ctx):
        functions.log(ctx.guild.name, ctx.author, ctx.command)

        embed = discord.Embed(
            colour=discord.Colour.orange(),
            description=
            f"<a:spinning:804022054822346823> Searching for a random image...")
        functions.embed_footer(ctx, embed)
        loading = await ctx.send(embed=embed)

        random_img = functions.find_random_img()

        embed = functions.image_embed(random_img)

        await loading.delete()

        functions.embed_footer(ctx, embed)  # get default footer from function
        await ctx.send(f"Random image", embed=embed)
Ejemplo n.º 3
0
    async def randomimgofin(self, ctx, profile, room_name):
        functions.log(ctx.guild.name, ctx.author, ctx.command)

        account = functions.check_account_existence_and_return(profile)
        if account:
            profile = account['username']
            room = functions.get_room_json(room_name)
            if room:
                photos = functions.id_to_feed(account['account_id'])

                if photos:
                    found_photos = []
                    # find photos in room
                    for photo in photos:
                        if photo['RoomId'] == room['RoomId']:
                            found_photos.append(photo)

                    if found_photos:
                        random_photos = found_photos[random.randint(
                            0,
                            len(found_photos) - 1)]

                        embed = functions.image_embed(random_photos)
                    else:
                        embed = functions.error_msg(
                            ctx,
                            f"User `@{account['username']}` doesn't appear in `^{room['Name']}`!"
                        )
                else:
                    embed = functions.error_msg(
                        ctx,
                        f"User `@{profile}` doesn't appear in `^{room_name}` at all!"
                    )
            else:
                embed = functions.error_msg(
                    ctx, f"Room `^{room_name}` doesn't exist!")
        else:
            embed = functions.error_msg(ctx,
                                        f"User `@{profile}` doesn't exist!")

        functions.embed_footer(ctx, embed)  # get default footer from function
        await ctx.send(f"Random image of `@{profile}`, in `^{room['Name']}`",
                       embed=embed)
Ejemplo n.º 4
0
    async def randomimgof(self, ctx, profile):
        functions.log(ctx.guild.name, ctx.author, ctx.command)

        account = functions.check_account_existence_and_return(profile)
        if account:
            profile = account['username']
            feed = functions.id_to_feed(account['account_id'])

            if feed:
                random_feed = feed[random.randint(0, len(feed) - 1)]

                embed = functions.image_embed(random_feed)
            else:
                embed = functions.error_msg(
                    ctx, f"User `@{profile}` doesn't appear in any post!")
        else:
            embed = functions.error_msg(ctx,
                                        f"User `@{profile}` doesn't exist!")

        functions.embed_footer(ctx, embed)  # get default footer from function
        await ctx.send(f"Random image of `@{profile}`", embed=embed)
Ejemplo n.º 5
0
    async def randomimgby(self, ctx, profile):
        functions.log(ctx.guild.name, ctx.author, ctx.command)

        account = functions.check_account_existence_and_return(profile)
        if account:
            profile = account['username']
            photos = functions.id_to_photos(account['account_id'])

            if photos:
                random_photos = photos[random.randint(0, len(photos) - 1)]
                embed = functions.image_embed(random_photos)

            else:
                embed = functions.error_msg(
                    ctx,
                    f"User `@{account['username']}` hasn't shared a single post!"
                )
        else:
            embed = functions.error_msg(ctx,
                                        f"User `@{profile}` doesn't exist!")

        functions.embed_footer(ctx, embed)  # get default footer from function
        await ctx.send(f"Random image by `@{profile}`", embed=embed)