コード例 #1
0
    async def randomevent(self, ctx):
        functions.log(ctx.guild.name, ctx.author, ctx.command)

        event = functions.find_random_event()
        event_creator = functions.id_to_username(event['CreatorPlayerId'])
        event_description = event['Description']
        try:
            event_room = f"[^{functions.get_room_json(event['RoomId'], True)['Name']}](https://rec.net/room/{functions.get_room_json(event['RoomId'], True)['Name']})"
        except:
            event_room = "`Dorm room`"
        if not event["Description"]:
            event_description = "None"

        embed = discord.Embed(
            colour=discord.Colour.orange(),
            title=f"{event['Name'] }",
            description=
            f"**Description**```{event_description}```\n**Information**\n🚪 Room: {event_room}\n👥 Attendees: `{event['AttendeeCount']}`\n📆 Start time: `{event['StartTime'][:10]}`, at ⏰ `{event['StartTime'][11:16]} UTC`\n🚷 End time: `{event['EndTime'][:10]}`, at ⏰ `{event['EndTime'][11:16]} UTC`",
            url=f"https://rec.net/event/{event['PlayerEventId']}")

        embed.set_author(name=f"🔗 {event_creator}'s profile",
                         url=f"https://rec.net/user/{event_creator}",
                         icon_url=functions.id_to_pfp(
                             event['CreatorPlayerId']))
        embed.set_image(
            url=f"https://img.rec.net/{event['ImageName']}?width=720")
        functions.embed_footer(ctx, embed)  # get default footer from function
        await ctx.send(embed=embed)
コード例 #2
0
    async def randomaccount(self, ctx):
        functions.log(ctx.guild.name, ctx.author, ctx.command)

        account = functions.find_random_account()
        pfp = functions.id_to_pfp(account['accountId'])

        embed = discord.Embed(
            colour=discord.Colour.orange(),
            title=f"Random account! @{account['username']}",
        )
        embed.add_field(name="Display name",
                        value=f"`{account['displayName']}`",
                        inline=True)
        embed.add_field(name="Created at",
                        value=f"`{account['createdAt'][:10]}`",
                        inline=True)
        embed.add_field(name="Is junior?",
                        value=f"`{account['isJunior']}`",
                        inline=True)
        embed.add_field(
            name="Bio",
            value=f"```{functions.id_to_bio(account['accountId'])}```")
        embed.set_image(url=pfp)
        embed.set_author(name=f"🔗 {account['username']}'s profile",
                         url=f"https://rec.net/user/{account['username']}",
                         icon_url=pfp)

        functions.embed_footer(ctx, embed)  # get default footer from function
        await ctx.send(embed=embed)
コード例 #3
0
    async def randompfp(self, ctx):
        functions.log(ctx.guild.name, ctx.author, ctx.command)

        pfp = "DefaultProfileImage"
        while pfp == "DefaultProfileImage":
            account = functions.find_random_account()
            pfp = account["profileImage"]

        account_id = account["accountId"]
        username = account["username"]

        embed = discord.Embed(
            colour=discord.Colour.orange(),
            title="Random profile picture!",
            description=
            f"[🔗 RecNet post](https://rec.net/image/{pfp}) *(might not exist)*"
        )
        embed.set_image(url=f"https://img.rec.net/{pfp}")
        embed.set_author(name=f"🔗 {username}'s profile",
                         url=f"https://rec.net/user/{username}",
                         icon_url=functions.id_to_pfp(account_id))

        functions.embed_footer(ctx, embed)  # get default footer from function
        await ctx.send(embed=embed)
コード例 #4
0
ファイル: fun.py プロジェクト: Jegarde/RecNetBotV2
    async def cringebiocheck(self, ctx, profile):
        functions.log(ctx.guild.name, ctx.author, ctx.command)

        account = functions.check_account_existence_and_return(profile)
        if account:
            bio = functions.get_bio(account['account_id'])
            pfp = functions.id_to_pfp(account['account_id'], True)

            print(
                f"{ctx.command} > {account['account_id']}, {account['username']}, {bio}, {pfp}"
            )

            embed = functions.default_embed()
            embed.add_field(name=f"{account['username']}'s bio:",
                            value=f"```{bio}```")

            flags = ""
            cringe_check_list = functions.load("cringe_word_list.json")
            cringe_score = 0
            cringe_rating_dict = {
                0: "Not cringe!",
                1: "A little cringe!",
                2: "Cringe!",
                3: "Very cringe!",
                4: "Yikes..!",
                5: "Radically cringe!",
                6: "Super cringe!",
                7: "Mega cringe!",
                8: "Ultra cringe!",
                9: "THE CRINGIEST!",
                10: "All hope for humanity has been lost!"
            }

            if bio:
                split_bio = bio.split(" ")
                for word in split_bio:
                    for flag in cringe_check_list:
                        if flag.casefold() in word.casefold():
                            cringe_score += 1
                            flags += f"`{flag}`, "

                if cringe_score > len(cringe_rating_dict) - 1:
                    cringe_rating = cringe_rating_dict[len(cringe_rating_dict)
                                                       - 1]
                else:
                    cringe_rating = cringe_rating_dict[cringe_score]

                embed.add_field(name="Cringe score",
                                value=f"`{cringe_score}` ({cringe_rating})",
                                inline=False)

                if flags:
                    embed.add_field(
                        name="Flags",
                        value=
                        f"||{flags}||\nThis command is just for fun, and not meant to shame anybody!",
                        inline=False)

            embed.set_author(name=f"🔗 {account['username']}'s profile",
                             url=f"https://rec.net/user/{account['username']}",
                             icon_url=pfp)
        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(embed=embed)
コード例 #5
0
ファイル: fun.py プロジェクト: Jegarde/RecNetBotV2
    async def cringenamecheck(self, ctx, profile):
        functions.log(ctx.guild.name, ctx.author, ctx.command)

        account = functions.check_account_existence_and_return(profile)
        if account:
            embed = functions.default_embed()

            cringe_check_list = functions.load("cringe_word_list.json")
            cringe_score = 0
            cringe_rating = {
                0: "Not cringe!",
                1: "Maybe a little cringe?",
                2: "Little cringe.",
                3: "A bit cringe!",
                4: "Cringe!",
                5: "Quite cringe!",
                6: "Very cringe!",
                7: "Super cringe!",
                8: "Incredibly cringe!",
                9: "Ludicrously cringe!",
                10: "THE CRINGIEST!"
            }

            display_name = functions.id_to_display_name(account['account_id'])
            cringe_words = [
                ele for ele in cringe_check_list
                if (ele.casefold() in display_name.casefold())
            ]
            cringe_score = len(cringe_words) * 2

            for char in display_name:
                if not char.isalpha():
                    cringe_score += 1
                    cringe_words.append(char)

            if cringe_score > 10:
                cringe_score = 10

            embed.add_field(name=f"{account['username']}'s display name:",
                            value=f"```{display_name}```")
            embed.add_field(
                name="Cringe score",
                value=f"`{cringe_score}` ({cringe_rating[cringe_score]})",
                inline=False)

            flags = ""
            for flag in cringe_words:
                flags += f"`{flag}`, "

            if flags:
                embed.add_field(
                    name="Flags",
                    value=
                    f"||{flags}||\nThis command is just for fun, and not meant to shame anybody!",
                    inline=False)

            pfp = functions.id_to_pfp(account['account_id'], True)
            embed.set_author(name=f"🔗 {account['username']}'s profile",
                             url=f"https://rec.net/user/{account['username']}",
                             icon_url=pfp)
        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(embed=embed)